Exemple #1
0
 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];
             }
         }
     }
 }
Exemple #3
0
 public void LoadingGame()
 {
     if (PlayerPrefs.GetString("ScanSave") != "")
     {
         SumVariable.nextlevel      = PlayerPrefs.GetString("ScanSave");
         SumVariable.nextad         = PlayerPrefsX.GetVector3("nextadSave");
         SumVariable.nextdt         = "down";
         SumVariable.teamban        = PlayerPrefsX.GetBoolArray("banSave");
         SumVariable.battleteam     = PlayerPrefsX.GetIntArray("battleteamSave");
         SumVariable.charactor      = PlayerPrefs.GetString("charactorSave");
         SumVariable.key            = PlayerPrefs.GetInt("keySave");
         SumVariable.charactorlv[1] = PlayerPrefsX.GetIntArray("charactorlv1");
         SumVariable.charactorlv[2] = PlayerPrefsX.GetIntArray("charactorlv2");
         SumVariable.charactorlv[3] = PlayerPrefsX.GetIntArray("charactorlv3");
         PlayerPrefs.SetString("cacheitemSave", PlayerPrefs.GetString("itemSave"));
         PlayerPrefs.SetString("cachefriendsSave", PlayerPrefs.GetString("friendsSave"));
         PlayerPrefs.SetString("cachemainSave", PlayerPrefs.GetString("mainSave"));
         PlayerPrefs.SetString("cacheCureSkillSave", PlayerPrefs.GetString("CureSkillSave"));
         PlayerPrefs.SetString("cacheHelpSkillSave", PlayerPrefs.GetString("HelpSkillSave"));
         PlayerPrefs.SetString("cacheAttackSkill", PlayerPrefs.GetString("AttackSkillSave"));
         PlayerPrefs.SetString("cacheFriendstipSave", PlayerPrefs.GetString("FriendstipSave"));
         PlayerPrefs.SetString("cachetasksSave", PlayerPrefs.GetString("tasksSave"));
         PlayerPrefs.Save();
         SceneManager.LoadScene("scan/loading1");
     }
 }
Exemple #4
0
    public void LoadPlayerSave(Monster playerMonster)
    {
        Debug.Log("Load save");
        for (int i = 0; i < allParts.Length; ++i)
        {
            allParts[i].playerlevel     = PlayerPrefsX.GetIntArray($"PartsLevels_{allParts[i].type}");
            allParts[i].isOwnedByPlayer = PlayerPrefsX.GetBoolArray($"IsOwnedByPlayer_{allParts[i].type}");
        }

        LoadBodyPart(BodyPartType.Body);

        LoadBodyPart(BodyPartType.Arms);
        LoadBodyPart(BodyPartType.Legs);
        LoadBodyPart(BodyPartType.Tail);
        LoadBodyPart(BodyPartType.Wings);
        LoadBodyPart(BodyPartType.Fur);

        LoadBodyPart(BodyPartType.Head);
        LoadBodyPart(BodyPartType.Teeth);
        LoadBodyPart(BodyPartType.Eyes);
        LoadBodyPart(BodyPartType.Horns);

        void LoadBodyPart(BodyPartType type)
        {
            int id = PlayerPrefs.GetInt($"EquipedId_{type}");

            allParts[(int)type].parts[id].isEquipedByPlayer = true;
            playerMonster.usedBodyParts.Add(GetAllParts(type)[id]);
        }

        OnNewPlayerPartsAvaliable?.Invoke();
    }
    // Use this for initialization
    void Start()
    {
        //PlayerPrefs.DeleteAll ();
        if (PlayerPrefs.HasKey("Cleared_Stage"))
        {
            bool[] cleared_stages = PlayerPrefsX.GetBoolArray("Cleared_Stage");
            //bool[] stage_mode = PlayerPrefsX.GetBoolArray ("Cleared_Stage_Mode");
            int cleared_stage_num = 0;

            foreach (bool item in cleared_stages)
            {
                if (item == true)
                {
                    cleared_stage_num++;
                }
            }
            if (cleared_stage_num == 10)
            {
                noticeBox_10th.SetActive(true);
            }
            int i = Mathf.FloorToInt(cleared_stage_num / 10) + 1;
            Show_This_Stage(i);
            Show_ClearedText(i);
        }
    }
 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);
 }
Exemple #7
0
    public void LoadPattern(string newSound)
    {
        ClearLights();
        if (newSound == null)
        {
            return;
        }
        else
        {
            currentSound = newSound;
            if (PlayerPrefsX.GetBoolArray(currentSound).Length < 10)
            {
                return;
            }
            else
            {
                ActiveLights = PlayerPrefsX.GetBoolArray(currentSound);

                int i = 0;
                foreach (bool lightOn in ActiveLights)
                {
                    i++;
                    if (lightOn == true)
                    {
                        lights [i - 1].SetActive(true);
                        Debug.Log("on = " + i);
                    }
                    if (lightOn == false)
                    {
                        lights [i - 1].SetActive(false);
                    }
                }
            }
        }
    }
Exemple #8
0
    public void SetColorColorOrBW()
    {
        bool[] isUnlocked = PlayerPrefsX.GetBoolArray("CharacterUnlocked");
        int    i          = 0;

        while (i < isUnlocked.Length)
        {
            int j = 0;
            //Debug.Log(isUnlocked[i]);
            //Debug.Log(i);
            while (j < 10)
            {
                if (trueMaterial[i, j] != null)
                {
                    if (!isUnlocked[i])
                    {
                        trueMaterial[i, j].color = bwColor[i, j];
                    }
                    else if (isUnlocked[i])
                    {
                        trueMaterial[i, j].color = trueColor[i, j];
                    }
                }
                j++;
            }
            i++;
        }
    }
Exemple #9
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);
            }
        }
    }
Exemple #10
0
    private void LoadPrefs()
    {
        _currentLevel = PlayerPrefs.GetInt("currentLevel");

        bool [] levelsAvailable = PlayerPrefsX.GetBoolArray("levelsAvalable");
        bool [] levelsCompleted = PlayerPrefsX.GetBoolArray("levelsCompleted");
        bool [] levelsVisited   = PlayerPrefsX.GetBoolArray("levelsVisited");
        int []  levelsStars     = PlayerPrefsX.GetIntArray("levelsStars");

        _levelsPrefs = new List <Level> ();
        for (int i = 0; i < levelsTotal; i++)
        {
            _levelsPrefs.Add(new Level(levelsAvailable[i], levelsCompleted[i], levelsStars[i], levelsVisited[i]));
            if (i < levelsTotal - 1)
            {
                if (_levelsInfo.transitions != null && i < _levelsInfo.transitions.Count)
                {
                    _levelsPrefs[i].transitions = _levelsInfo.transitions[i];
                }
                else
                {
                    _levelsPrefs[i].transitions = new List <int>();
                    _levelsPrefs[i].transitions.Add(i + 1);
                }
            }
            else
            {
                _levelsPrefs[i].transitions = null;
            }
        }
    }
Exemple #11
0
    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);
        }
    }
Exemple #12
0
    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 void UnlockAll()
 {
     levelProgress = PlayerPrefsX.GetBoolArray("LevelProgress", true, buttons.Length);
     levelProgress.Fill <bool>(true);
     PlayerPrefsX.SetBoolArray("LevelProgress", levelProgress);
     PlayerPrefs.SetInt("coins", 1000000);
     Start();
 }
Exemple #15
0
    // Start is called before the first frame update
    void Start()
    {
        //Application.OpenURL(@"C:\Windows\System32\osk.exe");
        b_pond.onClick.AddListener(ShowScroll);
        b_back.onClick.AddListener(HideScroll);
        b_list.onClick.AddListener(delegate { UpdateUIGroup(0); });
        b_archievement.onClick.AddListener(delegate { UpdateUIGroup(2); });

        buttonOrigin = b_list.GetComponent <Image>().sprite;
        boyOrigin    = boy.sprite;
        girlOrigin   = girl.sprite;
        img_sb0      = b_list.transform.Find("Image").GetComponent <Image>();
        img_sb1      = b_archievement.transform.Find("Image").GetComponent <Image>();

        //strangely it doesnt work
        //buttons = scrollView.GetComponentsInChildren<Button>();
        //for (int i = 0; i < buttons.Length; i++) {
        //    Debug.Log(i);
        //    Debug.Log(buttons[i].name);
        //    buttons[i].onClick.AddListener(delegate { ShowDetail(i); });
        //}

        AssetBundle ab;

#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
        ab = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/data.ab");
#endif
#if UNITY_ANDROID
        ab = AssetBundle.LoadFromFile(Application.dataPath + "!assets/data.ab");
#endif
        TextAsset ta = ab.LoadAsset <TextAsset>("Fish");
        fishDataList = JsonUtility.FromJson <FishDataList>(ta.text);
        ab.Unload(true);

        fishCount.text = PlayerPrefs.GetInt("FishCount", 0).ToString();
        farthest.text  = (PlayerPrefs.GetFloat("Farthest", 0f) * 0.5f).ToString("0");
        PlayerPrefs.SetInt("TotalFishType", fishDataList.fish.Count);
        bool[] array = PlayerPrefsX.GetBoolArray("FishType", false, fishDataList.fish.Count);
        int    count = 0;
        for (int i = 0; i < array.Length; i++)
        {
            if (array[i] == true)
            {
                count++;
            }
        }
        fishType.text = count.ToString();
        FillList();
        FillDetail();
        arhievement.gameObject.SetActive(false);
        detailView.gameObject.SetActive(false);
        scrollView.gameObject.SetActive(true);
        b_list.GetComponent <Image>().sprite         = buttonSelected;
        b_archievement.GetComponent <Image>().sprite = buttonOrigin;
        img_sb0.color = imgSelectedColor;
        img_sb1.color = imgDeSelectedColor;
    }
Exemple #16
0
    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);
    }
Exemple #18
0
    void FillList()
    {
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
        spriteAB = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/ponduifish.ab");
#endif
#if UNITY_ANDROID
        spriteAB = AssetBundle.LoadFromFile(Application.dataPath + "!assets/data.ab");
#endif
        Button[] btns  = scrollView.GetComponentsInChildren <Button>();
        bool[]   array = PlayerPrefsX.GetBoolArray("FishType", false, fishDataList.fish.Count);

        //for (int i = 0; i < fishDataList.fish.Count; i++) {
        //    Debug.Log(fishDataList.fish[i].research);
        //}
        for (int i = 0; i < btns.Length; i++)
        {
            if (array[i])
            {
                btns[i].gameObject.transform.Find("Image").GetComponent <Image>().sprite = spriteAB.LoadAsset <Sprite>((i + 1).ToString());
                btns[i].gameObject.transform.Find("name").GetComponent <Text>().text     = fishDataList.fish[i].name;
                int[] arrayInt = PlayerPrefsX.GetIntArray("FishCountArray", 0, fishDataList.fish.Count);
                float percent;
                if (arrayInt[i] == 0)
                {
                    percent = 0;
                }
                else
                {
                    percent = arrayInt[i] / (float)fishDataList.fish[i].research;
                }
                if (percent > 1)
                {
                    percent = 1.0f;
                }
                btns[i].gameObject.transform.Find("per").GetComponent <Text>().text       = (percent * 100f).ToString("0") + "%";
                btns[i].gameObject.transform.Find("Slider").GetComponent <Slider>().value = percent;
            }
            else
            {
                btns[i].gameObject.transform.Find("Image").GetComponent <Image>().sprite = spriteAB.LoadAsset <Sprite>("Null");
                btns[i].gameObject.transform.Find("name").GetComponent <Text>().text     = "尚未遇到的鱼";
                float percent = 0;
                btns[i].gameObject.transform.Find("per").GetComponent <Text>().text       = percent.ToString("0") + "%";
                btns[i].gameObject.transform.Find("Slider").GetComponent <Slider>().value = percent;
            }
            if (i < 9)
            {
                btns[i].gameObject.transform.Find("no").GetComponent <Text>().text = "0" + (i + 1).ToString() + ".";
            }
            else
            {
                btns[i].gameObject.transform.Find("no").GetComponent <Text>().text = (i + 1).ToString() + ".";
            }
        }
        //dont unload ab here
    }
Exemple #19
0
 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! ");
 }
    private void LoadforTest(int gNum, int pNum)
    {
        //test this
        bool[] tmpArr2 = PlayerPrefsX.GetBoolArray("CompleteLevel" + gNum);

        Debug.Log("LENGHT " + tmpArr2.Length);
        for (int i = 0; i < tmpArr2.Length; i++)
        {
            Debug.Log(tmpArr2.GetValue(i));
        }
    }
Exemple #21
0
 // Start is called before the first frame update
 void Start()
 {
     currentMission = PlayerPrefsX.GetBoolArray("missionsAccomplished", false, 1);
     for (int i = 0; i < currentMission.Length; i++)
     {
         if (currentMission[i] == true)
         {
             Medals[i].GetComponent <Animator>().SetBool("firstMission", true);
         }
     }
 }
Exemple #22
0
 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();
 }
Exemple #23
0
    void FillDetail()
    {
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
#endif
#if UNITY_ANDROID
        spriteAB = AssetBundle.LoadFromFile(Application.dataPath + "!assets/data.ab");
#endif
        Button[] btns  = detailContent.GetComponentsInChildren <Button>();
        bool[]   array = PlayerPrefsX.GetBoolArray("FishType", false, fishDataList.fish.Count);
        for (int i = 0; i < btns.Length; i++)
        {
            int[] arrayInt = PlayerPrefsX.GetIntArray("FishCountArray", 0, fishDataList.fish.Count);
            if (array[i])
            {
                btns[i].gameObject.transform.Find("Image").GetComponent <Image>().sprite = spriteAB.LoadAsset <Sprite>((i + 1).ToString() + "d");
                btns[i].gameObject.transform.Find("name").GetComponent <Text>().text     = fishDataList.fish[i].name;
                btns[i].gameObject.transform.Find("Info").GetComponent <Text>().text     = fishDataList.fish[i].info;


                float percent;
                if (arrayInt[i] == 0)
                {
                    percent = 0;
                }
                else
                {
                    percent = arrayInt[i] / (float)fishDataList.fish[i].research;
                }
                if (percent > 1)
                {
                    percent = 1.0f;
                }
                btns[i].gameObject.transform.Find("per").GetComponent <Text>().text = (percent * 100f).ToString("0") + "%";
            }
            else
            {
                btns[i].gameObject.transform.Find("Image").GetComponent <Image>().sprite = spriteAB.LoadAsset <Sprite>("Null");
                btns[i].gameObject.transform.Find("name").GetComponent <Text>().text     = "尚未遇到的鱼";
                btns[i].gameObject.transform.Find("Info").GetComponent <Text>().text     = "???";
                float percent = 0;
                btns[i].gameObject.transform.Find("per").GetComponent <Text>().text = percent.ToString("0") + "%";
            }
            btns[i].gameObject.transform.Find("meet").GetComponent <Text>().text = arrayInt[i].ToString() + "次";
            if (fishDataList.fish[i].range.Split('-')[1].Equals("0"))
            {
                btns[i].gameObject.transform.Find("Range").GetComponent <Text>().text = fishDataList.fish[i].range.Split('-')[0] + "m后出现";
            }
            else
            {
                btns[i].gameObject.transform.Find("Range").GetComponent <Text>().text = fishDataList.fish[i].range.Split('-')[0] + "m - " + fishDataList.fish[i].range.Split('-')[1] + "m";
            }
        }
        //dont unload ab here
    }
Exemple #24
0
    private void Awake()
    {
        ///////////////////////for testing purposes ---deletes all prefs for all scripts
        PlayerPrefs.DeleteAll();
        ///////////////////////

        DeleteGamePrefs();

        //get Run data from prefs
        runDates        = PlayerPrefsX.GetStringArray("runDates", "", 5);
        areRunsFinished = PlayerPrefsX.GetBoolArray("areRunsFinished", false, 5);
    }
Exemple #25
0
 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);
     }
 }
Exemple #26
0
 void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     inventario = PlayerPrefsX.GetIntArray("inventario");
     if (inventario.Length < 4)
     {
         inventario = new int[4];
     }
     acquiredColectables = PlayerPrefsX.GetBoolArray("itens");
     if (acquiredColectables.Length < 40)
     {
         acquiredColectables = new bool[40];
     }
 }
Exemple #27
0
    // Start is called before the first frame update
    void Start()
    {
        missionsAccomplished = PlayerPrefsX.GetBoolArray("missionsAccomplished", false, 1);
        missionsList         = new List <bool>(missionsAccomplished);
        currentMission       = missionsAccomplished.Length - 1;


        TextAsset file = Resources.Load("missions") as TextAsset;
        string    json = file.ToString();

        missions = JsonUtility.FromJson <MissionInformation>(json);
        currentObjective.text = missions.missions[currentMission];
    }
    // Update is called once per frame
    void Update()
    {
        bool[] bought   = PlayerPrefsX.GetBoolArray("MapsBought");
        int    selected = 0;

        for (int i = 0; i < bought.Length; i++)
        {
            if (maps[i] == GameObject.Find("MapDatabase").GetComponent <MapsDatabase>().GetCurrentMap())
            {
                selected = i;
                break;
            }
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            ScrollLeft();
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            ScrollRight();
        }

        if (indexItemShowing != goalIndexItem)
        {
            Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, positions[goalIndexItem], timeBetween);
            Camera.main.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, startCameraZ);
            float currentX = float.Parse(Camera.main.transform.position.x.ToString("F1"));
            float goalX    = float.Parse(positions[goalIndexItem].x.ToString("F1"));
            if (currentX == goalX)
            {
                indexItemShowing = goalIndexItem;
            }
        }

        if (bought[goalIndexItem])
        {
            if (goalIndexItem == selected)             //Esse e o selecionado
            {
                GameObject.FindWithTag("Buy").GetComponent <SpriteRenderer>().sprite = select;
            }
            else              //Comprado mas nao selecionado
            {
                GameObject.FindWithTag("Buy").GetComponent <SpriteRenderer>().sprite = deselect;
            }
        }
        else          //Nao comprado
        {
            GameObject.FindWithTag("Buy").GetComponent <SpriteRenderer>().sprite = notBought;
        }
    }
Exemple #29
0
    //0 to 1 enter
    public void MoveDetailRect()
    {
        int   id     = defaultFishID;
        float offset = id * detailWidth;

        bool[] array = PlayerPrefsX.GetBoolArray("FishType", false, 17);
        if (array[id])
        {
            OpenFishCamera(id);
            fish[id].GetComponent <PondFishMovement>().OnShow();
        }
        detailContent.DOAnchorPosX(-offset, 0.0f);
        detailButtons[id].Select();
    }
Exemple #30
0
    public int GetQuestClearNum(int sdNum)//現在のクリアしているクエストの数 データ指定
    {
        int k = 0;

        bool[] b = PlayerPrefsX.GetBoolArray(questIsClear + sdNum);
        for (int i = 0; i < b.Length; i++)
        {
            if (b[i] == true)
            {
                k++;
            }
        }
        return(k);
    }