public void OnButtonClickBack() { if (!SaveDataController.GetInstance().IsSubmitting) { ReturnToMainMenu(); } }
public void SavingScore(int level, int star) { SaveDataController saveController = gameObject.GetComponent <SaveDataController>(); saveController.SaveStarResult(1, level, star); saveController.unlockStage(1, level + 1); }
// Use this for initialization private void Awake() { SaveDataController.Init(Application.persistentDataPath, "ServerData.DATA"); clientDic = new Dictionary <string, string>(); studentDic = new Dictionary <string, StudentItem>(); DontDestroyOnLoad(gameObject); }
private void Start() { var UIController = GroupSettingSceneUIController.Instance; StartButton = UIController.MainMenu.AddCell(); DoneButton = UIController.MainMenu.AddCell(); ResetButton = UIController.MainMenu.AddCell(); LoadButton = UIController.MainMenu.AddCell(); StartButton.Text.text = "Press to Start"; LoadButton.Text.text = "Load Saved Formation"; StartButton.Button.onClick.AddListener(OnStartPressed); DoneButton.Button.onClick.AddListener(OnDonePressed); ResetButton.Button.onClick.AddListener(OnResetPressed); LoadButton.Button.onClick.AddListener(OnLoadPressed); SaveDataController.TryLoad(DataName.SavedFormation, out List <List <PosVector> > Data); SavedFormation.Update(Data); SavedFormationList = SavedFormation.SavedList; for (int i = 0; i < SavedFormation.AllowedCount; i++) { var button = UIController.TopRightMenu.AddCell(); int ID = i; button.Button.onClick.AddListener(delegate { OnSlotPressed(ID); }); SavedFormationButtons.Add(button); } }
// Use this for initialization void Start() { Debug.Log("GameController.cs"); // Load the current level _dataController = SaveDataController.GetInstance(); _currentLevelNum = _dataController.LoadData().CurrentLevel; LoadLevel(_currentLevelNum); // Stop any music being played SoundController.StopMusic(); // Start the game paused before the countdown _isPaused = true; _updateEveryFrame = UpdateEveryFrame; GameInput.AttachInput( actionClick: OnButtonClickAction, skillClick: OnButtonClickSkill, backClick: OnButtonClickBack, leftClick: OnButtonClickLeft, rightClick: OnButtonClickRight, downClick: OnButtonClickDown, upClick: OnButtonClickUp); // Start the countdown sequence StartCountdown(); }
public void OnButtonClickAction() { // If submitting name, submit the score if (SaveDataController.GetInstance().IsSubmitting) { SoundController.PlaySound(SoundType.UIAction, false); int rank = SubmitScore(); // Enable the high scores Submission.SetActive(false); HighScores.SetActive(true); // If submitted score was high enough to be on high scores, // then highlight it if (rank < NUM_LISTINGS) { ScoreboardListings[rank].Name.color = SUBMITTED_SCORE_COLOUR; ScoreboardListings[rank].Score.color = SUBMITTED_SCORE_COLOUR; } // Update the scoreboard to show the newly submitted score UpdateScoreboard(); return; } }
// Use this for initialization void Start() { //load character level buttons LoadCharacterLevelButtons(); //find UI components clickZone = GameObject.Find("Click Zone").GetComponent <Collider2D>(); scoreText = GameObject.Find("Score").GetComponent <Text>(); characterCountText = GameObject.Find("Character Count").GetComponent <Text>(); cheerCountText = GameObject.Find("Cheer Count").GetComponent <Text>(); //load savedata sav = new SaveDataController(); UIUpdateScore(); UIUpdateCharacterCount(); UIUpdateCheerCount(); UIUpdateCharacterPanel(); //load object pools cheerEffectPool = ObjectPool.GetObjectPool("prefabs/system/Cheer Effect"); for (int series = 0; series < Constants.CHARACTER_SERIES_COUNT; series++) { for (int character = 0; character < 5; character++) { string path = "prefabs/characters/" + CharacterSeriesDatabase.data[series].name_lowercase + "_" + Constants.ALPHABET_NAMES_LOWERCASE[character]; charPool[series, character] = ObjectPool.GetObjectPool(path, 5, 5); } } StartCoroutine(TryGenerate()); StartCoroutine(AutoSave()); }
private void SaveScores() { //_data.HighScores = serialized; SaveDataController save = SaveDataController.GetInstance(); save.SaveData(_data); save.SaveDataToDisk(); }
//!Tworzy instancję przy uruchomieniu gry. void Awake() { if (instance == null) { instance = this; } DontDestroyOnLoad(this.gameObject); }
// Use this for initialization void Start() { GameObject gameControl = GameObject.FindGameObjectWithTag("GameController"); SaveDataController saveController = gameControl.GetComponent <SaveDataController>(); int currentStar = saveController.GetStar(this.stage, this.level); this.showStar(currentStar); }
// Return the instance of the controller // Use this to get access to the controller public static SaveDataController GetInstance() { if( _instance == null ) { _instance = new SaveDataController(); } return _instance; }
private void SerializeAndSave() { GenerateInfo(); string PATH = SaveDataController.GenerateFileLocation("ItemInfos.json"); string data = JsonConvert.SerializeObject(ItemInfos, Formatting.Indented); StreamWriter streamWriter = new StreamWriter(PATH); streamWriter.Write(data); streamWriter.Close(); }
private void OnSubmitButtonSelect() { // Submit score Debug.Log("Submit button is selected"); // Flag submit request to true to indicate that a score is being // submitted SaveDataController.GetInstance().IsSubmitting = true; ChangeState(GameStateLoader.GAME_STATES.SCOREBOARD); }
void Awake() { if (SaveDataController.instance == null) { SaveDataController.instance = this; this.data = new Data(); this.data.InicializePrefs(); DontDestroyOnLoad(this.gameObject); } }
public void OnButtonClickLeft() { // If submitting name, move one slot to the left if (SaveDataController.GetInstance().IsSubmitting) { _selectedNameSlot = Mathf.Max(0, _selectedNameSlot - 1); UpdateNameSlots(); SoundController.PlaySound(SoundType.UIClick, false); return; } }
private void Save() { List <PosVector> tempPos = new List <PosVector>(); foreach (var item in SeletedTiles) { tempPos.Add(item.Position); } SaveDataController.Save(DataName.DefaultFormation, tempPos); }
//!Sprawdza czy gracz wszedł w obszar percepcji przeciwnika. private void OnTriggerEnter(Collider other) { PlayerCombatController playerCombatController = other.gameObject.GetComponent <PlayerCombatController>(); if (playerCombatController != null) { isInCombat = true; player = other.gameObject; playerStats = SaveDataController.getInstance().LoadedSave.PlayerStats; } }
// Use this for initialization void Start() { id = SystemInfo.graphicsDeviceID; userName = SystemInfo.deviceName; #if UNITY_ANDROID userName = SystemInfo.deviceUniqueIdentifier; #endif password = SystemInfo.deviceUniqueIdentifier; SaveDataController.Init(Application.persistentDataPath, "ClientData.DATA"); clientConnectThread = Loom.StartSingleThread(ClientConnect, System.Threading.ThreadPriority.Normal, true); }
public void OnButtonClickRight() { // If submitting name, move one slot to the right if (SaveDataController.GetInstance().IsSubmitting) { _selectedNameSlot = Mathf.Min(NameSlots.Length - 1, _selectedNameSlot + 1); UpdateNameSlots(); SoundController.PlaySound(SoundType.UIClick, false); return; } }
//public Dictionary<string, int[]> userEquipItem; private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private SaveDataController saveDataController; //!<Kontroler stanu gry. void Start() { saveDataController = SaveDataController.getInstance(); if (!isDisplayingEnding) { disableUI(); } if (choiceButtons.Count == 3) //Wykorzystanie pętli do przypisania delegatów okazało sie w praktyce niemożliwe. { choiceButtons[0].onClick.AddListener(delegate { makeChoice(0); }); choiceButtons[1].onClick.AddListener(delegate { makeChoice(1); }); choiceButtons[2].onClick.AddListener(delegate { makeChoice(2); }); } }
// Use this for initialization void Start() { // Get all existing scores _data = SaveDataController.GetInstance().LoadData(); // Handle score submit if (SaveDataController.GetInstance().IsSubmitting) { // Hide the high scores HighScores.SetActive(false); // Enable name submission _selectedNameSlot = 0; _slotLetters = new int[NameSlots.Length]; UpdateNameSlots(); // Set the score text ScoreValueText.text = "$ " + SaveDataController.GetInstance().ScoreToSubmit.ToString(); } else { // Hide the name submission Submission.SetActive(false); // Display all the scores UpdateScoreboard(); } // Press any key to return to main menu GameInput.AttachInput( actionClick: OnButtonClickAction, backClick: OnButtonClickBack, leftClick: OnButtonClickLeft, rightClick: OnButtonClickRight, downClick: OnButtonClickDown, upClick: OnButtonClickUp); // Show the appropriate help text for the platform if (HelperFunctions.IsRunningOnDesktop()) { ScoreboardDesktop.SetActive(true); SubmissionDesktop.SetActive(true); } else if (HelperFunctions.IsRunningOnPS4()) { ScoreboardPS4.SetActive(true); SubmissionPS4.SetActive(true); } }
public void EndGame(bool pWin) { if (GameEnded) { Debug.Log("gamew already ended"); return; } GameEnded = true; Debug.Log("WIN = " + pWin); SaveDataController.OnLevelWin(director.SelectedLevel); game.HUD.Curtain.SetFade(true, () => game.HUD.EndScreen.Show(pWin), 3); }
private void Awake() { btnStart.onClick.AddListener(() => StartCoroutine(OnBtnStart())); btnExit.onClick.AddListener(OnBtnExit); bool lvl1Done = SaveDataController.IsLevelDone(1); bool lvl2Done = SaveDataController.IsLevelDone(2); bool lvl3Done = SaveDataController.IsLevelDone(3); btnLevel1.SetEnabled(true); btnLevel2.SetEnabled(lvl1Done); btnLevel1.AddAction(() => SelectLevel(1)); btnLevel2.AddAction(() => SelectLevel(2)); }
public void startGame() { Debug.Log("We Do start"); SaveDataController saveController = this.gameObject.GetComponent <SaveDataController>(); if (saveController.LoadSaveData()) { SceneManager.LoadScene("scene/StageSelect", LoadSceneMode.Single); } else { saveController.GenerateNewSave(); SceneManager.LoadScene("scene/StageSelect", LoadSceneMode.Single); } }
public void OnButtonClickDown() { // If submitting name, move to next letter if (SaveDataController.GetInstance().IsSubmitting) { int letterIndex = _slotLetters[_selectedNameSlot] + 1; if (letterIndex >= LETTERS.Length) { letterIndex = 0; } UpdateSlotLetter(letterIndex); SoundController.PlaySound(SoundType.UIClick, false); return; } }
private void Awake() { if (instance == null) { instance = this; Initialize(); LoadSettingData(); LoadSaveData(); } else if (instance != this) { instance.Initialize(); Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start() { Debug.Log("MainMenu.cs"); GameInput.AttachInput( actionClick: OnButtonClickAction, skillClick: OnButtonClickSkill, backClick: OnButtonClickBack, leftClick: OnButtonClickLeft, rightClick: OnButtonClickRight, downClick: OnButtonClickDown, upClick: OnButtonClickUp); // Initialize menu options AddMenuOption(PLAY_BUTTON, OnPlayButtonSelect); AddMenuOption(INSTRUCTIONS_BUTTON, OnInstructionsButtonSelect); AddMenuOption(SCOREBOARD_BUTTON, OnScoreboardButtonSelect); SelectDefaultButton(); // Play title music SoundController.PlayMusic(MusicType.Title); // Show the appropriate help text for the platform if (HelperFunctions.IsRunningOnDesktop()) { HelpTextDesktop.SetActive(true); // Add the exit button for desktop AddMenuOption(EXIT_BUTTON, OnExitButtonSelect); } else if (HelperFunctions.IsRunningOnPS4()) { HelpTextPS4.SetActive(true); // Remove the exit button for the PS4 ExitButton.SetActive(false); } // Set play button to read "Continue" if the player is not on the first level GameData data = SaveDataController.GetInstance().LoadData(); if (data.CurrentLevel > 1) { PlayText.text = CONTINUE_TEXT + " (Lv. " + data.CurrentLevel + ")"; } }
// Start is called before the first frame update void Start() { saveDataController = GetComponent <SaveDataController>(); #if UNITY_EDITOR if (DeleteAllDataOnStart) { saveDataController.DeleteAllSaveData(); } #endif GetCurrentDay(); SetupDayPanel(); desiredIntensity = Day * DayIntensityMultiplier; rampUpTimerStart = Time.time; }
// Submit the score and return the index of the submitted score // This index corresponds to the "rank" of the score in the high scores list private int SubmitScore() { ListingValues listing; listing.Name = GetSubmittedName(); listing.Score = SaveDataController.GetInstance().ScoreToSubmit; // Insert this score in appropriate order bool isInserted = false; int rank = 0; for (int i = 0; i < _data.HighScores.Count; ++i) { if (listing.Score > _data.HighScores[i].Score) { _data.HighScores.Insert(i, listing); isInserted = true; rank = i; break; } } // If the listing hasn't been added yet, just push to the back of // the list if (!isInserted) { _data.HighScores.Add(listing); rank = _data.HighScores.Count - 1; } // Remove the lowest score if there too many listings if (_data.HighScores.Count > NUM_LISTINGS) { _data.HighScores.RemoveAt(_data.HighScores.Count - 1); } // Save the score using SaveDataController SaveScores(); // Done with submit request SaveDataController.GetInstance().IsSubmitting = false; return(rank); }