コード例 #1
0
 void OnBtnClick(string BtnName)
 {
     if (BtnName == "Btn_Close")
     {
         Close();
     }
     else
     {
         if (Core.Data.playerManager.curJingLi < NeedEnergy)
         {
             JCRestoreEnergyMsg.OpenUI(110015, 110016);
         }
         else
         {
             int      floorID = this.FristFloorID + int.Parse(BtnName);
             NewFloor floor   = null;
             //如果关卡存在
             if (Core.Data.newDungeonsManager.FloorList.TryGetValue(floorID, out floor))
             {
                 SelectFightPanelType _type  = this.type == 0 ? SelectFightPanelType.EXP_BATTLE:SelectFightPanelType.GEM_BATTLE;
                 FightRoleSelectPanel FPanel = FightRoleSelectPanel.OpenUI(floor.config.TeamSize, _type, floor.config.FightType);
                 if (FPanel != null)
                 {
                     gameObject.SetActive(false);
                     FPanel.CallBack_Fight = (int[] array, int teamID) =>
                     {
                         if (array.Length == 0)
                         {
                             SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(9092));
                         }
                         else
                         {
                             JCPVEFightLogic.Instance.Fight(floor.config.ID, array, teamID);
                         }
                     };
                     FPanel.OnClose = () =>
                     {
                         gameObject.SetActive(true);
                     };
                 }
             }
             else
             {
                 SQYAlertViewMove.CreateAlertViewMove("[ff0000]Can't find floor:" + floorID.ToString() + "[-]");
             }
         }
     }
 }
コード例 #2
0
    public static FightRoleSelectPanel OpenUI(int TeamCount, SelectFightPanelType PVEType, int FightType = -1)
    {
        if (Instance == null)
        {
            Object prefab = PrefabLoader.loadFromPack("JC/FightRoleSelectPanel");
            if (prefab != null)
            {
                GameObject obj = Instantiate(prefab) as GameObject;
                RED.AddChild(obj, DBUIController.mDBUIInstance._PVERoot.gameObject);
                Instance = obj.GetComponent <FightRoleSelectPanel>();
                DBUIController.mDBUIInstance._PVERoot.AddPage(obj.name, obj);
                Instance.FightType = FightType;

                Instance.TeamCount = TeamCount;
                Instance.PVEType   = PVEType;
            }
            Instance.Init();
        }
        return(Instance);
    }