代码拉取完成,页面将自动刷新
require "base/setup"
function Main()
LogInfo("当前平台:"..tostring(Application.platform))
LogInfof("屏幕宽:%s,高:%s", Screen.width, Screen.height)
InitSetting()
InitObject()
Hotswap()
InitClass()
GameManager.Instance:Start()
end
function InitObject()
GameObject.DontDestroyOnLoad(GameObject.Find("EventSystem"))
UIDefine.canvasRoot = GameObject.Find("Canvas").transform
GameObject.DontDestroyOnLoad(UIDefine.canvasRoot.gameObject)
local size = UIDefine.canvasRoot.sizeDelta
KvData.curScreenWidth = size.x
KvData.curScreenHeight = size.y
local mixedObj = GameObject("mixed")
mixedObj:AddComponent(RectTransform)
mixedObj.transform:SetParent(UIDefine.canvasRoot)
mixedObj.transform:Reset()
mixedObj.transform:SetSizeDelata(0,0)
local calcPosNode = GameObject("calc_pos_node")
calcPosNode:AddComponent(RectTransform)
calcPosNode.transform:SetParent(mixedObj.transform)
mixedObj.transform:Reset()
mixedObj.transform:SetSizeDelata(0,0)
UIDefine.calcPosNode = calcPosNode.transform
UIDefine.uiCamera = GameObject.Find("UICamera"):GetComponent(Camera)
GameObject.DontDestroyOnLoad(UIDefine.uiCamera.gameObject)
KvData.mainCamera = GameObject.Find("MainCamera"):GetComponent(Camera)
GameObject.DontDestroyOnLoad(KvData.mainCamera.gameObject)
end
function Hotswap()
if VersionUpdater.Instance.hotswap ~= "" then
local hotswapContent = string.format("<----------\n%s\n---------->",VersionUpdater.Instance.hotswap)
LogInfo("hotswap内容:\n"..hotswapContent)
require("hotswap")
end
end
function InitClass()
GameManager.New()
end
function ModuleSetup(module)
local class = GetClass(module)
if class == nil then LogErrorf("无法找到模块入口[%s]",module) return end
local facade = class.New(class)
end
function Update()
GameManager.Instance:Update()
end
function LateUpdate()
GameManager.Instance:LateUpdate()
end
function OnApplicationFocus(flag)
GameManager.Instance:OnApplicationFocus(flag)
end
function OnApplicationQuit()
GameManager.Instance:OnApplicationQuit()
end
function InitPlatform()
end
function InitSetting()
KvData.luaDebug = BaseSetting.debug and BaseSetting.luaDebug
if Application.platform == RuntimePlatform.Android then
KvData.platform = KvData.PlatformType.Android
elseif Application.platform == RuntimePlatform.IPhonePlayer then
KvData.platform = KvData.PlatformType.IPhonePlayer
elseif Application.platform == RuntimePlatform.WindowsEditor then
KvData.platform = KvData.PlatformType.WindowsEditor
IS_DEBUG = true
IS_EDITOR = true
elseif Application.platform == RuntimePlatform.OSXEditor then
KvData.platform = KvData.PlatformType.OSXEditor
IS_DEBUG = true
IS_EDITOR = true
elseif Application.platform == RuntimePlatform.OSXPlayer then
KvData.platform = KvData.PlatformType.OSXPlayer
IS_DEBUG = true
elseif Application.platform == RuntimePlatform.WindowsPlayer then
KvData.platform = KvData.PlatformType.WindowsPlayer
IS_DEBUG = true
elseif Application.platform == RuntimePlatform.WebGLPlayer then
KvData.platform = KvData.PlatformType.WebGLPlayer
IS_DEBUG = true
end
if not IS_DEBUG then
IS_DEBUG = PlayerPrefsEx.GetInt("IS_DEBUG",0) > 0
end
IS_DEBUG = true
if IS_DEBUG then
LuaManager.logObj:SetActive(true)
end
--TODO:调试阶段,先开启
--IS_DEBUG = true
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。