private void OnSwitch(TabControl t)
        {
            int index = t.getSeletedIndex();

            if (current != null)
            {
                current.onClose();
                current.gameObject.SetActive(false);
            }

            if (index == 0)
            {
                if (A3_PetModel.getInstance().hasPet())
                {
                    if (pet == null)
                    {
                        GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_pet_skin");
                        GameObject panel  = GameObject.Instantiate(prefab) as GameObject;
                        //pet = new a3_pet_skin(panel.transform);
                        //pet.setPerent(con);
                        //pet.gameObject.SetActive(false);
                    }
                    if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET))
                    {
                        current = pet;
                    }
                }
                else
                {
                    flytxt.instance.fly(ContMgr.getCont("no_get_pet"));
                    current = null;
                }
            }
            else if (index == 1)
            {
                if (wing == null)
                {//TODO
                    GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_wing_skin");
                    GameObject panel  = GameObject.Instantiate(prefab) as GameObject;
                    //wing = new a3_wing_skin(panel.transform);
                    // wing.setPerent(con);
                    //wing.gameObject.SetActive(false);
                }
                if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET_SWING))
                {
                    current = wing;
                }
            }

            if (current != null)
            {
                current.onShowed();
                current.visiable = true;
                if (!current.__mainTrans.gameObject.activeSelf)
                {
                    current.__mainTrans.gameObject.SetActive(true);
                }
            }
        }
Example #2
0
        private void OnSwitch(TabControl t)
        {
            int  seletedIndex = t.getSeletedIndex();
            bool flag         = this.current != null;

            if (flag)
            {
                this.current.onClose();
                this.current.gameObject.SetActive(false);
            }
            bool flag2 = seletedIndex == 0;

            if (flag2)
            {
                bool flag3 = ModelBase <A3_PetModel> .getInstance().hasPet();

                if (flag3)
                {
                    bool flag4 = this.pet == null;
                    if (flag4)
                    {
                        GameObject original   = Resources.Load <GameObject>("prefab/a3_pet_skin");
                        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original);
                    }
                    bool flag5 = FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET, false);
                    if (flag5)
                    {
                        this.current = this.pet;
                    }
                }
                else
                {
                    flytxt.instance.fly("宠物未获得", 0, default(Color), null);
                    this.current = null;
                }
            }
            else
            {
                bool flag6 = seletedIndex == 1;
                if (flag6)
                {
                    bool flag7 = this.wing == null;
                    if (flag7)
                    {
                        GameObject original2   = Resources.Load <GameObject>("prefab/a3_wing_skin");
                        GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(original2);
                    }
                    bool flag8 = FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET_SWING, false);
                    if (flag8)
                    {
                        this.current = this.wing;
                    }
                }
            }
            bool flag9 = this.current != null;

            if (flag9)
            {
                this.current.onShowed();
                this.current.visiable = true;
                bool flag10 = !this.current.__mainTrans.gameObject.activeSelf;
                if (flag10)
                {
                    this.current.__mainTrans.gameObject.SetActive(true);
                }
            }
        }