110 lines
3.4 KiB
Lua
110 lines
3.4 KiB
Lua
--region *.lua
|
|
--Date
|
|
--此文件由[BabeLua]插件自动生成
|
|
|
|
|
|
require "Framework/Manager/UIManager"
|
|
require "Framework/Manager/PoolManager"
|
|
require "Framework/Manager/SoundManager"
|
|
require "Framework/Manager/CardRendererManager"
|
|
require "Framework/Manager/RoleRenderManager"
|
|
require "Framework/Manager/ServerConfigManager"
|
|
require "Data/UIData"
|
|
require "Data/SoundData"
|
|
require "Data/ConfigData"
|
|
require "Framework.Manager.PackageManager"
|
|
|
|
Framework = { }
|
|
|
|
Framework.isDebug = false
|
|
Framework.PlayClickSoundThisTime = false --允许这次点击播放声音,否则不播,并且下次继续播
|
|
|
|
local effectPos = Vector3.New(Screen.width / 2, Screen.height / 2, 0)
|
|
local update = function()
|
|
if Input.GetKeyDown(UnityEngine.KeyCode.Escape) then
|
|
if AppConst.isSDK and SDKMgr:IsSupportExit() then
|
|
if LoginManager.IsLogin then
|
|
SubmitExtraData({ type = SDKSubMitType.TYPE_EXIT_GAME })
|
|
SDKMgr:ExitGame()
|
|
else
|
|
SDKMgr:ExitGame()
|
|
end
|
|
else
|
|
SysPanel.ShowTwo(Language[12108], nil, function()
|
|
Game.Quit()
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- 临时退出游戏代码
|
|
if not AppConst.isSDK and Input.GetKeyDown(UnityEngine.KeyCode.Tab) then
|
|
SysPanel.ShowTwo(Language[11857], nil, function()
|
|
Game.Logout()
|
|
end)
|
|
end
|
|
|
|
if Input.GetMouseButtonUp(0) then
|
|
if Framework.PlayClickSoundThisTime then
|
|
SoundManager.PlaySound(SoundConfig.Sound_UIClick)
|
|
local clickEffect = poolManager:LoadAsset("fx_ui_i_DianJi", PoolManager.AssetType.GameObject)
|
|
clickEffect.transform:SetParent(UIManager.fixedNode)
|
|
clickEffect.transform.localScale = Vector3.one
|
|
clickEffect.transform.localPosition = Vector3.zero
|
|
|
|
-- local ft = UIManager.width/UIManager.height
|
|
-- local rw = ft * 1920
|
|
|
|
-- Log(UIManager.UIWidth.."|"..UIManager.UIHeight)
|
|
-- Log(UIManager.width.."|"..UIManager.height)
|
|
-- Log(Input.mousePosition.x.."|"..Input.mousePosition.y)
|
|
local wf = UIManager.UIWidth/1080
|
|
local hf = UIManager.UIHeight/1920
|
|
|
|
|
|
|
|
local v3 = Input.mousePosition - effectPos
|
|
|
|
|
|
v3 = Vector3.New(v3.x / UIManager.width * UIManager.UIWidth, v3.y / UIManager.height * UIManager.UIHeight, v3.z)
|
|
clickEffect:GetComponent("RectTransform").anchoredPosition = v3
|
|
clickEffect:SetActive(true)
|
|
|
|
local timer = Timer.New(function()
|
|
poolManager:UnLoadAsset("fx_ui_i_DianJi", clickEffect, PoolManager.AssetType.GameObject)
|
|
end, 1, false, true)
|
|
timer:Start()
|
|
else
|
|
Framework.PlayClickSoundThisTime = true
|
|
end
|
|
end
|
|
|
|
--TODO:快速重新登录
|
|
--if Input.GetKeyDown('1') then
|
|
-- Framework.Dispose()
|
|
-- App.Instance:ReStart()
|
|
--end
|
|
end
|
|
--框架初始化
|
|
function Framework. Initialize()
|
|
ConfigManager.Initialize()
|
|
SoundManager.Initialize()
|
|
UIManager.Initialize()
|
|
poolManager = PoolManager:new()
|
|
CardRendererManager.Initialize()
|
|
ServerConfigManager.Initialize()
|
|
PackageManager.Initialize()
|
|
|
|
UpdateBeat:Add(update, Framework)
|
|
end
|
|
|
|
--销毁框架
|
|
function Framework.Dispose()
|
|
UIManager.Dispose()
|
|
SoundManager.Dispose()
|
|
CardRendererManager.Dispose()
|
|
poolManager:onDestroy()
|
|
|
|
UpdateBeat:Remove(update, Framework)
|
|
end
|
|
|
|
--endregion |