public void End(string name) { if (testNetwork.isConnect) { myParse.InsertScore(combo, name); GameObject.Find("Preload").GetComponent <Preload>().FirstInStartScene(); Application.LoadLevel("Start"); } int[] scores = PlayerPrefsX.GetIntArray("scores"); string[] names = PlayerPrefsX.GetStringArray("names"); scores[10] = combo; names[10] = name; for (int i = 0; i < scores.Length; i++) { for (int j = i; j < scores.Length; j++) { if (scores[j] > scores[i]) { int temp = scores[j]; scores[j] = scores[i]; scores[i] = temp; string temp1 = names[j]; names[j] = names[i]; names[i] = temp1; } } } PlayerPrefsX.SetIntArray("scores", scores); PlayerPrefsX.SetStringArray("names", names); }
void Start() { if (PlayerPrefsX.GetIntArray("TablicaWynikow", 0, 10)[0] == 0) { int[] TablicaWynikow = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; PlayerPrefsX.SetIntArray("TablicaWynikow", TablicaWynikow); } if (PlayerPrefsX.GetStringArray("TablicaWynikowNick", "", 10)[0] == "") { string[] TablicaWynikowNick = new string[10] { "", "", "", "", "", "", "", "", "", "" }; PlayerPrefsX.SetStringArray("TablicaWynikowNick", TablicaWynikowNick); } scena = SceneManager.GetActiveScene(); if (scena.name != naz) { menuInGame.SetActive(false); } }
public void LoadValues() { hasSavedValues = PlayerPrefsX.GetBool("hasSaved"); indexValueAtt = PlayerPrefsX.GetIntArray("TypeIndexAttack").ToList(); indexValueDef = PlayerPrefsX.GetIntArray("TypeIndexDefense").ToList(); if (nameAttack == null) { nameAttack = new List <List <string> >(); nameAttack.Add(new List <string>()); } if (nameDefense == null) { nameDefense = new List <List <string> >(); nameDefense.Add(new List <string>()); } nameAttack[0] = PlayerPrefsX.GetStringArray("NameAttack").ToList(); nameDefense[0] = PlayerPrefsX.GetStringArray("NameDefense").ToList(); if (indexValueAtt.Count != nameAttack.Count || indexValueDef.Count != nameDefense.Count) { for (int i = 1; i < indexValueAtt.Count; i++) { nameAttack.Add(PlayerPrefsX.GetStringArray("NameAttack").ToList()); nameDefense.Add(PlayerPrefsX.GetStringArray("NameDefense").ToList()); } } int j = 1; effect = new List <Effectiveness>(); for (int i = 0; i < indexValueAtt.Count; i++) { effect.Add((Effectiveness)System.Enum.Parse(typeof(Effectiveness), PlayerPrefs.GetString("EnumName" + j))); j++; } }
IEnumerator Start() { yield return(null); int slot = PlayerPrefs.GetInt("Slot"); if (slot > 0) { foreach (var obj in PlayerPrefsX.GetStringArray("ITriggers" + slot)) { var trigger = FindObjectsOfTypeAll <MonoBehaviour>().OfType <ITrigger>().FirstOrDefault(e => e.GameObject.name == obj); if (trigger != null) { if (trigger.Parent != null) { trigger.Parent.OnTrigger(trigger.GameObject); } if (trigger is EnemyController) { Destroy(trigger.GameObject); } } } CharacterController.Player.transform.position = PlayerPrefsX.GetVector3("Position" + slot); CharacterController.Player.transform.rotation = PlayerPrefsX.GetQuaternion("Rotation" + slot); CharacterController.Player.Health.CurrentHealth = PlayerPrefs.GetFloat("Health" + slot); CharacterController.Player.Energy.CurrentEnergy = PlayerPrefs.GetFloat("Energy" + slot); } }
public static int LoadTheGame(int loadSlot) //should be 1-4 { //check if load exists, if not doesn't load the game if (PlayerPrefsX.GetVector3("respawn" + loadSlot) == null) { return(-1); //failure } plants.Clear(); loadedSlot = loadSlot; //LOADS THE GAME SceneManager.LoadScene(PlayerPrefs.GetString("activeScene" + loadSlot)); //change update player next respawn spawnLocation = PlayerPrefsX.GetVector3("respawn" + loadSlot); Globals.player.health = PlayerPrefs.GetInt("playerHealth" + loadSlot); inventory = PlayerPrefsX.GetIntArray("playerInventory" + loadSlot); print(inventory); PlayerPrefsX.GetBool("lavaBossBeaten" + loadSlot, lavaBossBeaten); PlayerPrefsX.GetBool("windBossBeaten" + loadSlot, windBossBeaten); PlayerPrefsX.GetBool("caveBossBeaten" + loadSlot, caveBossBeaten); Vector3[] tempPlantPositions = PlayerPrefsX.GetVector3Array("PlantPositions" + loadSlot); int[] tempPlantTypes = PlayerPrefsX.GetIntArray("PlantTypes" + loadSlot); String[] tempPlantScenes = PlayerPrefsX.GetStringArray("PlantScenes" + loadSlot); int[] tempPlantDirections = PlayerPrefsX.GetIntArray("PlantDirections" + loadSlot); for (int i = 0; i < tempPlantDirections.Length; i++) { plants.Add(new PlantData(tempPlantPositions[i], tempPlantScenes[i], (Direction)tempPlantDirections[i]), tempPlantTypes[i]); } return(1); //success }
void LoadDecksFromPlayerPrefs() { List <DeckInfo> DecksFound = new List <DeckInfo>(); for (int i = 0; i < 9; i++) { string deckListKey = "Deck" + i; string characterKey = "DeckHero" + i; string deckNameKey = "DeckName" + i; string[] DeckAsCardNames = PlayerPrefsX.GetStringArray(deckListKey); if (DeckAsCardNames.Length > 0 && PlayerPrefs.HasKey(characterKey) && PlayerPrefs.HasKey(deckNameKey)) { string characterName = PlayerPrefs.GetString(characterKey); string deckName = PlayerPrefs.GetString(deckNameKey); List <CardAsset> deckList = new List <CardAsset>(); foreach (string name in DeckAsCardNames) { deckList.Add(CardCollection.Instance.GetCardAssetByName(name)); } DecksFound.Add(new DeckInfo(deckList, deckName, CharacterAssetsByName.Instance.GetCharacterByName(characterName))); } } AllDecks = DecksFound; }
public void UnlockWorld(string nameWorld) { var listWorld = PlayerPrefsX.GetStringArray("lockWorld").ToList(); listWorld.Remove(nameWorld); PlayerPrefsX.SetStringArray("lockWorld", listWorld.ToArray()); }
// Use this for initialization void Start() { string[] array = PlayerPrefsX.GetStringArray("highscore"); toggle.enabled = PlayerPrefsX.GetBool("sendOnServer"); List <Score> seznam = new List <Score>(); for (int i = 0; i < array.Length; i++) { string[] deli = array[i].Split('|'); Score s = new Score(); s.name = deli[0]; s.points = Int32.Parse(deli[1]); seznam.Add(s); } List <Score> SortedList = seznam.OrderByDescending(o => o.points).ToList(); for (int i = 0; i < SortedList.Count && i < 5; i++) { text.text += (i + 1).ToString() + ". " + SortedList[i].name + "\n"; text2.text += SortedList[i].points.ToString() + "\n"; } }
void napolniHighscore() { int[] highScoreArr = PlayerPrefsX.GetIntArray("HighScore"); string[] Names = PlayerPrefsX.GetStringArray("Names"); //Debug.Log(highScoreArr.Length + " " + Names.Length); if (highScoreArr.Length > 0 && Names.Length > 0) { if (highScoreArr.Length == Names.Length) { for (int i = 0; i < highScoreArr.Length; i++) { highscoreText[i].text = Names[i] + " - " + highScoreArr[i]; } } else { Debug.Log("Error?"); } } //else //{ // int[] tempArrayINT = new int[10] { 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100 }; // string[] tempArraySTR = new string[10] { "PC Master", "Luka", "Rok", "Aljaz", "Matjaz", "Ziga", "Janez", "Micka", "Francka", "Joze" }; // PlayerPrefsX.SetIntArray("HighScore", tempArrayINT); // PlayerPrefsX.SetStringArray("Names", tempArraySTR); // //highscoreText[0].text = "Napolnim"; // Debug.Log("Prazno... zaj polnim"); //} }
public void UnlockCar(string id) { var listCar = PlayerPrefsX.GetStringArray("lockCar").ToList(); listCar.Remove(id); PlayerPrefsX.SetStringArray("lockCar", listCar.ToArray()); }
void SaveUserName(string name) { string[] names = PlayerPrefsX.GetStringArray(UserNameKEY); //[0,0,0]// 取得 names = Add(names, name); // 新しい得点を追加 Debug.Log(string.Join(",", names)); // 配列の要素を,区切りのstring型で表示する PlayerPrefsX.SetStringArray(UserNameKEY, names); // 保存 }
void LoadChangedPlatforms() { var names = PlayerPrefsX.GetStringArray("insteadNamesArray"); if (names.Length == 0) { return; } else { var sprites = FindObjectsOfType <SpriteRenderer>(); var enemies = new List <GameObject>(); foreach (SpriteRenderer sprite in sprites) { if (sprite.gameObject.layer == enemyLayer) { enemies.Add(sprite.gameObject); } } foreach (GameObject enemy in enemies) { foreach (string name in names) { if (enemy.name == name) { enemy.GetComponent <SpriteRenderer>().color = Colors.completeColor; enemy.layer = wallsLayer; } } } } }
// Start is called before the first frame update public void Start() { var timesList = PlayerPrefsX.GetStringArray("TimeKEY"); Debug.Log(timesList); var scoreList = PlayerPrefsX.GetIntArray("KEY"); foreach (int A in scoreList) { Debug.Log(A); } //得点を新しい順に表示するコード var zip = scoreList.Zip(timesList, (scores, times) => new { scores, times }) .OrderByDescending(pair => pair.times) .Select((pair, index) => $"{pair.times} 得点:{pair.scores}"); //削除:No.{index + 1} foreach (string A in zip) { ResultBox = Instantiate(ResultBoxPrefab); ResultBox.transform.SetParent(canvas.transform, false); var txtComp = ResultBox.GetComponentInChildren <Text>(); txtComp.text = A; Debug.Log(A); rankingList.Add(txtComp); Debug.Log(rankingList[0]); } }
void UnlockStages(GameObject stage, float soul) { if (allSoul < soul) { Debug.Log("Soul not enough"); } else { string[] rs = PlayerPrefsX.GetStringArray("StageListUnlockx"); for (int i = 0; i < rs.Length; i++) { unlockStage.Add(rs [i]); } unlockStage.Add(stage.transform.name); if (!PlayerPrefsX.SetStringArray("StageListUnlockx", unlockStage.ToArray())) { Debug.Log("Can't save names"); } stage.transform.FindChild("Unlock").gameObject.SetActive(false); stage.transform.FindChild("Stage_Info").gameObject.SetActive(false); stage.transform.FindChild("Play").gameObject.SetActive(true); allSoul = allSoul - needSoul; allSoulText.text = "" + allSoul; PlayerPrefs.SetFloat("allSoul", allSoul); } }
void LoadDecksFromPlayerPrefs() { List <DeckInfo> DecksFound = new List <DeckInfo>(); // load the information about decks from PlayerPrefsX for (int i = 0; i < 9; i++) { string deckListKey = "Deck" + i.ToString(); string characterKey = "DeckHero" + i.ToString(); string deckNameKey = "DeckName" + i.ToString(); string[] DeckAsCardNames = PlayerPrefsX.GetStringArray(deckListKey); Debug.Log("Has character key: " + PlayerPrefs.HasKey(characterKey)); Debug.Log("Has Deckname key: " + PlayerPrefs.HasKey(deckNameKey)); Debug.Log("Length of DeckAsCardNames: " + DeckAsCardNames.Length); if (DeckAsCardNames.Length > 0 && PlayerPrefs.HasKey(characterKey) && PlayerPrefs.HasKey(deckNameKey)) { string characterName = PlayerPrefs.GetString(characterKey); string deckName = PlayerPrefs.GetString(deckNameKey); // make a CardAsset list from an array of strings: List <CardAsset> deckList = new List <CardAsset>(); foreach (string name in DeckAsCardNames) { deckList.Add(CardCollection.Instance.GetCardAssetByName(name)); } DecksFound.Add(new DeckInfo(deckList, deckName, CharacterAssetsByName.Instance.GetCharacterByName(characterName))); } } AllDecks = DecksFound; }
void Start() { if (potentialMessages) { json = JSON.Parse(potentialMessages.ToString()); Debug.Log("Loading chat..."); character = PlayerPrefs.GetString("chatting_with"); character_id = PlayerPrefs.GetInt("character id", 0); avatar = Resources.Load <Sprite>("Characters/" + character); string[] chat_path_history = PlayerPrefsX.GetStringArray(character); string[] chat_path_response_history = PlayerPrefsX.GetStringArray(character + "_responses"); int responseCounter = 0; for (int i = 0; i < chat_path_history.Length; i++) { SendMessageToPlayer(character, chat_path_history[i], false); if (i < chat_path_response_history.Length) { chatLog.addResponseToChatLog(chat_path_response_history[i]); responseCounter++; } } if (responseCounter < chat_path_response_history.Length) { Debug.LogError("still remaining responses in archive"); } if (chat_path_history.Length == 0) { SendMessageToPlayer(character, "intro", true); } } }
void SaveTime(string time) { string[] times = PlayerPrefsX.GetStringArray(TimeKEY); //[0,0,0]// 取得 times = Add(times, time); // 新しい得点を追加 Debug.Log(string.Join(",", times)); // 配列の要素を,区切りのstring型で表示する PlayerPrefsX.SetStringArray(TimeKEY, times); // 保存 }
public Text listeScores; //Text pour la liste des scores //variable à transformer en % NiveauOxygene void Start() { //ChangementScenePortail.leNomDuJoueur = "Kim"; //ControlerPersonnage.NiveauOxygene=10; PlayerPrefs.DeleteKey("FichierScores"); //Effacer les données précédemment enregistrées PlayerPrefs.DeleteKey("FichierNoms"); //Effacer les données précédemment enregistrées bool infoExisteDeja = PlayerPrefs.HasKey("FichierNoms"); //Regarde si valeurs présentes //si valeurs trouvées on affiche if (infoExisteDeja == true) { //lecture des données tableauValeursScore = PlayerPrefsX.GetFloatArray("FichierScores"); tableauNoms = PlayerPrefsX.GetStringArray("FichierNoms"); } tableauNoms[3] = ChangementScenePortail.leNomDuJoueur; tableauValeursScore[3] = ControlerPersonnage.NiveauOxygene; //listeScores.text = tableauValeursScore[0].ToString(); //Trier le tableau selon le score System.Array.Sort(tableauValeursScore, tableauNoms); System.Array.Reverse(tableauValeursScore); // System.Array.Reverse(tableauNoms); // AfficherElements(); //Écriture des données PlayerPrefsX.SetFloatArray("FichierScores", tableauValeursScore); PlayerPrefsX.SetStringArray("FichierNoms", tableauNoms); }
void Start() { highUser = PlayerPrefsX.GetStringArray("userArray", "Anonim", 15); highScores = PlayerPrefsX.GetIntArray("scoreArray", 0, 15); insertScore(); setupSetting(); }
void LoadArray() { players.Clear(); scores.Clear(); players.AddRange(PlayerPrefsX.GetStringArray("Leaderboard.players")); scores.AddRange(PlayerPrefsX.GetIntArray("Leaderboard.scores")); }
public void Load() { //Find load number int n; if (PlayerPrefs.HasKey("saveNumber")) { n = PlayerPrefs.GetInt("saveNumber"); } else { n = 0; } //Load selected game Dropdown x = GameObject.Find("LoadDropdown").GetComponent <Dropdown>(); if (x.value + 1 > n) { return; } CustomTiles.loading = true; //Make sure CustomTiles update() function doesn't overwrite words and translations CustomTiles.words = PlayerPrefsX.GetStringArray("WordsSave" + (x.value + 1)); CustomTiles.translations = PlayerPrefsX.GetStringArray("TranslationsSave" + (x.value + 1)); PlayCustomGame(); }
private void Load() { ClearUp(); var savedList = PlayerPrefsX.GetStringArray(PlayerPrefKey.CardList); if (savedList != null) { foreach (var card in savedList.Where(card => _cardPool.Contains(card))) { if (_cardList.ContainsKey(card)) { if (_cardList[card] <= 0) { _cardList[card] = 1; } else if (_cardList[card] >= _deck.MaxOfSingle()) { _cardList[card] = _deck.MaxOfSingle(); } else { _cardList[card]++; } } else { _cardList.Add(new KeyValuePair <string, int>(card, 1)); } } } AddCardsToList(); UpdateProgress(); }
public void SaveSecondName(string input) { secondCheckName = input; PlayerPrefs.SetString("secondCheckName" + curRunIndex.ToString(), secondCheckName); secondDailyName[14] = secondCheckName; PlayerPrefsX.GetStringArray("secondDailyName" + curRunIndex.ToString(), "", 30); }
/// <summary> /// Get list username from ArrayPrefs. /// </summary> /// <returns></returns> public List <string> GetStringList( ) { string[] arr = PlayerPrefsX.GetStringArray(PlayerPrefsKeys.USERNAME.ToString( )); List <string> list = new List <string>(); list.AddRange(arr); return(list); }
// Start is called before the first frame update void Start() { index = 0; buildingsIndex = 0; //Prendi i nomi da playerPrefs e salvali nelle rispettive liste unitsNames = PlayerPrefsX.GetStringArray("Units").ToList <string>(); buildingsNames = PlayerPrefsX.GetStringArray("Buildings").ToList <string>(); LoadCards(); }
public static string[] getHighscores() { if (highscores == null) { highscores = PlayerPrefsX.GetStringArray(playerPrefsKey); } //resetHighscores(); return(highscores); }
public void LoadCurrentValuesFromPrefs(int index) { curRunIndex = index; //getting all the prefs at the berginning of the game playerName = PlayerPrefs.GetString("playerName", ""); gender = PlayerPrefs.GetString("gender", ""); goodFuture = PlayerPrefs.GetString("goodFuture", ""); badFuture = PlayerPrefs.GetString("badFuture", ""); badHabitName = PlayerPrefs.GetString("badHabitName" + curRunIndex.ToString(), ""); firstCheckName = PlayerPrefs.GetString("firstCheckName" + curRunIndex.ToString(), ""); secondCheckName = PlayerPrefs.GetString("secondCheckName" + curRunIndex.ToString(), ""); weeklyCheckName = PlayerPrefs.GetString("weeklyCheckName" + curRunIndex.ToString(), ""); firstDailyCheck = PlayerPrefsX.GetStringArray("firstDailyCheck" + curRunIndex.ToString(), "", 30); secondDailyCheck = PlayerPrefsX.GetStringArray("secondDailyCheck" + curRunIndex.ToString(), "", 30); habitDailyCheck = PlayerPrefsX.GetStringArray("habitDailyCheck" + curRunIndex.ToString(), "", 30); dayJournal = PlayerPrefsX.GetStringArray("dayJournal" + curRunIndex.ToString(), "", 30); weekJournal = PlayerPrefsX.GetStringArray("weekJournal" + curRunIndex.ToString(), "", 5); weeklyCheck = PlayerPrefsX.GetStringArray("weeklyCheck" + curRunIndex.ToString(), "", 5); habitDailyName = PlayerPrefsX.GetStringArray("habitDailyName" + curRunIndex.ToString(), "", 30); firstDailyName = PlayerPrefsX.GetStringArray("firstDailyName" + curRunIndex.ToString(), "", 30); secondDailyName = PlayerPrefsX.GetStringArray("secondDailyName" + curRunIndex.ToString(), "", 30); weeklyName = PlayerPrefsX.GetStringArray("weeklyName" + curRunIndex.ToString(), "", 5); ////////////////////////////////////////////////////// //just for testing ---- fills up the calendar with successful previous days //int currentDayIndex = GetComponent<DateManagement>().GetCurrentDayIndex(); //int currentWeekIndex = GetComponent<DateManagement>().GetCurrentWeek(); //for (int i = 0; i < currentDayIndex - 1; i++) //{ // firstDailyCheck[i] = OptionCodes.options[0]; // habitDailyCheck[i] = OptionCodes.options[0]; // habitDailyName[i] = "lala"; // firstDailyName[i] = "lala"; //} //weeklyCheck[0] = OptionCodes.options[0]; ////weeklyCheck[1] = OptionCodes.options[1]; //weeklyName[0] = "lala"; ////weeklyName[1] = "lala"; //playerName = "lala"; ////badHabitName = "lala"; //firstCheckName = "lala"; //weeklyCheckName = "lala"; //secondCheckName = "lala"; ////////////////////////////////////////////////////// }
public override void TASK_START() { if (!manager) { Start(); } base.startTask(); if (!skip) { // Grab any info about loading next scenes or conditions from PlayerPrefs(X) var nextIndex = PlayerPrefs.GetInt("NextIndex"); var nextLevels = PlayerPrefsX.GetStringArray("NextLevels"); var nextConditions = PlayerPrefsX.GetStringArray("NextConditions"); // If we have a next task/condition, update it if (nextIndex < nextLevels.Length) { manager.config.level = nextLevels[nextIndex]; var levelname = manager.config.level; // save from destruction manager.config.condition = nextConditions[nextIndex]; nextIndex++; PlayerPrefs.SetInt("NextIndex", nextIndex); // removed as this is only used for proprietary Cyberith Virtualizer SDK; If using, uncomment this code //// Handle the current Landmarks structure to avoid breaking the game on loading the next scene //if (avatar.GetComponent<CVirtHapticListener>() != null) //{ // Destroy(avatar.GetComponent<CVirtHapticListener>()); // There can only be one! //} GameObject oldInstance = GameObject.Find("_Landmarks_"); oldInstance.name = "OldInstance"; GameObject.FindWithTag("Experiment").SetActive(false); GameObject.FindWithTag("Environment").SetActive(false); Destroy(avatar); // particularly important for SteamVR and interaction system; bugs on load // End the timeline and close the log file so there is no data loss/clipping at the end if (manager.config.runMode != ConfigRunMode.PLAYBACK) { manager.tasks.endTask(); } manager.dblog.close(); // avoid frame-drop during load forcing to SteamVr compositor by using SteamVR_LoadLevel for VR apps if (vrEnabled) { SteamVR_LoadLevel.Begin(levelname); Debug.Log("Loading new VR scene"); } else { SceneManager.LoadScene(levelname); // otherwise, just load the level like usual } } } }
void LoadList() { string[] names; float[] playertimes; names = PlayerPrefsX.GetStringArray("PlayerNames"); playertimes = PlayerPrefsX.GetFloatArray("PlayerTimes"); }
public void SendMessageToPlayer(string character, string _passage, bool archive) { FindTracker(); message = new Message(); message.sender = character; message.passage = _passage; message.belief = json[message.sender][message.passage]["belief_id"]; if (tracker) { tracker.belief_id = message.belief; tracker.path = _passage; tracker.character = character; } message.body = json[message.sender][message.passage]["message"]; //TODO: save belief chatLog.addMessage(message, avatar); sender = character; passage = _passage; if (archive) { List <string> chat_path_history = PlayerPrefsX.GetStringArray(character).ToList(); chat_path_history.Add(passage); Debug.Log("character: " + character + " passage:" + _passage); PlayerPrefsX.SetStringArray(character, chat_path_history.ToArray()); ToggleResponseOptions(); if (passage.Contains("finished")) { PlayerPrefs.SetInt("intervention index", 1); //show notification Invoke("SendNotification", 3.0f); } } else { Debug.Log("not archiving..."); Debug.Log("passage: " + passage); if (passage.Contains("finished")) { Debug.Log("Deactivating Responses"); chatLog.respondButton.SetActive(false); chatLog.responseContainer.SetActive(false); chatLog.waitingForResponse = false; } else { ToggleResponseOptions(); } } if (tracker) { tracker.Track(); } }