private void Start() { if (SaveLoad.SaveExists("preferences")) { // Charger les preferences du joueur (sauvegarde dans un fichier local) preferences = SaveLoad.Load <Dictionary <string, string> >("preferences"); isFullScreen = Utils.ConvertStringToBoolean(preferences["isFullScreen"]); music = Utils.ConvertStringToFloat(preferences["music"]); soundsEffect = Utils.ConvertStringToFloat(preferences["soundsEffect"]); } if (audioMixer != null) { audioMixer.SetFloat("Music", music); audioMixer.SetFloat("SoundsEffect", soundsEffect); } if (fullScreenToggle != null) { fullScreenToggle.isOn = isFullScreen; } if (musicVolumeSlider != null) { musicVolumeSlider.value = music; } if (soundsEffectVolumeSlider != null) { soundsEffectVolumeSlider.value = soundsEffect; } Screen.fullScreen = isFullScreen; if (Screen.fullScreen) { Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen; } else { Screen.fullScreenMode = FullScreenMode.Windowed; } }
static void OnBeforeSceneLoadRuntimeMethod() { //SaveLoad.FilePath: where we save our game //if running game on Unity editor if (Application.isEditor) { SaveLoad.FilePath = System.IO.Path.Combine(Application.dataPath, "Resources/save.txt"); } else { SaveLoad.FilePath = System.IO.Path.Combine(Application.persistentDataPath, "save.txt"); } //If the user has already saved his game progress, we overwrite myPlayer with his game progress if (File.Exists(SaveLoad.FilePath)) { SaveLoad.Load(); } }
public void LoadGame() { int oldDataCount = 0; // if savegame exist load it if (SaveLoad.Find()) { oldDataCount = SaveLoad.Load(debugText); } CreateOrEditSave(oldDataCount); if (Application.isPlaying) { CorrectHungerLevel(); UpdateAffectionLvl(); UpdateSatisfaction(); } }
public void GameStart() { if (SaveLoad.HasSave()) { bool successed = SaveLoad.Load(); if (successed) { GameManager.gm.SetSE((int)SE.SEType.Click_Cute); SceneManager.LoadScene("ChooseStages"); } else { SetGameNameBox.SetActive(true); } } else { SetGameNameBox.SetActive(true); } }
// Use this for initialization void Start() { // Get references to buildable tiles. buildableTiles = FindObjectsOfType(typeof(BuildableTile)) as BuildableTile[]; // Update UI elements. uiCanvas.UpdateLivesText(playerLives); // Get a reference to the currency managers. persistentCurrencyManager = PersistentCurrencyManager.instance; // Get a reference to the audio manager. audioManager = FindObjectOfType <AudioManager>(); // Initialize session currency. sessionCurrencyManager.SetSessionCurrency(startingSessionCurrency); // Load the saved game state (useful for running the game directly through the main scene). SaveLoad.Load(); }
void Start() { uIController = GetComponent <UIController>(); player = SaveLoad.Load(); if (!player) { //Si no existe cargamos el player del resources player = Resources.Load("Prefabs/Players/player") as GameObject; } // Instanciamos el player en la escena playerClone = Instantiate(player, new Vector3(-0.45f, -2.5f, 0f), new Quaternion()); playerClone.GetComponent <PlayerController>().setFunctional(false); Destroy(playerClone.GetComponent <Rigidbody2D>()); playerClone.transform.localScale = playerClone.transform.localScale; // Volvemos activos solamente los botones "habilidades" y "start" buildPanelHabilidades(); }
void LoadSave() { if (SaveLoad.SaveExist(uniqueName)) { SerializeSoil soil = SaveLoad.Load <SerializeSoil>(uniqueName); this.IsPlanted = soil.IsPlanted; this.seconds = soil.seconds; this.saveSeconds = soil.saveSeconds; this.interval = soil.interval; this.stages = soil.stages; this.i = soil.i; this.isDroplets = soil.isDroplets; this.plant_trigger = soil.plant_trigger; this.harvestTime = soil.harvestTime; this.plant = soil.plant; anim.SetTrigger(plant_trigger[i]); droplets.SetActive(isDroplets); } }
IEnumerator DelayUsernameUpdate(string id) { yield return(new WaitForSeconds(0.3F)); data = SaveLoad.Load(); if (myID == id) { data.lastID = id; Debug.Log("updating id: " + id); } if (data.newUser) { data.username = "******"; data.setNewUser(false); } SaveLoad.Save(data); nh_network.server.newUsername(data.username); }
void Start() { displayScript = GameObject.Find("WaveNumber").GetComponent <DisplayWaveNumber>(); newGameScript = GameObject.Find(newGameFile).GetComponent <newGame>(); if (newGameScript.startNewHordeGame == false) { Debug.Log("CONTINUE CALLED"); Debug.Log(newGameScript.startNewHordeGame); waveNumber = SaveLoad.Load(filePath); } else { Debug.Log("NEW GAME CALLED"); Debug.Log(newGameScript.startNewHordeGame); waveNumber = 1; SaveLoad.SaveData(1, filePath); } displayScript.Refresh(filePath); }
//продолжить игру public void ContinueGame() { SaveLoad.Load(); MainMenuObj.SetActive(false); ContinueObj.SetActive(true); CreateNewGameObj.SetActive(false); int gap = 0; foreach (MapInfo g in SaveLoad.savedGames) { Transform but = Instantiate(button) as Transform; but.SetParent(ContinueObj.transform); RectTransform tr = but.GetComponent <RectTransform> (); tr.anchoredPosition = new Vector2(0, gap); gap -= -39; but.GetComponentInChildren <Text> ().text = g.nameM; Button b = but.GetComponent <Button> (); b.onClick.AddListener(() => onButtonClick(g)); } }
void Awake() { SelectColor(0); lockbattle = false; editmode = false; SaveLoad.Load(); GameMemento.current = SaveLoad.savedGame; if (GameMemento.current.hexGridMemento.size != 0) //load from most recent if player presses continue { Debug.Log("Loading"); playerManager.SetActivePlayers(); loadMap.LoadHexTiles(); loadMap.LoadTerrain(); loadMap.LoadBuildings(); //loadMap.LoadEntities(); loadMap.LoadResources(); loadMap.LoadCorpses(); summon.SummonEntity(14, EntityNames.Necromancer, 1); summon.SummonEntity(12, EntityNames.Militia, 2); summon.SummonEntity(15, EntityNames.Militia, 3); summon.SummonEntity(3, EntityNames.Skeleton, 1); summon.SummonEntity(18, EntityNames.Zombie, 1); } else //create new game when no game, set from player settings in menu { Debug.Log("New"); playerManager.SetActivePlayers(); //TODO modify set active players to set new players when new game loadMap.LoadNewHexTiles(12, 12); loadMap.LoadRandom(12); //sets the seed of the terrain spawn //TODO set above random seed somewhere //TODOTEST remove test entities summon.SummonEntity(14, EntityNames.Necromancer, 1); summon.SummonEntity(12, EntityNames.Militia, 2); summon.SummonEntity(15, EntityNames.Militia, 3); summon.SummonEntity(3, EntityNames.Skeleton, 1); summon.SummonEntity(18, EntityNames.Zombie, 1); } //TODO Overlay to add players }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (!MainSave.Saved) // If the current session has not been saved, will prompt to save before loading { DialogResult loading = MessageBox.Show("Save before loading?", "Load Spreadsheet", MessageBoxButtons.YesNoCancel); if (loading == DialogResult.Yes) { saveAsToolStripMenuItem_Click(this, e); // saves the current form } else if (loading == DialogResult.Cancel) { return; } } OpenFileDialog OpenFrom = new OpenFileDialog(); // prompts the user to enter a file to open if (OpenFrom.ShowDialog() == DialogResult.OK) { try { mainSS = new Spreadsheet(this.height, this.width, DefaultBGColor); // Reinitializes the spreadsheet dataGridView1.Rows.Clear(); // clears all rows in the UI dataGridView1.Columns.Clear(); // clears all columns in the UI Form1_Load(sender, e); // Reinitializes the DataGridView MainSave.Load(OpenFrom.FileName, mainSS); // Loads the info from the input file MainSave.Saved = true; // Form comes in as saved SaveLabel.Text = "Load Successful."; undoToolStripMenuItem.Enabled = false; undoToolStripMenuItem.Text = "Undo"; // loading resets the undo system redoToolStripMenuItem.Enabled = false; redoToolStripMenuItem.Text = "Redo"; // loading resets the redo system } catch (Exception err) // catches an exception if the file failed to load { DialogResult CannotOpen = MessageBox.Show(err.Message, "Error - Cannot Open File", MessageBoxButtons.OK); } } }
void Awake() { SaveLoad.Load(); fileDataPanel = transform.Find("FileData").gameObject; continueButton = transform.Find("Continue").gameObject; intro = transform.Find("Intro(unfinished)").gameObject; importantThings = transform.Find("ImportantThings").gameObject; Transform newGameButton = transform.Find("NewGame"); Transform settingsButton = transform.Find("Settings"); Transform[] buttonTransforms = new Transform[] { continueButton.transform, newGameButton, settingsButton }; for (int i = 0; i < 3; i++) { button[i] = buttonTransforms[i].Find("ButtonTexture").GetComponent <GUITexture>(); buttonHighlight[i] = buttonTransforms[i].Find("ButtonHighlight").GetComponent <GUITexture>(); buttonText[i] = buttonTransforms[i].Find("Text").GetComponent <GUIText>(); buttonTextShadow[i] = buttonText[i].transform.Find("TextShadow").GetComponent <GUIText>(); } fileNumbersText = continueButton.transform.Find("FileNumbers").GetComponent <GUIText>(); fileNumbersTextShadow = fileNumbersText.transform.Find("FileNumbersShadow").GetComponent <GUIText>(); fileSelected = fileNumbersText.transform.Find("FileSelected").GetComponent <GUIText>(); mapNameText = fileDataPanel.transform.Find("MapName").GetComponent <GUIText>(); mapNameTextShadow = mapNameText.transform.Find("MapNameShadow").GetComponent <GUIText>(); dataText = fileDataPanel.transform.Find("DataText").GetComponent <GUIText>(); dataTextShadow = dataText.transform.Find("DataTextShadow").GetComponent <GUIText>(); background = transform.Find("Background").GetComponent <GUITexture>(); introBackground = transform.Find("Intro(unfinished)").Find("Background").GetComponent <GUITexture>(); Dialog = gameObject.GetComponent <DialogBoxHandler>(); for (int i = 0; i < 6; i++) { pokemon[i] = fileDataPanel.transform.Find("Pokemon" + i).GetComponent <GUITexture>(); } }
// Use this for initialization void Start() { musicManager = GameObject.FindGameObjectWithTag(Global.TAG_MUSIC_MANAGER); musicManager.GetComponent <MusicManager> ().PlayMAPSound(); showLoading = false; SaveLoad.Load(); currentLevelProgress = SaveLoad.data.LevelProgress; //btn_1.GetComponent<Button> ().interactable = false; for (int i = 0; i < currentLevelProgress - 1; i++) { buttonsList [i].GetComponent <Button> ().interactable = true; buttonsList [i].GetComponent <StageButton> ().ShowStar(); } if (currentLevelProgress <= 30) { buttonsList [currentLevelProgress - 1].GetComponent <Button> ().interactable = true; } }
public void Update(ContentManager content) { var inputState = InputManager.GetCurrentInputState(); if (mRefresh.Update(inputState)) { LoadContent(content); } else { foreach (var btn in mListButtons) { if (btn.Update(inputState)) { var saveLoad = new SaveLoad(); saveLoad.Load(btn.GetInput() + ".spielstand"); GameStateManager.State = GameState.PlayGameMenu; } } } }
private void Awake() { //Creamos el player Vector3 posicionPlayer = new Vector3(-7f, -2.5f, 0f); GameObject player = Instantiate(SaveLoad.Load(), posicionPlayer, new Quaternion()); //Creamos el enemy GameObject enemy = QueryMaster.findRandomEnemy(); enemy.transform.localScale = new Vector3(-enemy.transform.localScale.x, enemy.transform.localScale.y, enemy.transform.localScale.z); //Gestionamos los botones y asignamos el enemigo a ambos player.GetComponent <PlayerController>().setFunctional(true); player.GetComponent <PlayerController>().enemy = enemy; enemy.GetComponent <PlayerController>().enemy = player; gestionarBotones(player); GameObject habButton = GameObject.Find("btVolver"); habButton.GetComponentInChildren <Button>().onClick.AddListener(habVolverOnClick); }
public void LoadScene(string target) { switch (target) { case "Quit": Application.Quit(); break; case "Option": break; case "LoadGame": SaveLoad.Load(0); break; default: Application.LoadLevel(target); break; } //loadingImage.SetActive (true); }
public bool save(int index) { saveScore(); if (saveIndex < 0) { // new save if (index < 0) { saveIndex = SaveLoad.Save(-1); if (saveIndex < 0) { return(false); } // load save } else { saveIndex = index; GameManagerData gmd = SaveLoad.Load(saveIndex); if (gmd != null) { loadData(gmd); } else { return(false); } } } else { // overwrite save if (SaveLoad.Save(saveIndex) < 0) { return(false); } } return(true); }
void OnGUI() { SaveLoad.Load(); GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); if (true) { GUILayout.Box("Select Save File"); GUILayout.Space(10); foreach (Game g in SaveLoad.savedGames) { if (GUILayout.Button(g.saveName)) { Game.current = g; //Game.current.LoadPlayerData(); //Move on to game... Time.timeScale = 1; SceneManager.LoadScene(3); } } //GUILayout.Space(10); //if (GUILayout.Button("Cancel")) //{ // currentMenu = Menu.MainMenu; //} } GUILayout.FlexibleSpace(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndArea(); }
void Start() { levelsCommonAssets = levelsGroup.transform.Find("_CommonAssets").gameObject; boardOne = levelsGroup.transform.Find("BoardOne").gameObject; boardTwo = levelsGroup.transform.Find("BoardTwo").gameObject; boardThree = levelsGroup.transform.Find("BoardThree").gameObject; HideMenus(); mainMenuButtons.SetActive(true); titleGroup.SetActive(true); SaveLoad.Load(); if (CampaignData.GetLastScene() == null) { CampaignData.SetLastScene(""); } else { if (CampaignData.GetLastScene().Contains("Campaign")) { ShowCampaignMenu(); } else if (CampaignData.GetLastScene().Contains("Classic")) { ShowVersusClassicMenu(); } else if (CampaignData.GetLastScene().Contains("Battle")) { ShowVersusBattleMenu(); } else if (CampaignData.GetLastScene().Contains("2Player")) { ShowVersusTwoPlayerMenu(); } } devOptionTapCount = 0; softBackDelay = 0f; }
public void LoadFamily() { if (!SaveLoad.CheckIfPathIsEmpty()) { List <FamilyMemberClass> getList; SaveLoad.Load(out getList); Vector3 pos; //Debug.Log(getList.Count); foreach (FamilyMemberClass f in getList) { pos = new Vector3(f.windowPosition[0], f.windowPosition[1], f.windowPosition[2]); CreateNewMemberWindow(f, pos); } ConnectWindows(); } else { Debug.Log("File not found!"); } }
private void Start() { //gets instances gameEnvironmentSetUp = gameObject.AddComponent <GameEnvironmentSetUp>() as GameEnvironmentSetUp; touchControlManager = TouchControlManager.Instance; //gets datas saved SaveLoad.Load(); gameDatas = SaveLoad.gameDatas; WholePlatform = new GameObject("wholePlatform"); PlatformCount = gameDatas.PlatformCount; //get harder point settings firstGetHarderPoint = (PlatformCount * 25) / 100; secondGetHarderPoint = (PlatformCount * 50) / 100; thirdGetHarderPoint = (PlatformCount * 75) / 100; PlatformSetUp(); MakeControlPointForARing(); }
public void ShowScoreboard() { foreach (var item in MainMenu) { item.SetActive(false); } foreach (var item in Scoreboard) { item.SetActive(true); } Text scores = Scoreboard[0].GetComponent <Text>(); SaveLoad.Load(); if (scores != null) { scores.text = ""; for (int i = 0; i < SaveLoad.scoresSaves.Count; i++) { scores.text += string.Format("{0}. {1}\t{2}\n", i + 1, SaveLoad.scoresSaves[i].scorePoints, SaveLoad.scoresSaves[i].playerName); } } }
void Awake() { MultiplayerController.Instance.TrySignIn(); instance = this; SaveLoad.Load(); numberOfBugs.text = Lizard.current.regenBugs.ToString(); if (Lizard.current.level > Lizard.current.lastLevel) { levelUpPopUp.SetActive(true); Lizard.current.lastLevel = Lizard.current.level; Debug.Log("Levelled up to " + Lizard.current.level + " and last " + Lizard.current.lastLevel); SaveLoad.Save(); } if (Lizard.current.myRHPRemaining <= 0 && Lizard.current.regenBugs > 0) { useBugPopUp.SetActive(true); } else if (Lizard.current.myRHPRemaining <= 0 && Lizard.current.regenBugs <= 0) { timeOutPopUp.SetActive(true); } }
public void LoadPlayer() { PlayerData data = SaveLoad.Load(); textSpace.text = data.notepadString; Vector2 loadedNotePos = new Vector2(data.notepadPos[0], data.notepadPos[1]); notepadIcon.anchoredPosition = loadedNotePos; Vector2 noteWindPos = new Vector2(data.noteWindPos[0], data.noteWindPos[1]); notepadWindow.anchoredPosition = noteWindPos; Vector2 noteSzDelta = new Vector2(data.noteWindSzDelta[0], data.noteWindSzDelta[1]); notepadWindow.sizeDelta = noteSzDelta; Vector2 loadedTrashPos = new Vector2(data.trashPos[0], data.trashPos[1]); trashIcon.anchoredPosition = loadedTrashPos; }
void SavenLoad() { //----------------------------------------------------------------- //ADD SAVE AND LOAD ICONS/TEXT if (control.save) { Scene scene = SceneManager.GetActiveScene(); Game.current.currentPlayerData.sceneID = scene.buildIndex; Game.current.currentPlayerData.playerPosX = transform.position.x; Game.current.currentPlayerData.playerPosY = transform.position.y; Game.current.currentPlayerData.playerPosZ = transform.position.z; Game.current.currentPlayerData.powers = powers; Game.current.currentPlayerData.power1 = power1; Game.current.currentPlayerData.power2 = power2; SaveLoad.Save(); } //----------------------------------------------------------------- if (control.load) { SaveLoad.Load(); Game.current.isSceneBeingLoaded = true; int whichScene = Game.current.currentPlayerData.sceneID; SceneManager.LoadScene(whichScene); float t_x = Game.current.currentPlayerData.playerPosX; float t_y = Game.current.currentPlayerData.playerPosY; float t_z = Game.current.currentPlayerData.playerPosZ; transform.position = new Vector3(t_x, t_y, t_z); powers = Game.current.currentPlayerData.powers; power1 = Game.current.currentPlayerData.power1; power2 = Game.current.currentPlayerData.power2; } }
void Start() { LoginButton.onClick.AddListener(LoginListener); SubmitCodeButton.onClick.AddListener(SubmitCodeListener); LogoutButton.onClick.AddListener(LogoutListener); SaveLoad.Load(); LoginCanvas.enabled = false; TokenCanvas.enabled = false; FinishCanvas.enabled = false; if (SaveLoad.credentials != null && SaveLoad.credentials.OAuthToken != null && SaveLoad.credentials.OAuthToken.Length == 64) { getUserId(); FinishCanvas.enabled = true; } else { LoginCanvas.enabled = true; } }
public void LoadSelectSave() { string slotName = EventSystem.current.currentSelectedGameObject.name; switch (slotName) { case "Slot_01": SaveLoad.SetCurrentSaveSlot(1); break; case "Slot_02": SaveLoad.SetCurrentSaveSlot(2); break; case "Slot_03": SaveLoad.SetCurrentSaveSlot(3); break; } SaveLoad.Load(); SceneManager.LoadScene(sceneToLoad); }
//DW // void Start() { MultiplayerManager mm = MultiplayerManager.GetInstance(); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; if (SaveLoad.Load()) { mm.localPlayerName = Game.current.name; mm.networkAddress = Game.current.IPaddress; } if (mm != null) { HostNameField.text = mm.localPlayerName; JoinNameField.text = mm.localPlayerName; IPField.text = mm.networkAddress; } //just in case input is locked InputWrapper.ReleaseKeyboard(); InputWrapper.ReleaseMouse(); }
/// <summary> /// Ínitialises data /// </summary> void Awake() { if (_instance == null) { _instance = this; } else { Debug.Log("There are 2 players... somehow.. does it make sense?"); } if (SaveLoad.SaveExist()) { loadPlayerData(SaveLoad.Load()); } else { NewPlayer(); } AddAbilities(); VisualController._instance.CreatePlayerHealthbar(maxHealth); }