在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
在AppConst public const bool LuaBundleMode = true; //Lua代码AssetBundle模式 改为fasle //主面板控制器
MainCtrl = {}; local this = MainCtrl; local main;
local transform; local gameObject; --构建函数--
function MainCtrl.New() logWarn("MainCtrl.New--->>"); return this; end function MainCtrl.Awake()
logWarn("MainCtrl.Awake--->>"); panelMgr:CreatePanel('Main', this.OnCreate); end --启动事件--
function MainCtrl.OnCreate(obj) gameObject = obj; transform = obj.transform; main = transform:GetComponent('LuaBehaviour'); logWarn("Start lua--->>"..gameObject.name); main:AddClick(MainPanel.re, this.OnClickRe); main:AddClick(MainPanel.lo, this.OnClickLo); end --注册单击事件--
function MainCtrl.OnClickRe(go) MainPanel.InitPanel(); if((MainPanel.idtext=="")or (MainPanel.passtext=="")) then print("No Register") else print("Register Successful") end end --登录单击事件--
function MainCtrl.OnClickLo(go) MainPanel.InitPanel(); if((MainPanel.idtext=="1")and(MainPanel.passtext=="1")) then print("Login Successful") panelMgr:CreatePanel('Pack', this.OnCreate); panelMgr:ClosePanel("Main") else print("No Login") end end //主面板
local transform; local gameObject; MainPanel = {};
local this = MainPanel; --启动事件--
function MainPanel.Awake(obj) gameObject = obj; transform = obj.transform; this.InitPanel();
logWarn("Awake lua--->>"..gameObject.name); end --初始化面板--
function MainPanel.InitPanel() local id= transform:Find("id/InputField/idtext"); this.idtext=id:GetComponent('Text').text; local pass= transform:Find("pass/InputField/passtext"); this.passtext=id:GetComponent('Text').text; this.re = transform:Find("re").gameObject; this.lo = transform:Find("lo").gameObject; end //背包控制器
PackCtrl = {}; local this = PackCtrl; local pack;
local transform; local gameObject; --构建函数--
function PackCtrl.New() logWarn("PackCtrl.New--->>"); return this; end --启动事件--
function PackCtrl.OnCreate(obj) gameObject = obj; transform = obj.transform; main = transform:GetComponent('LuaBehaviour'); logWarn("Start lua--->>"..gameObject.name); end //背包面板 |
请发表评论