void Awake() { if (luafun_UILoopItem_Set == null) { luaEnv = LuaManager.GetInstance().LuaEnvGetOrNew(); //luaEnv = new LuaEnv(); if (functionName == null && functionName.Equals("")) { luaEnv.DoString(script); luafun_UILoopItem_Set = luaEnv.Global.GetInPath <UILoopItem_Set>("UILoopItem_Set"); } else { luafun_UILoopItem_Set = luaEnv.Global.GetInPath <UILoopItem_Set>(functionName); } UILoopItem_Set luafun_UILoopItem_Awake = luaEnv.Global.GetInPath <UILoopItem_Set>(awakefunctionName); if (luafun_UILoopItem_Awake != null) { luafun_UILoopItem_Awake(itemIndex, transform, GetData()); } if (mstrOnSetSelectedFunName != "") { luaSetSelected = luaEnv.Global.GetInPath <OnSetSelected>(mstrOnSetSelectedFunName); } } }
private void Awake() { selectItem = this.transform.GetComponent <LuaSelectItem>(); if (luafun_UILoopItem_Set == null) { luaEnv = LuaManager.GetInstance().LuaEnvGetOrNew(); if (functionName == null && functionName.Equals("")) { luafun_UILoopItem_Set = luaEnv.Global.GetInPath <UILoopItem_Set>("UILoopItem_Set"); } else { luafun_UILoopItem_Set = luaEnv.Global.GetInPath <UILoopItem_Set>(functionName); } } if (isAutoListener) { Button[] btns = this.transform.GetComponentsInChildren <Button>(); SelectGroup group = this.transform.parent.GetComponent <SelectGroup>(); group.AddItem(selectItem); foreach (Button btn in btns) { btn.onClick.AddListener(() => { group.SelectByIndex(selectItem.index); }); } } UILoopItem_Set luafun_UILoopItem_Awake = luaEnv.Global.GetInPath <UILoopItem_Set>(awakefunctionName); if (luafun_UILoopItem_Awake != null) { luafun_UILoopItem_Awake(itemIndex, transform, GetData()); } }