Esempio n. 1
0
        /// <summary>
        /// 加载新游戏
        /// </summary>
        public virtual void StartNewGame(string battleId = "")
        {
            if (IsInBattle)
            {
                CLog.Error("正在游戏中");
                return;
            }

            TDBaseBattleData tempData = Table.Find(battleId);

            if (tempData == null)
            {
                CLog.Error("没有这个战场:{0}", battleId);
                return;
            }

            BaseDBGameData data = SelfBaseGlobal.DBMgr.StartNewGame();

            if (data == null)
            {
                CLog.Error("游戏存档为空");
                return;
            }
            data.GameNetMode       = GameNetMode.PVE;
            data.GamePlayStateType = GamePlayStateType.NewGame;
            LoadBattle(tempData);
            Callback_OnStartNewGame?.Invoke();
        }
Esempio n. 2
0
        // 加载新游戏
        public virtual void StartNewGame(string battleId = "")
        {
            if (SubBattleMgr != null && SubBattleMgr.IsInBattle)
            {
                CLog.Error("正在SubBattle中");
                return;
            }
            if (IsInBattle)
            {
                CLog.Error("正在游戏中");
                return;
            }

            TDBaseBattleData tempData = TDLuaMgr.Get <TData>(battleId);

            if (tempData == null)
            {
                CLog.Error("没有这个战场:{0}", battleId);
                return;
            }

            BattleID = battleId;
            DBBaseGame data = DBMgr.StartNewGame();

            if (data == null)
            {
                CLog.Error("游戏存档为空");
                return;
            }
            data.GameNetMode       = GameNetMode.PVE;
            data.GamePlayStateType = GamePlayStateType.NewGame;
            LoadScene(tempData);
            Callback_OnStartNewGame?.Invoke();
        }