Beispiel #1
0
        /// <summary>
        /// 加载游戏
        /// </summary>
        public virtual void LoadGame(string dbKey)
        {
            if (IsInBattle)
            {
                ReloadGame(dbKey);
                return;
            }

            BaseDBGameData data = SelfBaseGlobal.DBMgr.LoadGame(dbKey);

            if (data == null)
            {
                CLog.Error("游戏存档为空");
                return;
            }

            TDBaseBattleData tempData = Table.Find(data.BattleID);

            if (tempData == null)
            {
                CLog.Error("没有这个战场:{0}", data.BattleID);
                return;
            }
            data.GamePlayStateType = GamePlayStateType.LoadGame;
            LoadBattle(tempData);
        }
Beispiel #2
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();
        }