Example #1
0
    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());
        }
    }
Example #2
0
 public void Select()
 {
     selectGroup.SelectByIndex(index);
 }