public void LoadGame() { string content = SaveAndLoad.Load(); PlayerData player = JsonUtility.FromJson <PlayerData>(content); PlayerController.gameObject.transform.position = player.position; }
public void SpawnImage(int num) { gameObject1 = Instantiate(tiles[num], rt.transform); gameObject1.transform.SetParent(rt.transform); saveAndLoad.Load(); listTiles = gameObject1.GetComponent <ListTiles>(); }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 30), showDebug? "Hide Debug" : "Show Debug")) { showDebug = !showDebug; } if (showDebug) { if (GUI.Button(new Rect(10, 50, 120, 30), "Clear Saved Data")) { SaveAndLoad.ClearData(); SaveAndLoad.Load(); } barrelsBeatStr = GUI.TextField(new Rect(10, 90, 70, 20), barrelsBeatStr); if (GUI.Button(new Rect(90, 90, 40, 30), ">>")) { barrelsBeat = int.Parse(barrelsBeatStr); initialBarrelsBeat = barrelsBeat; } GUI.Label(new Rect(Screen.width - 100, 80, 500, 30), "-- Info -- "); GUI.Label(new Rect(Screen.width - 100, 100, 500, 30), "Curr Barrel: " + (barrels.IndexOf(barrelHolingPlayer) + 1)); GUI.Label(new Rect(Screen.width - 100, 120, 500, 30), "Prev Barrel: " + (barrels.IndexOf(prevBarrelHoldingPlayer) + 1)); GUI.Label(new Rect(Screen.width - 100, 140, 500, 30), "Lst N of JB: " + lastBarrelsJumped.Count); GUI.Label(new Rect(Screen.width - 100, 160, 500, 30), "Game TIme: " + Mathf.Floor(Time.realtimeSinceStartup)); GUI.Label(new Rect(Screen.width - 100, 180, 500, 30), "Barrls Beat: " + barrelsBeat); GUI.Label(new Rect(Screen.width - 100, 200, 500, 30), "Record: " + DifficultyManager.barrelsBeatRecord); GUI.Label(new Rect(Screen.width - 100, 220, 500, 30), "Difficulty: " + DifficultyManager.currentDifficulty); GUI.Label(new Rect(Screen.width - 100, 240, 500, 30), "CurrB Diff: " + (barrelHolingPlayer ? "" + barrelHolingPlayer.GetComponent <Barrel>().difficulty : "N/A")); } }
public void OnClickLButton() { int num = 0; GameObject Button = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject; switch (Button.transform.name) { case "L0Button": num = 0; break; case "L1Button": num = 1; break; case "L2Button": num = 2; break; case "L3Button": num = 3; break; } SaveAndLoad S = new SaveAndLoad(); S.Load(num); }
void Start() { // Load past highscore data SaveAndLoad.Load(); score.text = "SCORE: " + PlayerStats.LastScore.ToString(); highscore.text = "HIGHSCORE: " + PlayerStats.Highscore.ToString(); }
private void Awake() { if (SaveAndLoad.SaveExists(DICTIONARY)) { _circuitsNameDictionary = SaveAndLoad.Load <Dictionary <string, string> >(DICTIONARY); } }
// Start is called before the first frame update private void Awake() { //Only if gameManager is null, we init all if it is the first game and then load if there is //some data saved before if (gameManagerInstace == null) { gameManagerInstace = this; DontDestroyOnLoad(gameObject); string myPath = "Assets/Resources/Maps"; DirectoryInfo dir = new DirectoryInfo(myPath); FileInfo[] info = dir.GetFiles("*.txt"); _levels = new Level[info.Length]; _levels[0] = new Level(false, false, false, false); for (int i = 1; i < _levels.Length; i++) { _levels[i] = new Level(false, false, false, true); } _ruby = 100; _nRayPowerUp = 2; SaveAndLoad.Load(); } if (!Advertisement.isInitialized) { Advertisement.Initialize("2988623", true); } }
// Use this for initialization void Start() { terr = Terrain.activeTerrain; float[,] orgTerrain = terr.terrainData.GetHeights(0, 0, terr.terrainData.heightmapResolution, terr.terrainData.heightmapResolution); for (int x = 0; x < terr.terrainData.heightmapResolution; x++) //^^ Gets current terrain data. { for (int y = 0; y < terr.terrainData.heightmapResolution; y++) //Loops through every value. { orgTerrain[x, y] = 0; //Sets the height to zero. } } terr.terrainData.SetHeights(0, 0, orgTerrain); //Applies the changes. if (!World.newWorld) { sal.Load(World.name); //Load Objects if (sal.isOldFile) { List <string> s = new List <string>(); s.Add("Continue"); s.Add("Exit to Main Menu"); WindowUI wui = new WindowUI(WindowImage.WARNING, WindowType.YES_NO, s, "Pre Alpha 1.6 Version", "It looks like you are loading a world from a version of the game before Alpha 1.6. Would you like to continue loading the world and update it to the new format?", false, 4, ExitDefault.CLOSEOPERATION); wui.Display(); } forLoop(sal.obj); //Spawn in objects. } if (sal.loadHeights != null) //Checks if there is any heightmap stored. { terr.terrainData.SetHeights(0, 0, sal.loadHeights); //Load heights. } }
public void LoadCharacter() { SaveAndLoad.Load(); if (SaveAndLoad.savedGames.Count > 0) { charLoadPanel.SetActive(true); loadCharList = new GameObject[SaveAndLoad.savedGames.Count]; for (int i = 0; i < SaveAndLoad.savedGames.Count; i++) { loadCharList[i] = Instantiate(characterPanelPF, charLoadContent.transform); loadCharList[i].GetComponentInChildren <Text>().text = SaveAndLoad.savedGames[i].GROUP[0].pcName + " the " + SaveAndLoad.savedGames[i].GROUP[0].pcType; int x = i; // This fixes the Closure problem. loadCharList[i].GetComponent <Button>().onClick.AddListener(() => ClickOnLoadCharacterPanel(x)); loadCharList[i].GetComponent <DeleteCharacterButton>().ButtonIndex = i; if (SaveAndLoad.savedGames[i].GROUP[0].pcStatus != "Ready") { loadCharList[i].SetActive(false); } } } else { NavigateToCreateCharacter(); } }
// Start is called before the first frame update void Start() { saveAndLoad = new SaveAndLoad(); if (saveAndLoad.Load()) { player.Credit = saveAndLoad.Credit; } else { player.Credit = STARTING_CREDIT; } deck.BuildDeck(); deck.ShuffleDeck(); allChips.MakeChips(); player.ResetHand(); handResultsText = new List <Text>(); betChips = new List <Chip>(); creditText.text = ConvertToDollars(player.Credit); canBet = true; standButton.gameObject.SetActive(false); splitButton.gameObject.SetActive(false); hitButton.gameObject.SetActive(false); doubleButton.gameObject.SetActive(false); gameOverImage.gameObject.SetActive(false); betButton.gameObject.SetActive(false); redoBetButton.gameObject.SetActive(false); }
private void Start() { if (!PlayerPrefs.HasKey("Dibujado")) { if (fc != null) { fc.ExecuteBlock("Intro"); PlayerPrefs.SetInt("Dibujado", 1); } } else { if (fc != null) { PlayerPrefs.SetInt("Dibujado", PlayerPrefs.GetInt("Dibujado") + 1); } } followCamera.enabled = false; zenitalCamera.enabled = true; cameraBrain.m_DefaultBlend = cameraDefinition; if (SaveAndLoad.SaveExists(DICTIONARY)) { _circuitsNameDictionary = SaveAndLoad.Load <Dictionary <string, string> >(DICTIONARY); } }
void OnEnable() { SaveAndLoad.Load(); speedSlider.value = CurrentData.gameData.blockSpeed; windowModeToggle.isOn = CurrentData.gameData.isFullscreen; ShowTipsEveryGame.isOn = CurrentData.gameData.showTipsEveryGame; volumeSlider.value = CurrentData.gameData.volume; }
public void clearAllData() { SaveAndLoad.Delete(); SaveAndLoad.Load(); GameObject.Find("High Score Text").GetComponent <Text>().text = "High Score: " + CurrentData.gameData.highScore + "Ft"; GameObject.Find("Total Blocks Placed Text").GetComponent <Text>().text = "Total Blocks Placed: " + CurrentData.gameData.totalBlocksPlaced; GameObject.Find("Total Blocks Lost Text").GetComponent <Text>().text = "Total Blocks Lost: " + CurrentData.gameData.totalBlocksLost; }
private void Awake() { SaveAndLoad.Load(); statsUI.SetActive(true); GameObject.Find("High Score Text").GetComponent <Text>().text = "High Score: " + CurrentData.gameData.highScore + "Ft"; GameObject.Find("Total Blocks Placed Text").GetComponent <Text>().text = "Total Blocks Placed: " + CurrentData.gameData.totalBlocksPlaced; GameObject.Find("Total Blocks Lost Text").GetComponent <Text>().text = "Total Blocks Lost: " + CurrentData.gameData.totalBlocksLost; statsUI.SetActive(false); }
// Start is called before the first frame update void Start() { numSeen = SaveAndLoad.Load().numSeen; numShiny = SaveAndLoad.Load().numShiny; numMissed = SaveAndLoad.Load().numMissed; resetNotPokemon(); notAPokemonNintendoPleaseDontSue.GetComponent <SpriteRenderer>().sprite = chars[notPokemonHunting - 1]; notAPokemonNintendoPleaseDontSue.GetComponent <SpriteRenderer>().color = new Color(0, 0, 0); }
public void LoadGameScene() { SaveAndLoad.Load(); Time.timeScale = 1.0f; GameData.team1coins = 0; GameData.team2coins = 0; GameData.team1Skips = 3; GameData.team2Skips = 3; SceneManager.LoadScene("Main"); }
private void Start() { if (score == null) { score = GameObject.FindObjectOfType <Scores>(); } if (saveandload == null) { saveandload = GameObject.FindObjectOfType <SaveAndLoad>(); } SaveAndLoad.Load(); }
void LoadGame() { SetVisible(false); EventManager.ExecuteEvent(EventType.NewGameStart); SaveAndLoad.Load(); ModelManager.Get <GameLevelModel>("GameLevelModel").SetAIRole(); ViewManager.Get("WndPrepare").SetVisible(true); ViewManager.Get("WndCooper").SetVisible(true); }
public void LoadPlayer() { PlayerData data = SaveAndLoad.Load(); Vector3 position; position.x = data.position[0]; position.y = data.position[1]; position.z = data.position[2]; transform.position = position; }
void LoadLevelsFromSave() { SaveAndLoad.Load(); levelsData = GameSave.current.levels; statsData = GameSave.current.stats; optionsData = GameSave.current.options; //Create new if not existing if (levelsData == null) { levelsData = new LevelsData(); } if (statsData == null) { statsData = new StatsData(); } if (optionsData == null) { optionsData = new OptionsData(); } //Get Levels from old data. Should support adding more levels (savefile with less levels than currently) List <Level> newLevelList = new List <Level>(); for (int i = 0; i < worldList_par.Count; ++i) { for (int j = 0; j < worldList_par[i].Count; ++j) { Level previousLevelData = PopLevelInList(levelsData.levelList, i + 1, j); if (previousLevelData != null) { newLevelList.Add(new Level(GetLevelID(i + 1, j), previousLevelData.unlocked, previousLevelData.completed, previousLevelData.completedPar, previousLevelData.bestMoveScore)); //Debug.Log("world" + (i + 1) + " level " + (j) + " found. Completed : " + previousLevelData.completed + " completedPar : " + previousLevelData.completedPar + " unlocked : " + previousLevelData.unlocked); } else { newLevelList.Add(new Level(GetLevelID(i + 1, j))); } newLevelList[newLevelList.Count - 1].SetPar(worldList_par[i][j]); } } levelsData.levelList = newLevelList; GameSave.current.levels = levelsData; GameSave.current.stats = statsData; GameSave.current.options = optionsData; //Debug.Log("Chaos Shown :" + statsData.notif_chaos_shown + " Chaos Time : " + statsData.notif_chaos_time); SaveAndLoad.Save(); }
void ButtonSetUp() { sl.GetSaveData(); if (saveButtons == null) { saveButtons = new GameObject[10]; for (int i = 0; i < saveButtons.Length; i++) { saveButtons[i] = GameObject.Instantiate(saveButtonPref, saveButtonPer.transform); int n = i; saveButtons[i].GetComponent <Button>().onClick.AddListener(() => { title.SelectSaveData(n); }); } } for (int i = 0; i < saveButtons.Length; i++) { saveButtons[i].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "セーブデータ" + (i + 1); SaveData sd = sl.Load(i); if (sd != null) { saveButtons[i].transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = sd.time.year + "年 " + sd.time.SeasonToStr + " " + sd.time.day + "日 <br>" + sd.time.hour + "時 " + sd.time.minit.ToString("0") + "分 "; saveButtons[i].transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = (sd.money / 1000000000000 != 0 ? sd.money % 10000000000000000 / 1000000000000 + "兆" : "") + (sd.money % 1000000000000 / 100000000 != 0 ? sd.money % 1000000000000 / 100000000 + "億<br>" : "") + (sd.money % 100000000 / 10000 != 0 ? sd.money % 100000000 / 10000 + "万" : "") + (sd.money % 10000 != 0 ? (sd.money % 10000).ToString() : "") + "株"; } else { saveButtons[i].transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = "から"; saveButtons[i].transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = ""; } } }
public void LevelWinCondition() { if (TotalSeedlings == points && playOnce && SaveAndLoad.Load() < 4) { AudioSource Song = GetComponent <AudioSource>(); Song.PlayOneShot(Sound, .1f); CompleteScreen.ToggleLevelComplete(); playOnce = false; } else if (TotalSeedlings == points && playOnce) { SaveAndLoad.Save(0); Credits.ToggleLevelComplete(); } }
//First thing called void Awake() { if (GAME == null) { GAME = this; DontDestroyOnLoad(GAME); Initilize(); if (SceneManager.GetActiveScene().name == "ThelmoreTown") { SaveAndLoad.Load(); SaveGame.current = SaveAndLoad.savedGames[0]; } } else { Destroy(this); } }
void Init() { foreach (var pair in item_Dict) { if (SaveAndLoad.Load(pair.Key) == "读取失败!") { return; } for (int i = 1; i <= Convert.ToInt32(SaveAndLoad.Load(pair.Key)); i++) { pair.Value.Count = Convert.ToInt32(SaveAndLoad.Load(pair.Key)); var item_Img = UIManager.Instance.CreatComItem <Com_Item>(rectTran); item_Img.rDataName = pair.Key; var image = item_Img.gameObject.transform.Find("Tran_DragPoint/Img_drag").GetComponent <Image>(); SetImgSprit(image, pair.Value.Label); } } }
// Use this for initialization void Start() { WarningImage.SetActive(false); if (score == null) { score = GameObject.FindObjectOfType <Scores>(); } if (saveandload == null) { saveandload = GameObject.FindObjectOfType <SaveAndLoad>(); } SaveAndLoad.Load(); //show values if (SpeedComplited) { SpeedText.text = "COMPLETED"; } else { SpeedText.text = "PAY " + SpeedCost + " and upgrade for more Slow PowerUp time"; } if (ShieldComplited) { ShieldText.text = "COMPLETED"; } else { ShieldText.text = "PAY " + ShieldCost + " and upgrade for more Shield PowerUp time"; } if (MagnetComplited) { MagnetText.text = "COMPLETED"; } else { MagnetText.text = "PAY " + MagnetCost + " and upgrade for more Magnet PowerUp time"; } }
public void LoadTitleScene() { if (GameData.isTutorial == true) { GameData.isTutorial = false; } Time.timeScale = 1.0f; GameData.team1coins = 0; GameData.team2coins = 0; if (SceneManager.GetActiveScene().name == "Store Scene") { SaveAndLoad.save(); } SceneManager.LoadScene("Title"); SaveAndLoad.Load(); }
public void LoadSceneWithName() { SaveAndLoad.Load(); if (selectGameMode == GameMode.PassAndPlay) { GameData.namesExist = false; } if (CurrentData.gameData.showTipsEveryGame) { CurrentData.gameData.isFirstTime = true; } else { CurrentData.gameData.isFirstTime = false; } Time.timeScale = 1.0f; GameData.selectedMode = selectGameMode; SceneManager.LoadScene(nameOfSceneToLoad); }
// Start is called before the first frame update void Start() { numSeen = SaveAndLoad.Load().numSeen; numShiny = SaveAndLoad.Load().numShiny; numMissed = SaveAndLoad.Load().numMissed; updateChar(topChar + charSelected - 1); cursorSound = upArrow.GetComponent <AudioSource>(); int seenTotal = 0; int shinyTotal = 0; int missedTotal = 0; for (int i = 0; i < numSeen.Length; i++) { seenTotal += numSeen[i]; shinyTotal += numShiny[i]; missedTotal += numMissed[i]; } globalNumbers.text = "Seen: " + seenTotal + ", Shinies Caught: " + shinyTotal + ", Shinies Missed: " + missedTotal; }
void OnGUI() { GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); GUILayout.Box("Guidance"); GUILayout.Space(10); if (SaveAndLoad.Load() == -1) { GUILayout.Box("You have no saves!"); } else { GUILayout.Box("Pick a Save!"); GUILayout.Space(10); if (GUILayout.Button("Stage number: " + (SaveAndLoad.Load() - 1))) { SceneManager.LoadScene(SaveAndLoad.Load()); } } GUILayout.Space(10); if (GUILayout.Button("Quit")) { SceneManager.LoadScene(0); } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); }
public void initSaveGame() { SaveAndLoad.savedGames = new List <Game>(); SaveAndLoad.Load(); if (SaveAndLoad.savedGames.Count > 0) { SaveAndLoad.selectedIndex = 0; /*foreach(RankRow r in SaveAndLoad.savedGames[SaveAndLoad.selectedIndex].ranking) * { * Debug.Log(r.alias + " " + r.points.ToString()); * } * Debug.Log("Tutorial hecho:" + SaveAndLoad.savedGames[SaveAndLoad.selectedIndex].tutorialed);*/ } else { Debug.Log("Sin archivo de guardado"); SaveAndLoad.savedGames.Add(new Game()); } }
static void loadCustomers() { Console.WriteLine("Are you sure you want to load a saved customer list?\nThis will delete the current list. Y/N"); if (confirm()) { Console.WriteLine("Loading...\n"); try { SaveAndLoad load = new SaveAndLoad("customer_list.sav"); customerList = load.Load<SavingsAccount>(); Console.WriteLine("Load successful!\n"); } catch { Console.WriteLine("There does not seem to be a valid saved customer list."); } } Console.WriteLine("Press any key to return to the menu..."); Console.ReadKey(); }