public void Start() { gameState.SetStartTime(DateTime.Now); Gamer.WriteGameLog("Starting the game. Played by " + gameState.GetPlayedBy() + "."); GameTimeCycle(); // Take the snapshot when the game is starting. Can be used when the // player loses in the first level. gameSaveSnapshots.SetSnapshot(gameSaver.SaveGame(gameState)); playThread.Start(); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var gameSaver = new GameSaver(gameboard.GetElementsCollection(), engine.Players, engine.CurrentPlayer, NumberOfTurns); gameSaver.SaveGame(); }
public void SaveLevel() { if (fileNum == null) { fileNum = "test"; } gameSaver.SaveGame(fileNum); }
private void SaveGame() { if (inputField.text.Length == 0) { return; } gameSaver.SaveGame(inputField.text); menuController.CloseMenu(); }
public void AdvanceTime() { gameSaver.SaveGame(); if (!sunUp) { day++; dayOfWeek++; if (dayOfWeek > 7) { dayOfWeek = 1; for (int i = 0; i < cityList.Count; ++i) { playerCity.GetComponent <City>().CollectFromVillages(); cityList[i].CollectFromVillages(); } for (int i = 0; i < villageList.Count; ++i) { villageList[i].UpdatePopulation(); } } } //player city takes turn playerCity.GetComponent <City>().TakeTurn(); //other cities take turns for (int i = 0; i < cityList.Count; ++i) { cityList[i].TakeTurn(); } playerCity.GetComponent <City>().RemoveIfDestroyed(); for (int i = 0; i < cityList.Count; ++i) { cityList[i].RemoveIfDestroyed(); } uiBank.selectedTile.SimulateMouseClick(); //Time Stuff uiBank.weekText.text = dayOfWeek.ToString() + "/7"; uiBank.dayText.text = "DAY " + day.ToString(); sunUp = !sunUp; uiBank.munText.text = playerCity.GetComponent <City>().muns.ToString(); uiBank.foodText.text = playerCity.GetComponent <City>().food.ToString(); uiBank.selectedTile.SelectTile(); //MUST HAPPEN LAST }
public void DoStuffWhenButtonIsClicked(int buttonID) { // activate the back to inbox button CreditCardGameController.b.gameObject.SetActive(true); //set the new savings amount based on which button was clicked // the new savings amount is actually the amount that will be in the player's //account after six months based on their choices in this scene if (buttonID == 1) { newSavingsAmount = (currentSavingsAmount + (earningsOverSixMonths)) - priceOfPurchasedItem - ExtraChargesDueToMinPayment(priceOfPurchasedItem, minPayment, creditCardInterestFactor); } if (buttonID == 2) { newSavingsAmount = currentSavingsAmount + earningsOverSixMonths - priceOfPurchasedItem; } // update the savings amount text newSavingsText.text = "Your new projected savings for next 6 months: " + newSavingsAmount; Debug.Log("Current savings amount is: " + currentSavingsAmount); Debug.Log("New savings amount is: " + newSavingsAmount); // create a dictionary solely for the attributes that were changed in this scene Dictionary <PlayerAttributeEnums, object> attributesToSave = new Dictionary <PlayerAttributeEnums, object>(); // add only those attributes that were changed in this scene attributesToSave.Add(PlayerAttributeEnums.currentSavingsAmount, newSavingsAmount); // call the method from the "SaveGame" Class and pass the dictionary of modified attributes as // parameter gs.SaveGame(attributesToSave); /* * // this is just a test to see if the dictionaries for scenes 0 and 1 hold the same values or not * // ideally, there is only one value different : current savings amount and the following * // print statement must return exactly one "false". This test passes. * foreach (object key in PersistentManagerScript.sceneToPlayerAttributesMap[0].Keys) * { * Debug.Log(PersistentManagerScript.sceneToPlayerAttributesMap[0][key].Equals(PersistentManagerScript.sceneToPlayerAttributesMap[1][key])); * } */ }
public void SaveGame() { GameSaver.SaveGame(CurrentBank, StartingBank, startingDeck, cardOfferPool, turn, score, gameCount, level, masterDeckList, Deck.Cards, cardShopT1, cardShopT2, cardShopT3, cardLockedT1, cardLockedT2, cardLockedT3, redCost1, blueCost1, yellowCost1, coinCost1, screen); }
public void SaveGame() { GameSaver.SaveGame(); pauseMenuUI.SetActive(false); saveGameUI.SetActive(true); }
public void SaveQuit() { GameSaver.SaveGame(); Application.Quit(); }
public void SaveGame() { GameSaver.SaveGame(World, "game"); }
public void SaveGo() { GameSaver.SaveGame(); Time.timeScale = 1f; SceneManager.LoadScene("Main Menu"); }
public void TakeCommand(string rawString) { currentMode = Command.none; string cmdString = rawString.ToLower(); foreach (string word in cmdString.Split(' ')) { if (currentMode == Command.none) { switch (word) { case "echo": currentMode = Command.echo; break; case "load": case "loadscene": currentMode = Command.loadScene; break; case "takedamage": case "dmg": currentMode = Command.takeDamage; break; case "spendmana": case "lmana": currentMode = Command.spendMana; break; case "save": GameSaver.SaveGame(); return; case "name": Debug.Log("Player name is :" + GameSaver.liveSave.playerName); return; case "freeze": WaterTileObject[] water = Resources.FindObjectsOfTypeAll <WaterTileObject> (); Debug.Log("Freezing " + water.Length + " water objects."); for (int i = 0; i < water.Length; i++) { water [i].Freeze(); } return; case "setflag": case "set": case "kill": //in the context of killing bosses. If more flags end up being settable with this command it'll make less sense currentMode = Command.setFlag; break; case "loadinv": case "linv": inv.LoadInventory(string.Empty); // set to empty to load from pref return; case "saveinv": case "sinv": inv.SaveInventory(); return; case "godmode": case "god": player.isInvincible = !player.isInvincible; player.infiniteMana = !player.infiniteMana; Debug.Log("Toggling God Mode. Now " + (player.infiniteMana ? "enabled." : "disabled.")); return; case "addkey": case "key": player.hasKeys++; return; case "addmoney": case "coins": currentMode = Command.addMoney; break; case "demo": Debug.Log("Entering demo mode."); //god mode player.isInvincible = true; //can be toggled off with godmode player.infiniteMana = true; //access all dungeons GameSaver.liveSave.watertutorialpoint = true; GameSaver.liveSave.firetutorialpoint = true; GameSaver.liveSave.mazetutorialpoint = true; //add a buncha money player.coins = 99999; player.GetComponentInChildren <CoinScript> ().SetText(); return; default: Debug.Log("Error: '" + word + "' is not a recognzed command."); return; } continue; } //we've received a multi-word command, time to execute based on the following word switch (currentMode) { case Command.echo: Debug.Log(word); return; case Command.loadScene: DevLoadLevel(word); return; case Command.takeDamage: gameObject.SendMessageUpwards("TakeDamage", Int32.Parse(word, NumberStyles.AllowLeadingSign)); break; case Command.spendMana: gameObject.SendMessageUpwards("SpendMana", Int32.Parse(word, NumberStyles.AllowLeadingSign)); break; case Command.addMoney: player.coins += Int32.Parse(word, NumberStyles.AllowLeadingSign); player.GetComponentInChildren <CoinScript> ().SetText(); break; case Command.setFlag: switch (word) { case "boss0": case "fire_boss": GameSaver.liveSave.bossKilled [0] = true; break; case "boss1": case "water_boss": GameSaver.liveSave.bossKilled [1] = true; break; case "boss2": case "maze_boss": case "final_boss": GameSaver.liveSave.bossKilled [2] = true; break; case "watertut": GameSaver.liveSave.watertutorialpoint = true; break; case "firetut": GameSaver.liveSave.firetutorialpoint = true; break; case "mazetut": GameSaver.liveSave.mazetutorialpoint = true; break; } break; //break setflag case default: Debug.Log("The dev console reached a stage it shouldn't. pls to fix"); break; } } }