同步观战
parent
06c3fdb252
commit
6e7ebe64a6
|
|
@ -17,6 +17,7 @@ local function __ConntectGameServer(cmd, room, host, _data, callback)
|
||||||
local _game_client = NetClient.new(host, "game")
|
local _game_client = NetClient.new(host, "game")
|
||||||
_game_client:connect()
|
_game_client:connect()
|
||||||
ControllerManager.SetGameNetClient(_game_client)
|
ControllerManager.SetGameNetClient(_game_client)
|
||||||
|
|
||||||
_game_client.onconnect:Add(function(code)
|
_game_client.onconnect:Add(function(code)
|
||||||
if (code == SocketCode.Connect) then
|
if (code == SocketCode.Connect) then
|
||||||
_game_client:send(cmd, _data, function(response)
|
_game_client:send(cmd, _data, function(response)
|
||||||
|
|
@ -274,24 +275,24 @@ function M:PublicWitnessRoom(cmd, roomid, group_id, callback, game_id, pid)
|
||||||
if (res1.ReturnCode ~= 0) then
|
if (res1.ReturnCode ~= 0) then
|
||||||
if (callback) then callback(res1) end
|
if (callback) then callback(res1) end
|
||||||
else
|
else
|
||||||
-- ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
|
ControllerManager.enterPlayerData = res1.Data.tableInfo.playerData
|
||||||
-- local _s2croom = res1.Data
|
local _s2croom = res1.Data
|
||||||
-- room.owner_id = _s2croom["owner"]
|
room.owner_id = _s2croom["owner"]
|
||||||
-- if _s2croom.createTime then
|
if _s2croom.createTime then
|
||||||
-- room.create_time = _s2croom["createTime"]
|
room.create_time = _s2croom["createTime"]
|
||||||
-- end
|
end
|
||||||
-- if _s2croom.manor then
|
if _s2croom.manor then
|
||||||
-- room.banker_seat = _s2croom.manor
|
room.banker_seat = _s2croom.manor
|
||||||
-- end
|
end
|
||||||
-- room.agent = _s2croom.agent == 1 and true or false
|
room.agent = _s2croom.agent == 1 and true or false
|
||||||
-- -- ControllerManager.SetGameNetClient(game_net)
|
-- ControllerManager.SetGameNetClient(game_net)
|
||||||
-- local extend = ExtendManager.GetExtendConfig(room.game_id)
|
local extend = ExtendManager.GetExtendConfig(room.game_id)
|
||||||
-- extend:FillRoomData(_s2croom)
|
extend:FillWitnessData(_s2croom)
|
||||||
-- ControllerManager.ChangeController(GameController)
|
ControllerManager.ChangeController(GameController)
|
||||||
-- local gamectr = ControllerManager.GetCurrenController()
|
local gamectr = ControllerManager.GetCurrenController()
|
||||||
-- gamectr.tmpRoomID = room.room_id
|
gamectr.tmpRoomID = room.room_id
|
||||||
-- gamectr.tmpGroupID = room.group_id
|
gamectr.tmpGroupID = room.group_id
|
||||||
-- if callback then callback(res1) end
|
if callback then callback(res1) end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ function M:UpdateFamilyRoom(fgCtr, id)
|
||||||
-- ViewManager.ChangeView(ViewManager.View_Lobby)
|
-- ViewManager.ChangeView(ViewManager.View_Lobby)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
ViewManager.ChangeView(ViewManager.View_Main, gameId)
|
ViewManager.ChangeView(ViewManager.View_Witness, gameId)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
gameId,
|
gameId,
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,25 @@ function M:InitView(url, isHideIpAdds)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self._chat_Talk = _view:GetChild('btn_sendTalk')
|
||||||
|
if self._chat_Talk then
|
||||||
|
self._ctr_voice = _view:GetController('voice')
|
||||||
|
|
||||||
|
self._chat_Talk.onTouchBegin:Set(function()
|
||||||
|
if record_baned == 1 then
|
||||||
|
self:__SetRecordEnable()
|
||||||
|
else
|
||||||
|
self._record_time = 0
|
||||||
|
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic + 1
|
||||||
|
self._chat_Talk.onTouchEnd:Set(self.__RecordTouchEnd, self)
|
||||||
|
-- Voice.BeginRecord()
|
||||||
|
self._ctr_voice.selectedIndex = 1
|
||||||
|
self.__runwait_record = nil
|
||||||
|
self.__runwait_record = coroutine.start(self.__WaitRecord, self)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local btn_ready = _view:GetChild('btn_ready')
|
local btn_ready = _view:GetChild('btn_ready')
|
||||||
if btn_ready ~= nil then
|
if btn_ready ~= nil then
|
||||||
btn_ready.onClick:Set(function()
|
btn_ready.onClick:Set(function()
|
||||||
|
|
@ -575,7 +594,7 @@ function M:__RecordTouchEnd()
|
||||||
self.__runwait_record = nil
|
self.__runwait_record = nil
|
||||||
self._ctr_voice.selectedIndex = 0
|
self._ctr_voice.selectedIndex = 0
|
||||||
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic - 1
|
GameApplication.Instance.StopMusic = GameApplication.Instance.StopMusic - 1
|
||||||
self._btn_record.onTouchEnd:Remove(self.__RecordTouchEnd, self)
|
self._chat_Talk.onTouchEnd:Remove(self.__RecordTouchEnd, self)
|
||||||
local room = self._room
|
local room = self._room
|
||||||
Voice.EndRecord(
|
Voice.EndRecord(
|
||||||
room.room_id,
|
room.room_id,
|
||||||
|
|
@ -1062,7 +1081,10 @@ function M:OnUpdate()
|
||||||
end
|
end
|
||||||
if self._view:GetChild('gcm_chat') then
|
if self._view:GetChild('gcm_chat') then
|
||||||
self._record_time = self._record_time + deltaTime
|
self._record_time = self._record_time + deltaTime
|
||||||
|
elseif self._record_time then
|
||||||
|
self._record_time = self._record_time + deltaTime
|
||||||
end
|
end
|
||||||
|
|
||||||
local _left_time = self._left_time
|
local _left_time = self._left_time
|
||||||
if (_left_time > 0) then
|
if (_left_time > 0) then
|
||||||
_left_time = _left_time - deltaTime
|
_left_time = _left_time - deltaTime
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,13 @@ ViewManager = {
|
||||||
|
|
||||||
View_Lobby = 2,
|
View_Lobby = 2,
|
||||||
|
|
||||||
View_Main = 3,
|
View_Family = 3,
|
||||||
|
|
||||||
View_PlayBack = 4,
|
View_Main = 4,
|
||||||
|
|
||||||
View_Family = 5,
|
View_PlayBack = 5,
|
||||||
|
|
||||||
|
View_Witness = 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -151,7 +153,7 @@ end
|
||||||
|
|
||||||
function ViewManager.OnApplicationPause()
|
function ViewManager.OnApplicationPause()
|
||||||
-- print("game pause")
|
-- print("game pause")
|
||||||
if (_currenView ~= nil) then
|
if (_currenView ~= nil) then
|
||||||
_currenView:OnApplicationPause()
|
_currenView:OnApplicationPause()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,388 @@
|
||||||
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
|
local EXClearingView = import(".EXClearingView")
|
||||||
|
local TX_GameEvent = import(".GameEvent")
|
||||||
|
|
||||||
|
local Record_Event = import(".RecordEvent")
|
||||||
|
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- Create a new
|
||||||
|
function M.new()
|
||||||
|
setmetatable(M, { __index = BaseView })
|
||||||
|
local self = setmetatable({}, { __index = M })
|
||||||
|
self.class = "EXMJWitness"
|
||||||
|
self:init()
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:init()
|
||||||
|
self._gamectr = ControllerManager.GetController(GameController)
|
||||||
|
self._room = DataManager.CurrenRoom
|
||||||
|
self._room.Witness = true
|
||||||
|
UIPackage.AddPackage('base/chat/ui/Chat')
|
||||||
|
UIPackage.AddPackage("base/main_majiang/ui/Main_Majiang")
|
||||||
|
self._eventmap = {}
|
||||||
|
-- self._full = true
|
||||||
|
self._put_map = false
|
||||||
|
self._new_hide = false
|
||||||
|
self._queue = false
|
||||||
|
self._style = 1
|
||||||
|
self:InitView()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:InitView(url)
|
||||||
|
local room = self._room
|
||||||
|
UIPackage.AddPackage("extend/majiang/lichuan/ui/Extend_MJ_LiChuan")
|
||||||
|
BaseView.InitView(self, string.format("ui://Main_Majiang/Main_new_%d_jiangxi", room.room_config.people_num))
|
||||||
|
self:EventInit()
|
||||||
|
|
||||||
|
local _cardbox = self._view:GetChild("cardbox")
|
||||||
|
--self._view:GetChild("panel_record"):GetChild("btn_LastStep").enabled = false
|
||||||
|
self._ctr_cardbox = _cardbox:GetController("c1")
|
||||||
|
self._tex_round = self._view:GetChild("tex_round")
|
||||||
|
self._tex_LeftCard = self._view:GetChild("remaining_card")
|
||||||
|
self._anchor = self._view:GetChild("mask_tips")
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:FillRoomData(data)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:EventInit()
|
||||||
|
-- UIPackage.AddPackage("extend/majiang/hongzhong/ui/Extend_MJ_HongZhong")
|
||||||
|
MainView.EventInit(self)
|
||||||
|
local _room = self._room
|
||||||
|
local _view = self._view
|
||||||
|
local _gcm_outcard_url = UIPackage.GetItemURL("Main_Majiang", "Gcm_OutCard")
|
||||||
|
local _player_info = self._player_info
|
||||||
|
local _gamectr = self._gamectr
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendLaiZi, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
print("lingmeng witness SendLaiZi")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendGangZi, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
print("lingmeng witness SendGangZi")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventBuGang, function(...)
|
||||||
|
local arg = { ... }
|
||||||
|
print("lingmeng witness EventBuGang")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.SendCards, function(...)
|
||||||
|
print("lingmeng witness SendCards")
|
||||||
|
end)
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventTurn, function(...)
|
||||||
|
print("lingmeng witness EventTurn")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.OutHint, function(...)
|
||||||
|
print("lingmeng witness OutHint")
|
||||||
|
end)
|
||||||
|
|
||||||
|
local _gcm_outcard_url = "ui://Main_Majiang/Gcm_OutCard"
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.OutCard, function(...)
|
||||||
|
print("lingmeng witness OutCard")
|
||||||
|
end)
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.GetCard, function(...)
|
||||||
|
print("lingmeng witness GetCard")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.FZTips, function(...)
|
||||||
|
print("lingmeng witness FZTips")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.FangziAction, function()
|
||||||
|
print("lingmeng witness FangziAction")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPHuCard, function(...)
|
||||||
|
print("lingmeng witness ZPHuCard")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventNiao, function(...)
|
||||||
|
print("lingmeng witness EventNiao")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult1, function(...)
|
||||||
|
print("lingmeng witness ZPResult1")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.ZPResult2, function(...)
|
||||||
|
print("lingmeng witness ZPResult2")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiaoTip, function()
|
||||||
|
print("lingmeng witness EvnetPiaoTip")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EvnetPiao, function(...)
|
||||||
|
print("lingmeng witness EvnetPiao")
|
||||||
|
end)
|
||||||
|
|
||||||
|
_gamectr:AddEventListener(TX_GameEvent.EventResidueCard, function(...)
|
||||||
|
print("lingmeng witness EventResidueCard")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:ShowStep(index)
|
||||||
|
local step = self._step[index + 1]
|
||||||
|
self:UpdateLeftCard(step.left_card)
|
||||||
|
-- self._ctr_cardbox.selectedIndex = step.current_out_seat
|
||||||
|
self:UpdateCardBox(self:GetPos(step.current_out_seat))
|
||||||
|
self:UpdateStep(index + 1)
|
||||||
|
if step.cmd ~= Record_Event.Evt_OutCard then
|
||||||
|
self:RemoveCursor()
|
||||||
|
end
|
||||||
|
for i = 1, #step.player_card_data do
|
||||||
|
local p = self._room:GetPlayerBySeat(i)
|
||||||
|
local info = self._player_card_info[self:GetPos(i)]
|
||||||
|
p.card_list = step.player_card_data[i].card_list
|
||||||
|
p.outcard_list = step.player_card_data[i].outcard_list
|
||||||
|
p.fz_list = step.player_card_data[i].fz_list
|
||||||
|
p.hand_left_count = #p.card_list
|
||||||
|
info:Clear()
|
||||||
|
info:ResetFzList()
|
||||||
|
p.piao_niao = step.player_card_data[i].piao_niao
|
||||||
|
local head_info = self._player_info[self:GetPos(i)]
|
||||||
|
if p.piao_niao and p.piao_niao > 0 then
|
||||||
|
head_info._view:GetChild("mask_piao").title = "飘分 " .. p.piao_niao
|
||||||
|
head_info._view:GetController("piao_niao").selectedIndex = 1
|
||||||
|
else
|
||||||
|
head_info._view:GetController("piao_niao").selectedIndex = 0
|
||||||
|
end
|
||||||
|
if step.cmd == Record_Event.Evt_OutCard and i == step.last_out_seat then
|
||||||
|
local card = p.outcard_list[#p.outcard_list]
|
||||||
|
info:UpdateOutCardList(nil, nil, self._cursor)
|
||||||
|
else
|
||||||
|
info:UpdateOutCardList()
|
||||||
|
end
|
||||||
|
if step.cmd == Record_Event.Evt_GetCard and p.seat == step.current_out_seat then
|
||||||
|
info:UpdateHandCard(true, true)
|
||||||
|
else
|
||||||
|
info:UpdateHandCard(false, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if step.cmd == Record_Event.Evt_Win then
|
||||||
|
self._win_pic = UIPackage.CreateObjectFromURL("ui://Main_Majiang/胡")
|
||||||
|
local info = self._player_card_info[self:GetPos(step.win)]
|
||||||
|
info._mask_liangpai:AddChild(self._win_pic)
|
||||||
|
self._win_pic:Center()
|
||||||
|
else
|
||||||
|
if self._win_pic then
|
||||||
|
self._win_pic:Dispose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if step.cmd == Record_Event.Evt_Niao then
|
||||||
|
local niao_list = step.niao
|
||||||
|
self._niao = UIPackage.CreateObjectFromURL("ui://Extend_MJ_LiChuan/Panel_Birds")
|
||||||
|
local list = self._niao:GetChild("Lst_birds")
|
||||||
|
list:RemoveChildrenToPool()
|
||||||
|
for i = 1, #niao_list do
|
||||||
|
local item = list:AddItemFromPool()
|
||||||
|
item.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. niao_list[i].card)
|
||||||
|
if niao_list[i].score > 0 then
|
||||||
|
item:GetController("bg").selectedIndex = 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self._view:AddChild(self._niao)
|
||||||
|
self._view:AddChild(self._view:GetChild("panel_record"))
|
||||||
|
self._niao:Center()
|
||||||
|
else
|
||||||
|
if self._niao then
|
||||||
|
self._niao:Dispose()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if step.cmd == Record_Event.Evt_Result then
|
||||||
|
if not self.result then
|
||||||
|
self.result = EXClearingView.new(self._root_view, true)
|
||||||
|
self.result:InitData(0, self._room, step.result_data)
|
||||||
|
self.result._view.x = (GRoot.inst.width - self.result._view.width) * -0.5
|
||||||
|
self.result._view.width = GRoot.inst.width
|
||||||
|
self.result._view.height = GRoot.inst.height
|
||||||
|
self.result._view:GetChild("btn_confirm").visible = false
|
||||||
|
self._anchor:AddChild(self.result._view)
|
||||||
|
self.result._view.x = self._anchor.x * -1
|
||||||
|
self.result._view.y = self._anchor.y * -1
|
||||||
|
else
|
||||||
|
self.result._view.visible = true
|
||||||
|
end
|
||||||
|
-- self.result._view:Center()
|
||||||
|
else
|
||||||
|
if self.result then
|
||||||
|
self.result._view.visible = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:GenerateAllStepData(data)
|
||||||
|
local cmdList = self.cmdList
|
||||||
|
self._step = {}
|
||||||
|
local step = {}
|
||||||
|
local info = data.info
|
||||||
|
step.cmd = ""
|
||||||
|
step.left_card = info.left_card
|
||||||
|
step.last_out_seat = 0
|
||||||
|
step.current_out_seat = 1
|
||||||
|
step.win = 0
|
||||||
|
step.niao = 0
|
||||||
|
|
||||||
|
step.player_card_data = {}
|
||||||
|
for i = 1, #self._room.player_list do
|
||||||
|
local p = info.playerData[i]
|
||||||
|
local u = {}
|
||||||
|
u.seat = p.seat
|
||||||
|
u.card_list = p.hand_card
|
||||||
|
u.hand_left_count = #u.card_list
|
||||||
|
u.fz_list = {}
|
||||||
|
u.outcard_list = {}
|
||||||
|
u.piao_niao = p.piao_niao
|
||||||
|
step.player_card_data[u.seat] = u
|
||||||
|
end
|
||||||
|
self._step[#self._step + 1] = step
|
||||||
|
|
||||||
|
for i = 1, #cmdList do
|
||||||
|
local tem = cmdList[i]
|
||||||
|
self._cmdmap[tem.cmd](self, tem, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdGetCard(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.current_out_seat = cmd.seat
|
||||||
|
data.left_card = cmd.data.left_count
|
||||||
|
local u = data.player_card_data[cmd.seat]
|
||||||
|
u.card_list[#u.card_list + 1] = cmd.data.card
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdOutCard(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.last_out_seat = cmd.seat
|
||||||
|
local u = data.player_card_data[cmd.seat]
|
||||||
|
list_remove(u.card_list, cmd.data.card)
|
||||||
|
table.sort(u.card_list, self.HandCardSortAndJing)
|
||||||
|
u.outcard_list[#u.outcard_list + 1] = cmd.data.card
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdAction(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.last_out_seat = 0
|
||||||
|
data.current_out_seat = cmd.seat
|
||||||
|
local u = data.player_card_data[cmd.seat]
|
||||||
|
for i = 1, #cmd.data.opcard do
|
||||||
|
list_remove(u.card_list, cmd.data.opcard[i])
|
||||||
|
end
|
||||||
|
local fz = {}
|
||||||
|
fz.type = cmd.data.type
|
||||||
|
fz.card = cmd.data.card
|
||||||
|
fz.opcard = cmd.data.opcard
|
||||||
|
local uf = data.player_card_data[cmd.data.from_seat]
|
||||||
|
if fz.type ~= FZType.Gang_An and fz.type ~= FZType.Gang_Peng then
|
||||||
|
table.remove(uf.outcard_list, #uf.outcard_list)
|
||||||
|
end
|
||||||
|
if fz.type ~= FZType.Gang_Peng then
|
||||||
|
u.fz_list[#u.fz_list + 1] = fz
|
||||||
|
else
|
||||||
|
for i = 1, #u.fz_list do
|
||||||
|
if u.fz_list[i].type == FZType.Peng and u.fz_list[i].card == fz.card then
|
||||||
|
u.fz_list[i].type = FZType.Gang_Peng
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdWin(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.win = cmd.seat
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdNiao(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.niao = cmd.data.niao
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdPiao(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.player_card_data[cmd.seat].piao_niao = cmd.data.num
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CmdResult(cmd, index)
|
||||||
|
local data = self:CopyLastStep(index)
|
||||||
|
data.cmd = cmd.cmd
|
||||||
|
data.result_data = cmd.data
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:CopyLastStep(index)
|
||||||
|
local step = {}
|
||||||
|
local last_step = self._step[index]
|
||||||
|
step = membe_deep_clone(last_step)
|
||||||
|
self._step[#self._step + 1] = step
|
||||||
|
step.result_data = nil
|
||||||
|
return step
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateLeftCard(num)
|
||||||
|
self._tex_LeftCard.text = "剩余 " .. num .. " 张牌"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateCardBox(seat)
|
||||||
|
local index = seat
|
||||||
|
local people_num = self._room.room_config.people_num
|
||||||
|
if people_num == 2 and seat == 2 then
|
||||||
|
index = 3
|
||||||
|
elseif people_num == 3 and seat == 3 then
|
||||||
|
index = 4
|
||||||
|
end
|
||||||
|
self._ctr_cardbox.selectedIndex = index
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateRound(round)
|
||||||
|
self._tex_round.text = "第 " .. round .. "/" .. self._room.room_config.round .. " 局"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:UpdateStep(step)
|
||||||
|
self._record:GetChild("tex_step").text = "第 " .. step .. " / " .. #self._step .. "步"
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.HandCardSortAndJing(a, b)
|
||||||
|
local jing = DataManager.CurrenRoom.jing
|
||||||
|
if a == jing or b == jing then
|
||||||
|
if a == b then
|
||||||
|
return a < b
|
||||||
|
end
|
||||||
|
return a == jing
|
||||||
|
else
|
||||||
|
if a < 200 then
|
||||||
|
a = a + 1000
|
||||||
|
elseif a < 300 then
|
||||||
|
a = a + 3000
|
||||||
|
elseif a < 400 then
|
||||||
|
a = a + 2000
|
||||||
|
else
|
||||||
|
a = a + 4000
|
||||||
|
end
|
||||||
|
if b < 200 then
|
||||||
|
b = b + 1000
|
||||||
|
elseif b < 300 then
|
||||||
|
b = b + 3000
|
||||||
|
elseif b < 400 then
|
||||||
|
b = b + 2000
|
||||||
|
else
|
||||||
|
b = b + 4000
|
||||||
|
end
|
||||||
|
return a < b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -5,6 +5,7 @@ local EXMainView = import(".EXMainView")
|
||||||
local EXGameController = import(".EXGameController")
|
local EXGameController = import(".EXGameController")
|
||||||
local EXRoomConfig = import(".EXRoomConfig")
|
local EXRoomConfig = import(".EXRoomConfig")
|
||||||
local EXPlayBackView = import(".EXPlayBackView")
|
local EXPlayBackView = import(".EXPlayBackView")
|
||||||
|
local EXWitnessView = import(".EXWitnessView")
|
||||||
local MJRoom = require("main.majiang.MJRoom")
|
local MJRoom = require("main.majiang.MJRoom")
|
||||||
|
|
||||||
local ExtendConfig = {}
|
local ExtendConfig = {}
|
||||||
|
|
@ -20,6 +21,7 @@ function ExtendConfig.new()
|
||||||
self._viewMap = {}
|
self._viewMap = {}
|
||||||
self._viewMap[ViewManager.View_Main] = EXMainView
|
self._viewMap[ViewManager.View_Main] = EXMainView
|
||||||
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
self._viewMap[ViewManager.View_PlayBack] = EXPlayBackView
|
||||||
|
self._viewMap[ViewManager.View_Witness] = EXWitnessView
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -180,6 +182,61 @@ function M:FillPlayBackData(pd_data)
|
||||||
room.cmdList = pd_data["cmdList"]
|
room.cmdList = pd_data["cmdList"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:FillWitnessData(pd_data)
|
||||||
|
local room = DataManager.CurrenRoom
|
||||||
|
local _tableInfo = pd_data["tableInfo"]
|
||||||
|
|
||||||
|
local _config = _tableInfo["config"]
|
||||||
|
room.room_id = _tableInfo.roomid
|
||||||
|
room.room_config = EXRoomConfig.new(_config)
|
||||||
|
room.owner_id = _config["ownerid"]
|
||||||
|
local active_seat = _tableInfo["active_seat"]
|
||||||
|
local bank_seat = _tableInfo["banker_seat"]
|
||||||
|
room.left_count = _tableInfo["left_card"]
|
||||||
|
room.banker_seat = bank_seat
|
||||||
|
room.curren_turn_seat = active_seat
|
||||||
|
room.curren_round = _tableInfo["round"]
|
||||||
|
|
||||||
|
local _info_list = _tableInfo["playerData"]
|
||||||
|
for i = 1, #_info_list do
|
||||||
|
local _jp = _info_list[i]
|
||||||
|
local p = room:NewPlayer()
|
||||||
|
p.seat = _jp["seat"]
|
||||||
|
local online = _jp["online"]
|
||||||
|
p.line_state = online
|
||||||
|
p.ready = _jp["ready"] == 1 and true or false
|
||||||
|
local pid = _jp["aid"]
|
||||||
|
p.piao_niao = _jp["piao_niao"]
|
||||||
|
-- -- print(DataManager.SelfUser.account_id,pid)
|
||||||
|
-- if (278 == pid) then
|
||||||
|
-- room.self_player = p
|
||||||
|
-- p.self_user = DataManager.SelfUser
|
||||||
|
-- else
|
||||||
|
if p.seat == 1 then room.self_player = p end
|
||||||
|
local u = User.new()
|
||||||
|
u.account_id = pid
|
||||||
|
p.self_user = u
|
||||||
|
u.nick_name = _jp["nick"]
|
||||||
|
u.head_url = _jp["portrait"]
|
||||||
|
u.sex = _jp["sex"]
|
||||||
|
-- end
|
||||||
|
p.self_user.host_ip = p.self_user.host_ip
|
||||||
|
local _hand_card = _jp["hand_card"]
|
||||||
|
p.card_list = _hand_card
|
||||||
|
--room.self_player.card_list = _hand_card
|
||||||
|
-- table.sort(_hand_card, self.HandCardSortAndJing)
|
||||||
|
p.total_score = _jp["score"]
|
||||||
|
-- p.hand_left_count = #_hand_card
|
||||||
|
-- if _jp.hp_info then
|
||||||
|
-- room.room_config.isNonnegative = 1
|
||||||
|
-- p.cur_hp = _jp.hp_info.cur_hp
|
||||||
|
-- end
|
||||||
|
|
||||||
|
room:AddPlayer(p)
|
||||||
|
end
|
||||||
|
room.cmdList = pd_data["cmdList"]
|
||||||
|
end
|
||||||
|
|
||||||
function M.HandCardSortAndJing(a, b)
|
function M.HandCardSortAndJing(a, b)
|
||||||
local jing = DataManager.CurrenRoom.jing
|
local jing = DataManager.CurrenRoom.jing
|
||||||
if a == jing or b == jing then
|
if a == jing or b == jing then
|
||||||
|
|
|
||||||
|
|
@ -217,9 +217,6 @@ function M:InitView(url)
|
||||||
-- self._view:GetChild('Btn_GamePlay').onClick:Set(function()
|
-- self._view:GetChild('Btn_GamePlay').onClick:Set(function()
|
||||||
-- ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
-- ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
||||||
-- end)
|
-- end)
|
||||||
self._view:GetChild('Btn_Message').onClick:Set(function()
|
|
||||||
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
|
||||||
end)
|
|
||||||
self._view:GetChild('Btn_Invite').onClick:Set(function()
|
self._view:GetChild('Btn_Invite').onClick:Set(function()
|
||||||
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="2532,1170" designImageAlpha="100" designImageLayer="1">
|
<component size="2532,1170" designImageAlpha="100" designImageLayer="1">
|
||||||
<controller name="state" pages="0,准备状态,1,游戏状态,2,,3,回放" selected="1"/>
|
<controller name="state" pages="0,准备状态,1,游戏状态,2,,3,回放" selected="0"/>
|
||||||
<controller name="sdk" pages="0,,1," selected="0"/>
|
<controller name="sdk" pages="0,,1," selected="0"/>
|
||||||
<controller name="action" pages="2,空,0,准备,1,开始" selected="0"/>
|
<controller name="action" pages="2,空,0,准备,1,开始" selected="0"/>
|
||||||
<controller name="time" pages="0,,1,,2,,3," selected="2"/>
|
<controller name="time" pages="0,,1,,2,,3," selected="0"/>
|
||||||
<controller name="card_eff" pages="0,,1," selected="0"/>
|
<controller name="card_eff" pages="0,,1," selected="0"/>
|
||||||
<controller name="zidongtishi" pages="0,,1," selected="0"/>
|
<controller name="zidongtishi" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="voice" pages="0,,1," selected="1"/>
|
||||||
<displayList>
|
<displayList>
|
||||||
<graph id="n141_ckvb" name="bg_mask" xy="6,7" size="2532,751" type="rect" lineSize="0" fillColor="#00ffffff"/>
|
<graph id="n141_ckvb" name="bg_mask" xy="6,7" size="2532,751" type="rect" lineSize="0" fillColor="#00ffffff"/>
|
||||||
<component id="n76_rqeb" name="mask" src="prgzeq" fileName="component/mask.xml" xy="14,1956" alpha="0">
|
<component id="n76_rqeb" name="mask" src="prgzeq" fileName="component/mask.xml" xy="14,1956" alpha="0">
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
<gearDisplay controller="state" pages="0,1,2"/>
|
<gearDisplay controller="state" pages="0,1,2"/>
|
||||||
<relation target="" sidePair="center-center"/>
|
<relation target="" sidePair="center-center"/>
|
||||||
</group>
|
</group>
|
||||||
<component id="n67_qfrg" name="time" src="prgzer" fileName="component/Clock.xml" xy="2797,1976" scale="1.5,1.5" touchable="false">
|
<component id="n67_qfrg" name="time" src="prgzer" fileName="component/Clock.xml" xy="625,198" scale="1.5,1.5" touchable="false">
|
||||||
<gearDisplay controller="time" pages="1,2,3"/>
|
<gearDisplay controller="time" pages="1,2,3"/>
|
||||||
<gearXY controller="time" pages="1,2" values="-296,2199|2797,1976" default="625,198"/>
|
<gearXY controller="time" pages="1,2" values="-296,2199|2797,1976" default="625,198"/>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -152,12 +153,12 @@
|
||||||
<group id="n126_ckvb" name="readyBtn" xy="871,479" size="789,332" advanced="true">
|
<group id="n126_ckvb" name="readyBtn" xy="871,479" size="789,332" advanced="true">
|
||||||
<gearDisplay controller="state" pages="0,2"/>
|
<gearDisplay controller="state" pages="0,2"/>
|
||||||
</group>
|
</group>
|
||||||
<component id="n127_ckvb" name="Btn_Message" src="ckvbcj7" fileName="Main_New/Component/Btn_Message.xml" xy="2328,409" group="n129_ckvb">
|
<component id="n127_ckvb" name="btn_sendText" src="ckvbcj7" fileName="Main_New/Component/Btn_Message.xml" xy="2328,409" group="n129_ckvb">
|
||||||
<relation target="" sidePair="right-right,top-top"/>
|
<relation target="" sidePair="right-right,top-top"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n142_eqmd" name="n142" src="eqmdckh" fileName="Main_New/Component/Btn_MessageTalk.xml" xy="2328,567" group="n129_ckvb"/>
|
<component id="n142_eqmd" name="btn_sendTalk" src="eqmdckh" fileName="Main_New/Component/Btn_MessageTalk.xml" xy="2328,567" group="n129_ckvb"/>
|
||||||
<group id="n129_ckvb" name="left" xy="2328,409" size="120,278"/>
|
<group id="n129_ckvb" name="left" xy="2328,409" size="120,278"/>
|
||||||
<component id="n140_ckvb" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="2133,159">
|
<component id="n140_ckvb" name="Comp_Clock" src="ckvbcis" fileName="Main_New/Component/Comp_Clock.xml" xy="388,492">
|
||||||
<gearDisplay controller="time" pages="1,2,3"/>
|
<gearDisplay controller="time" pages="1,2,3"/>
|
||||||
<gearXY controller="time" pages="1,2" values="729,667|2133,159" default="388,492"/>
|
<gearXY controller="time" pages="1,2" values="729,667|2133,159" default="388,492"/>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -191,6 +192,12 @@
|
||||||
</component>
|
</component>
|
||||||
<component id="n139_ckvb" name="Btn_Check" src="ckvbcjk" fileName="Main_New/Component/Btn_Check.xml" xy="1560,23" group="n131_ckvb"/>
|
<component id="n139_ckvb" name="Btn_Check" src="ckvbcjk" fileName="Main_New/Component/Btn_Check.xml" xy="1560,23" group="n131_ckvb"/>
|
||||||
<group id="n131_ckvb" name="top" xy="684,14" size="1173,86"/>
|
<group id="n131_ckvb" name="top" xy="684,14" size="1173,86"/>
|
||||||
|
<graph id="n143_cksh" name="n143" xy="0,0" size="2532,1170" group="n144_cksh" type="rect" lineSize="0" fillColor="#73000000"/>
|
||||||
|
<image id="n146_cksh" name="n146" src="ckvbcj2" fileName="Main_New/Image/Group 205.png" xy="1203,522" group="n144_cksh"/>
|
||||||
|
<text id="n147_cksh" name="n147" xy="1024,667" size="484,79" group="n144_cksh" fontSize="60" color="#ffffff" text="松开按钮发送语音"/>
|
||||||
|
<group id="n144_cksh" name="chatTalk" xy="0,0" size="2532,1170" advanced="true">
|
||||||
|
<gearDisplay controller="voice" pages="1"/>
|
||||||
|
</group>
|
||||||
</displayList>
|
</displayList>
|
||||||
<transition name="t1">
|
<transition name="t1">
|
||||||
<item time="0" type="Alpha" target="n75_jmab" tween="true" startValue="1" endValue="1" duration="18"/>
|
<item time="0" type="Alpha" target="n75_jmab" tween="true" startValue="1" endValue="1" duration="18"/>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="2532,1170">
|
<component size="2532,1170">
|
||||||
<controller name="familyType" exported="true" homePageType="specific" homePage="6" pages="6,空,0,main,1,playEdit,4,createAndJoin,5,numberList,7,numberRecord,8,auditNumber" selected="1"/>
|
<controller name="familyType" exported="true" homePageType="specific" homePage="6" pages="6,空,0,main,1,playEdit,4,createAndJoin,5,numberList,7,numberRecord,8,auditNumber" selected="6"/>
|
||||||
<controller name="createOrJoin" pages="0,create,1,join" selected="0"/>
|
<controller name="createOrJoin" pages="0,create,1,join" selected="0"/>
|
||||||
<controller name="listFamily" pages="0,,1,,10,,11,,12,,13,,14,,15," selected="0"/>
|
<controller name="listFamily" pages="0,,1,,10,,11,,12,,13,,14,,15," selected="0"/>
|
||||||
<controller name="numberRecordRank" pages="0,,1,,3," selected="0"/>
|
<controller name="numberRecordRank" pages="0,,1,,3," selected="0"/>
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
</list>
|
</list>
|
||||||
<list id="n28_in3i" name="list_room" xy="866,367" size="1620,743" group="n34_86ct" overflow="scroll" lineGap="24" defaultItem="ui://htcn7v3rin3i7cuh" autoClearItems="true">
|
<list id="n28_in3i" name="list_room" xy="866,367" size="1620,743" group="n34_86ct" overflow="scroll" lineGap="10" defaultItem="ui://htcn7v3rin3i7cuh" autoClearItems="true">
|
||||||
<relation target="" sidePair="height-height,left-left%"/>
|
<relation target="" sidePair="height-height,left-left%"/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
|
|
@ -328,16 +328,16 @@
|
||||||
<text id="n281_jrro" name="text_titleAuditNumber" xy="1108,44" size="272,86" group="n349_jrro" font="ui://27vd145bh35o7ik0" fontSize="66" color="#ffffff" bold="true" text="申请消息">
|
<text id="n281_jrro" name="text_titleAuditNumber" xy="1108,44" size="272,86" group="n349_jrro" font="ui://27vd145bh35o7ik0" fontSize="66" color="#ffffff" bold="true" text="申请消息">
|
||||||
<relation target="" sidePair="center-center"/>
|
<relation target="" sidePair="center-center"/>
|
||||||
</text>
|
</text>
|
||||||
<image id="n282_jrro" name="n282" src="86ct7cvc" fileName="GamePlay/Image/Rectangle 91.png" xy="45,180" size="2441,960" group="n284_jrro"/>
|
<image id="n282_jrro" name="n282" src="86ct7cvc" fileName="GamePlay/Image/Rectangle 91.png" xy="228,180" size="2076,960" group="n284_jrro"/>
|
||||||
<image id="n283_jrro" name="n283" src="86ct7cvb" fileName="GamePlay/Image/Rectangle 112.png" xy="75,210" size="2383,900" group="n284_jrro"/>
|
<image id="n283_jrro" name="n283" src="86ct7cvb" fileName="GamePlay/Image/Rectangle 112.png" xy="258,210" size="2018,900" group="n284_jrro"/>
|
||||||
<group id="n284_jrro" name="bg_auditNumber" xy="45,180" size="2441,960" group="n349_jrro"/>
|
<group id="n284_jrro" name="bg_auditNumber" xy="228,180" size="2076,960" group="n349_jrro"/>
|
||||||
<list id="n351_jrro" name="list_auditNumberList" xy="149,219" size="2233,868" group="n349_jrro" overflow="scroll" lineGap="37" defaultItem="ui://htcn7v3rjrro7cxz" autoClearItems="true">
|
<list id="n351_jrro" name="list_auditNumberList" xy="149,219" size="2233,868" group="n349_jrro" overflow="scroll" lineGap="37" defaultItem="ui://htcn7v3rjrro7cxz" autoClearItems="true">
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
<item/>
|
<item/>
|
||||||
</list>
|
</list>
|
||||||
<group id="n349_jrro" name="auditNumber" xy="45,44" size="2441,1096" advanced="true">
|
<group id="n349_jrro" name="auditNumber" xy="149,44" size="2233,1096" advanced="true">
|
||||||
<gearDisplay controller="familyType" pages="8"/>
|
<gearDisplay controller="familyType" pages="8"/>
|
||||||
</group>
|
</group>
|
||||||
<image id="n369_j9s1" name="n369" src="jrro7cy2" fileName="Main/Image/bg_left1.png" xy="424,248" size="359,913" group="n366_j9s1">
|
<image id="n369_j9s1" name="n369" src="jrro7cy2" fileName="Main/Image/bg_left1.png" xy="424,248" size="359,913" group="n366_j9s1">
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,10 @@
|
||||||
<gearXY controller="site" pages="2,0,1" values="-47,-46|-37,-57|150,0"/>
|
<gearXY controller="site" pages="2,0,1" values="-47,-46|-37,-57|150,0"/>
|
||||||
<relation target="" sidePair="center-center,top-top"/>
|
<relation target="" sidePair="center-center,top-top"/>
|
||||||
</text>
|
</text>
|
||||||
<component id="n31_e54q" name="chat" src="gq7m6b" fileName="component/MsgBubble2.xml" xy="-32,-82" size="197,103" alpha="0" touchable="false"/>
|
<component id="n31_e54q" name="chat" src="gq7m6b" fileName="component/MsgBubble2.xml" xy="78,11" size="197,103" alpha="0" touchable="false"/>
|
||||||
<component id="n27_e54q" name="face" src="gq7m5x" fileName="component/Face3.xml" xy="99,-88" alpha="0" touchable="false"/>
|
<component id="n27_e54q" name="face" src="gq7m5x" fileName="component/Face3.xml" xy="0,0" alpha="0" touchable="false">
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
|
</component>
|
||||||
<image id="n38_tla5" name="n38" src="gq7m5w" fileName="images/game_icon_07.png" xy="-20,-89">
|
<image id="n38_tla5" name="n38" src="gq7m5w" fileName="images/game_icon_07.png" xy="-20,-89">
|
||||||
<gearDisplay controller="mask_voice" pages="1"/>
|
<gearDisplay controller="mask_voice" pages="1"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
<gearXY controller="site" pages="2,0,1" values="136,18|-33,-57|154,0"/>
|
<gearXY controller="site" pages="2,0,1" values="136,18|-33,-57|154,0"/>
|
||||||
<relation target="" sidePair="left-left,bottom-middle"/>
|
<relation target="" sidePair="left-left,bottom-middle"/>
|
||||||
</text>
|
</text>
|
||||||
<component id="n31_e54q" name="chat" src="gq7m6b" fileName="component/MsgBubble2.xml" xy="-23,-81" size="197,103" alpha="0" touchable="false"/>
|
<component id="n31_e54q" name="chat" src="gq7m6b" fileName="component/MsgBubble2.xml" xy="117,16" size="197,103" alpha="0" touchable="false"/>
|
||||||
<component id="n27_e54q" name="face" src="gq7m5x" fileName="component/Face3.xml" xy="99,-88" alpha="0" touchable="false"/>
|
<component id="n27_e54q" name="face" src="gq7m5x" fileName="component/Face3.xml" xy="0,0" alpha="0" touchable="false"/>
|
||||||
<image id="n38_tla5" name="n38" src="gq7m5w" fileName="images/game_icon_07.png" xy="-20,-89">
|
<image id="n38_tla5" name="n38" src="gq7m5w" fileName="images/game_icon_07.png" xy="-20,-89">
|
||||||
<gearDisplay controller="mask_voice" pages="1"/>
|
<gearDisplay controller="mask_voice" pages="1"/>
|
||||||
</image>
|
</image>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<component size="132,132" initName="gcm_info">
|
||||||
|
<controller name="room_owner" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="bank" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="read" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="offline" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="mask_voice" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="piao_niao" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="three_win" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="ting" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="text_color" pages="0,,1," selected="0"/>
|
||||||
|
<controller name="site" pages="2,normol,0,2-1,1,2-2" selected="0"/>
|
||||||
|
<displayList>
|
||||||
|
<text id="n47_nkur" name="tuoguanTips" xy="1,125" size="302,48" fontSize="22" color="#ff0000" vAlign="middle" autoSize="none" text="开启托管剩余时间">
|
||||||
|
<gearXY controller="site" pages="2,1" values="1,125|154,50" default="-85,-104"/>
|
||||||
|
<relation target="" sidePair="center-center,top-bottom"/>
|
||||||
|
</text>
|
||||||
|
<graph id="n32_kba2" name="offLine" xy="21,21" size="90,90" group="n33_e7qn" aspect="true" touchable="false" type="eclipse" lineSize="0" fillColor="#b3000000">
|
||||||
|
<gearDisplay controller="offline" pages="1"/>
|
||||||
|
</graph>
|
||||||
|
<component id="n49_pkx5" name="btn_head" src="pkx5sz" fileName="Main_new/Main/Component/btn_head.xml" xy="0,0" group="n33_e7qn">
|
||||||
|
<relation target="" sidePair="width-width,height-height"/>
|
||||||
|
</component>
|
||||||
|
<text id="n37_aawn" name="n37" xy="34,45" size="64,42" group="n33_e7qn" fontSize="30" color="#ffffff" text="离线">
|
||||||
|
<gearDisplay controller="offline" pages="1"/>
|
||||||
|
</text>
|
||||||
|
<image id="n6" name="fangzhu" src="gq7m5t" fileName="images/z02.png" xy="0,89" group="n33_e7qn" visible="false">
|
||||||
|
<gearDisplay controller="room_owner" pages="1"/>
|
||||||
|
</image>
|
||||||
|
<image id="n34_u4l2" name="zhuang" src="gq7m5u" fileName="images/z01.png" xy="92,2" group="n33_e7qn">
|
||||||
|
<gearDisplay controller="bank" pages="1"/>
|
||||||
|
</image>
|
||||||
|
<group id="n33_e7qn" name="n33" xy="0,0" size="132,132"/>
|
||||||
|
<image id="n8" name="ready" src="gq7m5y" fileName="font/images/game/game_fonts_01.png" xy="158,32">
|
||||||
|
<gearDisplay controller="read" pages="1"/>
|
||||||
|
</image>
|
||||||
|
<text id="n48_pkx5" name="name" xy="136,18" size="203,49" font="ui://27vd145bh35o7ik0" fontSize="36" color="#ffffff" autoSize="shrink" bold="true" singleLine="true" text="萌萌六个字了">
|
||||||
|
<gearXY controller="site" pages="2,0,1" values="136,18|-33,-57|154,0"/>
|
||||||
|
<relation target="" sidePair="left-left,bottom-middle"/>
|
||||||
|
</text>
|
||||||
|
<component id="n31_e54q" name="chat" src="gq7m6b" fileName="component/MsgBubble2.xml" xy="-65,105" size="197,103" alpha="0" touchable="false"/>
|
||||||
|
<component id="n27_e54q" name="face" src="gq7m5x" fileName="component/Face3.xml" xy="0,0" alpha="0" touchable="false"/>
|
||||||
|
<image id="n38_tla5" name="n38" src="gq7m5w" fileName="images/game_icon_07.png" xy="-20,-89">
|
||||||
|
<gearDisplay controller="mask_voice" pages="1"/>
|
||||||
|
</image>
|
||||||
|
<component id="n18" name="mask_voice" src="gq7m61" fileName="component/VoiceMask(1).xml" xy="31,-64" touchable="false">
|
||||||
|
<gearDisplay controller="mask_voice" pages="1"/>
|
||||||
|
</component>
|
||||||
|
<component id="n39_nip5" name="mask_piao" src="gq7m65" fileName="component/piao_niao/mask_piao.xml" xy="-5,97" touchable="false">
|
||||||
|
<gearDisplay controller="piao_niao" pages="1"/>
|
||||||
|
</component>
|
||||||
|
<component id="n40_7q1m" name="com_three_win" src="gq7m32" fileName="Main_style_2/component/tip_continue_win/com_continual_win.xml" xy="-5,-12">
|
||||||
|
<gearDisplay controller="three_win" pages="1"/>
|
||||||
|
</component>
|
||||||
|
<component id="n41_7q1m" name="n41" src="gq7m67" fileName="ting.xml" xy="-3,7">
|
||||||
|
<gearDisplay controller="ting" pages="1"/>
|
||||||
|
</component>
|
||||||
|
<text id="n44_rfcn" name="text_jifen" xy="136,64" size="29,58" group="n46_rfcn" font="ui://27vd145bh35o7ik0" fontSize="43" color="#ffffff" align="center" vAlign="middle" bold="true" autoClearText="true" text="0">
|
||||||
|
<gearColor controller="text_color" pages="1" values="#ff0000,#000000" default="#ffffff,#000000"/>
|
||||||
|
<relation target="" sidePair="left-left,top-middle"/>
|
||||||
|
</text>
|
||||||
|
<group id="n46_rfcn" name="zhanji" xy="136,64" size="29,58" advanced="true">
|
||||||
|
<gearXY controller="site" pages="2,1" values="136,64|154,97" default="29,136"/>
|
||||||
|
</group>
|
||||||
|
</displayList>
|
||||||
|
</component>
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<component size="2532,1170">
|
<component size="2532,1170">
|
||||||
<controller name="state" pages="0,准备状态,1,游戏状态,2,回合间状态,3,回放状态" selected="0"/>
|
<controller name="state" pages="0,准备状态,1,游戏状态,2,回合间状态,3,回放状态,4,观战状态" selected="1"/>
|
||||||
<controller name="sdk" pages="0,,1," selected="0"/>
|
<controller name="sdk" pages="0,,1," selected="0"/>
|
||||||
<controller name="action" pages="2,空,0,准备,1,开始" selected="0"/>
|
<controller name="action" pages="2,空,0,准备,1,开始" selected="0"/>
|
||||||
<controller name="3d" pages="0,,1," selected="0"/>
|
<controller name="3d" pages="0,,1," selected="0"/>
|
||||||
<controller name="showNext" pages="0,不展示,1,展示" selected="0"/>
|
<controller name="showNext" pages="0,不展示,1,展示" selected="0"/>
|
||||||
<controller name="showNextConfrim" pages="0,不展示,1,展示" selected="0"/>
|
<controller name="showNextConfrim" pages="0,不展示,1,展示" selected="0"/>
|
||||||
<controller name="more" pages="0,,1," selected="1"/>
|
<controller name="more" pages="0,,1," selected="0"/>
|
||||||
<displayList>
|
<displayList>
|
||||||
<component id="n115_pkx5" name="player_info1_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,897" size="144,144">
|
<component id="n115_pkx5" name="player_info1_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="71,784" size="144,144">
|
||||||
<gearDisplay controller="state" pages="0,2"/>
|
<gearDisplay controller="state" pages="0,2"/>
|
||||||
<gearXY controller="state" pages="1" values="71,784" default="1188,897"/>
|
<gearXY controller="state" pages="1" values="71,784" default="1188,897"/>
|
||||||
<gearSize controller="state" default="144,144,1,1"/>
|
<gearSize controller="state" default="144,144,1,1"/>
|
||||||
<relation target="" sidePair="center-center,bottom-bottom"/>
|
<relation target="" sidePair="center-center,bottom-bottom"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n141_lu84" name="player_info1_2" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="737,916" size="144,144">
|
<component id="n141_lu84" name="player_info1_2" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="71,784" size="144,144">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<gearXY controller="state" pages="1,3" values="71,784|71,784" default="737,916"/>
|
<gearXY controller="state" pages="1,3" values="71,784|71,784" default="737,916"/>
|
||||||
<relation target="n118_pkx5" sidePair="right-left,top-top"/>
|
<relation target="n118_pkx5" sidePair="right-left,top-top"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n150_kxhm" name="player_info2_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1188,274" size="144,144">
|
<component id="n150_kxhm" name="player_info2_1" src="pkx5so" fileName="Main_new/Main/PlayerHead_1.xml" xy="1867,27" size="144,144">
|
||||||
<gearDisplay controller="state" pages="0,2"/>
|
<gearDisplay controller="state" pages="0,2"/>
|
||||||
<gearXY controller="state" pages="0,1,2" values="1188,274|1867,27|1188,274" default="1188,909"/>
|
<gearXY controller="state" pages="0,1,2" values="1188,274|1867,27|1188,274" default="1188,909"/>
|
||||||
<relation target="" sidePair="center-center,top-top"/>
|
<relation target="" sidePair="center-center,top-top"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n152_kxhm" name="player_info2_2" src="lu84tz" fileName="Main_new/Main/PlayerHead_2.xml" xy="2031,519" size="108,108">
|
<component id="n152_kxhm" name="player_info2_2" src="o8k813y" fileName="Main_new/Main_new_2/PlayerHead2_2.xml" xy="1885,27" size="108,108">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<gearXY controller="state" pages="0,1,3" values="2031,519|1885,27|1885,27" default="1337,909"/>
|
<gearXY controller="state" pages="0,1,3" values="2031,519|1885,27|1885,27" default="1337,909"/>
|
||||||
<relation target="n155_gi99" sidePair="left-right,top-top"/>
|
<relation target="n155_gi99" sidePair="left-right,top-top"/>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -117,9 +117,9 @@
|
||||||
</group>
|
</group>
|
||||||
<component id="n132_swus" name="jing" src="ckvb11l" fileName="Main_new/Main/Component/Comp_jing.xml" xy="550,33" size="64,90" visible="false" touchable="false"/>
|
<component id="n132_swus" name="jing" src="ckvb11l" fileName="Main_new/Main/Component/Comp_jing.xml" xy="550,33" size="64,90" visible="false" touchable="false"/>
|
||||||
<component id="n137_lu84" name="btn_setting" src="t6zvw5" fileName="Main_new/Main/Component/btn_setting.xml" xy="2232,36" group="n138_lu84"/>
|
<component id="n137_lu84" name="btn_setting" src="t6zvw5" fileName="Main_new/Main/Component/btn_setting.xml" xy="2232,36" group="n138_lu84"/>
|
||||||
<component id="n170_gmbn" name="btn_more" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2412,60" pivot="0.5,0.5" size="72,72" group="n138_lu84" rotation="180">
|
<component id="n170_gmbn" name="btn_more" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2412,60" pivot="0.5,0.5" size="72,72" group="n138_lu84">
|
||||||
<gearLook controller="more" pages="1" values="1,180,0,1" default="1,0,0,1"/>
|
<gearLook controller="more" pages="1" values="1,180,0,1" default="1,0,0,1"/>
|
||||||
<Button checked="true" icon="ui://v0j9abjygmbn13t" controller="more" page="1"/>
|
<Button icon="ui://v0j9abjygmbn13t" controller="more" page="1"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n171_gmbn" name="btn_change" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2031,33" pivot="0.5,0.5" size="102,119" group="n138_lu84">
|
<component id="n171_gmbn" name="btn_change" src="gmbn13s" fileName="Main_new/Main/Component/btn_normol.xml" xy="2031,33" pivot="0.5,0.5" size="102,119" group="n138_lu84">
|
||||||
<gearDisplay controller="more" pages="1"/>
|
<gearDisplay controller="more" pages="1"/>
|
||||||
|
|
@ -148,22 +148,22 @@
|
||||||
<text id="n136_lu84" name="text_roomId" xy="43,97" size="228,49" group="n135_lu84" font="ui://27vd145bh35o7ika" fontSize="36" color="#ffffff" text="房间:123456"/>
|
<text id="n136_lu84" name="text_roomId" xy="43,97" size="228,49" group="n135_lu84" font="ui://27vd145bh35o7ika" fontSize="36" color="#ffffff" text="房间:123456"/>
|
||||||
<group id="n135_lu84" name="top_left" xy="43,44" size="228,171"/>
|
<group id="n135_lu84" name="top_left" xy="43,44" size="228,171"/>
|
||||||
<component id="n155_gi99" name="player_card_info2" src="inqx13x" fileName="Main_new/Main_new_2/Player_card_info_2_2.xml" xy="515,33">
|
<component id="n155_gi99" name="player_card_info2" src="inqx13x" fileName="Main_new/Main_new_2/Player_card_info_2_2.xml" xy="515,33">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
</component>
|
</component>
|
||||||
<component id="n118_pkx5" name="player_card_info1" src="inqx13w" fileName="Main_new/Main_new_2/Player_card_info_2_1.xml" xy="7,975">
|
<component id="n118_pkx5" name="player_card_info1" src="inqx13w" fileName="Main_new/Main_new_2/Player_card_info_2_1.xml" xy="7,975">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<relation target="" sidePair="center-center,bottom-bottom"/>
|
<relation target="" sidePair="center-center,bottom-bottom"/>
|
||||||
</component>
|
</component>
|
||||||
<text id="n176_eqmd" name="remaining_card" xy="897,469" size="215,74" group="n179_eqmd" font="ui://27vd145bh35o7ik0" fontSize="56" color="#cccccc" align="center" vAlign="middle" bold="true" text="余999张">
|
<text id="n176_eqmd" name="remaining_card" xy="897,469" size="215,74" group="n179_eqmd" font="ui://27vd145bh35o7ik0" fontSize="56" color="#cccccc" align="center" vAlign="middle" bold="true" text="余999张">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<relation target="n159_ckvb" sidePair="right-left"/>
|
<relation target="n159_ckvb" sidePair="right-left"/>
|
||||||
</text>
|
</text>
|
||||||
<text id="n177_eqmd" name="wanfa_text" xy="418,599" pivot="0.5,0" size="1696,56" group="n179_eqmd" fontSize="42" color="#ffffff" align="center" vAlign="middle" autoSize="shrink" singleLine="true" text="玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍
">
|
<text id="n177_eqmd" name="wanfa_text" xy="418,599" pivot="0.5,0" size="1696,56" group="n179_eqmd" fontSize="42" color="#ffffff" align="center" vAlign="middle" autoSize="shrink" singleLine="true" text="玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍玩法介绍
">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<relation target="" sidePair="center-center"/>
|
<relation target="" sidePair="center-center"/>
|
||||||
</text>
|
</text>
|
||||||
<text id="n178_eqmd" name="text_round" xy="1418,469" size="241,74" group="n179_eqmd" font="ui://27vd145bh35o7ik0" fontSize="56" color="#cccccc" align="center" vAlign="middle" bold="true" text="局数:1\81">
|
<text id="n178_eqmd" name="text_round" xy="1418,469" size="241,74" group="n179_eqmd" font="ui://27vd145bh35o7ik0" fontSize="56" color="#cccccc" align="center" vAlign="middle" bold="true" text="局数:1\81">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
<relation target="n159_ckvb" sidePair="left-right"/>
|
<relation target="n159_ckvb" sidePair="left-right"/>
|
||||||
</text>
|
</text>
|
||||||
<group id="n179_eqmd" name="center_text" xy="418,469" size="1696,186" advanced="true">
|
<group id="n179_eqmd" name="center_text" xy="418,469" size="1696,186" advanced="true">
|
||||||
|
|
@ -171,7 +171,7 @@
|
||||||
</group>
|
</group>
|
||||||
<text id="n162_qz7i" name="text_testName" xy="47,178" size="266,49" visible="false" fontSize="36" color="#ffffff" bold="true" text="|一个玩家的名字"/>
|
<text id="n162_qz7i" name="text_testName" xy="47,178" size="266,49" visible="false" fontSize="36" color="#ffffff" bold="true" text="|一个玩家的名字"/>
|
||||||
<component id="n159_ckvb" name="Comp_ConterBox" src="gjnb107" fileName="Main_new/Main/Comp_ConterBox.xml" xy="1136,375" group="n169_gmbn">
|
<component id="n159_ckvb" name="Comp_ConterBox" src="gjnb107" fileName="Main_new/Main/Comp_ConterBox.xml" xy="1136,375" group="n169_gmbn">
|
||||||
<gearDisplay controller="state" pages="1,3"/>
|
<gearDisplay controller="state" pages="1,3,4"/>
|
||||||
</component>
|
</component>
|
||||||
<group id="n169_gmbn" name="conter_box" xy="1136,375" size="258,258"/>
|
<group id="n169_gmbn" name="conter_box" xy="1136,375" size="258,258"/>
|
||||||
<graph id="n146_l15a" name="btn_showNext" xy="1121,424" size="208,165" type="rect" lineSize="0" fillColor="#00ffffff">
|
<graph id="n146_l15a" name="btn_showNext" xy="1121,424" size="208,165" type="rect" lineSize="0" fillColor="#00ffffff">
|
||||||
|
|
|
||||||
|
|
@ -1206,6 +1206,7 @@
|
||||||
<component id="zmou13v" name="Main_new_2_jiangxi.xml" path="/Main_new/" exported="true"/>
|
<component id="zmou13v" name="Main_new_2_jiangxi.xml" path="/Main_new/" exported="true"/>
|
||||||
<component id="inqx13w" name="Player_card_info_2_1.xml" path="/Main_new/Main_new_2/"/>
|
<component id="inqx13w" name="Player_card_info_2_1.xml" path="/Main_new/Main_new_2/"/>
|
||||||
<component id="inqx13x" name="Player_card_info_2_2.xml" path="/Main_new/Main_new_2/"/>
|
<component id="inqx13x" name="Player_card_info_2_2.xml" path="/Main_new/Main_new_2/"/>
|
||||||
|
<component id="o8k813y" name="PlayerHead2_2.xml" path="/Main_new/Main_new_2/"/>
|
||||||
</resources>
|
</resources>
|
||||||
<publish name="Main_Majiang" path="..\wb_unity_pro\Assets\ART\base\main_majiang\ui" packageCount="2"/>
|
<publish name="Main_Majiang" path="..\wb_unity_pro\Assets\ART\base\main_majiang\ui" packageCount="2"/>
|
||||||
</packageDescription>
|
</packageDescription>
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
[Ll]ibrary/
|
||||||
|
[Tt]emp/
|
||||||
|
[Oo]bj/
|
||||||
|
[Bb]uild/
|
||||||
|
|
||||||
|
# Autogenerated VS/MD solution and project files
|
||||||
|
*.csproj
|
||||||
|
*.unityproj
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.tmp
|
||||||
|
*.user
|
||||||
|
*.userprefs
|
||||||
|
*.pidb
|
||||||
|
*.booproj
|
||||||
|
|
||||||
|
# Unity3D generated meta files
|
||||||
|
*.pidb.meta
|
||||||
|
|
||||||
|
# Unity3D Generated File On Crash Reports
|
||||||
|
sysinfo.txt
|
||||||
|
/Assets/UnityVS.meta
|
||||||
|
/Assets/UnityVS
|
||||||
|
/UnityVS.tolua.v11.suo
|
||||||
|
/UnityVS.tolua.CSharp.csproj
|
||||||
|
/UnityVS.tolua.CSharp.Editor.csproj
|
||||||
|
/UnityVS.tolua.sln
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"components": [
|
||||||
|
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fae290b60afd54546a57594ffe4624d9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 677476fc253e9204dbe2a266d13940a0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 32aca8baa0839a14bbe2028dc29395cd
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1630481058
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 060fd5bb621ccb44d8956aece85e8724
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_Name: FlyGold
|
||||||
|
m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TexEnvs:
|
||||||
|
- first:
|
||||||
|
name: <noninit>
|
||||||
|
second:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- first:
|
||||||
|
name: _MainTex
|
||||||
|
second:
|
||||||
|
m_Texture: {fileID: 2800000, guid: 77eb177a0c9d0fd4d91ae4a29e711161, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- first:
|
||||||
|
name: <noninit>
|
||||||
|
second: 0
|
||||||
|
m_Colors:
|
||||||
|
- first:
|
||||||
|
name: <noninit>
|
||||||
|
second: {r: 0, g: 1.556495e-34, b: 0, a: 1.5564877e-34}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0e1d5c04ce1cb084a8d6f7e23a3a8d7d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
|
|
@ -0,0 +1,98 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 77eb177a0c9d0fd4d91ae4a29e711161
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapMode: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Windows Store Apps
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 772338ec68e701847a565d981a690787
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b59eafa6cc9ce7d47b541a915b44eff2
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fcf30f88f707602469793d93f00507c2
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1551347279
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// UnityAction.h
|
||||||
|
// Unity-iPhone
|
||||||
|
//
|
||||||
|
// Created by qyq on 2019/6/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WXAppDelegate.h"
|
||||||
|
|
||||||
|
@interface UnityAction : NSObject
|
||||||
|
|
||||||
|
+(void)login;
|
||||||
|
+(void)share:(int)id:(const char*)str:(const char*)func;
|
||||||
|
+(int)GetWIFISignalStrength;
|
||||||
|
+(int)GetTeleSignalStrength;
|
||||||
|
+(int)__GetSignalStrength;
|
||||||
|
+(float)GetBatteryLevel;
|
||||||
|
+(bool)_ifChargingBattery;
|
||||||
|
+(void)CopyToClipboard:(const char*)text;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 75c73cd0afbd2424f9c211606eaa0789
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 0
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
//
|
||||||
|
// UnityAction.m
|
||||||
|
// Unity-iPhone
|
||||||
|
//
|
||||||
|
// Created by qyq on 2019/6/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "UnityAction.h"
|
||||||
|
|
||||||
|
@implementation UnityAction
|
||||||
|
|
||||||
|
+(void)login
|
||||||
|
{
|
||||||
|
[WXAppDelegate login];
|
||||||
|
}
|
||||||
|
|
||||||
|
+(void)share : (int) id : (const char*) str : (const char*) func
|
||||||
|
{
|
||||||
|
NSString* jsonString = [NSString stringWithUTF8String:str];
|
||||||
|
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
NSError *err;
|
||||||
|
NSDictionary *shareDic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
|
||||||
|
if(err)
|
||||||
|
{
|
||||||
|
NSLog(@"json解析失败:%@",err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (1 == id)
|
||||||
|
[WXAppDelegate share:shareDic];
|
||||||
|
else
|
||||||
|
NSLog(@"获取id出错,id=%i", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
+(int) GetWIFISignalStrength{
|
||||||
|
UIApplication *app = [UIApplication sharedApplication];
|
||||||
|
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
|
||||||
|
NSString *dataNetworkItemView = nil;
|
||||||
|
|
||||||
|
for (id subview in subviews) {
|
||||||
|
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
|
||||||
|
dataNetworkItemView = subview;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int signalStrength = [[dataNetworkItemView valueForKey:@"_wifiStrengthBars"] intValue];
|
||||||
|
|
||||||
|
return signalStrength;
|
||||||
|
}
|
||||||
|
+(int) GetTeleSignalStrength{
|
||||||
|
UIApplication *app = [UIApplication sharedApplication];
|
||||||
|
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
|
||||||
|
NSString *dataNetworkItemView = nil;
|
||||||
|
|
||||||
|
for (id subview in subviews) {
|
||||||
|
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
|
||||||
|
dataNetworkItemView = subview;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int signalStrength = [[dataNetworkItemView valueForKey:@"_wifiStrengthBars"] intValue];
|
||||||
|
|
||||||
|
return signalStrength;
|
||||||
|
}
|
||||||
|
+(int) __GetSignalStrength{
|
||||||
|
UIApplication *app = [UIApplication sharedApplication];
|
||||||
|
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
|
||||||
|
NSString *dataNetworkItemView = nil;
|
||||||
|
int flag = 0;
|
||||||
|
for (id subview in subviews) {
|
||||||
|
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarSignalStrengthItemView") class]]){
|
||||||
|
dataNetworkItemView = subview;
|
||||||
|
flag = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
|
||||||
|
dataNetworkItemView = subview;
|
||||||
|
flag = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int signalStrength = 0;
|
||||||
|
if (flag == 1){
|
||||||
|
signalStrength = [[dataNetworkItemView valueForKey:@"_signalStrengthBars"] intValue];
|
||||||
|
}
|
||||||
|
else if(flag == 2){
|
||||||
|
signalStrength = [[dataNetworkItemView valueForKey:@"_wifiStrengthBars"] intValue];
|
||||||
|
}
|
||||||
|
return signalStrength;
|
||||||
|
}
|
||||||
|
|
||||||
|
+(float) GetBatteryLevel{
|
||||||
|
UIDevice *device = [UIDevice currentDevice];
|
||||||
|
device.batteryMonitoringEnabled = YES;
|
||||||
|
|
||||||
|
return [[UIDevice currentDevice] batteryLevel];
|
||||||
|
}
|
||||||
|
+(bool) _ifChargingBattery{
|
||||||
|
if([UIDevice currentDevice].batteryState == UIDeviceBatteryStateUnknown || [UIDevice currentDevice].batteryState == UIDeviceBatteryStateUnplugged)
|
||||||
|
return false;
|
||||||
|
else if([UIDevice currentDevice].batteryState == UIDeviceBatteryStateCharging || [UIDevice currentDevice].batteryState == UIDeviceBatteryStateFull)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
+(void) CopyToClipboard:(const char*)textList
|
||||||
|
{
|
||||||
|
NSString *text = [NSString stringWithUTF8String: textList];
|
||||||
|
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||||
|
pasteboard.string = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8621d3ab08b9fe24ca0fbbe77be68a37
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 0
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#import <QuartzCore/CADisplayLink.h>
|
||||||
|
|
||||||
|
#include "RenderPluginDelegate.h"
|
||||||
|
|
||||||
|
#import "WXAppDelegate.h"
|
||||||
|
#import "UnityAction.h"
|
||||||
|
|
||||||
|
@class UnityView;
|
||||||
|
@class UnityViewControllerBase;
|
||||||
|
@class DisplayConnection;
|
||||||
|
|
||||||
|
__attribute__ ((visibility("default")))
|
||||||
|
@interface UnityAppController : NSObject<UIApplicationDelegate>
|
||||||
|
{
|
||||||
|
UnityView* _unityView;
|
||||||
|
CADisplayLink* _displayLink;
|
||||||
|
|
||||||
|
UIWindow* _window;
|
||||||
|
UIView* _rootView;
|
||||||
|
UIViewController* _rootController;
|
||||||
|
UIViewController* _snapshotViewController;
|
||||||
|
|
||||||
|
DisplayConnection* _mainDisplay;
|
||||||
|
|
||||||
|
// We will cache view controllers used for fixed orientation (indexed by UIInterfaceOrientation).
|
||||||
|
// Default view contoller goes to index 0. The default view controller is used when autorotation is enabled.
|
||||||
|
//
|
||||||
|
// There's no way to force iOS to change orientation when autorotation is enabled and the current orientation is disabled.
|
||||||
|
// [UIViewController attemptRotationToDeviceOrientation] is insufficient to force iOS to change orientation in this circumstance.
|
||||||
|
// We will recreate _viewControllerForOrientation[0] in that case immediately (see checkOrientationRequest for more comments)
|
||||||
|
#if UNITY_SUPPORT_ROTATION
|
||||||
|
UIViewController* _viewControllerForOrientation[5];
|
||||||
|
UIInterfaceOrientation _curOrientation;
|
||||||
|
#else
|
||||||
|
UIViewController* _viewControllerForOrientation[1];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
id<RenderPluginDelegate> _renderDelegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// override it to add your render plugin delegate
|
||||||
|
- (void)shouldAttachRenderDelegate;
|
||||||
|
|
||||||
|
// this one is called at the very end of didFinishLaunchingWithOptions:
|
||||||
|
// after views have been created but before initing engine itself
|
||||||
|
// override it to register plugins, tweak UI etc
|
||||||
|
- (void)preStartUnity;
|
||||||
|
|
||||||
|
// this one is called at first applicationDidBecomeActive
|
||||||
|
// NB: it will be started with delay 0, so it will run on next run loop iteration
|
||||||
|
// this is done to make sure that activity indicator animation starts before blocking loading
|
||||||
|
- (void)startUnity:(UIApplication*)application;
|
||||||
|
|
||||||
|
// this is a part of UIApplicationDelegate protocol starting with ios5
|
||||||
|
// setter will be generated empty
|
||||||
|
@property (retain, nonatomic) UIWindow* window;
|
||||||
|
|
||||||
|
@property (readonly, copy, nonatomic) UnityView* unityView;
|
||||||
|
@property (readonly, copy, nonatomic) CADisplayLink* unityDisplayLink;
|
||||||
|
|
||||||
|
@property (readonly, copy, nonatomic) UIView* rootView;
|
||||||
|
@property (readonly, copy, nonatomic) UIViewController* rootViewController;
|
||||||
|
@property (readonly, copy, nonatomic) DisplayConnection* mainDisplay;
|
||||||
|
|
||||||
|
#if UNITY_SUPPORT_ROTATION
|
||||||
|
@property (readonly, nonatomic) UIInterfaceOrientation interfaceOrientation;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@property (nonatomic, retain) id renderDelegate;
|
||||||
|
@property (nonatomic, copy) void(^quitHandler)();
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
// accessing app controller
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern UnityAppController* _UnityAppController;
|
||||||
|
extern UnityAppController* GetAppController();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Put this into mm file with your subclass implementation
|
||||||
|
// pass subclass name to define
|
||||||
|
|
||||||
|
#define IMPL_APP_CONTROLLER_SUBCLASS(ClassName) \
|
||||||
|
@interface ClassName(OverrideAppDelegate) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
+(void)load; \
|
||||||
|
@end \
|
||||||
|
@implementation ClassName(OverrideAppDelegate) \
|
||||||
|
+(void)load \
|
||||||
|
{ \
|
||||||
|
extern const char* AppControllerClassName; \
|
||||||
|
AppControllerClassName = #ClassName; \
|
||||||
|
} \
|
||||||
|
@end \
|
||||||
|
|
||||||
|
|
||||||
|
// plugins
|
||||||
|
|
||||||
|
#define APP_CONTROLLER_RENDER_PLUGIN_METHOD(method) \
|
||||||
|
do { \
|
||||||
|
id<RenderPluginDelegate> delegate = GetAppController().renderDelegate; \
|
||||||
|
if([delegate respondsToSelector:@selector(method)]) \
|
||||||
|
[delegate method]; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define APP_CONTROLLER_RENDER_PLUGIN_METHOD_ARG(method, arg) \
|
||||||
|
do { \
|
||||||
|
id<RenderPluginDelegate> delegate = GetAppController().renderDelegate; \
|
||||||
|
if([delegate respondsToSelector:@selector(method:)]) \
|
||||||
|
[delegate method:arg]; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
// these are simple wrappers about ios api, added for convenience
|
||||||
|
void AppController_SendNotification(NSString* name);
|
||||||
|
void AppController_SendNotificationWithArg(NSString* name, id arg);
|
||||||
|
|
||||||
|
void AppController_SendUnityViewControllerNotification(NSString* name);
|
||||||
|
|
||||||
|
// in the case when apple adds new api that has easy fallback path for old ios
|
||||||
|
// we will add new api methods at runtime on older ios, so we can switch to new api universally
|
||||||
|
// in that case we still need actual declaration: we will do it here as it is the most convenient place
|
||||||
|
|
||||||
|
// history:
|
||||||
|
// [CADisplayLink preferredFramesPerSecond], [UIScreen maximumFramesPerSecond], [UIView safeAreaInsets]
|
||||||
|
// were removed after we started to enforce xcode9 (sdk 11)
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c43875e5fb3a048a5b802d05af381001
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 1
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,717 @@
|
||||||
|
#import "UnityAppController.h"
|
||||||
|
#import "UnityAppController+ViewHandling.h"
|
||||||
|
#import "UnityAppController+Rendering.h"
|
||||||
|
#import "iPhone_Sensors.h"
|
||||||
|
|
||||||
|
#import <CoreGraphics/CoreGraphics.h>
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
#import <QuartzCore/CADisplayLink.h>
|
||||||
|
#import <Availability.h>
|
||||||
|
#import <AVFoundation/AVFoundation.h>
|
||||||
|
|
||||||
|
#import <OpenGLES/EAGL.h>
|
||||||
|
#import <OpenGLES/EAGLDrawable.h>
|
||||||
|
#import <OpenGLES/ES2/gl.h>
|
||||||
|
#import <OpenGLES/ES2/glext.h>
|
||||||
|
|
||||||
|
#include <mach/mach_time.h>
|
||||||
|
|
||||||
|
// MSAA_DEFAULT_SAMPLE_COUNT was moved to iPhone_GlesSupport.h
|
||||||
|
// ENABLE_INTERNAL_PROFILER and related defines were moved to iPhone_Profiler.h
|
||||||
|
// kFPS define for removed: you can use Application.targetFrameRate (30 fps by default)
|
||||||
|
// DisplayLink is the only run loop mode now - all others were removed
|
||||||
|
|
||||||
|
#include "CrashReporter.h"
|
||||||
|
|
||||||
|
#include "UI/OrientationSupport.h"
|
||||||
|
#include "UI/UnityView.h"
|
||||||
|
#include "UI/Keyboard.h"
|
||||||
|
#include "UI/SplashScreen.h"
|
||||||
|
#include "Unity/InternalProfiler.h"
|
||||||
|
#include "Unity/DisplayManager.h"
|
||||||
|
#include "Unity/EAGLContextHelper.h"
|
||||||
|
#include "Unity/GlesHelper.h"
|
||||||
|
#include "Unity/ObjCRuntime.h"
|
||||||
|
#include "PluginBase/AppDelegateListener.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
// we assume that app delegate is never changed and we can cache it, instead of re-query UIApplication every time
|
||||||
|
UnityAppController* _UnityAppController = nil;
|
||||||
|
UnityAppController* GetAppController()
|
||||||
|
{
|
||||||
|
return _UnityAppController;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we keep old bools around to support "old" code that might have used them
|
||||||
|
bool _ios81orNewer = false, _ios82orNewer = false, _ios83orNewer = false, _ios90orNewer = false, _ios91orNewer = false;
|
||||||
|
bool _ios100orNewer = false, _ios101orNewer = false, _ios102orNewer = false, _ios103orNewer = false;
|
||||||
|
bool _ios110orNewer = false, _ios111orNewer = false, _ios112orNewer = false;
|
||||||
|
bool _ios130orNewer = false;
|
||||||
|
|
||||||
|
// was unity rendering already inited: we should not touch rendering while this is false
|
||||||
|
bool _renderingInited = false;
|
||||||
|
// was unity inited: we should not touch unity api while this is false
|
||||||
|
bool _unityAppReady = false;
|
||||||
|
// see if there's a need to do internal player pause/resume handling
|
||||||
|
//
|
||||||
|
// Typically the trampoline code should manage this internally, but
|
||||||
|
// there are use cases, videoplayer, plugin code, etc where the player
|
||||||
|
// is paused before the internal handling comes relevant. Avoid
|
||||||
|
// overriding externally managed player pause/resume handling by
|
||||||
|
// caching the state
|
||||||
|
bool _wasPausedExternal = false;
|
||||||
|
// should we skip present on next draw: used in corner cases (like rotation) to fill both draw-buffers with some content
|
||||||
|
bool _skipPresent = false;
|
||||||
|
// was app "resigned active": some operations do not make sense while app is in background
|
||||||
|
bool _didResignActive = false;
|
||||||
|
|
||||||
|
// was startUnity scheduled: used to make startup robust in case of locking device
|
||||||
|
static bool _startUnityScheduled = false;
|
||||||
|
static bool _displayLinkDestroyed = false;
|
||||||
|
static bool _trampolineShutDown = false;
|
||||||
|
|
||||||
|
bool _supportsMSAA = false;
|
||||||
|
|
||||||
|
@interface UnityAppController() <UIApplicationDelegate>
|
||||||
|
@end
|
||||||
|
|
||||||
|
#if UNITY_SUPPORT_ROTATION
|
||||||
|
// Required to enable specific orientation for some presentation controllers: see supportedInterfaceOrientationsForWindow below for details
|
||||||
|
NSInteger _forceInterfaceOrientationMask = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@implementation UnityAppController
|
||||||
|
|
||||||
|
@synthesize unityView = _unityView;
|
||||||
|
@synthesize unityDisplayLink = _displayLink;
|
||||||
|
|
||||||
|
@synthesize rootView = _rootView;
|
||||||
|
@synthesize rootViewController = _rootController;
|
||||||
|
@synthesize mainDisplay = _mainDisplay;
|
||||||
|
@synthesize renderDelegate = _renderDelegate;
|
||||||
|
@synthesize quitHandler = _quitHandler;
|
||||||
|
|
||||||
|
#if UNITY_SUPPORT_ROTATION
|
||||||
|
@synthesize interfaceOrientation = _curOrientation;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- (id)init
|
||||||
|
{
|
||||||
|
if ((self = _UnityAppController = [super init]))
|
||||||
|
{
|
||||||
|
// due to clang issues with generating warning for overriding deprecated methods
|
||||||
|
// we will simply assert if deprecated methods are present
|
||||||
|
// NB: methods table is initied at load (before this call), so it is ok to check for override
|
||||||
|
NSAssert(![self respondsToSelector: @selector(createUnityViewImpl)],
|
||||||
|
@"createUnityViewImpl is deprecated and will not be called. Override createUnityView"
|
||||||
|
);
|
||||||
|
NSAssert(![self respondsToSelector: @selector(createViewHierarchyImpl)],
|
||||||
|
@"createViewHierarchyImpl is deprecated and will not be called. Override willStartWithViewController"
|
||||||
|
);
|
||||||
|
NSAssert(![self respondsToSelector: @selector(createViewHierarchy)],
|
||||||
|
@"createViewHierarchy is deprecated and will not be implemented. Use createUI"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setWindow:(id)object {}
|
||||||
|
- (UIWindow*)window { return _window; }
|
||||||
|
|
||||||
|
|
||||||
|
- (void)shouldAttachRenderDelegate {}
|
||||||
|
- (void)preStartUnity {}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)startUnity:(UIApplication*)application
|
||||||
|
{
|
||||||
|
NSAssert(_unityAppReady == NO, @"[UnityAppController startUnity:] called after Unity has been initialized");
|
||||||
|
|
||||||
|
UnityInitApplicationGraphics();
|
||||||
|
|
||||||
|
// we make sure that first level gets correct display list and orientation
|
||||||
|
[[DisplayManager Instance] updateDisplayListCacheInUnity];
|
||||||
|
|
||||||
|
UnityLoadApplication();
|
||||||
|
Profiler_InitProfiler();
|
||||||
|
|
||||||
|
[self showGameUI];
|
||||||
|
[self createDisplayLink];
|
||||||
|
|
||||||
|
UnitySetPlayerFocus(1);
|
||||||
|
|
||||||
|
AVAudioSession* audioSession = [AVAudioSession sharedInstance];
|
||||||
|
[audioSession setActive: YES error: nil];
|
||||||
|
[audioSession addObserver: self forKeyPath: @"outputVolume" options: 0 context: nil];
|
||||||
|
UnityUpdateMuteState([audioSession outputVolume] < 0.01f ? 1 : 0);
|
||||||
|
|
||||||
|
#if UNITY_REPLAY_KIT_AVAILABLE
|
||||||
|
void InitUnityReplayKit(); // Classes/Unity/UnityReplayKit.mm
|
||||||
|
|
||||||
|
InitUnityReplayKit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void UnityDestroyDisplayLink()
|
||||||
|
{
|
||||||
|
//[GetAppController() destroyDisplayLink];
|
||||||
|
|
||||||
|
if (!_displayLinkDestroyed)
|
||||||
|
{
|
||||||
|
[GetAppController() destroyDisplayLink];
|
||||||
|
_displayLinkDestroyed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void UnityShutdownTrampoline()
|
||||||
|
{
|
||||||
|
if (!_trampolineShutDown)
|
||||||
|
{
|
||||||
|
if (UnityGetMainWindow().rootViewController == UnityGetGLViewController())
|
||||||
|
UnityGetMainWindow().rootViewController = nil;
|
||||||
|
|
||||||
|
[UnityGetGLView() removeFromSuperview];
|
||||||
|
|
||||||
|
UnityDestroyDisplayLink();
|
||||||
|
_trampolineShutDown = true;
|
||||||
|
_unityAppReady = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void UnityRequestQuit()
|
||||||
|
{
|
||||||
|
_didResignActive = true;
|
||||||
|
if (GetAppController().quitHandler)
|
||||||
|
GetAppController().quitHandler();
|
||||||
|
else
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void SensorsCleanup();
|
||||||
|
extern "C" void UnityCleanupTrampoline()
|
||||||
|
{
|
||||||
|
// Unity view and viewController will not necessary be destroyed right after this function execution.
|
||||||
|
// We need to ensure that these objects will not receive any callbacks from system during that time.
|
||||||
|
[_UnityAppController window].rootViewController = nil;
|
||||||
|
[[_UnityAppController unityView] removeFromSuperview];
|
||||||
|
|
||||||
|
// Prevent multiple cleanups
|
||||||
|
if (_UnityAppController == nil)
|
||||||
|
return;
|
||||||
|
|
||||||
|
[KeyboardDelegate Destroy];
|
||||||
|
|
||||||
|
SensorsCleanup();
|
||||||
|
|
||||||
|
Profiler_UninitProfiler();
|
||||||
|
|
||||||
|
[DisplayManager Destroy];
|
||||||
|
|
||||||
|
UnityDestroyDisplayLink();
|
||||||
|
|
||||||
|
_UnityAppController = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if UNITY_SUPPORT_ROTATION
|
||||||
|
|
||||||
|
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
|
||||||
|
{
|
||||||
|
// No rootViewController is set because we are switching from one view controller to another, all orientations should be enabled
|
||||||
|
if ([window rootViewController] == nil)
|
||||||
|
return UIInterfaceOrientationMaskAll;
|
||||||
|
|
||||||
|
// During splash screen show phase no forced orientations should be allowed.
|
||||||
|
// This will prevent unwanted rotation while splash screen is on and application is not yet ready to present (Ex. Fogbugz cases: 1190428, 1269547).
|
||||||
|
if (!_unityAppReady)
|
||||||
|
return [_rootController supportedInterfaceOrientations];
|
||||||
|
|
||||||
|
// Some presentation controllers (e.g. UIImagePickerController) require portrait orientation and will throw exception if it is not supported.
|
||||||
|
// At the same time enabling all orientations by returning UIInterfaceOrientationMaskAll might cause unwanted orientation change
|
||||||
|
// (e.g. when using UIActivityViewController to "share to" another application, iOS will use supportedInterfaceOrientations to possibly reorient).
|
||||||
|
// So to avoid exception we are returning combination of constraints for root view controller and orientation requested by iOS.
|
||||||
|
// _forceInterfaceOrientationMask is updated in willChangeStatusBarOrientation, which is called if some presentation controller insists on orientation change.
|
||||||
|
return [[window rootViewController] supportedInterfaceOrientations] | _forceInterfaceOrientationMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)application:(UIApplication*)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration
|
||||||
|
{
|
||||||
|
// Setting orientation mask which is requested by iOS: see supportedInterfaceOrientationsForWindow above for details
|
||||||
|
_forceInterfaceOrientationMask = 1 << newStatusBarOrientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !PLATFORM_TVOS
|
||||||
|
- (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityDidReceiveLocalNotification, notification);
|
||||||
|
UnitySendLocalNotification(notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_USES_REMOTE_NOTIFICATIONS
|
||||||
|
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityDidReceiveRemoteNotification, userInfo);
|
||||||
|
UnitySendRemoteNotification(userInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityDidRegisterForRemoteNotificationsWithDeviceToken, deviceToken);
|
||||||
|
UnitySendDeviceToken(deviceToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !PLATFORM_TVOS
|
||||||
|
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityDidReceiveRemoteNotification, userInfo);
|
||||||
|
UnitySendRemoteNotification(userInfo);
|
||||||
|
if (handler)
|
||||||
|
{
|
||||||
|
handler(UIBackgroundFetchResultNoData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityDidFailToRegisterForRemoteNotificationsWithError, error);
|
||||||
|
UnitySendRemoteNotificationError(error);
|
||||||
|
// alas people do not check remote notification error through api (which is clunky, i agree) so log here to have at least some visibility
|
||||||
|
::printf("\nFailed to register for remote notifications:\n%s\n\n", [[error localizedDescription] UTF8String]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// UIApplicationOpenURLOptionsKey was added only in ios10 sdk, while we still support ios9 sdk
|
||||||
|
- (BOOL)application:(UIApplication*)app openURL:(NSURL*)url options:(NSDictionary<NSString*, id>*)options
|
||||||
|
{
|
||||||
|
id sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey], annotation = options[UIApplicationOpenURLOptionsAnnotationKey];
|
||||||
|
|
||||||
|
NSMutableDictionary<NSString*, id>* notifData = [NSMutableDictionary dictionaryWithCapacity: 3];
|
||||||
|
if (url)
|
||||||
|
{
|
||||||
|
notifData[@"url"] = url;
|
||||||
|
UnitySetAbsoluteURL(url.absoluteString.UTF8String);
|
||||||
|
}
|
||||||
|
if (sourceApplication) notifData[@"sourceApplication"] = sourceApplication;
|
||||||
|
if (annotation) notifData[@"annotation"] = annotation;
|
||||||
|
|
||||||
|
AppController_SendNotificationWithArg(kUnityOnOpenURL, notifData);
|
||||||
|
NSString* urlString = [url absoluteString];
|
||||||
|
if ([urlString hasPrefix:[WXAppDelegate getAppId]])
|
||||||
|
{
|
||||||
|
return [WXApi handleOpenURL:url delegate:[[WXAppDelegate alloc]init]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
|
||||||
|
#if defined(__IPHONE_12_0) || defined(__TVOS_12_0)
|
||||||
|
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring> > * _Nullable restorableObjects))restorationHandler
|
||||||
|
#else
|
||||||
|
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
NSURL* url = userActivity.webpageURL;
|
||||||
|
if (url)
|
||||||
|
UnitySetAbsoluteURL(url.absoluteString.UTF8String);
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication*)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptions
|
||||||
|
{
|
||||||
|
AppController_SendNotificationWithArg(kUnityWillFinishLaunchingWithOptions, launchOptions);
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
|
||||||
|
{
|
||||||
|
::printf("-> applicationDidFinishLaunching()\n");
|
||||||
|
|
||||||
|
// send notfications
|
||||||
|
#if !PLATFORM_TVOS
|
||||||
|
if (UILocalNotification* notification = [launchOptions objectForKey: UIApplicationLaunchOptionsLocalNotificationKey])
|
||||||
|
UnitySendLocalNotification(notification);
|
||||||
|
|
||||||
|
if ([UIDevice currentDevice].generatesDeviceOrientationNotifications == NO)
|
||||||
|
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UnityInitApplicationNoGraphics(UnityDataBundleDir());
|
||||||
|
|
||||||
|
[self selectRenderingAPI];
|
||||||
|
[UnityRenderingView InitializeForAPI: self.renderingAPI];
|
||||||
|
|
||||||
|
_window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds];
|
||||||
|
_unityView = [self createUnityView];
|
||||||
|
|
||||||
|
[DisplayManager Initialize];
|
||||||
|
_mainDisplay = [DisplayManager Instance].mainDisplay;
|
||||||
|
[_mainDisplay createWithWindow: _window andView: _unityView];
|
||||||
|
|
||||||
|
[self createUI];
|
||||||
|
[self preStartUnity];
|
||||||
|
|
||||||
|
// if you wont use keyboard you may comment it out at save some memory
|
||||||
|
[KeyboardDelegate Initialize];
|
||||||
|
if(![WXApi registerApp:[WXAppDelegate getAppId]])
|
||||||
|
NSLog(@"wechat register fail");
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey, id> *)change context:(void *)context
|
||||||
|
{
|
||||||
|
if ([keyPath isEqual: @"outputVolume"])
|
||||||
|
{
|
||||||
|
UnityUpdateMuteState([[AVAudioSession sharedInstance] outputVolume] < 0.01f ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidEnterBackground:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("-> applicationDidEnterBackground()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillEnterForeground:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("-> applicationWillEnterForeground()\n");
|
||||||
|
|
||||||
|
// applicationWillEnterForeground: might sometimes arrive *before* actually initing unity (e.g. locking on startup)
|
||||||
|
if (_unityAppReady)
|
||||||
|
{
|
||||||
|
// if we were showing video before going to background - the view size may be changed while we are in background
|
||||||
|
[GetAppController().unityView recreateRenderingSurfaceIfNeeded];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidBecomeActive:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("-> applicationDidBecomeActive()\n");
|
||||||
|
|
||||||
|
[self removeSnapshotViewController];
|
||||||
|
|
||||||
|
if (_unityAppReady)
|
||||||
|
{
|
||||||
|
if (UnityIsPaused() && _wasPausedExternal == false)
|
||||||
|
{
|
||||||
|
UnityWillResume();
|
||||||
|
UnityPause(0);
|
||||||
|
}
|
||||||
|
if (_wasPausedExternal)
|
||||||
|
{
|
||||||
|
if (UnityIsFullScreenPlaying())
|
||||||
|
TryResumeFullScreenVideo();
|
||||||
|
}
|
||||||
|
// need to do this with delay because FMOD restarts audio in AVAudioSessionInterruptionNotification handler
|
||||||
|
[self performSelector: @selector(updateUnityAudioOutput) withObject: nil afterDelay: 0.1];
|
||||||
|
UnitySetPlayerFocus(1);
|
||||||
|
}
|
||||||
|
else if (!_startUnityScheduled)
|
||||||
|
{
|
||||||
|
_startUnityScheduled = true;
|
||||||
|
[self performSelector: @selector(startUnity:) withObject: application afterDelay: 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
_didResignActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateUnityAudioOutput
|
||||||
|
{
|
||||||
|
UnityUpdateAudioOutputState();
|
||||||
|
UnityUpdateMuteState([[AVAudioSession sharedInstance] outputVolume] < 0.01f ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addSnapshotViewController
|
||||||
|
{
|
||||||
|
// This is done on the next frame so that
|
||||||
|
// in the case where unity is paused while going
|
||||||
|
// into the background and an input is deactivated
|
||||||
|
// we don't mess with the view hierarchy while taking
|
||||||
|
// a view snapshot (case 760747).
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
// if we are active again, we don't need to do this anymore
|
||||||
|
if (!_didResignActive || _snapshotViewController)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIView* snapshotView = [self createSnapshotView];
|
||||||
|
|
||||||
|
if (snapshotView != nil)
|
||||||
|
{
|
||||||
|
_snapshotViewController = [[UIViewController alloc] init];
|
||||||
|
_snapshotViewController.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||||
|
_snapshotViewController.view = snapshotView;
|
||||||
|
|
||||||
|
[_rootController presentViewController: _snapshotViewController animated: false completion: nil];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)removeSnapshotViewController
|
||||||
|
{
|
||||||
|
// do this on the main queue async so that if we try to create one
|
||||||
|
// and remove in the same frame, this always happens after in the same queue
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
if (_snapshotViewController)
|
||||||
|
{
|
||||||
|
// we've got a view on top of the snapshot view (3rd party plugin/social media login etc).
|
||||||
|
if (_snapshotViewController.presentedViewController)
|
||||||
|
{
|
||||||
|
[self performSelector: @selector(removeSnapshotViewController) withObject: nil afterDelay: 0.05];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[_snapshotViewController dismissViewControllerAnimated: NO completion: nil];
|
||||||
|
_snapshotViewController = nil;
|
||||||
|
|
||||||
|
// Make sure that the keyboard input field regains focus after the application becomes active.
|
||||||
|
[[KeyboardDelegate Instance] becomeFirstResponder];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillResignActive:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("-> applicationWillResignActive()\n");
|
||||||
|
|
||||||
|
if (_unityAppReady)
|
||||||
|
{
|
||||||
|
UnitySetPlayerFocus(0);
|
||||||
|
|
||||||
|
_wasPausedExternal = UnityIsPaused();
|
||||||
|
if (_wasPausedExternal == false)
|
||||||
|
{
|
||||||
|
// Pause Unity only if we don't need special background processing
|
||||||
|
// otherwise batched player loop can be called to run user scripts.
|
||||||
|
if (!UnityGetUseCustomAppBackgroundBehavior())
|
||||||
|
{
|
||||||
|
// Force player to do one more frame, so scripts get a chance to render custom screen for minimized app in task manager.
|
||||||
|
// NB: UnityWillPause will schedule OnApplicationPause message, which will be sent normally inside repaint (unity player loop)
|
||||||
|
// NB: We will actually pause after the loop (when calling UnityPause).
|
||||||
|
UnityWillPause();
|
||||||
|
[self repaint];
|
||||||
|
UnityPause(1);
|
||||||
|
|
||||||
|
[self addSnapshotViewController];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_didResignActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("WARNING -> applicationDidReceiveMemoryWarning()\n");
|
||||||
|
UnityLowMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)applicationWillTerminate:(UIApplication*)application
|
||||||
|
{
|
||||||
|
::printf("-> applicationWillTerminate()\n");
|
||||||
|
|
||||||
|
// Only clean up if Unity has finished initializing, else the clean up process will crash,
|
||||||
|
// this happens if the app is force closed immediately after opening it.
|
||||||
|
if (_unityAppReady)
|
||||||
|
{
|
||||||
|
UnityCleanup();
|
||||||
|
UnityCleanupTrampoline();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)application:(UIApplication*)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)())completionHandler
|
||||||
|
{
|
||||||
|
NSDictionary* arg = @{identifier: completionHandler};
|
||||||
|
AppController_SendNotificationWithArg(kUnityHandleEventsForBackgroundURLSession, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
void AppController_SendNotification(NSString* name)
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName: name object: GetAppController()];
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppController_SendNotificationWithArg(NSString* name, id arg)
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName: name object: GetAppController() userInfo: arg];
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppController_SendUnityViewControllerNotification(NSString* name)
|
||||||
|
{
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName: name object: UnityGetGLViewController()];
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" UIWindow* UnityGetMainWindow()
|
||||||
|
{
|
||||||
|
return GetAppController().mainDisplay.window;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" UIViewController* UnityGetGLViewController()
|
||||||
|
{
|
||||||
|
return GetAppController().rootViewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" UIView* UnityGetGLView()
|
||||||
|
{
|
||||||
|
return GetAppController().unityView;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" ScreenOrientation UnityCurrentOrientation() { return GetAppController().unityView.contentOrientation; }
|
||||||
|
|
||||||
|
|
||||||
|
bool LogToNSLogHandler(LogType logType, const char* log, va_list list)
|
||||||
|
{
|
||||||
|
NSLogv([NSString stringWithUTF8String: log], list);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AddNewAPIImplIfNeeded();
|
||||||
|
|
||||||
|
// From https://stackoverflow.com/questions/4744826/detecting-if-ios-app-is-run-in-debugger
|
||||||
|
static bool isDebuggerAttachedToConsole(void)
|
||||||
|
// Returns true if the current process is being debugged (either
|
||||||
|
// running under the debugger or has a debugger attached post facto).
|
||||||
|
{
|
||||||
|
int junk;
|
||||||
|
int mib[4];
|
||||||
|
struct kinfo_proc info;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
// Initialize the flags so that, if sysctl fails for some bizarre
|
||||||
|
// reason, we get a predictable result.
|
||||||
|
|
||||||
|
info.kp_proc.p_flag = 0;
|
||||||
|
|
||||||
|
// Initialize mib, which tells sysctl the info we want, in this case
|
||||||
|
// we're looking for information about a specific process ID.
|
||||||
|
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_PROC;
|
||||||
|
mib[2] = KERN_PROC_PID;
|
||||||
|
mib[3] = getpid();
|
||||||
|
|
||||||
|
// Call sysctl.
|
||||||
|
|
||||||
|
size = sizeof(info);
|
||||||
|
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
|
||||||
|
assert(junk == 0);
|
||||||
|
|
||||||
|
// We're being debugged if the P_TRACED flag is set.
|
||||||
|
|
||||||
|
return ((info.kp_proc.p_flag & P_TRACED) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnityInitTrampoline()
|
||||||
|
{
|
||||||
|
InitCrashHandling();
|
||||||
|
|
||||||
|
NSString* version = [[UIDevice currentDevice] systemVersion];
|
||||||
|
#define CHECK_VER(s) [version compare: s options: NSNumericSearch] != NSOrderedAscending
|
||||||
|
_ios81orNewer = CHECK_VER(@"8.1"), _ios82orNewer = CHECK_VER(@"8.2"), _ios83orNewer = CHECK_VER(@"8.3");
|
||||||
|
_ios90orNewer = CHECK_VER(@"9.0"), _ios91orNewer = CHECK_VER(@"9.1");
|
||||||
|
_ios100orNewer = CHECK_VER(@"10.0"), _ios101orNewer = CHECK_VER(@"10.1"), _ios102orNewer = CHECK_VER(@"10.2"), _ios103orNewer = CHECK_VER(@"10.3");
|
||||||
|
_ios110orNewer = CHECK_VER(@"11.0"), _ios111orNewer = CHECK_VER(@"11.1"), _ios112orNewer = CHECK_VER(@"11.2");
|
||||||
|
_ios130orNewer = CHECK_VER(@"13.0");
|
||||||
|
|
||||||
|
#undef CHECK_VER
|
||||||
|
|
||||||
|
AddNewAPIImplIfNeeded();
|
||||||
|
|
||||||
|
#if !TARGET_IPHONE_SIMULATOR
|
||||||
|
// Use NSLog logging if a debugger is not attached, otherwise we write to stdout.
|
||||||
|
if (!isDebuggerAttachedToConsole())
|
||||||
|
UnitySetLogEntryHandler(LogToNSLogHandler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" bool UnityiOS81orNewer() { return _ios81orNewer; }
|
||||||
|
extern "C" bool UnityiOS82orNewer() { return _ios82orNewer; }
|
||||||
|
extern "C" bool UnityiOS90orNewer() { return _ios90orNewer; }
|
||||||
|
extern "C" bool UnityiOS91orNewer() { return _ios91orNewer; }
|
||||||
|
extern "C" bool UnityiOS100orNewer() { return _ios100orNewer; }
|
||||||
|
extern "C" bool UnityiOS101orNewer() { return _ios101orNewer; }
|
||||||
|
extern "C" bool UnityiOS102orNewer() { return _ios102orNewer; }
|
||||||
|
extern "C" bool UnityiOS103orNewer() { return _ios103orNewer; }
|
||||||
|
extern "C" bool UnityiOS110orNewer() { return _ios110orNewer; }
|
||||||
|
extern "C" bool UnityiOS111orNewer() { return _ios111orNewer; }
|
||||||
|
extern "C" bool UnityiOS112orNewer() { return _ios112orNewer; }
|
||||||
|
extern "C" bool UnityiOS130orNewer() { return _ios130orNewer; }
|
||||||
|
|
||||||
|
// sometimes apple adds new api with obvious fallback on older ios.
|
||||||
|
// in that case we simply add these functions ourselves to simplify code
|
||||||
|
static void AddNewAPIImplIfNeeded()
|
||||||
|
{
|
||||||
|
if (![[UIScreen class] instancesRespondToSelector: @selector(maximumFramesPerSecond)])
|
||||||
|
{
|
||||||
|
IMP UIScreen_MaximumFramesPerSecond_IMP = imp_implementationWithBlock(^NSInteger(id _self) {
|
||||||
|
return 60;
|
||||||
|
});
|
||||||
|
class_replaceMethod([UIScreen class], @selector(maximumFramesPerSecond), UIScreen_MaximumFramesPerSecond_IMP, UIScreen_maximumFramesPerSecond_Enc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![[UIView class] instancesRespondToSelector: @selector(safeAreaInsets)])
|
||||||
|
{
|
||||||
|
IMP UIView_SafeAreaInsets_IMP = imp_implementationWithBlock(^UIEdgeInsets(id _self) {
|
||||||
|
return UIEdgeInsetsZero;
|
||||||
|
});
|
||||||
|
class_replaceMethod([UIView class], @selector(safeAreaInsets), UIView_SafeAreaInsets_IMP, UIView_safeAreaInsets_Enc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
void ShareLink(int id, const char* str, const char* func)
|
||||||
|
{
|
||||||
|
[UnityAction share:id :str :func];
|
||||||
|
}
|
||||||
|
bool GetIosTest()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void WXLogin()
|
||||||
|
{
|
||||||
|
[UnityAction login];
|
||||||
|
}
|
||||||
|
int GetWIFISignalStrength(){
|
||||||
|
return [UnityAction GetWIFISignalStrength];
|
||||||
|
}
|
||||||
|
int GetTeleSignalStrength(){
|
||||||
|
return [UnityAction GetTeleSignalStrength];
|
||||||
|
}
|
||||||
|
int __GetSignalStrength(){
|
||||||
|
return [UnityAction __GetSignalStrength];
|
||||||
|
}
|
||||||
|
|
||||||
|
float GetBatteryLevel()
|
||||||
|
{
|
||||||
|
return [UnityAction GetBatteryLevel];
|
||||||
|
}
|
||||||
|
BOOL _ifChargingBattery(){
|
||||||
|
return [UnityAction _ifChargingBattery];
|
||||||
|
}
|
||||||
|
void CopyToClipboard(const char *textList)
|
||||||
|
{
|
||||||
|
[UnityAction CopyToClipboard:textList];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ded2253e04004b30b0d11a8345d5ce8
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 1
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,273 @@
|
||||||
|
#if UNITY_IOS
|
||||||
|
|
||||||
|
#include "UnityViewControllerBaseiOS.h"
|
||||||
|
#include "OrientationSupport.h"
|
||||||
|
#include "Keyboard.h"
|
||||||
|
#include "UnityView.h"
|
||||||
|
#include "PluginBase/UnityViewControllerListener.h"
|
||||||
|
#include "UnityAppController.h"
|
||||||
|
#include "UnityAppController+ViewHandling.h"
|
||||||
|
#include "Unity/ObjCRuntime.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
typedef id (*WillRotateToInterfaceOrientationSendFunc)(struct objc_super*, SEL, UIInterfaceOrientation, NSTimeInterval);
|
||||||
|
static void WillRotateToInterfaceOrientation_DefaultImpl(id self_, SEL _cmd, UIInterfaceOrientation toInterfaceOrientation, NSTimeInterval duration);
|
||||||
|
|
||||||
|
typedef id (*DidRotateFromInterfaceOrientationSendFunc)(struct objc_super*, SEL, UIInterfaceOrientation);
|
||||||
|
static void DidRotateFromInterfaceOrientation_DefaultImpl(id self_, SEL _cmd, UIInterfaceOrientation fromInterfaceOrientation);
|
||||||
|
|
||||||
|
typedef id (*ViewWillTransitionToSizeSendFunc)(struct objc_super*, SEL, CGSize, id<UIViewControllerTransitionCoordinator>);
|
||||||
|
static void ViewWillTransitionToSize_DefaultImpl(id self_, SEL _cmd, CGSize size, id<UIViewControllerTransitionCoordinator> coordinator);
|
||||||
|
|
||||||
|
|
||||||
|
// when returning from presenting UIViewController we might need to update app orientation to "correct" one, as we wont get rotation notification
|
||||||
|
@interface UnityAppController ()
|
||||||
|
- (void)updateAppOrientation:(UIInterfaceOrientation)orientation;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation UnityViewControllerBase
|
||||||
|
|
||||||
|
- (id)init
|
||||||
|
{
|
||||||
|
if ((self = [super init]))
|
||||||
|
AddViewControllerDefaultRotationHandling([UnityViewControllerBase class]);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
|
||||||
|
{
|
||||||
|
return UIRectEdgeBottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)shouldAutorotate
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)prefersStatusBarHidden
|
||||||
|
{
|
||||||
|
static bool _PrefersStatusBarHidden = true;
|
||||||
|
|
||||||
|
static bool _PrefersStatusBarHiddenInited = false;
|
||||||
|
if (!_PrefersStatusBarHiddenInited)
|
||||||
|
{
|
||||||
|
NSNumber* hidden = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UIStatusBarHidden"];
|
||||||
|
_PrefersStatusBarHidden = hidden ? [hidden boolValue] : YES;
|
||||||
|
|
||||||
|
_PrefersStatusBarHiddenInited = true;
|
||||||
|
}
|
||||||
|
return _PrefersStatusBarHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||||
|
{
|
||||||
|
static UIStatusBarStyle _PreferredStatusBarStyle = UIStatusBarStyleDefault;
|
||||||
|
|
||||||
|
static bool _PreferredStatusBarStyleInited = false;
|
||||||
|
if (!_PreferredStatusBarStyleInited)
|
||||||
|
{
|
||||||
|
NSString* style = [[[NSBundle mainBundle] infoDictionary] objectForKey: @"UIStatusBarStyle"];
|
||||||
|
if (style && ([style isEqualToString: @"UIStatusBarStyleBlackOpaque"] || [style isEqualToString: @"UIStatusBarStyleBlackTranslucent"]))
|
||||||
|
_PreferredStatusBarStyle = UIStatusBarStyleLightContent;
|
||||||
|
|
||||||
|
_PreferredStatusBarStyleInited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _PreferredStatusBarStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidLayoutSubviews
|
||||||
|
{
|
||||||
|
[super viewDidLayoutSubviews];
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityViewDidLayoutSubviews);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidDisappear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewDidDisappear: animated];
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityViewDidDisappear);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillDisappear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewWillDisappear: animated];
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityViewWillDisappear);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewDidAppear: animated];
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityViewDidAppear);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[super viewWillAppear: animated];
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityViewWillAppear);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation UnityDefaultViewController
|
||||||
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
|
{
|
||||||
|
NSAssert(UnityShouldAutorotate(), @"UnityDefaultViewController should be used only if unity is set to autorotate");
|
||||||
|
|
||||||
|
NSUInteger ret = 0;
|
||||||
|
|
||||||
|
if (UnityIsOrientationEnabled(portrait))
|
||||||
|
ret |= (1 << UIInterfaceOrientationPortrait);
|
||||||
|
if (UnityIsOrientationEnabled(portraitUpsideDown))
|
||||||
|
ret |= (1 << UIInterfaceOrientationPortraitUpsideDown);
|
||||||
|
if (UnityIsOrientationEnabled(landscapeLeft))
|
||||||
|
ret |= (1 << UIInterfaceOrientationLandscapeRight);
|
||||||
|
if (UnityIsOrientationEnabled(landscapeRight))
|
||||||
|
ret |= (1 << UIInterfaceOrientationLandscapeLeft);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation UnityPortraitOnlyViewController
|
||||||
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
|
{
|
||||||
|
return 1 << UIInterfaceOrientationPortrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[GetAppController() updateAppOrientation: UIInterfaceOrientationPortrait];
|
||||||
|
[super viewWillAppear: animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
@implementation UnityPortraitUpsideDownOnlyViewController
|
||||||
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
|
{
|
||||||
|
return 1 << UIInterfaceOrientationPortraitUpsideDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[GetAppController() updateAppOrientation: UIInterfaceOrientationPortraitUpsideDown];
|
||||||
|
[super viewWillAppear: animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
@implementation UnityLandscapeLeftOnlyViewController
|
||||||
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
|
{
|
||||||
|
return 1 << UIInterfaceOrientationLandscapeLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[GetAppController() updateAppOrientation: UIInterfaceOrientationLandscapeLeft];
|
||||||
|
[super viewWillAppear: animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
@implementation UnityLandscapeRightOnlyViewController
|
||||||
|
- (NSUInteger)supportedInterfaceOrientations
|
||||||
|
{
|
||||||
|
return 1 << UIInterfaceOrientationLandscapeRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated
|
||||||
|
{
|
||||||
|
[GetAppController() updateAppOrientation: UIInterfaceOrientationLandscapeRight];
|
||||||
|
[super viewWillAppear: animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
extern "C" void UnityNotifyAutoOrientationChange()
|
||||||
|
{
|
||||||
|
[UIViewController attemptRotationToDeviceOrientation];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ios8 changed the way ViewController should handle rotation, so pick correct implementation at runtime
|
||||||
|
//
|
||||||
|
|
||||||
|
static void WillRotateToInterfaceOrientation_DefaultImpl(id self_, SEL _cmd, UIInterfaceOrientation toInterfaceOrientation, NSTimeInterval duration)
|
||||||
|
{
|
||||||
|
[UIView setAnimationsEnabled: UnityUseAnimatedAutorotation() ? YES : NO];
|
||||||
|
[GetAppController() interfaceWillChangeOrientationTo: toInterfaceOrientation];
|
||||||
|
|
||||||
|
[KeyboardDelegate StartReorientation];
|
||||||
|
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityInterfaceWillChangeOrientation);
|
||||||
|
UNITY_OBJC_FORWARD_TO_SUPER(self_, [UIViewController class], @selector(willRotateToInterfaceOrientation:duration:), WillRotateToInterfaceOrientationSendFunc, toInterfaceOrientation, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DidRotateFromInterfaceOrientation_DefaultImpl(id self_, SEL _cmd, UIInterfaceOrientation fromInterfaceOrientation)
|
||||||
|
{
|
||||||
|
UIViewController* self = (UIViewController*)self_;
|
||||||
|
|
||||||
|
[self.view layoutSubviews];
|
||||||
|
[GetAppController() interfaceDidChangeOrientationFrom: fromInterfaceOrientation];
|
||||||
|
|
||||||
|
[KeyboardDelegate FinishReorientation];
|
||||||
|
[UIView setAnimationsEnabled: YES];
|
||||||
|
|
||||||
|
AppController_SendUnityViewControllerNotification(kUnityInterfaceDidChangeOrientation);
|
||||||
|
UNITY_OBJC_FORWARD_TO_SUPER(self_, [UIViewController class], @selector(didRotateFromInterfaceOrientation:), DidRotateFromInterfaceOrientationSendFunc, fromInterfaceOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ViewWillTransitionToSize_DefaultImpl(id self_, SEL _cmd, CGSize size, id<UIViewControllerTransitionCoordinator> coordinator)
|
||||||
|
{
|
||||||
|
UIViewController* self = (UIViewController*)self_;
|
||||||
|
|
||||||
|
ScreenOrientation curOrient = ConvertToUnityScreenOrientation(self.interfaceOrientation);
|
||||||
|
ScreenOrientation newOrient = OrientationAfterTransform(curOrient, [coordinator targetTransform]);
|
||||||
|
|
||||||
|
// in case of presentation controller it will take control over orientations
|
||||||
|
// so to avoid crazy-ass corner cases, make default view controller to ignore "wrong" orientations
|
||||||
|
// as they will come only in case of presentation view controller and will be reverted anyway
|
||||||
|
// NB: we still want to pass message to super, we just want to skip unity-specific magic
|
||||||
|
NSUInteger targetMask = 1 << ConvertToIosScreenOrientation(newOrient);
|
||||||
|
if (([self supportedInterfaceOrientations] & targetMask) != 0)
|
||||||
|
{
|
||||||
|
[UIView setAnimationsEnabled: UnityUseAnimatedAutorotation() ? YES : NO];
|
||||||
|
[KeyboardDelegate StartReorientation];
|
||||||
|
|
||||||
|
[GetAppController() interfaceWillChangeOrientationTo: ConvertToIosScreenOrientation(newOrient)];
|
||||||
|
|
||||||
|
[coordinator animateAlongsideTransition: nil completion:^(id < UIViewControllerTransitionCoordinatorContext > context) {
|
||||||
|
[self.view setNeedsLayout];
|
||||||
|
[GetAppController() interfaceDidChangeOrientationFrom: ConvertToIosScreenOrientation(curOrient)];
|
||||||
|
|
||||||
|
[KeyboardDelegate FinishReorientation];
|
||||||
|
[UIView setAnimationsEnabled: YES];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
UNITY_OBJC_FORWARD_TO_SUPER(self_, [UIViewController class], @selector(viewWillTransitionToSize:withTransitionCoordinator:), ViewWillTransitionToSizeSendFunc, size, coordinator);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void AddViewControllerRotationHandling(Class class_, IMP willRotateToInterfaceOrientation, IMP didRotateFromInterfaceOrientation, IMP viewWillTransitionToSize)
|
||||||
|
{
|
||||||
|
if (_ios80orNewer && viewWillTransitionToSize)
|
||||||
|
{
|
||||||
|
ObjCSetKnownInstanceMethod(class_, @selector(viewWillTransitionToSize:withTransitionCoordinator:), viewWillTransitionToSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ObjCSetKnownInstanceMethod(class_, @selector(willRotateToInterfaceOrientation:duration:), willRotateToInterfaceOrientation);
|
||||||
|
ObjCSetKnownInstanceMethod(class_, @selector(didRotateFromInterfaceOrientation:), didRotateFromInterfaceOrientation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void AddViewControllerDefaultRotationHandling(Class class_)
|
||||||
|
{
|
||||||
|
AddViewControllerRotationHandling(
|
||||||
|
class_,
|
||||||
|
(IMP)&WillRotateToInterfaceOrientation_DefaultImpl, (IMP)&DidRotateFromInterfaceOrientation_DefaultImpl,
|
||||||
|
(IMP)&ViewWillTransitionToSize_DefaultImpl
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // UNITY_IOS
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c2f94cbe16de3e546a9831ae3969f033
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 1
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// WXAppDelegate.h
|
||||||
|
// Unity-iPhone
|
||||||
|
//
|
||||||
|
// Created by qyq on 2018/1/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "WXApi.h"
|
||||||
|
|
||||||
|
@interface WXAppDelegate : NSObject <WXApiDelegate>
|
||||||
|
|
||||||
|
+(NSString*)getAppId;
|
||||||
|
+(void)share:(NSDictionary*)dic;
|
||||||
|
+(void)login;
|
||||||
|
+(bool)checkApp;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21a8a82fcdb67d249b186351951f292d
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude WebGL: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude WindowsStoreApps: 1
|
||||||
|
Exclude iOS: 0
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Windows Store Apps: WindowsStoreApps
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DontProcess: False
|
||||||
|
PlaceholderPath:
|
||||||
|
SDK: AnySDK
|
||||||
|
ScriptingBackend: AnyScriptingBackend
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
//
|
||||||
|
// WXAppDelegate.m
|
||||||
|
// Unity-iPhone
|
||||||
|
//
|
||||||
|
// Created by qyq on 2018/1/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "WXAppDelegate.h"
|
||||||
|
|
||||||
|
@interface WXAppDelegate() <WXApiDelegate>
|
||||||
|
@end
|
||||||
|
|
||||||
|
static NSString* const AppId = @"wx11904574ece35867";
|
||||||
|
|
||||||
|
@implementation WXAppDelegate
|
||||||
|
|
||||||
|
-(void) onResp:(BaseResp*)resp
|
||||||
|
{
|
||||||
|
if([resp isKindOfClass:[SendMessageToWXResp class]])
|
||||||
|
{//分享
|
||||||
|
if (resp.errCode == 0)
|
||||||
|
{
|
||||||
|
UnitySendMessage("Core","OnShareAction","");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if([resp isKindOfClass:[SendAuthResp class]])
|
||||||
|
{//登录
|
||||||
|
[self getWeiXinCodeFinishedWithResp:resp];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- (void)getWeiXinCodeFinishedWithResp:(BaseResp *)resp
|
||||||
|
{
|
||||||
|
if (resp.errCode == 0)
|
||||||
|
{
|
||||||
|
SendAuthResp *aresp = (SendAuthResp *)resp;
|
||||||
|
const char*code=[aresp.code UTF8String];
|
||||||
|
UnitySendMessage("Core", "WXGetToken", code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSString*)getAppId
|
||||||
|
{
|
||||||
|
return AppId;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void) share:(NSDictionary*)dic
|
||||||
|
{
|
||||||
|
if (![WXAppDelegate checkApp])
|
||||||
|
return;
|
||||||
|
|
||||||
|
NSDictionary* mediaObject = [dic objectForKey:@"mediaObject"];
|
||||||
|
NSString* info = [dic objectForKey:@"description"];
|
||||||
|
int scene = [[dic objectForKey:@"scene"] intValue];
|
||||||
|
NSString* title = [dic objectForKey:@"title"];
|
||||||
|
NSNumber* type = [mediaObject objectForKey:@"type"];
|
||||||
|
NSString* url = [mediaObject objectForKey:@"url"];
|
||||||
|
NSString* picUrl = @"";
|
||||||
|
NSString* thumbUrl = @"";
|
||||||
|
WXMediaMessage *message = [WXMediaMessage message];
|
||||||
|
if ([type isEqual:@0])
|
||||||
|
{
|
||||||
|
message.title = title;
|
||||||
|
message.description = info;
|
||||||
|
WXWebpageObject *ext = [WXWebpageObject object];
|
||||||
|
[message setThumbImage:[UIImage imageNamed:@"AppIcon57x57"]];
|
||||||
|
ext.webpageUrl =url;
|
||||||
|
message.mediaObject = ext;
|
||||||
|
}
|
||||||
|
else if([type isEqual:@1])
|
||||||
|
{
|
||||||
|
NSArray *filePaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
|
picUrl = [[[[filePaths objectAtIndex:0] stringByAppendingString:@"/"] stringByAppendingString:[mediaObject objectForKey:@"filename"]] stringByAppendingString:@".jpg"];
|
||||||
|
thumbUrl = [picUrl stringByReplacingOccurrencesOfString:@".jpg" withString:@"_thumb.jpg"];
|
||||||
|
UIImage* pic = [UIImage imageWithContentsOfFile:picUrl];
|
||||||
|
UIImage* thumb = [UIImage imageWithContentsOfFile:thumbUrl];
|
||||||
|
|
||||||
|
[message setThumbImage:thumb];
|
||||||
|
WXImageObject *imageObject = [WXImageObject object];
|
||||||
|
imageObject.imageData = UIImageJPEGRepresentation(pic, 1.0);
|
||||||
|
message.mediaObject = imageObject;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
NSLog(@"invalid type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SendMessageToWXReq* req = [[SendMessageToWXReq alloc] init];
|
||||||
|
req.bText = NO;
|
||||||
|
req.message = message;
|
||||||
|
req.scene = scene;
|
||||||
|
if(![WXApi sendReq:req])
|
||||||
|
NSLog(@"share picture failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
+(void)login
|
||||||
|
{
|
||||||
|
if (![WXAppDelegate checkApp])
|
||||||
|
return;
|
||||||
|
|
||||||
|
//发送登录请求
|
||||||
|
SendAuthReq* req = [[SendAuthReq alloc] init];
|
||||||
|
req.scope = @"snsapi_userinfo";
|
||||||
|
req.state = @"51qp_test";
|
||||||
|
[WXApi sendReq:req];
|
||||||
|
}
|
||||||
|
|
||||||
|
+(bool) checkApp
|
||||||
|
{
|
||||||
|
if(![WXApi isWXAppInstalled]){
|
||||||
|
NSString* str_url = [WXApi getWXAppInstallUrl];
|
||||||
|
NSURL* url = [NSURL URLWithString:str_url];
|
||||||
|
[[UIApplication sharedApplication] openURL:url];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(![WXApi isWXAppSupportApi]){
|
||||||
|
NSLog(@"WX app isn't support api;");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4234fba6fab0a674db2d055d53eacb40
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude WebGL: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude WindowsStoreApps: 1
|
||||||
|
Exclude iOS: 0
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Windows Store Apps: WindowsStoreApps
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DontProcess: False
|
||||||
|
PlaceholderPath:
|
||||||
|
SDK: AnySDK
|
||||||
|
ScriptingBackend: AnyScriptingBackend
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5ce1390d5836dca468469083ff2610a6
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1493208866
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 75b10080bdc104b83beb6663fc9985fb
|
||||||
|
folderAsset: yes
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
: Linux
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: x86
|
||||||
|
- first:
|
||||||
|
: OSXIntel
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
: OSXIntel64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Android: Android
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: ARMv7
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
Exclude Android: 1
|
||||||
|
Exclude Editor: 1
|
||||||
|
Exclude Linux: 1
|
||||||
|
Exclude Linux64: 1
|
||||||
|
Exclude LinuxUniversal: 1
|
||||||
|
Exclude OSXIntel: 1
|
||||||
|
Exclude OSXIntel64: 1
|
||||||
|
Exclude OSXUniversal: 1
|
||||||
|
Exclude Win: 1
|
||||||
|
Exclude Win64: 1
|
||||||
|
Exclude iOS: 0
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
OS: AnyOS
|
||||||
|
- first:
|
||||||
|
Facebook: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Facebook: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Linux64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
Standalone: Win64
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
- first:
|
||||||
|
iPhone: iOS
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings:
|
||||||
|
CompileFlags:
|
||||||
|
FrameworkDependencies:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0dd2027a6278544d4acc46c208b9f5f5
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e39c573403bc479cb19650e7436097c
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1497947584
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
//
|
||||||
|
// Bugly.h
|
||||||
|
// Bugly
|
||||||
|
//
|
||||||
|
// Version: 2.4(8)
|
||||||
|
//
|
||||||
|
// Copyright (c) 2016年 Bugly. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
#import "BuglyConfig.h"
|
||||||
|
#import "BuglyLog.h"
|
||||||
|
|
||||||
|
BLY_START_NONNULL
|
||||||
|
|
||||||
|
@interface Bugly : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化Bugly,使用默认BuglyConfig
|
||||||
|
*
|
||||||
|
* @param appId 注册Bugly分配的应用唯一标识
|
||||||
|
*/
|
||||||
|
+ (void)startWithAppId:(NSString * BLY_NULLABLE)appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用指定配置初始化Bugly
|
||||||
|
*
|
||||||
|
* @param appId 注册Bugly分配的应用唯一标识
|
||||||
|
* @param config 传入配置的 BuglyConfig
|
||||||
|
*/
|
||||||
|
+ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
|
||||||
|
config:(BuglyConfig * BLY_NULLABLE)config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用指定配置初始化Bugly
|
||||||
|
*
|
||||||
|
* @param appId 注册Bugly分配的应用唯一标识
|
||||||
|
* @param development 是否开发设备
|
||||||
|
* @param config 传入配置的 BuglyConfig
|
||||||
|
*/
|
||||||
|
+ (void)startWithAppId:(NSString * BLY_NULLABLE)appId
|
||||||
|
developmentDevice:(BOOL)development
|
||||||
|
config:(BuglyConfig * BLY_NULLABLE)config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户标识
|
||||||
|
*
|
||||||
|
* @param userId 用户标识
|
||||||
|
*/
|
||||||
|
+ (void)setUserIdentifier:(NSString *)userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新版本信息
|
||||||
|
*
|
||||||
|
* @param version 应用版本信息
|
||||||
|
*/
|
||||||
|
+ (void)updateAppVersion:(NSString *)version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置关键数据,随崩溃信息上报
|
||||||
|
*
|
||||||
|
* @param value KEY
|
||||||
|
* @param key VALUE
|
||||||
|
*/
|
||||||
|
+ (void)setUserValue:(NSString *)value
|
||||||
|
forKey:(NSString *)key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取关键数据
|
||||||
|
*
|
||||||
|
* @return 关键数据
|
||||||
|
*/
|
||||||
|
+ (NSDictionary * BLY_NULLABLE)allUserValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置标签
|
||||||
|
*
|
||||||
|
* @param tag 标签ID,可在网站生成
|
||||||
|
*/
|
||||||
|
+ (void)setTag:(NSUInteger)tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前设置标签
|
||||||
|
*
|
||||||
|
* @return 当前标签ID
|
||||||
|
*/
|
||||||
|
+ (NSUInteger)currentTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备ID
|
||||||
|
*
|
||||||
|
* @return 设备ID
|
||||||
|
*/
|
||||||
|
+ (NSString *)buglyDeviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报自定义Objective-C异常
|
||||||
|
*
|
||||||
|
* @param exception 异常信息
|
||||||
|
*/
|
||||||
|
+ (void)reportException:(NSException *)exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报错误
|
||||||
|
*
|
||||||
|
* @param error 错误信息
|
||||||
|
*/
|
||||||
|
+ (void)reportError:(NSError *)error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 上报自定义错误
|
||||||
|
*
|
||||||
|
* @param category 类型(Cocoa=3,CSharp=4,JS=5,Lua=6)
|
||||||
|
* @param aName 名称
|
||||||
|
* @param aReason 错误原因
|
||||||
|
* @param aStackArray 堆栈
|
||||||
|
* @param info 附加数据
|
||||||
|
* @param terminate 上报后是否退出应用进程
|
||||||
|
*/
|
||||||
|
+ (void)reportExceptionWithCategory:(NSUInteger)category name:(NSString *)aName reason:(NSString *)aReason callStack:(NSArray *)aStackArray extraInfo:(NSDictionary *)info terminateApp:(BOOL)terminate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SDK 版本信息
|
||||||
|
*
|
||||||
|
* @return SDK版本号
|
||||||
|
*/
|
||||||
|
+ (NSString *)sdkVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App 是否发生了连续闪退
|
||||||
|
* 如果启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退
|
||||||
|
*
|
||||||
|
* @return 是否连续闪退
|
||||||
|
*/
|
||||||
|
+ (BOOL)isAppCrashedOnStartUpExceedTheLimit;
|
||||||
|
|
||||||
|
+ (void)setComponentIdentifier:(NSString *)componentId version:(NSString *)version;
|
||||||
|
|
||||||
|
BLY_END_NONNULL
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 841e5a51a12834159aeebd4cbad0d2ce
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
//
|
||||||
|
// BuglyConfig.h
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (c) 2016年 Tencent. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define BLY_UNAVAILABLE(x) __attribute__((unavailable(x)))
|
||||||
|
|
||||||
|
#if __has_feature(nullability)
|
||||||
|
#define BLY_NONNULL __nonnull
|
||||||
|
#define BLY_NULLABLE __nullable
|
||||||
|
#define BLY_START_NONNULL _Pragma("clang assume_nonnull begin")
|
||||||
|
#define BLY_END_NONNULL _Pragma("clang assume_nonnull end")
|
||||||
|
#else
|
||||||
|
#define BLY_NONNULL
|
||||||
|
#define BLY_NULLABLE
|
||||||
|
#define BLY_START_NONNULL
|
||||||
|
#define BLY_END_NONNULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "BuglyLog.h"
|
||||||
|
|
||||||
|
BLY_START_NONNULL
|
||||||
|
|
||||||
|
@protocol BuglyDelegate <NSObject>
|
||||||
|
|
||||||
|
@optional
|
||||||
|
/**
|
||||||
|
* 发生异常时回调
|
||||||
|
*
|
||||||
|
* @param exception 异常信息
|
||||||
|
*
|
||||||
|
* @return 返回需上报记录,随异常上报一起上报
|
||||||
|
*/
|
||||||
|
- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface BuglyConfig : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SDK Debug信息开关, 默认关闭
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL debugMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置自定义渠道标识
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *channel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置自定义版本号
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置自定义设备唯一标识
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *deviceIdentifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡顿监控开关,默认关闭
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL blockMonitorEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卡顿监控判断间隔,单位为秒
|
||||||
|
*/
|
||||||
|
@property (nonatomic) NSTimeInterval blockMonitorTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值)
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSString *applicationGroupIdentifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进程内还原开关,默认开启
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL symbolicateInProcessEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非正常退出事件记录开关,默认关闭
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL unexpectedTerminatingDetectionEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面信息记录开关,默认开启
|
||||||
|
*/
|
||||||
|
@property (nonatomic) BOOL viewControllerTrackingEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bugly Delegate
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) id<BuglyDelegate> delegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。
|
||||||
|
* 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BuglyLogLevel reportLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报
|
||||||
|
* 例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等
|
||||||
|
*/
|
||||||
|
@property (nonatomic, copy) NSArray *excludeModuleFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制台日志上报开关,默认开启
|
||||||
|
*/
|
||||||
|
@property (nonatomic, assign) BOOL consolelogEnable;
|
||||||
|
|
||||||
|
@end
|
||||||
|
BLY_END_NONNULL
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dca72c35ab06f4c9abf2877ad9a9f718
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// BuglyLog.h
|
||||||
|
//
|
||||||
|
// Copyright © 2017 tencent.com. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
// Log level for Bugly Log
|
||||||
|
typedef NS_ENUM(NSUInteger, BuglyLogLevel) {
|
||||||
|
BuglyLogLevelSilent = 0,
|
||||||
|
BuglyLogLevelError = 1,
|
||||||
|
BuglyLogLevelWarn = 2,
|
||||||
|
BuglyLogLevelInfo = 3,
|
||||||
|
BuglyLogLevelDebug = 4,
|
||||||
|
BuglyLogLevelVerbose = 5,
|
||||||
|
};
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
|
||||||
|
|
||||||
|
OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0);
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
#define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__]
|
||||||
|
|
||||||
|
#define BLYLogError(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__)
|
||||||
|
#define BLYLogWarn(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelWarn, fmt, ##__VA_ARGS__)
|
||||||
|
#define BLYLogInfo(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__)
|
||||||
|
#define BLYLogDebug(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__)
|
||||||
|
#define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#pragma mark - Interface
|
||||||
|
@interface BuglyLog : NSObject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化日志模块
|
||||||
|
*
|
||||||
|
* @param level 设置默认日志级别,默认BLYLogLevelSilent
|
||||||
|
*
|
||||||
|
* @param printConsole 是否打印到控制台,默认NO
|
||||||
|
*/
|
||||||
|
+ (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 打印BLYLogLevelInfo日志
|
||||||
|
*
|
||||||
|
* @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
|
||||||
|
*/
|
||||||
|
+ (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 打印日志
|
||||||
|
*
|
||||||
|
* @param level 日志级别
|
||||||
|
* @param message 日志内容 总日志大小限制为:字符串长度30k,条数200
|
||||||
|
*/
|
||||||
|
+ (void)level:(BuglyLogLevel) level logs:(NSString *)message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 打印日志
|
||||||
|
*
|
||||||
|
* @param level 日志级别
|
||||||
|
* @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
|
||||||
|
*/
|
||||||
|
+ (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 打印日志
|
||||||
|
*
|
||||||
|
* @param level 日志级别
|
||||||
|
* @param tag 日志模块分类
|
||||||
|
* @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
|
||||||
|
*/
|
||||||
|
+ (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4);
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 52d616a4d69ce46469563ec4166a5da7
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 877eab29b0d76443883ae4dbb398cb69
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
framework module Bugly {
|
||||||
|
umbrella header "Bugly.h"
|
||||||
|
|
||||||
|
export *
|
||||||
|
module * { export * }
|
||||||
|
|
||||||
|
link framework "Foundation"
|
||||||
|
link framework "Security"
|
||||||
|
link framework "SystemConfiguration"
|
||||||
|
link "c++"
|
||||||
|
link "z"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 01fcf8f3340eb42758a274ba09bbfa74
|
||||||
|
timeCreated: 1497948394
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ecccf44287a77c14e8252d53680afa3b
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1492050824
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
|
||||||
|
using UnityEditor.iOS.Xcode;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
public static class DirectoryProcessor
|
||||||
|
{
|
||||||
|
// 拷贝并增加到项目
|
||||||
|
public static void CopyAndAddBuildToXcode(PBXProject pbxProject, string targetGuid, string copyDirectoryPath, string buildPath, string currentDirectoryPath, bool needToAddBuild = true)
|
||||||
|
{
|
||||||
|
string unityDirectoryPath = copyDirectoryPath;
|
||||||
|
string xcodeDirectoryPath = buildPath;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(currentDirectoryPath))
|
||||||
|
{
|
||||||
|
unityDirectoryPath = Path.Combine(unityDirectoryPath, currentDirectoryPath);
|
||||||
|
xcodeDirectoryPath = Path.Combine(xcodeDirectoryPath, currentDirectoryPath);
|
||||||
|
Delete(xcodeDirectoryPath);
|
||||||
|
Directory.CreateDirectory(xcodeDirectoryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string filePath in Directory.GetFiles(unityDirectoryPath))
|
||||||
|
{
|
||||||
|
//过滤.meta文件
|
||||||
|
string extension = Path.GetExtension(filePath);
|
||||||
|
if (extension == ExtensionName.META)
|
||||||
|
continue;
|
||||||
|
//
|
||||||
|
if (extension == ExtensionName.ARCHIVE)
|
||||||
|
{
|
||||||
|
pbxProject.AddBuildProperty(targetGuid, XcodeProjectSetting.LIBRARY_SEARCH_PATHS_KEY, XcodeProjectSetting.PROJECT_ROOT + currentDirectoryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
string fileName = Path.GetFileName(filePath);
|
||||||
|
string copyPath = Path.Combine(xcodeDirectoryPath, fileName);
|
||||||
|
|
||||||
|
//有可能是.DS_Store文件,直接过滤
|
||||||
|
if (fileName[0] == '.')
|
||||||
|
continue;
|
||||||
|
File.Delete(copyPath);
|
||||||
|
File.Copy(filePath, copyPath);
|
||||||
|
|
||||||
|
if (needToAddBuild)
|
||||||
|
{
|
||||||
|
string relativePath = Path.Combine(currentDirectoryPath, fileName);
|
||||||
|
pbxProject.AddFileToBuild(targetGuid, pbxProject.AddFile(relativePath, relativePath, PBXSourceTree.Source));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string directoryPath in Directory.GetDirectories(unityDirectoryPath))
|
||||||
|
{
|
||||||
|
string directoryName = Path.GetFileName(directoryPath);
|
||||||
|
bool nextNeedToAddBuild = needToAddBuild;
|
||||||
|
if (directoryName.Contains(ExtensionName.FRAMEWORK) || directoryName.Contains(ExtensionName.BUNDLE) || directoryName == XcodeProjectSetting.IMAGE_XCASSETS_DIRECTORY_NAME)
|
||||||
|
{
|
||||||
|
nextNeedToAddBuild = false;
|
||||||
|
}
|
||||||
|
CopyAndAddBuildToXcode(pbxProject, targetGuid, copyDirectoryPath, buildPath, Path.Combine(currentDirectoryPath, directoryName), nextNeedToAddBuild);
|
||||||
|
if (directoryName.Contains(ExtensionName.FRAMEWORK) || directoryName.Contains(ExtensionName.BUNDLE))
|
||||||
|
{
|
||||||
|
string relativePath = Path.Combine(currentDirectoryPath, directoryName);
|
||||||
|
pbxProject.AddFileToBuild(targetGuid, pbxProject.AddFile(relativePath, relativePath, PBXSourceTree.Source));
|
||||||
|
pbxProject.AddBuildProperty(targetGuid, XcodeProjectSetting.FRAMEWORK_SEARCH_PATHS_KEY, XcodeProjectSetting.PROJECT_ROOT + currentDirectoryPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//拷贝文件夹或者文件
|
||||||
|
public static void CopyAndReplace(string sourcePath, string copyPath)
|
||||||
|
{
|
||||||
|
Delete(copyPath);
|
||||||
|
Directory.CreateDirectory(copyPath);
|
||||||
|
foreach (var file in Directory.GetFiles(sourcePath))
|
||||||
|
{
|
||||||
|
if (Path.GetExtension(file) == ExtensionName.META)
|
||||||
|
continue;
|
||||||
|
File.Copy(file, Path.Combine(copyPath, Path.GetFileName(file)));
|
||||||
|
}
|
||||||
|
foreach (var dir in Directory.GetDirectories(sourcePath))
|
||||||
|
{
|
||||||
|
CopyAndReplace(dir, Path.Combine(copyPath, Path.GetFileName(dir)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除目标文件夹以及文件夹内的所有文件
|
||||||
|
public static void Delete(string targetDirectoryPath)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(targetDirectoryPath))
|
||||||
|
return;
|
||||||
|
string[] filePaths = Directory.GetFiles(targetDirectoryPath);
|
||||||
|
foreach (string filePath in filePaths)
|
||||||
|
{
|
||||||
|
File.SetAttributes(filePath, FileAttributes.Normal);
|
||||||
|
File.Delete(filePath);
|
||||||
|
}
|
||||||
|
string[] directoryPaths = Directory.GetDirectories(targetDirectoryPath);
|
||||||
|
foreach (string directoryPath in directoryPaths)
|
||||||
|
{
|
||||||
|
Delete(directoryPath);
|
||||||
|
}
|
||||||
|
Directory.Delete(targetDirectoryPath, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ce94f7c6e9912164a8adc33fc2f6e4d4
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public static class ExtensionName
|
||||||
|
{
|
||||||
|
public const string META = ".meta";
|
||||||
|
public const string ARCHIVE = ".a";
|
||||||
|
public const string FRAMEWORK = ".framework";
|
||||||
|
public const string BUNDLE = ".bundle";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 85690819565a1cc43beb6a2f23ddb201
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor.iOS.Xcode;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
//Info.Plist修改设置
|
||||||
|
public static class InfoPlistProcessor
|
||||||
|
{
|
||||||
|
private static string GetInfoPlistPath(string buildPath)
|
||||||
|
{
|
||||||
|
return Path.Combine(buildPath, XcodeProjectSetting.INFO_PLIST_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlistDocument GetInfoPlist(string buildPath)
|
||||||
|
{
|
||||||
|
string plistPath = GetInfoPlistPath(buildPath);
|
||||||
|
PlistDocument plist = new PlistDocument();
|
||||||
|
plist.ReadFromFile(plistPath);
|
||||||
|
return plist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetPrivacySensiticeData(PlistDocument plist, List<XcodeProjectSetting.SensiticeData> permission)
|
||||||
|
{
|
||||||
|
PlistElementDict rootDict = plist.root;
|
||||||
|
int count = permission.Count;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
rootDict.SetString(permission[i].name, permission[i].des);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetApplicationQueriesSchemes(PlistDocument plist, List<string> _applicationQueriesSchemes)
|
||||||
|
{
|
||||||
|
PlistElementArray queriesSchemes;
|
||||||
|
int count = _applicationQueriesSchemes.Count;
|
||||||
|
string queriesScheme = null;
|
||||||
|
|
||||||
|
if (plist.root.values.ContainsKey(XcodeProjectSetting.APPLICATION_QUERIES_SCHEMES_KEY))
|
||||||
|
queriesSchemes = plist.root[XcodeProjectSetting.APPLICATION_QUERIES_SCHEMES_KEY].AsArray();
|
||||||
|
else
|
||||||
|
queriesSchemes = plist.root.CreateArray(XcodeProjectSetting.APPLICATION_QUERIES_SCHEMES_KEY);
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
queriesScheme = _applicationQueriesSchemes[i];
|
||||||
|
if (!queriesSchemes.values.Contains(new PlistElementString(queriesScheme)))
|
||||||
|
queriesSchemes.AddString(queriesScheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetBackgroundModes(PlistDocument plist, List<string> modes)
|
||||||
|
{
|
||||||
|
PlistElementDict rootDict = plist.root;
|
||||||
|
PlistElementArray bgModes = rootDict.CreateArray("UIBackgroundModes");
|
||||||
|
int count = modes.Count;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
bgModes.AddString(modes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetURLSchemes(PlistDocument plist, List<XcodeProjectSetting.BundleUrlType> urlList)
|
||||||
|
{
|
||||||
|
PlistElementArray urlTypes;
|
||||||
|
PlistElementDict itmeDict;
|
||||||
|
if (plist.root.values.ContainsKey(XcodeProjectSetting.URL_TYPES_KEY))
|
||||||
|
urlTypes = plist.root[XcodeProjectSetting.URL_TYPES_KEY].AsArray();
|
||||||
|
else
|
||||||
|
urlTypes = plist.root.CreateArray(XcodeProjectSetting.URL_TYPES_KEY);
|
||||||
|
|
||||||
|
for (int i = 0; i < urlList.Count; i++)
|
||||||
|
{
|
||||||
|
itmeDict = urlTypes.AddDict();
|
||||||
|
itmeDict.SetString(XcodeProjectSetting.URL_TYPE_ROLE_KEY, "Editor");
|
||||||
|
itmeDict.SetString(XcodeProjectSetting.URL_IDENTIFIER_KEY, urlList[i].identifier);
|
||||||
|
PlistElementArray schemesArray = itmeDict.CreateArray(XcodeProjectSetting.URL_SCHEMES_KEY);
|
||||||
|
if (itmeDict.values.ContainsKey(XcodeProjectSetting.URL_SCHEMES_KEY))
|
||||||
|
schemesArray = itmeDict[XcodeProjectSetting.URL_SCHEMES_KEY].AsArray();
|
||||||
|
else
|
||||||
|
schemesArray = itmeDict.CreateArray(XcodeProjectSetting.URL_SCHEMES_KEY);
|
||||||
|
//TODO:按理说要排除已经存在的,但由于我们是新生成,所以不做排除
|
||||||
|
for (int j = 0; j < urlList[i].bundleSchmes.Count; j++)
|
||||||
|
{
|
||||||
|
schemesArray.AddString(urlList[i].bundleSchmes[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetInfoPlist(string buildPath, XcodeProjectSetting setting)
|
||||||
|
{
|
||||||
|
PlistDocument plist = GetInfoPlist(buildPath);
|
||||||
|
plist.root.SetString ("CFBundleDevelopmentRegion", "zh_CN");
|
||||||
|
SetPrivacySensiticeData(plist, setting.privacySensiticeData);
|
||||||
|
SetApplicationQueriesSchemes(plist, setting.ApplicationQueriesSchemes);
|
||||||
|
SetBackgroundModes(plist, setting.BackgroundModes);
|
||||||
|
SetURLSchemes(plist, setting.BundleUrlTypeList);
|
||||||
|
plist.WriteToFile(GetInfoPlistPath(buildPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 077774284c0caf2438387ba9ad5b9160
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
using UnityEngine;
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Callbacks;
|
||||||
|
using UnityEditor.iOS.Xcode;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public class XCodeProjectMod : MonoBehaviour
|
||||||
|
{
|
||||||
|
#if UNITY_IPHONE
|
||||||
|
private const string SETTING_DATA_PATH = "Assets/Editor/XCodeAPI/Setting/XcodeProjectSetting.asset";
|
||||||
|
[PostProcessBuild]
|
||||||
|
private static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath)
|
||||||
|
{
|
||||||
|
Debug.LogError("ios工程==========================================");
|
||||||
|
if (buildTarget != BuildTarget.iOS)
|
||||||
|
return;
|
||||||
|
PBXProject pbxProject = null;
|
||||||
|
XcodeProjectSetting setting = null;
|
||||||
|
string pbxProjPath = PBXProject.GetPBXProjectPath(buildPath);
|
||||||
|
string targetGuid = null;
|
||||||
|
Debug.Log("开始设置.XCodeProj");
|
||||||
|
|
||||||
|
setting = AssetDatabase.LoadAssetAtPath<XcodeProjectSetting>(SETTING_DATA_PATH);
|
||||||
|
pbxProject = new PBXProject();
|
||||||
|
pbxProject.ReadFromString(File.ReadAllText(pbxProjPath));
|
||||||
|
targetGuid = pbxProject.GetUnityFrameworkTargetGuid();
|
||||||
|
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, XcodeProjectSetting.ENABLE_BITCODE_KEY, setting.EnableBitCode ? "YES" : "NO");
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, XcodeProjectSetting.DEVELOPMENT_TEAM, setting.DevelopmentTeam);
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, XcodeProjectSetting.GCC_ENABLE_CPP_EXCEPTIONS, setting.EnableCppEcceptions ? "YES" : "NO");
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, XcodeProjectSetting.GCC_ENABLE_CPP_RTTI, setting.EnableCppRtti ? "YES" : "NO");
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, XcodeProjectSetting.GCC_ENABLE_OBJC_EXCEPTIONS, setting.EnableObjcExceptions ? "YES" : "NO");
|
||||||
|
|
||||||
|
var sign_type = setting.SignType.ToString();
|
||||||
|
foreach (XcodeProjectSetting.SignIdentity si in setting.SignIdentityList)
|
||||||
|
{
|
||||||
|
if (si.name == sign_type)
|
||||||
|
{
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, "CODE_SIGN_IDENTITY", si.codeSign);
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, "PROVISIONING_PROFILE", si.profile);
|
||||||
|
pbxProject.SetBuildProperty(targetGuid, "PROVISIONING_PROFILE_SPECIFIER", si.profileSpecifier);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (!string.IsNullOrEmpty(setting.CopyDirectoryPath))
|
||||||
|
// DirectoryProcessor.CopyAndAddBuildToXcode(pbxProject, targetGuid, setting.CopyDirectoryPath, buildPath, "");
|
||||||
|
|
||||||
|
//编译器标记(Compiler flags)
|
||||||
|
foreach (XcodeProjectSetting.CompilerFlagsSet compilerFlagsSet in setting.CompilerFlagsSetList)
|
||||||
|
{
|
||||||
|
foreach (string targetPath in compilerFlagsSet.TargetPathList)
|
||||||
|
{
|
||||||
|
if (!pbxProject.ContainsFileByProjectPath(targetPath))
|
||||||
|
continue;
|
||||||
|
string fileGuid = pbxProject.FindFileGuidByProjectPath(targetPath);
|
||||||
|
List<string> flagsList = pbxProject.GetCompileFlagsForFile(targetGuid, fileGuid);
|
||||||
|
flagsList.Add(compilerFlagsSet.Flags);
|
||||||
|
pbxProject.SetCompileFlagsForFile(targetGuid, fileGuid, flagsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//引用内部框架
|
||||||
|
foreach (string framework in setting.FrameworkList)
|
||||||
|
{
|
||||||
|
pbxProject.AddFrameworkToProject(targetGuid, framework, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//引用.tbd文件
|
||||||
|
foreach (string tbd in setting.TbdList)
|
||||||
|
{
|
||||||
|
pbxProject.AddFileToBuild(targetGuid, pbxProject.AddFile("usr/lib/" + tbd, "Frameworks/" + tbd, PBXSourceTree.Sdk));
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置OTHER_LDFLAGS
|
||||||
|
pbxProject.UpdateBuildProperty(targetGuid, XcodeProjectSetting.LINKER_FLAG_KEY, setting.LinkerFlagArray, null);
|
||||||
|
//设置Framework Search Paths
|
||||||
|
pbxProject.UpdateBuildProperty(targetGuid, XcodeProjectSetting.FRAMEWORK_SEARCH_PATHS_KEY, setting.FrameworkSearchPathArray, null);
|
||||||
|
|
||||||
|
|
||||||
|
File.WriteAllText(pbxProjPath, pbxProject.WriteToString());
|
||||||
|
|
||||||
|
//已经存在的文件,拷贝替换
|
||||||
|
foreach (XcodeProjectSetting.CopeFiles file in setting.CopeFilesList)
|
||||||
|
{
|
||||||
|
Debug.Log(Application.dataPath + file.sourcePath + " " + buildPath + file.copyPath);
|
||||||
|
File.Copy(Application.dataPath + file.sourcePath, buildPath + file.copyPath, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置Plist
|
||||||
|
InfoPlistProcessor.SetInfoPlist(buildPath, setting);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5bb136fa14f37554f8ae8a3befeb293b
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,162 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Xcode项目的一些设定值
|
||||||
|
/// </summary>
|
||||||
|
public class XcodeProjectSetting : ScriptableObject
|
||||||
|
{
|
||||||
|
public const string PROJECT_ROOT = "$(PROJECT_DIR)/";
|
||||||
|
public const string IMAGE_XCASSETS_DIRECTORY_NAME = "Unity-iPhone";
|
||||||
|
public const string LINKER_FLAG_KEY = "OTHER_LDFLAGS";
|
||||||
|
public const string FRAMEWORK_SEARCH_PATHS_KEY = "FRAMEWORK_SEARCH_PATHS";
|
||||||
|
public const string LIBRARY_SEARCH_PATHS_KEY = "LIBRARY_SEARCH_PATHS";
|
||||||
|
public const string ENABLE_BITCODE_KEY = "ENABLE_BITCODE";
|
||||||
|
public const string DEVELOPMENT_TEAM = "DEVELOPMENT_TEAM";
|
||||||
|
public const string GCC_ENABLE_CPP_EXCEPTIONS = "GCC_ENABLE_CPP_EXCEPTIONS";
|
||||||
|
public const string GCC_ENABLE_CPP_RTTI = "GCC_ENABLE_CPP_RTTI";
|
||||||
|
public const string GCC_ENABLE_OBJC_EXCEPTIONS = "GCC_ENABLE_OBJC_EXCEPTIONS";
|
||||||
|
public const string INFO_PLIST_NAME = "Info.plist";
|
||||||
|
|
||||||
|
public const string URL_TYPES_KEY = "CFBundleURLTypes";
|
||||||
|
public const string URL_TYPE_ROLE_KEY = "CFBundleTypeRole";
|
||||||
|
public const string URL_IDENTIFIER_KEY = "CFBundleURLName";
|
||||||
|
public const string URL_SCHEMES_KEY = "CFBundleURLSchemes";
|
||||||
|
public const string APPLICATION_QUERIES_SCHEMES_KEY = "LSApplicationQueriesSchemes";
|
||||||
|
|
||||||
|
#region XCodeproj
|
||||||
|
public bool EnableBitCode = false;
|
||||||
|
public bool EnableCppEcceptions = true;
|
||||||
|
public bool EnableCppRtti = true;
|
||||||
|
public bool EnableObjcExceptions = true;
|
||||||
|
|
||||||
|
//要拷贝到XCode内的文件的路径
|
||||||
|
public string CopyDirectoryPath = "";
|
||||||
|
//AppleDevelopment内AppID表示
|
||||||
|
public string DevelopmentTeam = "";
|
||||||
|
|
||||||
|
public enum SignIdentityType
|
||||||
|
{
|
||||||
|
Developer,
|
||||||
|
Distribution
|
||||||
|
}
|
||||||
|
public SignIdentityType SignType = XcodeProjectSetting.SignIdentityType.Developer;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public struct SignIdentity
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
|
||||||
|
public string codeSign;
|
||||||
|
|
||||||
|
public string profile;
|
||||||
|
|
||||||
|
public string profileSpecifier;
|
||||||
|
|
||||||
|
public SignIdentity(string name, string codeSign, string profile, string profileSpecifier)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.codeSign = codeSign;
|
||||||
|
this.profile = profile;
|
||||||
|
this.profileSpecifier = profileSpecifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public List<SignIdentity> SignIdentityList = new List<SignIdentity>()
|
||||||
|
{
|
||||||
|
new SignIdentity("Developer","","",""),
|
||||||
|
new SignIdentity("Distribution","","","")
|
||||||
|
};
|
||||||
|
|
||||||
|
//引用的内部Framework
|
||||||
|
public List<string> FrameworkList = new List<string>() { };
|
||||||
|
//引用的内部.tbd
|
||||||
|
public List<string> TbdList = new List<string>() { };
|
||||||
|
//设置OtherLinkerFlag
|
||||||
|
public string[] LinkerFlagArray = new string[] { };
|
||||||
|
//设置FrameworkSearchPath
|
||||||
|
public string[] FrameworkSearchPathArray = new string[] { "$(inherited)", "$(PROJECT_DIR)/Frameworks" };
|
||||||
|
|
||||||
|
#region 针对单个文件进行flag标记
|
||||||
|
[System.Serializable]
|
||||||
|
public struct CompilerFlagsSet
|
||||||
|
{
|
||||||
|
public string Flags;
|
||||||
|
public List<string> TargetPathList;
|
||||||
|
|
||||||
|
public CompilerFlagsSet(string flags, List<string> targetPathList)
|
||||||
|
{
|
||||||
|
Flags = flags;
|
||||||
|
TargetPathList = targetPathList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CompilerFlagsSet> CompilerFlagsSetList = new List<CompilerFlagsSet>()
|
||||||
|
{
|
||||||
|
/*new CompilerFlagsSet ("-fno-objc-arc", new List<string> () {"Plugin/Plugin.mm"})*/ //实例,请勿删除
|
||||||
|
};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 拷贝文件
|
||||||
|
[System.Serializable]
|
||||||
|
public struct CopeFiles
|
||||||
|
{
|
||||||
|
public string sourcePath;
|
||||||
|
public string copyPath;
|
||||||
|
|
||||||
|
public CopeFiles(string sourcePath, string copyPath)
|
||||||
|
{
|
||||||
|
this.sourcePath = sourcePath;
|
||||||
|
this.copyPath = copyPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CopeFiles> CopeFilesList = new List<CopeFiles>() { };
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region info.Plist
|
||||||
|
//白名单
|
||||||
|
public List<string> ApplicationQueriesSchemes = new List<string>() { };
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public struct SensiticeData
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public string des;
|
||||||
|
|
||||||
|
public SensiticeData(string name, string des)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.des = des;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//iOS10新的特性
|
||||||
|
public List<SensiticeData> privacySensiticeData = new List<SensiticeData>() { };
|
||||||
|
|
||||||
|
#region 第三方平台URL Scheme
|
||||||
|
[System.Serializable]
|
||||||
|
public struct BundleUrlType
|
||||||
|
{
|
||||||
|
public string identifier;
|
||||||
|
public List<string> bundleSchmes;
|
||||||
|
|
||||||
|
public BundleUrlType(string identifier, List<string> bundleSchmes)
|
||||||
|
{
|
||||||
|
this.identifier = identifier;
|
||||||
|
this.bundleSchmes = bundleSchmes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BundleUrlType> BundleUrlTypeList = new List<BundleUrlType>() { };
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//放置后台需要开启的功能
|
||||||
|
public List<string> BackgroundModes = new List<string>() { };
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9478671de55c0824cb11716622ba4e34
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
|
||||||
|
public class XcodeProjectSettingCreator : MonoBehaviour
|
||||||
|
{
|
||||||
|
[MenuItem("Assets/Create/XcodeProjectSetting")]
|
||||||
|
public static void CreateAsset()
|
||||||
|
{
|
||||||
|
string path = AssetDatabase.GenerateUniqueAssetPath("Assets/Editor/XCodeAPI/Setting/XcodeProjectSetting.asset");
|
||||||
|
XcodeProjectSetting data = ScriptableObject.CreateInstance<XcodeProjectSetting>();
|
||||||
|
AssetDatabase.CreateAsset(data, path);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 391d91b61f38274488721dd9e6288fe6
|
||||||
|
timeCreated: 1492050526
|
||||||
|
licenseType: Pro
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c3fbaf0c3fb5c774dabf549596e9e07a
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1492050817
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9478671de55c0824cb11716622ba4e34, type: 3}
|
||||||
|
m_Name: XcodeProjectSetting
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
EnableBitCode: 0
|
||||||
|
EnableCppEcceptions: 1
|
||||||
|
EnableCppRtti: 1
|
||||||
|
EnableObjcExceptions: 1
|
||||||
|
CopyDirectoryPath: Assets/Editor/XCodeAPI/Resources
|
||||||
|
DevelopmentTeam: 5Z4523N5F7
|
||||||
|
SignType: 0
|
||||||
|
SignIdentityList:
|
||||||
|
- name: Developer
|
||||||
|
codeSign: iPhone Developer
|
||||||
|
profile:
|
||||||
|
profileSpecifier:
|
||||||
|
- name: Distribution
|
||||||
|
codeSign: iPhone Distribution
|
||||||
|
profile:
|
||||||
|
profileSpecifier:
|
||||||
|
FrameworkList:
|
||||||
|
- Security.framework
|
||||||
|
- CoreTelephony.framework
|
||||||
|
- JavaScriptCore.framework
|
||||||
|
- SystemConfiguration.framework
|
||||||
|
TbdList:
|
||||||
|
- libz.tbd
|
||||||
|
- libc++.tbd
|
||||||
|
- libsqlite3.tbd
|
||||||
|
LinkerFlagArray:
|
||||||
|
- -all_load
|
||||||
|
FrameworkSearchPathArray:
|
||||||
|
- $(inherited)
|
||||||
|
- $(PROJECT_DIR)/Frameworks
|
||||||
|
CompilerFlagsSetList: []
|
||||||
|
CopeFilesList:
|
||||||
|
- sourcePath: /Editor/XCodeAPI/Code/UnityAppController.h
|
||||||
|
copyPath: /Classes/UnityAppController.h
|
||||||
|
- sourcePath: /Editor/XCodeAPI/Code/UnityAppController.mm
|
||||||
|
copyPath: /Classes/UnityAppController.mm
|
||||||
|
- sourcePath: /Editor/XCodeAPI/Code/UnityViewControllerBaseiOS.mm
|
||||||
|
copyPath: /Classes/UI/UnityViewControllerBaseiOS.mm
|
||||||
|
ApplicationQueriesSchemes:
|
||||||
|
- weixin
|
||||||
|
privacySensiticeData:
|
||||||
|
- name: NSMicrophoneUsageDescription
|
||||||
|
des: "\u662F\u5426\u5141\u8BB8\u6B64App\u4F7F\u7528\u4F60\u7684\u9EA6\u514B\u98CE\uFF1F"
|
||||||
|
- name: NSLocationWhenInUseUsageDescription
|
||||||
|
des: "App\u9700\u8981\u60A8\u7684\u540C\u610F,\u624D\u80FD\u8BBF\u95EEGPS"
|
||||||
|
BundleUrlTypeList:
|
||||||
|
- identifier: weixin
|
||||||
|
bundleSchmes:
|
||||||
|
- wx11904574ece35867
|
||||||
|
- identifier: com.qp51.dev
|
||||||
|
bundleSchmes:
|
||||||
|
- wx11904574ece35867
|
||||||
|
- 51qp
|
||||||
|
BackgroundModes: []
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d1cd693bfe795764c8e2155617de7589
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4d94c3428ca1d88459776ea5e1f0444a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
|
|
@ -0,0 +1,92 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cbad99ab7e18a3141ae18f5324e24676
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
|
|
@ -0,0 +1,100 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dda4728053c74c04cade51d6daf2f62f
|
||||||
|
timeCreated: 1625627444
|
||||||
|
licenseType: Pro
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
- buildTarget: Windows Store Apps
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 545 KiB |
|
|
@ -0,0 +1,92 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0c96432335c56464db3c605e4582334f
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
|
|
@ -0,0 +1,92 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9e08f3d714fe6e244b88abeaa628a75c
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -100
|
||||||
|
wrapU: -1
|
||||||
|
wrapV: -1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 274a3fb1f56b69540893b859609a56fb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: efa6bf9eda570a74ab35c850bcce06cd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 66d9312cafc49bf4cad1ccdbb5b6668b
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1446459912
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cc39210f7f4d03f4aa637689b9d90d75
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1446459912
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b5137d7a41873f9499f95f860a6cef17
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1465913233
|
||||||
|
licenseType: Pro
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||||
|
|
||||||
|
Shader "FairyGUI/BlurFilter" {
|
||||||
|
Properties {
|
||||||
|
_MainTex ("Base (RGB)", 2D) = "white" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader {
|
||||||
|
Pass {
|
||||||
|
ZTest Always
|
||||||
|
ZWrite Off
|
||||||
|
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
#pragma target 2.0
|
||||||
|
struct appdata_t {
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
float2 texcoord : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f {
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
half2 texcoord : TEXCOORD0;
|
||||||
|
half2 taps[4] : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D _MainTex;
|
||||||
|
half4 _MainTex_TexelSize;
|
||||||
|
half4 _BlurOffsets;
|
||||||
|
|
||||||
|
v2f vert (appdata_t v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.texcoord = v.texcoord - _BlurOffsets.xy * _MainTex_TexelSize.xy;
|
||||||
|
o.taps[0] = o.texcoord + _MainTex_TexelSize * _BlurOffsets.xy;
|
||||||
|
o.taps[1] = o.texcoord - _MainTex_TexelSize * _BlurOffsets.xy;
|
||||||
|
o.taps[2] = o.texcoord + _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
|
||||||
|
o.taps[3] = o.texcoord - _MainTex_TexelSize * _BlurOffsets.xy * half2(1,-1);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed4 frag (v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
half4 color = tex2D(_MainTex, i.taps[0]);
|
||||||
|
color += tex2D(_MainTex, i.taps[1]);
|
||||||
|
color += tex2D(_MainTex, i.taps[2]);
|
||||||
|
color += tex2D(_MainTex, i.taps[3]);
|
||||||
|
return color * 0.25;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Fallback off
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f83d3bb1d90aaf54d8aed0783317662f
|
||||||
|
timeCreated: 1465913243
|
||||||
|
licenseType: Pro
|
||||||
|
ShaderImporter:
|
||||||
|
defaultTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||||
|
|
||||||
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||||||
|
|
||||||
|
Shader "FairyGUI/BMFont"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
|
||||||
|
|
||||||
|
_StencilComp ("Stencil Comparison", Float) = 8
|
||||||
|
_Stencil ("Stencil ID", Float) = 0
|
||||||
|
_StencilOp ("Stencil Operation", Float) = 0
|
||||||
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||||
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||||
|
|
||||||
|
_ColorMask ("Color Mask", Float) = 15
|
||||||
|
|
||||||
|
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
|
||||||
|
_BlendDstFactor ("Blend DstFactor", Float) = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
LOD 100
|
||||||
|
|
||||||
|
Tags
|
||||||
|
{
|
||||||
|
"Queue" = "Transparent"
|
||||||
|
"IgnoreProjector" = "True"
|
||||||
|
"RenderType" = "Transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
Stencil
|
||||||
|
{
|
||||||
|
Ref [_Stencil]
|
||||||
|
Comp [_StencilComp]
|
||||||
|
Pass [_StencilOp]
|
||||||
|
ReadMask [_StencilReadMask]
|
||||||
|
WriteMask [_StencilWriteMask]
|
||||||
|
}
|
||||||
|
|
||||||
|
Cull Off
|
||||||
|
Lighting Off
|
||||||
|
ZWrite Off
|
||||||
|
Fog { Mode Off }
|
||||||
|
Blend [_BlendSrcFactor] [_BlendDstFactor]
|
||||||
|
ColorMask [_ColorMask]
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma multi_compile NOT_GRAYED GRAYED
|
||||||
|
#pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
#pragma exclude_renderers d3d9 opengl flash
|
||||||
|
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
#pragma target 2.0
|
||||||
|
|
||||||
|
struct appdata_t
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D _MainTex;
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
float4 _ClipSoftness = float4(0, 0, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
v2f vert (appdata_t v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.texcoord = v.texcoord;
|
||||||
|
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
|
||||||
|
o.color.rgb = GammaToLinearSpace(v.color.rgb);
|
||||||
|
o.color.a = v.color.a;
|
||||||
|
#else
|
||||||
|
o.color = v.color;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed4 frag (v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
fixed4 col = i.color;
|
||||||
|
fixed4 tcol = tex2D(_MainTex, i.texcoord);
|
||||||
|
col.a *= tcol[i.texcoord.z];//z stores channel
|
||||||
|
|
||||||
|
#ifdef GRAYED
|
||||||
|
fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
|
||||||
|
col.rgb = fixed3(grey, grey, grey);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 factor = float2(0,0);
|
||||||
|
if(i.clipPos.x<0)
|
||||||
|
factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
|
||||||
|
else
|
||||||
|
factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
|
||||||
|
if(i.clipPos.y<0)
|
||||||
|
factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
|
||||||
|
else
|
||||||
|
factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
|
||||||
|
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 factor = abs(i.clipPos);
|
||||||
|
col.a *= step(max(factor.x, factor.y), 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Fallback "FairyGUI/Text"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cd79153f88fa7334ea6c5564c053bdca
|
||||||
|
timeCreated: 1459224288
|
||||||
|
licenseType: Pro
|
||||||
|
ShaderImporter:
|
||||||
|
defaultTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,182 @@
|
||||||
|
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||||
|
|
||||||
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||||||
|
|
||||||
|
Shader "FairyGUI/Image"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_MainTex ("Base (RGB), Alpha (A)", 2D) = "black" {}
|
||||||
|
|
||||||
|
_StencilComp ("Stencil Comparison", Float) = 8
|
||||||
|
_Stencil ("Stencil ID", Float) = 0
|
||||||
|
_StencilOp ("Stencil Operation", Float) = 0
|
||||||
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||||
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||||
|
|
||||||
|
_ColorMask ("Color Mask", Float) = 15
|
||||||
|
|
||||||
|
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
|
||||||
|
_BlendDstFactor ("Blend DstFactor", Float) = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
LOD 100
|
||||||
|
|
||||||
|
Tags
|
||||||
|
{
|
||||||
|
"Queue" = "Transparent"
|
||||||
|
"IgnoreProjector" = "True"
|
||||||
|
"RenderType" = "Transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
Stencil
|
||||||
|
{
|
||||||
|
Ref [_Stencil]
|
||||||
|
Comp [_StencilComp]
|
||||||
|
Pass [_StencilOp]
|
||||||
|
ReadMask [_StencilReadMask]
|
||||||
|
WriteMask [_StencilWriteMask]
|
||||||
|
}
|
||||||
|
|
||||||
|
Cull Off
|
||||||
|
Lighting Off
|
||||||
|
ZWrite Off
|
||||||
|
Fog { Mode Off }
|
||||||
|
Blend [_BlendSrcFactor] [_BlendDstFactor], One One
|
||||||
|
ColorMask [_ColorMask]
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma multi_compile NOT_COMBINED COMBINED
|
||||||
|
#pragma multi_compile NOT_GRAYED GRAYED COLOR_FILTER
|
||||||
|
#pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED ALPHA_MASK
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
#pragma target 2.0
|
||||||
|
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
|
||||||
|
struct appdata_t
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D _MainTex;
|
||||||
|
|
||||||
|
#ifdef COMBINED
|
||||||
|
sampler2D _AlphaTex;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
float4 _ClipSoftness = float4(0, 0, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLOR_FILTER
|
||||||
|
float4x4 _ColorMatrix;
|
||||||
|
float4 _ColorOffset;
|
||||||
|
float _ColorOption = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
v2f vert (appdata_t v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.texcoord = v.texcoord;
|
||||||
|
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
|
||||||
|
o.color.rgb = GammaToLinearSpace(v.color.rgb);
|
||||||
|
o.color.a = v.color.a;
|
||||||
|
#else
|
||||||
|
o.color = v.color;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed4 frag (v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
fixed4 col = tex2D(_MainTex, i.texcoord.xy / i.texcoord.w) * i.color;
|
||||||
|
|
||||||
|
#ifdef COMBINED
|
||||||
|
col.a *= tex2D(_AlphaTex, i.texcoord.xy / i.texcoord.w).g;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GRAYED
|
||||||
|
fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
|
||||||
|
col.rgb = fixed3(grey, grey, grey);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 factor = float2(0,0);
|
||||||
|
if(i.clipPos.x<0)
|
||||||
|
factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
|
||||||
|
else
|
||||||
|
factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
|
||||||
|
if(i.clipPos.y<0)
|
||||||
|
factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
|
||||||
|
else
|
||||||
|
factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
|
||||||
|
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 factor = abs(i.clipPos);
|
||||||
|
col.a *= step(max(factor.x, factor.y), 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLOR_FILTER
|
||||||
|
if (_ColorOption == 0)
|
||||||
|
{
|
||||||
|
fixed4 col2 = col;
|
||||||
|
col2.r = dot(col, _ColorMatrix[0]) + _ColorOffset.x;
|
||||||
|
col2.g = dot(col, _ColorMatrix[1]) + _ColorOffset.y;
|
||||||
|
col2.b = dot(col, _ColorMatrix[2]) + _ColorOffset.z;
|
||||||
|
col2.a = dot(col, _ColorMatrix[3]) + _ColorOffset.w;
|
||||||
|
col = col2;
|
||||||
|
}
|
||||||
|
else //premultiply alpha
|
||||||
|
col.rgb *= col.a;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ALPHA_MASK
|
||||||
|
clip(col.a - 0.001);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 263c97191482b3649ac7bf0810cc4f77
|
||||||
|
timeCreated: 1459224288
|
||||||
|
licenseType: Pro
|
||||||
|
ShaderImporter:
|
||||||
|
defaultTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||||
|
|
||||||
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||||||
|
|
||||||
|
Shader "FairyGUI/Text"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_MainTex ("Alpha (A)", 2D) = "white" {}
|
||||||
|
|
||||||
|
_StencilComp ("Stencil Comparison", Float) = 8
|
||||||
|
_Stencil ("Stencil ID", Float) = 0
|
||||||
|
_StencilOp ("Stencil Operation", Float) = 0
|
||||||
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||||
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||||
|
|
||||||
|
_ColorMask ("Color Mask", Float) = 15
|
||||||
|
|
||||||
|
_BlendSrcFactor ("Blend SrcFactor", Float) = 5
|
||||||
|
_BlendDstFactor ("Blend DstFactor", Float) = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
LOD 100
|
||||||
|
|
||||||
|
Tags
|
||||||
|
{
|
||||||
|
"Queue" = "Transparent"
|
||||||
|
"IgnoreProjector" = "True"
|
||||||
|
"RenderType" = "Transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
Stencil
|
||||||
|
{
|
||||||
|
Ref [_Stencil]
|
||||||
|
Comp [_StencilComp]
|
||||||
|
Pass [_StencilOp]
|
||||||
|
ReadMask [_StencilReadMask]
|
||||||
|
WriteMask [_StencilWriteMask]
|
||||||
|
}
|
||||||
|
|
||||||
|
Cull Off
|
||||||
|
Lighting Off
|
||||||
|
ZWrite Off
|
||||||
|
Fog { Mode Off }
|
||||||
|
Blend [_BlendSrcFactor] [_BlendDstFactor]
|
||||||
|
ColorMask [_ColorMask]
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma multi_compile NOT_GRAYED GRAYED
|
||||||
|
#pragma multi_compile NOT_CLIPPED CLIPPED SOFT_CLIPPED
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
#pragma target 2.0
|
||||||
|
struct appdata_t
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float4 vertex : SV_POSITION;
|
||||||
|
fixed4 color : COLOR;
|
||||||
|
float4 texcoord : TEXCOORD0;
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 clipPos : TEXCOORD1;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
sampler2D _MainTex;
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float4 _ClipBox = float4(-2, -2, 0, 0);
|
||||||
|
float4 _ClipSoftness = float4(0, 0, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
v2f vert (appdata_t v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.texcoord = v.texcoord;
|
||||||
|
#if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)
|
||||||
|
o.color.rgb = GammaToLinearSpace(v.color.rgb);
|
||||||
|
o.color.a = v.color.a;
|
||||||
|
#else
|
||||||
|
o.color = v.color;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
o.clipPos = mul(unity_ObjectToWorld, v.vertex).xy * _ClipBox.zw + _ClipBox.xy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed4 frag (v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
fixed4 col = i.color;
|
||||||
|
col.a *= tex2D(_MainTex, i.texcoord).a;
|
||||||
|
|
||||||
|
#ifdef GRAYED
|
||||||
|
fixed grey = dot(col.rgb, fixed3(0.299, 0.587, 0.114));
|
||||||
|
col.rgb = fixed3(grey, grey, grey);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SOFT_CLIPPED
|
||||||
|
float2 factor = float2(0,0);
|
||||||
|
if(i.clipPos.x<0)
|
||||||
|
factor.x = (1.0-abs(i.clipPos.x)) * _ClipSoftness.x;
|
||||||
|
else
|
||||||
|
factor.x = (1.0-i.clipPos.x) * _ClipSoftness.z;
|
||||||
|
if(i.clipPos.y<0)
|
||||||
|
factor.y = (1.0-abs(i.clipPos.y)) * _ClipSoftness.w;
|
||||||
|
else
|
||||||
|
factor.y = (1.0-i.clipPos.y) * _ClipSoftness.y;
|
||||||
|
col.a *= clamp(min(factor.x, factor.y), 0.0, 1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIPPED
|
||||||
|
float2 factor = abs(i.clipPos);
|
||||||
|
col.a *= step(max(factor.x, factor.y), 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8526777372c6fef4f8162b3a7901dcb0
|
||||||
|
timeCreated: 1459224288
|
||||||
|
licenseType: Pro
|
||||||
|
ShaderImporter:
|
||||||
|
defaultTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue