// 加载游戏 public virtual void LoadGame(string dbKey) { if (SubBattleMgr != null && SubBattleMgr.IsInBattle) { CLog.Error("正在SubBattle中"); return; } if (IsInBattle) { ReloadGame(dbKey); return; } DBBaseGame data = DBMgr.LoadGame(dbKey); if (data == null) { CLog.Error("游戏存档为空"); return; } TDBaseBattleData tempData = TDLuaMgr.Get <TData>(data.BattleID); if (tempData == null) { CLog.Error("没有这个战场:{0}", data.BattleID); return; } data.GamePlayStateType = GamePlayStateType.LoadGame; LoadScene(tempData); }
// 加载新游戏 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(); }