public bool LoadStageData(SaveDataStore saveData) { m_StageIndex = saveData.m_StageIndex - 1; if (m_StageIndex < 0 || m_StageIndex >= m_StageAssets.Length) { return(false); } m_Container = ObjectSaveLoad.JsonDataLoad <MapContainer>(m_StageAssets[m_StageIndex].text); m_Container.InitTileDataMap(); m_ShopItemList = m_Container.shopItemList; m_ShopWeaponList = m_Container.shopWeaponList; m_StageMapManager.CreateStageMap(m_Container); for (int i = 0; i < saveData.m_ChestStates.Count; i++) { HexCoord hex = new HexCoord(saveData.m_ChestStates[i].m_LocX, saveData.m_ChestStates[i].m_LocY); m_StageMapManager.GetMapTile(hex).SetChestState(saveData.GetChestState(hex)); } List <PlayerRecord> userPlayerRecords = GetUserPlayerRecords(saveData.m_UserPlayerRecords, saveData.m_StagePlayerRecords); List <PlayerRecord> enemyPlayerRecords = GetEnemyPlayerRecords(saveData.m_StageEnemyRecords); m_PlayerManager.GenetarePlayers(userPlayerRecords); m_PlayerManager.GenetarePlayers(enemyPlayerRecords); m_ScenarionManager.SetScenarion(m_Container.scenarionList, saveData.m_RemoveScenaroList); return(true); }
private void LoadGameElements() { if (m_GameElement != null) { return; } m_GameElement = ObjectSaveLoad.JsonDataLoad <GameElement>(m_ElementData.text); m_DicPlayerTypes = new Dictionary <int, CharacterTemplate>(); m_DicEnemyTypes = new Dictionary <int, CharacterTemplate>(); for (int i = 0; i < m_GameElement.characters.Count; i++) { if (m_GameElement.characters[i].enemy) { m_DicEnemyTypes.Add(m_GameElement.characters[i].id, m_GameElement.characters[i]); } else { m_DicPlayerTypes.Add(m_GameElement.characters[i].id, m_GameElement.characters[i]); } } }