public void RoomClear(int count) { isAreaClear[count] = true; PlayerPrefsX.SetBoolArray("RoomData", isAreaClear); PlayerClear.SetActive(true); PlayerClear.GetComponent <Animator>().SetTrigger("Clear"); }
public static bool Save(int savenum, ref FieldScript field) { lengthx = field.GetSizeForSave().first; lengthz = field.GetSizeForSave().second; if (field == null) { Debug.Log("Save fail"); return(false); } else { bool[] CellStatsRS; CellStatsRS = new bool[lengthx * lengthz]; for (int i = 0; i < lengthx; i++) { for (int z = 0; z < lengthz; z++) { CellStatsRS[i * lengthz + z] = field.CellStatsR[i, z]; } } PlayerPrefsX.SetBoolArray(savenum + ".cstatsr", CellStatsRS); PlayerPrefs.Save(); PlayerPrefs.SetInt(savenum + ".x", lengthx); PlayerPrefs.SetInt(savenum + ".z", lengthz); Debug.Log("saved on " + savenum + " with: " + lengthx + ", " + lengthz); return(true); } }
// Update is called once per frame void Update() { if (Input.touchCount >= 3 || Input.GetKeyDown(KeyCode.M)) { PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") + 10); if (PlayerPrefs.GetInt("Coins") > 99) { PlayerPrefs.SetInt("Coins", 99); } } if (Input.GetMouseButtonDown(1)) { PlayerPrefs.DeleteAll(); PlayerPrefsX.SetBoolArray("MapsBought", new bool[] { true, false }); PlayerPrefsX.SetBoolArray("RocketsBought", new bool[] { true, false }); } foreach (Touch t in Input.touches) { if (t.phase == TouchPhase.Began) { TestClick(Camera.main.ScreenToWorldPoint(t.position)); } } if (Input.GetMouseButtonDown(0)) { Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); TestClick(pos); } }
public static void FieldMapOpen() { for (int i = 0; i < fieldBridgeContainer.Length; i++) { foreach (Transform bridge in fieldBridgeContainer[i]) { bridge.gameObject.SetActive(true); } } for (int i = 0; i < (int)mapSize.x * (int)mapSize.y; i++) { for (int j = 0; j < (int)mapSize.x * (int)mapSize.y; j++) { fieldBridgeVisibility[i, j] = true; } } DataManager.BinarySerialize <bool[, ]>(fieldBridgeVisibility, DataFilePath.FieldBridgeVisibility); bool[] fieldEvnetVisibility = PlayerPrefsX.GetBoolArray(PrefsEntity.FieldEventVisibility); foreach (Transform e in fieldEventContainer) { if (e != null) { e.gameObject.SetActive(true); } } for (int i = 0; i < fieldEvnetVisibility.Length; i++) { fieldEvnetVisibility[i] = true; } PlayerPrefsX.SetBoolArray(PrefsEntity.FieldEventVisibility, fieldEvnetVisibility); Debug.Log("Map Open"); }
public void Start() { GameManager.instance.mainUI = this; for (int numOfWorld = 0; numOfWorld < GameManager.numOfWorlds; numOfWorld++) { if (PlayerPrefsX.GetBoolArray("World " + (numOfWorld + 1) + " Levels Unlocked").Length == 0) { bool[] isUnlocked = new bool[GameManager.levelsPerWorld]; isUnlocked[0] = true; PlayerPrefsX.SetBoolArray("World " + (numOfWorld + 1) + " Levels Unlocked", isUnlocked); for (int i = 0; i < GameManager.levelsPerWorld; i++) { GameManager.unlockedLevels[numOfWorld, i] = isUnlocked[i]; } } else { bool[] isUnlocked = PlayerPrefsX.GetBoolArray("World " + (numOfWorld + 1) + " Levels Unlocked"); for (int i = 0; i < GameManager.levelsPerWorld; i++) { GameManager.unlockedLevels[numOfWorld, i] = isUnlocked[i]; } } } }
private void CreateAllSpaces(int numCorrect) { int tmpG = numCorrect; bool[] arrFalse1 = new bool[numScenP]; for (int y = 1; y < numScenP; y++) { if (y == 1) { arrFalse1[y] = true; } else { arrFalse1[y] = false; } } bool[] arrFalse2 = new bool[numScenP]; for (int y = 1; y < numScenP; y++) { arrFalse2[y] = false; } for (int i = 1; i < tmpG; i++) { if (i == 1) { PlayerPrefsX.SetBoolArray("CompleteLevel" + i, arrFalse1); } else { PlayerPrefsX.SetBoolArray("CompleteLevel" + i, arrFalse2); } PlayerPrefs.Save(); } }
void Start() { buttons = GetComponentsInChildren <Button>(); levelProgress = PlayerPrefsX.GetBoolArray("LevelProgress", false, buttons.Length); if (buttons.Length != levelProgress.Length) { bool[] levelProgressNew = new bool[buttons.Length]; levelProgressNew.Copy <bool>(levelProgress); levelProgress = levelProgressNew; } PlayerPrefsX.SetBoolArray("LevelProgress", levelProgress); for (int i = 0; i < buttons.Length; i++) { Button currentButton = buttons[i]; int levelnum = Int32.Parse(currentButton.name); if (levelnum == 0 || levelProgress[levelnum - 1] == true) { currentButton.onClick.AddListener(delegate { LoadLevel(levelnum); }); buttons[i].GetComponent <Image>().color = unlocked; } else { currentButton.onClick.RemoveAllListeners(); buttons[i].GetComponent <Image>().color = locked; } } //Debug.Log(levelProgress.Length); }
private void InitPrefs(bool reset = false) { bool [] levelsAvailable = PlayerPrefsX.GetBoolArray("levelsAvalable"); if (levelsAvailable.Length == 0 || reset) { levelsAvailable = new bool[maxLevels]; bool [] levelsCompleted = new bool[maxLevels]; bool [] levelsVisited = new bool[maxLevels]; int [] levelsStars = new int[maxLevels]; for (int i = 0; i < maxLevels; i++) { levelsAvailable[i] = (i == 0); levelsCompleted[i] = false; levelsVisited[i] = false; levelsStars[i] = 0; } PlayerPrefsX.SetBoolArray("levelsAvalable", levelsAvailable); PlayerPrefsX.SetBoolArray("levelsCompleted", levelsCompleted); PlayerPrefsX.SetBoolArray("levelsVisited", levelsVisited); PlayerPrefsX.SetIntArray("levelsStars", levelsStars); PlayerPrefs.SetInt("currentLevel", 0); } if (!PlayerPrefs.HasKey("currentLevel")) { PlayerPrefs.SetInt("currentLevel", 0); } }
public void UnlockCharacter(int _index) { bool[] ballU = PlayerPrefsX.GetBoolArray(GameKeys.kprefBallPrizeUnlock); int totalDiamonds = PlayerPrefs.GetInt(GameKeys.kprefDiamonds); int[] ball_PrizeC = PlayerPrefsX.GetIntArray(GameKeys.kprefBallPrize); if (ballU [_index]) { PlayerPrefs.SetInt("INDEX", _index); return; } else { if (ball_PrizeC [_index] <= totalDiamonds) { int new_Diamond = totalDiamonds - ball_PrizeC [_index]; // GameController.instance.diamondScoreText.text = new_Diamond.ToString (); PlayerPrefs.SetInt(GameKeys.kprefDiamonds, new_Diamond); UpdateDiamondScore(); IPScrollView.Instance.scrollableObjects [_index].GetChild(0).GetChild(0).gameObject.SetActive(false); ballU [_index] = true; PlayerPrefsX.SetBoolArray(GameKeys.kprefBallPrizeUnlock, ballU); PlayerPrefs.SetInt("INDEX", _index); } } }
public static void startNewGame() { int[] area = { 0, 1, 2 }; int rand = (int)Random.Range(0, 2); int temp; for (int j = 0; j < 10; j++) { for (int i = 2; i > 0; i--) { rand = (int)Random.Range(0, 2); temp = area[rand]; area[rand] = area[i]; area[i] = temp; } } int area1 = (int)Random.Range((int)1, (int)11); int area2 = (int)Random.Range((int)1, (int)11); int area3 = (int)Random.Range((int)1, (int)11); bool[] doneArea = { false, false, false }; PlayerPrefsX.SetIntArray("areaGame", area); PlayerPrefs.SetInt("area1Key", area1); PlayerPrefs.SetInt("area2Key", area2); PlayerPrefs.SetInt("area3Key", area3); PlayerPrefsX.SetBoolArray("areaDone", doneArea); PlayerPrefsX.SetBool("saved", false); }
public void ButtonGet() { bool[] dataDailyGift = PlayerPrefsX.GetBoolArray(DialogDailyGift.key_data_daily_gift); dataDailyGift[id - 1] = true; //Luu lai PlayerPrefsX.SetBoolArray(DialogDailyGift.key_data_daily_gift, dataDailyGift); SetData(true); switch (id) { case 1: default: VariableSystem.AddDiamond(1); break; case 2: //super seed DialogShop.BoughtItem[0] = true; break; case 3: //amazing machine DialogShop.BoughtItem[2] = true; break; case 4: VariableSystem.AddDiamond(2); break; case 5: //radio DialogShop.BoughtItem[4] = true; break; case 6: //save money DialogShop.BoughtItem[5] = true; break; case 7: //super hand DialogShop.BoughtItem[3] = true; break; case 8: VariableSystem.AddDiamond(4); break; case 9: //fill rate meter MissionPowerUp.FillRateMeter = true; break; case 10: //price drop MissionPowerUp.PriceDrop = true; break; case 11: //More time MissionPowerUp.MoreTime = true; break; case 12: VariableSystem.AddDiamond(8); break; } }
public void ClearProgress() { levelProgress = PlayerPrefsX.GetBoolArray("LevelProgress", false, buttons.Length); levelProgress.Fill <bool>(false); PlayerPrefsX.SetBoolArray("LevelProgress", levelProgress); PlayerPrefs.SetInt("coins", 0); Start(); }
public static void Save_Quest_Info() //퀘스트를 끝내면(bool변경될 때 마다)호출 { Save_S1(); Save_S2(); PlayerPrefsX.SetBoolArray("Stage1_Quest", S1); PlayerPrefsX.SetBoolArray("Stage2_Quest", S2); PlayerPrefsX.SetIntArray("Stage2_Quest_INT", S2_intArr); }
public void UnlockAll() { levelProgress = PlayerPrefsX.GetBoolArray("LevelProgress", true, buttons.Length); levelProgress.Fill <bool>(true); PlayerPrefsX.SetBoolArray("LevelProgress", levelProgress); PlayerPrefs.SetInt("coins", 1000000); Start(); }
static void RoomDataReset() { bool[] isRoomData = { false, false, false, false }; PlayerPrefsX.SetBoolArray("RoomData", isRoomData); Debug.Log("RoomDataを初期化しました"); }
public void ResetSavedLevels() { bool[] tmp = new bool[10]; tmp[0] = true; PlayerPrefsX.SetBoolArray("World " + 1 + " Levels Unlocked", tmp); PlayerPrefsX.SetBoolArray("World " + 2 + " Levels Unlocked", tmp); PlayerPrefsX.SetBoolArray("World " + 3 + " Levels Unlocked", tmp); }
void Start() { hasGift = false; bgMain = transform.FindChild("Main"); bgBlack = transform.FindChild("Black"); grid = bgMain.FindChild("Scroll View").FindChild("Grid").GetComponent <UIGrid>(); //Debug.Log(DateTime.Today.DayOfYear + "------------------"); //Check ngay bat dau choi trong he thong neu chua co thi luu ngay hien tai vao data if (!PlayerPrefs.HasKey(key_start_day)) { PlayerPrefs.SetInt(key_start_day, DateTime.Today.DayOfYear); PlayerPrefs.SetInt(key_start_year, DateTime.Today.Year); } //Lay ngay ban dau da luu trong he thong int day_start = PlayerPrefs.GetInt(key_start_day); int year_start = PlayerPrefs.GetInt(key_start_year); //Lay ngay hien tai trong nam int day_current = DateTime.Today.DayOfYear; int year_current = DateTime.Today.Year; int day_open_gift = 1; //So sanh nam if (year_current > year_start) { //Neu nam hien tai > nam bat dau => mo het dailygift day_open_gift = 12; } else if (year_current == year_start) { day_open_gift = day_current - day_start + 1; } if (day_open_gift > 12) { day_open_gift = 12; } //Check data cua daily gift da co chua, neu chua se cho vao da ta if (!PlayerPrefs.HasKey(key_data_daily_gift)) { PlayerPrefsX.SetBoolArray(key_data_daily_gift, new bool[12]); } bool[] dataDailyGift = PlayerPrefsX.GetBoolArray(key_data_daily_gift); for (int i = 0; i < day_open_gift; i++) { grid.GetChild(i).GetComponent <ItemDailyGift>().SetData(dataDailyGift[i]); if (dataDailyGift[i] == false) { hasGift = true; } } if (DialogDailyGift.hasGift && LoadingStartMenu.showGift) { Debug.Log("SHOW gift "); LoadingStartMenu.showGift = false; ShowDialog(); } }
public void NextLevel() { int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1; bool[] progress = PlayerPrefsX.GetBoolArray("progress"); progress[SceneManager.GetActiveScene().buildIndex - 2] = true; PlayerPrefsX.SetBoolArray("progress", progress); SceneManager.LoadScene(nextSceneIndex); }
public static void ClearMeetFish() { bool[] array = PlayerPrefsX.GetBoolArray("FishType", false, 17); for (int i = 0; i < array.Length; i++) { array[i] = false; } PlayerPrefsX.SetBoolArray("FishType", array); Debug.Log("Complete! "); }
public static void Save_Item_Info() //아이템을 먹거나 사용할 때 호출 { _ic_for_Save = GameObject.FindWithTag("Item_Canvas").GetComponent <Item_Controller> (); PlayerPrefsX.SetStringArray("IC_nameList", _ic_for_Save._item_name_list); PlayerPrefsX.SetBoolArray("Usable_item", _ic_for_Save._usable_item); PlayerPrefsX.SetIntArray("NumOfItem", _ic_for_Save._the_number_of_items); PlayerPrefsX.SetStringArray("Interaction", _ic_for_Save._interaction_object); PlayerPrefsX.SetBoolArray("Consumable", _ic_for_Save._consumable); }
void ClearFishMeet() { int type = PlayerPrefs.GetInt("TotalFishType"); bool[] falseArray = new bool[type]; for (int i = 0; i < type; i++) { falseArray[i] = false; } PlayerPrefsX.SetBoolArray("FishType", falseArray); }
public void SetMatrixIsOpenTrue(int b, int i) { bool[] bNow = GetAllMatrixIsOpenBool(i); bNow[b] = true; PlayerPrefsX.SetBoolArray(allMatrixIsOpenBool + i, bNow); if (i != 2) { SetMatrixIsOpenTrue(b, 2); //全体のマトリックスデータも解放 } SetMatrixOpenNumBer(i); }
public void clearProgress() { bool[] gunsUnlocked = PlayerPrefsX.GetBoolArray("gunsUnlocked"); gunsUnlocked.Fill <bool>(false); gunsUnlocked[0] = true; PlayerPrefsX.SetBoolArray("gunsUnlocked", gunsUnlocked); gunsEquipped[0] = 0; gunsEquipped[1] = 0; PlayerPrefsX.SetIntArray("gunsEquipped", gunsEquipped); Start(); }
//Unlocks item void unlock(int index) { unlocked[index] = true; PlayerPrefsX.SetBoolArray("unlocked", unlocked); PlayerPrefs.SetInt("Stars", PlayerPrefs.GetInt("Stars") - price); hidePrice(index); setActiveSkin(index); PlayerPrefs.Save(); buttons[index].GetComponent <Image>().color = unlockedColor; setShopPicture(index); }
public void LevelFinished() { StartCoroutine(instance.levelUI.ShowLevelCompleteMenu()); if (currentLevel < levelsPerWorld) { unlockedLevels[currentWorld - 1, currentLevel] = true; bool[] unlockedForThisWorld = PlayerPrefsX.GetBoolArray("World " + instance.currentWorld + " Levels Unlocked"); print(unlockedForThisWorld.Length); print(currentLevel); unlockedForThisWorld[currentLevel] = true; PlayerPrefsX.SetBoolArray("World " + instance.currentWorld + " Levels Unlocked", unlockedForThisWorld); } }
private void OnTriggerEnter(Collider other) { for (int i = 0; i <= 5; i++) { if (this.gameObject.name == "item" + i.ToString()) { CollectionManager.Instance.itemTrigger[i] = true; PlayerPrefsX.SetBoolArray(CollectionManager.Instance.key, CollectionManager.Instance.itemTrigger); } print(CollectionManager.Instance.itemTrigger[i]); } Destroy(this.gameObject); }
public void UnlockNewLevel(int index) { Locked[index] = false; for (int i = 0; i == index; i++) { PlayerPrefsX.SetBoolArray("LockedLevel", Locked); } for (int i = 0; i < Locked.Length; i++) { PlayerPrefsX.SetBoolArray("LockedLevel", Locked); } Levels[index].transform.Find("Locked").gameObject.SetActive(false); }
IEnumerator FishColiWithWeb() { GameManager.totalMeet++; AddScoreHandler(_score, _weight); int count = PlayerPrefs.GetInt("FishCount"); count++; PlayerPrefs.SetInt("FishCount", count); //PlayerPrefsX.SetSingleBoolInArray("FishType", _id ,true); bool[] array = PlayerPrefsX.GetBoolArray("FishType", false, PlayerPrefs.GetInt("TotalFishType")); if (!array[_id]) { GameManager.newMeet++; array[_id] = true; if (FirstMeetHandler != null) { FirstMeetHandler.Invoke(_id); } } PlayerPrefsX.SetBoolArray("FishType", array); int[] arrayInt = PlayerPrefsX.GetIntArray("FishCountArray", 0, PlayerPrefs.GetInt("TotalFishType")); arrayInt[_id]++; PlayerPrefsX.SetIntArray("FishCountArray", arrayInt); GetComponent <Animator>().Play("jump"); GetComponentInChildren <Renderer>().material.SetTexture("_MainTex", tex); GetComponent <Rigidbody>().angularVelocity = Vector3.zero; AudioSource source = gameObject.AddComponent <AudioSource>(); int size = SoundManager.instance.bubble.Length; int i = UnityEngine.Random.Range(0, size); source.clip = SoundManager.instance.bubble[i]; source.Play(); //GetComponent<Rigidbody>().velocity = Vector3.zero; //GetComponent<Collider>().enabled = false; yield return(new WaitForSeconds(0.5f)); yield return(new WaitForSeconds(animLength - 0.5f)); Destroy(this.gameObject); }
private void CheckForSavedData() { if (!PlayerPrefs.HasKey(k_Levels)) { PlayerPrefs.SetInt(k_Levels, 0); } if (!PlayerPrefs.HasKey(k_Collectables)) { PlayerPrefs.SetInt(k_Collectables, 0); } if (!PlayerPrefs.HasKey(k_VolumeEffects)) { PlayerPrefs.SetFloat(k_VolumeEffects, 1); } if (!PlayerPrefs.HasKey(k_VolumeMusic)) { PlayerPrefs.SetFloat(k_VolumeMusic, 0.5f); } if (!PlayerPrefs.HasKey(k_Language)) { PlayerPrefs.SetInt(k_Language, GetSystemLanguage()); } // ASSIGN VALUES NumberOfLevelsCompleted = PlayerPrefs.GetInt(k_Levels); NumberOfCollectablesCollected = PlayerPrefs.GetInt(k_Collectables); VolumeEffects = PlayerPrefs.GetFloat(k_VolumeEffects); VolumeMusic = PlayerPrefs.GetFloat(k_VolumeMusic); Language = PlayerPrefs.GetInt(k_Language); if (PlayerPrefsX.GetBoolArray(k_CollectablesArray).Length != 0) { CollectableFromLevel = PlayerPrefsX.GetBoolArray(k_CollectablesArray); } else { CollectableFromLevel = new bool[levelCount]; PlayerPrefsX.SetBoolArray(k_CollectablesArray, CollectableFromLevel); } PlayerPrefs.Save(); CheckAchievementsStatus(); }
private void Start() { buttons = GetComponentsInChildren <Button>(true); gunsUnlocked = PlayerPrefsX.GetBoolArray("gunsUnlocked", false, buttons.Length - 2); gunsUnlocked[0] = true; if (buttons.Length - 2 != gunsUnlocked.Length) { bool[] gunsUnlockedNew = new bool[buttons.Length - 2]; gunsUnlockedNew.Copy <bool>(gunsUnlocked); gunsUnlocked = gunsUnlockedNew; } PlayerPrefsX.SetBoolArray("gunsUnlocked", gunsUnlocked); gunsEquipped = PlayerPrefsX.GetIntArray("gunsEquipped", 0, 2); for (int i = 0; i < buttons.Length; i++) { int x = i; Button currentButton = buttons[x]; if (GameObject.ReferenceEquals(currentButton.transform.parent.gameObject, slots)) { currentButton.onClick.RemoveAllListeners(); currentButton.onClick.AddListener(delegate { setGunSlot(Int32.Parse(currentButton.name) - 1); }); //Debug.Log(buttons[x].name); continue; } if (currentButton.gameObject.transform.name.Equals("Buy")) { currentButton.onClick.RemoveAllListeners(); currentButton.onClick.AddListener(delegate { buyGun(currentButton); }); continue; } if (gunsUnlocked[GunData.nameToGun[currentButton.gameObject.transform.name]] == true) { currentButton.image.color = unlocked; currentButton.onClick.RemoveAllListeners(); currentButton.onClick.AddListener(delegate { openSlots(currentButton.gameObject); }); } else { currentButton.image.color = locked; currentButton.onClick.RemoveAllListeners(); currentButton.onClick.AddListener(delegate { openBuy(currentButton); }); } } }