bool OnWndStartClick() { if (mIsProcessCheck) { return(true); } if (selectWnd.selectedItem != null && !selectWnd.selectedItem.IsFile) { MapItemDescs desc = mMapItems[selectWnd.selectedItem.index]; Pathea.CustomGameData customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); if (customdata == null || customdata.humanDescs.Length == 0) { //lz-2016.10.31 Need a player to start MessageBox_N.ShowOkBox(PELocalization.GetString(8000859)); return(true); } MapItemDescs mid = mMapItems[selectWnd.selectedItem.index]; ScenarioIntegrityCheck check = ScenarioMapUtils.CheckIntegrityByPath(mid.Path); StartCoroutine(ProcessIntegrityCheck(check)); selectWnd.HintBox.Msg = "Checking"; selectWnd.HintBox.isProcessing = true; selectWnd.HintBox.Open(); } return(true); }
void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item) { MapItemDescs desc = mMapItems[item.index]; Pathea.CustomGameData customdata = null; try { customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); } catch { mapInfo.texture.mainTexture = null; mapInfo.name.text = "crap"; mapInfo.size.text = "crap"; } finally { mapInfo.texture.mainTexture = customdata.screenshot; mapInfo.name.text = customdata.name.ToString(); mapInfo.size.text = customdata.size.x.ToString() + "X" + customdata.size.z.ToString(); //PlayerDesc[] human_descs = customdata.humanDescs; //playerInfo.playerList.items.Clear(); //foreach (PlayerDesc pd in human_descs) //{ // playerInfo.playerList.items.Add(pd.Name); //} //playerInfo.playerList.selection = human_descs[0].Name; } hostCreatCtrl.UID = desc.UID; }
public YirdData GetYirdData(string UID, string yirdName = null) { CustomGameData customGameData = GetCustomData(UID); if (customGameData == null) { return(null); } return(customGameData.GetYirdData(yirdName)); }
void OnWndPlayerSelectChanged(int playerIndex) { MapItemDescs desc = mMapItems[selectWnd.selectedItem.index]; Pathea.CustomGameData customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); if (customdata.DeterminePlayer(playerIndex)) { #if UNITY_EDITOR Debug.Log("Select the player [" + customdata.curPlayer.Name + "]"); #endif } }
void OnWndMapItemClick(UICustomGameSelectWnd.CMapInfo mapInfo, UICustomGameSelectWnd.CPlayerInfo playerInfo, UICustomMapItem item) { if (mMapItems.Count <= item.index) { return; } MapItemDescs desc = mMapItems[item.index]; Pathea.CustomGameData customdata = null; try { customdata = Pathea.CustomGameData.Mgr.Instance.GetCustomData(desc.UID, desc.Path); } catch { mapInfo.texture.mainTexture = null; mapInfo.name.text = "crap"; mapInfo.size.text = "crap"; } finally { mapInfo.texture.mainTexture = customdata.screenshot; mapInfo.name.text = customdata.name.ToString(); mapInfo.size.text = customdata.size.x.ToString() + "X" + customdata.size.z.ToString(); PlayerDesc[] human_descs = customdata.humanDescs; if (human_descs.Length > 0 && playerInfo.playerList != null) { playerInfo.playerList.items.Clear(); foreach (PlayerDesc pd in human_descs) { playerInfo.playerList.items.Add(pd.Name); } playerInfo.playerList.selection = human_descs[0].Name; } else { playerInfo.playerList.items.Clear(); playerInfo.playerList.selection = " "; } } }
protected override void Load() { // YirdData customData = CustomGameData.Mgr.Instance.GetYirdData(mGameName, yirdName); //// // LoadCustom(newGame, customData); ScenarioMapDesc desc = ScenarioMapUtils.GetMapByUID(mUID, GameConfig.CustomDataDir); CustomGameData customData = CustomGameData.Mgr.Instance.GetCustomData(mUID, desc.Path); if (customData != null) { CustomGameData.Mgr.Instance.curGameData = customData; LoadCustom(newGame, customData); } else { Debug.LogError("Error"); } }
public CustomGameData GetCustomData(string UID, string Path = null) { if (mDatas.ContainsKey(UID)) { return(mDatas[UID]); } if (Path == null) { return(null); } CustomGameData data = new CustomGameData(); data.Load(Path); mDatas.Add(UID, data); return(data); }
// static void LoadCustom(bool bNewGame, YirdData yirdData) static void LoadCustom(bool bNewGame = true) { CustomGameData customData = CustomGameData.Mgr.Instance.GetCustomData(Pathea.PeGameMgr.mapUID); if (null != customData) { CustomGameData.Mgr.Instance.curGameData = customData; } YirdData yirdData = customData.curYirdData; if (null == yirdData) { Debug.LogError("custom game data is null"); return; } Debug.Log(System.DateTime.Now.ToString("G") + "[Start Game Mode] " + "multi custom client"); PeLauncher.Instance.Add(new ResetGlobalData()); PeLauncher.Instance.Add(new LoadMultiPlayerSpawnPos()); PeLauncher.Instance.Add(new LoadCamera()); PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, yirdData.terrainPath)); PeLauncher.Instance.Add(new LoadPathFinding()); PeLauncher.Instance.Add(new LoadPathFindingEx()); PeLauncher.Instance.Add(new LoadWaveSystem()); PeLauncher.Instance.Add(new LoadEditedGrass(bNewGame, yirdData.grassPath)); PeLauncher.Instance.Add(new LoadVETreeProtos(bNewGame)); PeLauncher.Instance.Add(new LoadEditedTree(bNewGame, yirdData.treePath)); PeLauncher.Instance.Add(new LoadEnvironment()); PeLauncher.Instance.Add(new LoadFarm()); PeLauncher.Instance.Add(new LoadColony()); PeLauncher.Instance.Add(new LoadGUI()); PeLauncher.Instance.Add(new LoadUiHelp(bNewGame)); PeLauncher.Instance.Add(new InitBuildManager(bNewGame)); PeLauncher.Instance.Add(new LoadMultiCustomCreature()); //PeLauncher.Instance.Add(new LoadWorldCollider()); PeLauncher.Instance.Add(new LoadCustomEntityCreator(bNewGame, yirdData)); PeLauncher.Instance.Add(new LoadMultiCustom(bNewGame, customData)); PlayerPackageCmpt.LockStackCount = false; }
// static void LoadCustom(bool bNewGame, YirdData yirdData) static void LoadCustom(bool bNewGame, CustomGameData customData) { YirdData yirdData = customData.curYirdData; if (null == yirdData) { Debug.LogError("custom game data is null"); return; } Debug.Log(System.DateTime.Now.ToString("G") + "[Start Game Mode] " + (!bNewGame ? "saved" : "new") + " Custom, path:" + yirdData.terrainPath + "****************"); PeLauncher.Instance.Add(new ResetGlobalData()); PeLauncher.Instance.Add(new LoadReputation(bNewGame)); PeLauncher.Instance.Add(new LoadRandomItemMgr()); PeLauncher.Instance.Add(new LoadCustomPlayerSpawnPos(bNewGame, customData.curPlayer.StartLocation)); PeLauncher.Instance.Add(new LoadCamera()); PeLauncher.Instance.Add(new LoadEditedTerrain(bNewGame, yirdData.terrainPath)); PeLauncher.Instance.Add(new LoadPathFinding()); PeLauncher.Instance.Add(new LoadPathFindingEx()); PeLauncher.Instance.Add(new LoadCreationData(bNewGame)); PeLauncher.Instance.Add(new LoadItemAsset(bNewGame)); PeLauncher.Instance.Add(new LoadWaveSystem()); // Grass PeLauncher.Instance.Add(new LoadEditedGrass(bNewGame, yirdData.grassPath)); // Tree PeLauncher.Instance.Add(new LoadVETreeProtos(bNewGame)); PeLauncher.Instance.Add(new LoadEditedTree(bNewGame, yirdData.treePath)); PeLauncher.Instance.Add(new LoadEnvironment()); PeLauncher.Instance.Add(new LoadWorldInfo(bNewGame)); //PeLauncher.Instance.Add(new LoadCustomMap(bNewGame)); PeLauncher.Instance.Add(new LoadCustomDoodad(bNewGame, yirdData.GetDoodads())); PeLauncher.Instance.Add(new LoadCustomDragItem(yirdData.GetItems())); PeLauncher.Instance.Add(new LoadCustomSceneEffect(yirdData.GetEffects())); PeLauncher.Instance.Add(new LoadCustomCreature(bNewGame)); PeLauncher.Instance.Add(new LoadCustomEntityCreator(bNewGame, yirdData)); PeLauncher.Instance.Add(new LoadNPCTalkHistory(bNewGame)); PeLauncher.Instance.Add(new LoadGUI()); PeLauncher.Instance.Add(new LoadWorldCollider()); PeLauncher.Instance.Add(new LoadUiHelp(bNewGame)); PeLauncher.Instance.Add(new InitBuildManager(bNewGame)); PeLauncher.Instance.Add(new LoadCustomStory(bNewGame, customData)); PeLauncher.Instance.Add(new LoadSingleCustomInitData(bNewGame)); PeLauncher.Instance.Add(new LoadLootItem(bNewGame)); PeLauncher.Instance.Add(new LoadWorldCollider()); PlayerPackageCmpt.LockStackCount = false; }