void Start() { pm_instance = this; if (databasePlayer == null) { databasePlayer = new DatabasePlayer(); } manageLanguageMainScreen = FindObjectOfType <ManageLanguageMainScreen>(); phaseList = new Dictionary <string, int>(); playFabId = ""; displayName = ""; sizePhase = 4; messageTextLogin = messageLogin.GetComponent <Text>(); messageTextRegister = messageRegister.GetComponent <Text>(); isLogged = false; playButton.GetComponent <Button>().interactable = false; playerPrefs = new PlayerPreferences(); if (playerPrefs.getUsername() != null) { username = playerPrefs.getUsername(); messageTextLogin.text = ""; progressBar.SetActive(true); loginButton.GetComponent <Button>().interactable = false; databasePlayer.loginWithUsername(username, onSucessLogin, onFailureLogin); } }
private void OnLoginButtonClicked() { PlayerPreferences.lastLogin = m_login.GetText(); PlayerPreferences.lastPassword = m_password.GetText(); PlayerPreferences.Save(); connect?.Invoke(); }
private void Connect(bool asGuest, string login) { if (string.IsNullOrEmpty(login)) { PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo { message = 98703, buttons = new ButtonData[1] { new ButtonData(27169) }, selectedButton = 1, style = PopupStyle.Normal }); return; } LockUI(value: true); PlayerPreferences.lastLogin = login; if (string.IsNullOrWhiteSpace(PlayerPreferences.lastPassword)) { PlayerPreferences.lastPassword = "******"; } PlayerPreferences.Save(); ConnectionHandler.instance.Connect(); }
/// <summary>Initializes the game on startup.</summary> private void Initialize() { if (PlayerPreferences.GetBool(PlayerPreferencesKeys.hasSeenTutorial)) { //determine how much money the player has earned since last play float offlineEarnings = PlayerManager.instance.DetermineEarningsSinceLastPlay(); if (offlineEarnings > 0) { mainCanvas.SetInteractable(false); offlineEarningsPopup.Initialize(NumberFormatter.ToString(number: offlineEarnings, showDecimalPlaces: true, showDollarSign: true)); offlineEarningsPopup.Display(); } Debug.Log("offlineEarnings: " + offlineEarnings); } else { //show tutorial PlayerPreferences.SetBool(PlayerPreferencesKeys.hasSeenTutorial, true); } //create business panels CreateBusinessPanels(); //initialize specific ui elements bulkLevelUpButtonText.text = Constants.BULK_UPGRADE_OPTIONS[bulkLevelUpIndex]; prestigePanel.SetActive(false); //inialize dynamic ui elements UpdateUI(); //finally start a game save coroutine StartOrStopGameSaveCoroutine(true); }
private void Start() { gps = GameObject.FindGameObjectWithTag("GooglePlayServices").GetComponent<GooglePlayServices>(); playerPrefs = GameObject.FindGameObjectWithTag("PlayerPreferences").GetComponent<PlayerPreferences>(); if (playerPrefs.FirstTime) GetComponent<Animator>().SetTrigger("Show"); }
// Start is called before the first frame update void Start() { playerPreferencesScript = this.GetComponent <PlayerPreferences>(); for (int counter = 0; counter < levels.Length; counter++) { nextLevel++; if (nextLevel == levels.Length) { break; } playButton = levels[nextLevel].transform.Find("Play Button").gameObject; if (playerPreferencesScript.CheckIfExists(levels[counter].name)) { playButton.GetComponent <Button>().interactable = true; } else { playButton.GetComponent <Button>().interactable = false; } } }
private Vector3 m_shotAimDirection; //the horizontal/flat ball shot direction private void Start() { m_inputManager.InputShotHoldEvent += OnInputShotHold; m_inputManager.InputChangeCameraHeightEvent += OnInputChangeCameraHeight; m_inputManager.m_shotMaxHoldDuration = m_shotMaxHoldDuration; m_cameraManager.CameraChangedAimDirectionEvent += OnAimDirectionChanged; //if we didn't manually set a PlayerPref //OR if we come from MainMenu and another instance of //PlayerPref overrided our reference, let's try to find one if (m_playerPref == null) { m_playerPref = FindObjectOfType <PlayerPreferences>(); } m_cameraManager.SetGameDifficulty(m_playerPref ? m_playerPref.Difficulty : PlayerPreferences.GameDifficulty.Easy); m_whiteBall.MaxSpeed = m_yellowBall.MaxSpeed = m_redBall.MaxSpeed = m_ballsMaxSpeed; m_whiteBallStartPos = m_whiteBall.transform.position; m_yellowBallStartPos = m_yellowBall.transform.position; m_redBallStartPos = m_redBall.transform.position; m_preReplayTimer = 0f; SwitchGameState(GameState.Shooting); }
public void Init(PlayerBehaviour player) { this.player = player; CustomizationProfilesList profileList = FileManager.LoadFile <CustomizationProfilesList>(FILE_LIST_NAME + CustomizationProfilesList.FILE_TYPE); // not the first time we play if (profileList != null) { loadedProfiles = new CustomizationProfile[profileList.profilesNames.Length]; for (int i = 0; i < profileList.profilesNames.Length; i++) { loadedProfiles[i] = FileManager.LoadFile <CustomizationProfile>(profileList.profilesNames[i], PROFILE_FOLDER_NAME); } } else // first time we play { Debug.Log(debugTag + "No profile names found, generating default profile"); loadedProfiles = new CustomizationProfile[1]; loadedProfiles[0] = new CustomizationProfile("Default"); } preferences = FileManager.LoadFile <PlayerPreferences>(PLAYER_PREFERENCES_FILE_NAME + CustomizationProfilesList.FILE_TYPE); if (preferences == null) { preferences = new PlayerPreferences(); } InitInternal(); }
public static void Load() { Debug.Log("PlayerPreferences.Load"); if (PlayerPreferences.alreadyLoaded) { return; } PlayerPreferences.Preset = ((!CoopPeerStarter.DedicatedHost) ? PlayerPrefs.GetInt("Preset_v16", PlayerPreferences.Preset) : 5); PlayerPreferences.LowMemoryMode = (PlayerPrefs.GetInt("LowMemoryMode", 0) > 0); PlayerPreferences.MemorySafeSaveMode = (PlayerPrefs.GetInt("MemorySafeSaveMode", 0) > 0); PlayerPreferences.GammaWorldAndDay = PlayerPrefs.GetFloat("GammaWorldAndDay", 2f); PlayerPreferences.GammaCavesAndNight = PlayerPrefs.GetFloat("GammaCavesAndNight", 2f); PlayerPreferences.Contrast = PlayerPrefs.GetFloat("Contrast", 1f); PlayerPreferences.Volume = PlayerPrefs.GetFloat("Volume", 0.5f); PlayerPreferences.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f); PlayerPreferences.MicrophoneVolume = PlayerPrefs.GetFloat("MicrophoneVolume", 5f); PlayerPreferences.VoiceCount = PlayerPrefs.GetInt("VoiceCount", 128); PlayerPreferences.MouseInvert = (PlayerPrefs.GetInt("MouseInvert", 0) > 0); PlayerPreferences.MouseSensitivityX = PlayerPrefs.GetFloat("MouseSensitivity", 0.5f); PlayerPreferences.MouseSensitivityY = PlayerPrefs.GetFloat("MouseSensitivityY", PlayerPrefs.GetFloat("MouseSensitivity", 0.5f)); PlayerPreferences.MouseSmoothing = PlayerPrefs.GetFloat("MouseSmoothing2", 0.1f); PlayerPreferences.Fov = PlayerPrefs.GetFloat("Fov", 75f); PlayerPreferences.MaxFrameRate = PlayerPrefs.GetInt("MaxFrameRate2", -1); PlayerPreferences.ApplyMaxFrameRate(); PlayerPreferences.SetLowQualityPhysics(PlayerPrefs.GetInt("LowQualityPhysics", 0) > 0); PlayerPreferences.Language = PlayerPrefs.GetString("Language", "English"); PlayerPreferences.SetGhostTint(PlayerPrefs.GetInt("GhostTint", 0), PlayerPrefs.GetFloat("GhostTintOpacity", 0.0784f)); PlayerPreferences.ColorGrading = PlayerPrefs.GetInt("ColorGrading", 0); PlayerPreferences.VSync = (PlayerPrefs.GetInt("VSync", QualitySettings.vSyncCount) > 0); PlayerPreferences.ShowHud = (PlayerPrefs.GetInt("ShowHud", 1) > 0); PlayerPreferences.ShowOverlayIcons = (PlayerPrefs.GetInt("ShowOverlayIcons", 1) > 0); PlayerPreferences.OverlayIconsGrouping = (PlayerPrefs.GetInt("OverlayIconsGroupingV2", 1) > 0); PlayerPreferences.ShowProjectileReticle = (PlayerPrefs.GetInt("ShowProjectileReticle", 1) > 0); PlayerPreferences.UseXInput = (PlayerPrefs.GetInt("UseXInputV2", 1) > 0); PlayerPreferences.ShowPlayerNamesMP = (PlayerPrefs.GetInt("ShowPlayerNamesMP", 1) > 0); PlayerPreferences.ShowStealthMeter = (PlayerPrefs.GetInt("ShowStealthMeter", 1) > 0); PlayerPreferences.UseCrouchToggle = (PlayerPrefs.GetInt("UseCrouchToggle", 0) > 0); PlayerPreferences.UseSprintToggle = (PlayerPrefs.GetInt("UseSprintToggle", 0) > 0); PlayerPreferences.UseGamepadRumble = (PlayerPrefs.GetInt("UseGamepadRumble", 1) > 0); if (!CoopPeerStarter.DedicatedHost) { PlayerPreferences.TreeRegrowthLocal = (PlayerPrefs.GetInt("TreeRegrowth", 0) > 0); PlayerPreferences.NoDestructionLocal = (PlayerPrefs.GetInt("NoDestruction", 0) > 0); PlayerPreferences.AllowEnemiesCreative = (PlayerPrefs.GetInt("AllowEnemiesCreative", 0) > 0); PlayerPreferences.CheatsAllowed = (PlayerPrefs.GetInt("CheatsAllowed", 0) > 0); } PlayerPreferences.ExWallAutofill = (PlayerPrefs.GetInt("ExWallAutofill", 1) > 0); PlayerPreferences.ExFloorsAutofill = (PlayerPrefs.GetInt("ExFloorsAutofill", 1) > 0); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } QualitySettings.SetQualityLevel((int)TheForestQualitySettings.UserSettings.ShadowLevel); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } PlayerPreferences.ApplyValues(); PlayerPreferences.alreadyLoaded = true; }
private void SetSensitivity() { var datas = PlayerPreferences.GetSettings(); xAxis.m_MaxSpeed = datas.XCameraSensitivity * datas.MouseSensitivity; yAxis.m_MaxSpeed = datas.YCameraSensitivity * datas.MouseSensitivity; }
private void Awake() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown string text = "START version: 0.1.0.6045 " + DateTime.Now.ToShortDateString(); Log.Info(text + "\n" + new string('-', 35 + text.Length), 40, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Main.cs"); Device.LogInfo(); Object.DontDestroyOnLoad(this.get_gameObject()); PlayerPreferences.Load(); ApplicationConfig.Read(); QualityManager.Load(); if (PlayerPreferences.graphicPresetIndex == -1) { PlayerPreferences.graphicPresetIndex = QualityManager.GetQualityPresetIndex(); PlayerPreferences.Save(); } QualityManager.SetQualityPresetIndex(PlayerPreferences.graphicPresetIndex); monoBehaviour = this; StateManager.RegisterInputDefinition(new InputKeyCodeDefinition(27, 1, 0, 0.4f, 0.1f)); StateManager.RegisterInputDefinition(new InputKeyCodeDefinition(13, 2, 0, 0.4f, 0.1f)); StateManager.RegisterInputDefinition(new InputKeyCodeDefinition(271, 3, 0, 0.4f, 0.1f)); StateManager.RegisterInputDefinition(new InputKeyCodeDefinition(9, 4, 0, 0.4f, 0.1f)); }
private void Awake() { if (m_instance == null) //first opening of menu { m_instance = this; DontDestroyOnLoad(this); } else //another scene is loaded { if (m_instance != this) //we only want to keep the original object { DestroyImmediate(this.gameObject); } } if (PlayerPrefs.HasKey(KEY_VOLUME) && m_saveAndLoadInPlayerPrefs) { m_masterVolumeValue = PlayerPrefs.GetFloat(KEY_VOLUME); } if (PlayerPrefs.HasKey(KEY_DIFFICULTY) && m_saveAndLoadInPlayerPrefs) { m_difficulty = (GameDifficulty)PlayerPrefs.GetInt(KEY_DIFFICULTY); } }
private void Initialize() { PlayerPreferences = new PlayerPreferences(); Catching = new Catching(); CurrentPlayer = new Player(); AbilitiesContainer = new AbilitiesContainer(CurrentPlayer.Abilities); }
private void HandlePreferencesAndSettings(MsgPreferencesAndSettings message) { Preferences = message.Preferences; Settings = message.Settings; OnServerDataLoaded?.Invoke(); }
private void OnSelectServer(int serverIndex) { ServerList.ServerInfo serverInfo = m_serverList.GetServerInfo(serverIndex); ApplicationConfig.SetServerInfo(serverInfo); ApplicationConfig.versionCheckResult = VersionChecker.Result.Success; PlayerPreferences.lastServer = serverInfo.displayName; PlayerPreferences.Save(); }
/// <summary>Callback when the PlayButton is pressed.</summary> public void PlayButtonPressed() { playButton.interactable = false; //update player1 and player2 preferences and load the game scene PlayerPreferences.SetInt(PlayerPreferencesKeys.player1, player1RadioButtonGroup.selectedIndex); PlayerPreferences.SetInt(PlayerPreferencesKeys.player2, player2RadioButtonGroup.selectedIndex); SceneManager.LoadScene(SceneBuildIndeces.GameScene); }
public void SelectCharacter(int slot) { Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor); var msg = _netManager.CreateNetMessage <MsgSelectCharacter>(); msg.SelectedCharacterIndex = slot; _netManager.ClientSendMessage(msg); }
private void Start() { PlayerPreferences playerPreferences = PlayerPreferences.Instance; UpdateFXVolume(playerPreferences.SoundEffectVolume); playerPreferences.SoundEffectVolumeChanged += OnSoundEffectVolumeChanged; }
private void initialiseStateManagers() { AudicaGameStateManager.scoreKeeper = UnityEngine.Object.FindObjectOfType <ScoreKeeper>(); AudicaGameStateManager.modifiers = UnityEngine.Object.FindObjectOfType <GameplayModifiers>(); AudicaGameStateManager.prefs = UnityEngine.Object.FindObjectOfType <PlayerPreferences>(); AudicaGameStateManager.config = UnityEngine.Object.FindObjectOfType <KataConfig>(); AudicaGameStateManager.songCues = UnityEngine.Object.FindObjectOfType <SongCues>(); }
private void OnLevelWasLoaded(int level) { if (level == 2) { TheForestQualitySettings.UserSettings.SetTerrainQuality(TheForestQualitySettings.UserSettings.TerrainQuality); PlayerPreferences.ApplyValues(); } }
public static void SaveSettings(bool keepD1, bool KeepD2, float vol) { BinaryFormatter bf = new BinaryFormatter(); FileStream settingsStream = new FileStream(Application.persistentDataPath + "/PlayerPreference.ball", FileMode.Create); PlayerPreferences plPref = new PlayerPreferences(keepD1, KeepD2, vol); bf.Serialize(settingsStream, plPref); settingsStream.Close(); }
private void OnCreateGuestSuccess(RAccountApi <Account> response) { string firstHeaderValue = response.RestResponse.get_Headers().GetFirstHeaderValue("X-Password"); PlayerPreferences.guestLogin = response.Data.get_Login(); PlayerPreferences.guestPassword = firstHeaderValue; PlayerPreferences.Save(); ConnectionHandler.instance.Connect(); }
public void DeleteCharacter(int slot) { var characters = Preferences.Characters.Where(p => p.Key != slot); Preferences = new PlayerPreferences(characters, Preferences.SelectedCharacterIndex, Preferences.AdminOOCColor); var msg = _netManager.CreateNetMessage <MsgDeleteCharacter>(); msg.Slot = slot; _netManager.ClientSendMessage(msg); }
// Start is called before the first frame update void Start() { playerPreferencesScript = this.GetComponent <PlayerPreferences>(); //Load values from the PlayerPrefs to the text holders quartoScore.text = FormatText(playerPreferencesScript.GetScore("Quarto")); banheiroScore.text = FormatText(playerPreferencesScript.GetScore("Banheiro")); cozinhaScore.text = FormatText(playerPreferencesScript.GetScore("Cozinha")); salaScore.text = FormatText(playerPreferencesScript.GetScore("Sala")); }
private void ApplyCheatsAndOptions() { Cheats.NoEnemies = SteamDSConfig.VeganMode; Cheats.NoEnemiesDuringDay = SteamDSConfig.VegetarianMode; Cheats.ResetHoles = SteamDSConfig.ResetHolesMode; PlayerPreferences.SetLocalTreeRegrowth(SteamDSConfig.TreeRegrowMode); PlayerPreferences.SetLocalNoDestructionMode(!SteamDSConfig.AllowBuildingDestruction); PlayerPreferences.SetLocalAllowEnemiesCreativeMode(SteamDSConfig.AllowEnemiesCreative); PlayerPreferences.SetAllowCheatsMode(SteamDSConfig.AllowCheats); }
public void OnButtonSelected() { CalendarController cpc = gameObject.transform.parent.parent.GetComponent <CalendarController> (); int month = PlayerPreferences.TranslateMonth(cpc._month.text); int year = int.Parse(cpc._year.text); int day = int.Parse(dayText.gameObject.name); DataManager.dateNewAppointment = new DateTime(year, month, day); PageNavFrameWork.PageNav.GetPageNavInstance().PushPageToStack(PageNavFrameWork.PagesEnum.ScheduleDetailPage); }
public void HardDifficulty() { PlayerPreferences.SetEasyDifficulty(0); PlayerPreferences.SetMediumDifficulty(0); PlayerPreferences.SetHardDifficulty(1); Easy.SetActive(false); Medium.SetActive(false); Hard.SetActive(true); }
void Awake() { if (instance != null) { Debug.LogWarning("Multiple PlayerPreferences found"); } instance = this; DontDestroyOnLoad(this.gameObject); }
private void OnDestroy() { TitleSceneBridge.TitleScene = null; PlayerPreferences.ApplyMaxFrameRate(); base.enabled = false; if (TitleScreen.Instance == this) { TitleScreen.Instance = null; } }
/// <summary> /// </summary> /// <typeparam name="TMediator"></typeparam> /// <param name="prefab"></param> /// <returns></returns> public TMediator AddToDialog <TMediator>(GameObject prefab) where TMediator : Component { if (prefab != null) { PlayerPreferences.SaveRecentGui(prefab.name, Container); } var instance = _uiRootDigest.DialogLayer.AddChild(prefab); return(instance.GetComponent <TMediator>()); }
void Awake() { if (PlayerPreferences.isPlayerGameControlPreferenceChoiceTwoEnabled()) { EnableControls(choiceTwoControls); } else { EnableControls(choiceOneControls); } }
private void Start() { gps = GameObject.FindGameObjectWithTag("GooglePlayServices").GetComponent<GooglePlayServices>(); playerPrefs = GameObject.FindGameObjectWithTag("PlayerPreferences").GetComponent<PlayerPreferences>(); GetComponent<Button>().onClick.AddListener(OnClick); GooglePlayConnection.ActionPlayerConnected += ActionPlayerConnected; GooglePlayConnection.ActionPlayerDisconnected += ActionPlayerDisconnected; disbaledIcon.SetActive(gps.SignedIn); }