public static void AddSoulReward() { soul += soulReward; soulReward = 0; JsonSave.SaveCampaign(); }
public static void ChangeDay() { GenerateAvailableMonsters(); GenerateAvailableSkills(); JsonSave.SaveCampaign(); }
public static void AddGoldReward() { gold += goldReward; goldReward = 0; JsonSave.SaveCampaign(); }
public void LoadMonsters() { EnemyTeam[] enemyTeamTemp = JsonSave.LoadEnemyTeam(); enemyTeam = enemyTeamTemp [0]; Transform parentPos = GameObject.Find("_characters_pos").transform.GetChild(2); int nbMonsters = 0; for (int i = 0; i < enemyTeam.enemies.Length; i++) { GameObject summonerGO = Instantiate(this.enemyPrefab, parentPos.transform.GetChild(nbMonsters).transform.position, this.transform.rotation, parentPos) as GameObject; GameObject characterInfosGO = Instantiate(this.characterInfosPrefab, this.transform.position, this.transform.rotation) as GameObject; Summoner summonerScript = summonerGO.GetComponent <Summoner> (); CharacterInfosPanel characterInfosScript = characterInfosGO.GetComponent <CharacterInfosPanel> (); summonerGO.transform.localScale = new Vector3(-summonerGO.transform.localScale.x, summonerGO.transform.localScale.y, summonerGO.transform.localScale.z); this.CreateCharacter(summonerScript, enemyTeam.enemies[i]); summonerGO.name = enemyTeam.enemies [i].summonerName; summonerScript.charactersInfosPanel = characterInfosGO; summonerScript.cardTarget = L_Summoners [0]; summonerScript.Init(); characterInfosScript.Init(summonerGO, 3); L_Enemies.Add(summonerGO); nbMonsters += 1; } }
private async Task loading() { AccountInfo account = null; try { account = await JsonSave.LoadPersonalDataFromJson(); //AccountInfo account = new AccountInfo("test",123,23.21,321.1); await Task.Delay(TimeSpan.FromSeconds(2)); } catch { Debug.WriteLine("no account found"); } if (account != null) { Debug.WriteLine("account found"); if (this._contentLoaded) { Debug.WriteLine("loaded"); MyMapLoginScreen.IsEnabled = false; this.Content = null; await Task.Delay(TimeSpan.FromSeconds(1)); Frame.Navigate(typeof(BlankPage1)); } else { Debug.WriteLine("not fully loaded"); loading(); } } }
private async Task buyBuilding(Building building) { int index = buildingList.IndexOf(building); building.GetBuidlingType(); RedrawBuilding(building); buildingList.RemoveAt(index); if (ClickedBuilding.GetBuidlingType().Equals(Building.BuildingType.WonderType)) { buildingList.Add(new Wonder(ClickedBuilding.Name, ClickedBuilding.price, ClickedBuilding.EarningsP_S, ClickedBuilding.Posistion, true)); } else if (ClickedBuilding.GetBuidlingType().Equals(Building.BuildingType.HouseType)) { buildingList.Add(new House(ClickedBuilding.Name, ClickedBuilding.price, ClickedBuilding.EarningsP_S, ClickedBuilding.Posistion, true)); } else if (ClickedBuilding.GetBuidlingType().Equals(Building.BuildingType.MonumentType)) { buildingList.Add(new Monument(ClickedBuilding.Name, ClickedBuilding.price, ClickedBuilding.EarningsP_S, ClickedBuilding.Posistion, true)); } ClickedBuilding = buildingList.Last(); JsonSave.saveBuildingdata(buildingList); }
public void LaunchFight() { CampaignManager.daysToRemove = 1; CampaignManager.goldReward = this.monsterTeam.goldReward; CampaignManager.soulReward = this.monsterTeam.soulReward; CampaignManager.combatEnded = false; CampaignManager.SaveCampaign(); EnemyTeam monsterTeamToFight = new EnemyTeam(); monsterTeamToFight.enemies = new SummonerData[this.monsterTeam.group.Length]; for (int i = 0; i < this.monsterTeam.group.Length; i++) { SummonerData enemyTemp = new SummonerData(); for (int j = 0; j < CampaignManager.L_Enemies.Count; j++) { if (CampaignManager.L_Enemies [j].id == monsterTeam.group [i]) { enemyTemp = CampaignManager.L_Enemies [j]; } } monsterTeamToFight.enemies [i] = enemyTemp; } JsonSave.SaveEnemyTeam(monsterTeamToFight); SceneManager.LoadScene("combat", LoadSceneMode.Single); }
public void LoadFight() { PlayerTeam[] playerTeamTemp = JsonSave.LoadPlayerTeam(); playerTeam = playerTeamTemp [0]; this.LoadSummoners(playerTeamTemp[0].mainSummoner); }
public void PrepareBoss() { CampaignManager.isBossFight = true; CampaignManager.combatEnded = false; CampaignManager.SaveCampaign(); EnemyTeam monsterTeamToFight = new EnemyTeam(); monsterTeamToFight.enemies = new SummonerData[CampaignManager.finalBossTeam.group.Length]; for (int i = 0; i < CampaignManager.finalBossTeam.group.Length; i++) { SummonerData enemyTemp = new SummonerData(); for (int j = 0; j < CampaignManager.L_Enemies.Count; j++) { if (CampaignManager.L_Enemies [j].id == CampaignManager.finalBossTeam.group [i]) { enemyTemp = CampaignManager.L_Enemies [j]; } } monsterTeamToFight.enemies [i] = enemyTemp; } JsonSave.SaveEnemyTeam(monsterTeamToFight); SceneManager.LoadScene("combat", LoadSceneMode.Single); }
public static void LoadEtats() { EtatsData[] etats = JsonSave.LoadEtats(); for (int i = 0; i < etats.Length; i++) { etatsDictionary.Add(etats[i].id, etats[i]); } isEtatsLoaded = true; }
/*public void LoadEtats () * { * EtatCreator etatXML = XMLDeserializer.DeserializeEtat (); * for (int i = 0; i < etatXML.etatsList.Count; i++) { * dictionaryEtats.Add (etatXML.etatsList[i].ID, etatXML.etatsList[i]); * } * }*/ public static void LoadActions() { ActionsData[] actions = JsonSave.LoadActions(); for (int i = 0; i < actions.Length; i++) { actionsDictionary.Add(actions[i].id, actions[i]); } isActionLoaded = true; }
public void LoadSupports() { SupportData[] supports = JsonSave.LoadSupports(); for (int i = 0; i < supports.Length; i++) { L_Supports.Add(supports[i]); //print ("le name du support est : " + L_Supports[i].supportName); } }
private void collectButton_Click(ContentDialog sender, ContentDialogButtonClickEventArgs args) { TimeSpan moneySpan = DateTime.Now - ClickedBuilding.timeLastCollected; int collectMoney = Convert.ToInt32(moneySpan.TotalSeconds * ClickedBuilding.EarningsP_S / 100); account.setEarnings(account.GetEarnings() + collectMoney); ClickedBuilding.timeLastCollected = DateTime.Now; JsonSave.saveBuildingdata(buildingList); }
public void LoadEnemies() { SummonerData[] enemies = JsonSave.LoadEnemies(); for (int i = 0; i < enemies.Length; i++) { L_Enemies.Add(enemies[i]); //print ("le name de lenemy est : " + L_Enemies[i].summonerName); } }
public void LoadSummoners() { SummonerData[] summoners = JsonSave.LoadSummoners(); for (int i = 0; i < summoners.Length; i++) { L_Summoners.Add(summoners[i]); //print ("le name du summoner est : " + L_Summoners[i].summonerName); } }
public void LoadPlayerTeam() { PlayerTeam[] playerTeam = JsonSave.LoadPlayerTeam(); for (int i = 0; i < playerTeam.Length; i++) { T_Player = playerTeam [i]; //print ("l'ID du main summoner est : " + T_Player.mainSummoner); } }
private async void succes() { AccountInfo account = new AccountInfo(NameField.Text, 0, position.Coordinate.Point.Position.Longitude, position.Coordinate.Point.Position.Latitude); //AccountInfo account = new AccountInfo(NameField.Text, 0, 123.0, 123); accountList.Add(account); await JsonSave.SavePersonalDataToJson(accountList); MyMapLoginScreen.IsEnabled = false; this.Content = null; //await Task.Delay(TimeSpan.FromSeconds(1)); Frame.Navigate(typeof(BlankPage1)); }
public static async Task <bool> Test() { Debug.WriteLine("in test"); List <Building> list = FillTest(); StorageFolder localFolder = ApplicationData.Current.LocalFolder; var textFile = await localFolder.TryGetItemAsync("buildingData.json"); if (textFile == null) { JsonSave.saveBuildingdata(list); Debug.WriteLine("File doesn't exist, making new file for buildings"); } return(true); }
public void SaveAsJson() { //string jsonString = SendText.theName + ", " + GameManager.score.ToString() + ", " + GameManager.lives.ToString() + ", " + GameManager.time.ToString(); // Debug.Log(jsonString); JsonSave Save1 = new JsonSave { Saved = List1 }; Save1.Saved.Add(SendText.theName); Save1.Saved.Add(GameManager.score.ToString()); Save1.Saved.Add(GameManager.lives.ToString()); Save1.Saved.Add(GameManager.time.ToString()); string json = JsonUtility.ToJson(Save1); Debug.Log(json); }
public void GenerateCharactersPopup() { SummonerData[] summoners = JsonSave.LoadSummoners(); SummonerData[] enemies = JsonSave.LoadEnemies(); SupportData[] supports = JsonSave.LoadSupports(); for (int i = 0; i < summoners.Length; i++) { GameObject summonerElementTemp = Instantiate(this.characterElementPrefab, this.transform.GetChild(2).position, this.transform.rotation, this.transform.GetChild(2).GetChild(0)) as GameObject; PopupElement summonerElementScript = summonerElementTemp.GetComponent <PopupElement> (); summonerElementTemp.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("character_avatars/" + summoners [i].idAvatar); summonerElementTemp.transform.GetChild(1).GetComponent <Text> ().text = summoners [i].summonerName; summonerElementTemp.name = summoners [i].summonerName; summonerElementScript.summoner = summoners [i]; summonerElementScript.characterType = 1; summonerElementScript.characterId = summoners [i].id; } for (int i = 0; i < enemies.Length; i++) { GameObject summonerElementTemp = Instantiate(this.characterElementPrefab, this.transform.GetChild(2).position, this.transform.rotation, this.transform.GetChild(2).GetChild(0)) as GameObject; PopupElement summonerElementScript = summonerElementTemp.GetComponent <PopupElement> (); summonerElementTemp.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("character_avatars/" + enemies [i].idAvatar); summonerElementTemp.transform.GetChild(1).GetComponent <Text> ().text = enemies [i].summonerName; summonerElementTemp.name = enemies [i].summonerName; summonerElementScript.summoner = enemies [i]; summonerElementScript.characterType = 3; summonerElementScript.characterId = enemies [i].id; } for (int i = 0; i < supports.Length; i++) { GameObject summonerElementTemp = Instantiate(this.characterElementPrefab, this.transform.GetChild(2).position, this.transform.rotation, this.transform.GetChild(2).GetChild(0)) as GameObject; PopupElement summonerElementScript = summonerElementTemp.GetComponent <PopupElement> (); summonerElementTemp.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("character_avatars/" + supports [i].idAvatar); summonerElementTemp.transform.GetChild(1).GetComponent <Text> ().text = supports [i].supportName; summonerElementTemp.name = supports [i].supportName; summonerElementScript.support = supports [i]; summonerElementScript.characterType = 2; summonerElementScript.characterId = supports [i].id; } }
public void EndCombat() { if (CampaignManager.isCampaignGenerated == true) { playerTeam.mainSummoner.pv = L_Summoners [0].GetComponent <Summoner> ().pv; playerTeam.mainSummoner.L_etats.Clear(); for (int i = 0; i < playerTeam.supports.Length; i++) { playerTeam.supports [i].L_etats.Clear(); } CampaignManager.combatEnded = true; if (CampaignManager.isBossFight || this.isLost) { CampaignManager.isCampaignGenerated = false; JsonSave.SaveCampaign(); JsonSave.SavePlayerTeam(playerTeam); StartCoroutine(this.GetComponent <UiManager> ().ShowBlackScreen()); Invoke("LoadMainMenuScene", 0.5f); } else { JsonSave.SaveCampaign(); JsonSave.SavePlayerTeam(playerTeam); StartCoroutine(this.GetComponent <UiManager> ().ShowBlackScreen()); Invoke("LoadCampaignScene", 0.5f); } } else { playerTurn = 0; StopCoroutine(this.turnCoroutine); this.RemoveCharacters(); GameObject.Find("_HAND").GetComponent <CardsInHandPanel> ().EndCombat(); this.changeTurnButtonState = true; this.changeTurnButton.SetActive(false); Invoke("LoadEditorScene", 0.5f); } }
public void LoadSoundList() { string soundListPath = Path.Combine(Application.persistentDataPath, selectedLoadFileName + defaultSoundListExtension); if (File.Exists(soundListPath)) { soundList = (SoundList)JsonSave <SoundList> .Load(soundListPath); if (soundList != null) { RefreshAddMode(); HideEditMode(); if (!isEditMode) { SetupPlayMode(); } audioClips = new AudioClip[12]; StartCoroutine(GetAudioClips()); HideLoadPanel(); } } }
public async Task GetJsonBuildings() { try { //Get buildings from json buildingList = await JsonSave.getBuildingList(); //Add home location from json account = await JsonSave.LoadPersonalDataFromJson(); BasicGeoposition position = new BasicGeoposition(); position.Latitude = account.getLatitude(); position.Longitude = account.getLongitude(); buildingList.Add(new Home("Home", 0, 123, position, true)); account.setEarnings(9000000); } catch (Exception) { //Test(); //GetJsonBuildings(); } DrawBuildingList(buildingList); }
public static void Load() { saveData = new JsonSave(); folderPath = Path.Combine(Directory.GetCurrentDirectory(), "ServerSave"); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } filePath = Path.Combine(folderPath, "Save.json"); if (File.Exists(filePath)) { try { jsonSave = File.ReadAllText(filePath); saveData = JsonConvert.DeserializeObject <JsonSave>(jsonSave); } catch (Exception) { string filePathOld = Path.Combine(folderPath, "Save_Old.json"); if (File.Exists(filePathOld)) { try { jsonSave = File.ReadAllText(filePathOld); saveData = JsonConvert.DeserializeObject <JsonSave>(jsonSave); } catch (Exception) { Debug.LogError("Files corrupted", true); } } } } }
public void SaveSoundList() { if (selectedSaveFileName.Length > 0) { string savePath = Path.Combine(Application.persistentDataPath, selectedSaveFileName + defaultSoundListExtension); if (File.Exists(savePath)) { // ask user if he wants to overwrite using the confirmation panel Debug.Log("File exists"); } else { // place save call here } // save here for now, or we won't be able to override lists JsonSave <SoundList> .Save(soundList, savePath); HideSavePanel(); } else { // show error that a name has to be entered } }
public static void LoadCampaign() { Campaign campaignTemp = JsonSave.LoadCampaign(); gold = campaignTemp.gold; soul = campaignTemp.soul; day = campaignTemp.day; actionDone = campaignTemp.actionDone; combatEnded = campaignTemp.combatEnded; isBossFight = campaignTemp.isBossFight; isEditor = false; isCampaignGenerated = campaignTemp.isCampaignGenerated; goldReward = campaignTemp.goldReward; soulReward = campaignTemp.soulReward; daysToRemove = campaignTemp.daysToRemove; bossTeamId = campaignTemp.bossTeamId; monstersAvailableId = campaignTemp.monstersAvailableId; cardsAvailableId = campaignTemp.cardsAvailableId; finalBossTeam = L_bossTeams [bossTeamId]; for (int i = 0; i < monstersAvailableId.Length; i++) { monstersAvailable [i] = L_campaignTeams [monstersAvailableId[i]]; } for (int i = 0; i < cardsAvailableId.Length; i++) { ActionsData actionTemp = DictionaryManager.GetAction(cardsAvailableId[i]); int priceMin = actionTemp.price - ((actionTemp.price * 20) / 100); int priceMax = actionTemp.price + ((actionTemp.price * 20) / 100); actionTemp.price = Random.Range(priceMin, priceMax); cardAvailable [i] = actionTemp; } }
public static void LoadData() { if (DictionaryManager.isActionLoaded == false) { DictionaryManager.LoadActions(); } if (DictionaryManager.isEtatsLoaded == false) { DictionaryManager.LoadEtats(); } SummonerData[] summoners = JsonSave.LoadSummoners(); for (int i = 0; i < summoners.Length; i++) { L_Summoners.Add(summoners[i]); } SummonerData[] enemies = JsonSave.LoadEnemies(); for (int i = 0; i < enemies.Length; i++) { L_Enemies.Add(enemies[i]); //print ("le name de lenemy est : " + L_Enemies[i].summonerName); } SupportData[] supports = JsonSave.LoadSupports(); for (int i = 0; i < supports.Length; i++) { L_Supports.Add(supports[i]); //print ("le name du support est : " + L_Supports[i].supportName); } L_bossTeams = JsonSave.LoadBossTeam(); L_campaignTeams = JsonSave.LoadMonsterTeam(); }
private async void button1_Click(object sender, RoutedEventArgs e) { AccountInfo loadedAccountInfo = await JsonSave.LoadPersonalDataFromJson(); outputBox.Text = loadedAccountInfo.ToString(); }
public void LoadEnemyTeam() { EnemyTeam[] enemyTeam = JsonSave.LoadEnemyTeam(); T_Enemy = enemyTeam [0]; //print ("l'ID du monstre est : " + T_Enemy.enemies[0]); }
public void SaveSummoners() { JsonSave.SavePlayerTeam(T_Player); JsonSave.SaveEnemyTeam(T_Enemy); }