예제 #1
0
 public override void onClosed()
 {
     if (Curtran != null)
     {
         Curtran.onClose();
         Curtran = null;
     }
     clearCon_summon();
 }
예제 #2
0
        void onTab(string tran, int select_tujian = -1)
        {
            if (model.GetSummons().Count <= 0 && tran != "tujian")
            {
                flytxt.instance.fly(ContMgr.getCont("a3_summon_unllSummon"));
                return;
            }

            if (!A3_SummonModel.getInstance().Checklvl(GetType(tran), CurSummonID) && tran != "tujian" && A3_SummonModel.getInstance().GetSummons().ContainsKey(CurSummonID))
            {
                flytxt.instance.fly("召唤兽等级不足" + A3_SummonModel.getInstance().limitList[GetType(tran)].lvl + "级");
                return;
            }
            switch (tran)
            {
            case "shuxing": CurTranType = 1; break;

            case "xilian": CurTranType = 2; break;

            case "shouhun": CurTranType = 3; break;

            case "ronghe": CurTranType = 4; break;

            case "tunshi": CurTranType = 5; break;

            case "lianxie": CurTranType = 6; break;

            case "tujian": CurTranType = 0; break;
            }

            for (int i = 0; i < Btns.childCount; i++)
            {
                Btns.GetChild(i).GetComponent <Button>().interactable = true;
            }
            Btns.FindChild(tran).GetComponent <Button>().interactable = false;
            if (Curtran != null && Curtran.TransName == tran)
            {
                return;
            }
            foreach (BaseSummon am in _Trans.Values)
            {
                if (am != null)
                {
                    am.tranObj.SetActive(false);
                }
            }
            if (!_Trans.Keys.Contains(tran) || _Trans[tran] == null)
            {
                GameObject prefab = null;
                GameObject panel  = null;
                switch (tran)
                {
                case "shuxing":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_shuxing");// InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_shuxing");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_shuxing(panel.transform, tran);
                    break;

                case "xilian":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_xilian");// ; InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_xilian");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_xilian(panel.transform, tran);
                    break;

                case "shouhun":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_shouhun");// InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_shouhun");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_shouhun(panel.transform, tran);
                    break;

                case "ronghe":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_ronghe"); //InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_ronghe");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_ronghe(panel.transform, tran);
                    break;

                case "tunshi":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_tunshi"); //InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_tunshi");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_tunshi(panel.transform, tran);
                    break;

                case "lianxie":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_lianxie");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_lianxie(panel.transform, tran);
                    break;

                case "tujian":

                    prefab       = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_summon_tujian"); //InterfaceMgr.doGetAssert(GAMEAPI.ABLayer_LoadNow_GameObject, "a3_summon_tujian");
                    panel        = GameObject.Instantiate(prefab) as GameObject;
                    _Trans[tran] = new a3_summon_tujian(panel.transform, tran);
                    break;
                }
                panel.transform.SetParent(contents, false);
            }
            Curtran?.onClose();
            Curtran = _Trans[tran];
            Curtran.refreCurSummonID();

            refresh_summon_list(-1, false, GetType(tran));
            if (tran == "tujian" && select_tujian > 0)
            {//图鉴设置初始选定召唤兽
                Curtran.select_tujian = select_tujian;
            }
            Curtran?.onShowed();
            Curtran?.gameObject.SetActive(true);
            if (Curtran.TransName != "tujian")
            {
                summonlist.gameObject.SetActive(true);
            }
            else
            {
                summonlist.gameObject.SetActive(false);
            }
        }