/// <summary>
 /// Gets the string value for the key.
 /// </summary>
 /// <returns>The string value.</returns>
 /// <param name="key">Key.</param>
 public override string GetString(string key)
 {
     return(PlayerPrefs.GetString(key));
 }
    /// <summary>
    /// Load the specified CSV file.
    /// </summary>

    static bool LoadCSV(byte[] bytes, TextAsset asset, bool merge = false)
    {
        if (bytes == null)
        {
            return(false);
        }
        ByteReader reader = new ByteReader(bytes);

        // The first line should contain "KEY", followed by languages.
        BetterList <string> header = reader.ReadCSV();

        // There must be at least two columns in a valid CSV file
        if (header.size < 2)
        {
            return(false);
        }
        header.RemoveAt(0);

        string[] languagesToAdd = null;
        if (string.IsNullOrEmpty(mLanguage))
        {
            localizationHasBeenSet = false;
        }

        // Clear the dictionary
        if (!localizationHasBeenSet || (!merge && !mMerging) || mLanguages == null || mLanguages.Length == 0)
        {
            mDictionary.Clear();
            mLanguages = new string[header.size];

            if (!localizationHasBeenSet)
            {
                mLanguage = PlayerPrefs.GetString("Language", header[0]);
                localizationHasBeenSet = true;
            }

            for (int i = 0; i < header.size; ++i)
            {
                mLanguages[i] = header[i];
                if (mLanguages[i] == mLanguage)
                {
                    mLanguageIndex = i;
                }
            }
        }
        else
        {
            languagesToAdd = new string[header.size];
            for (int i = 0; i < header.size; ++i)
            {
                languagesToAdd[i] = header[i];
            }

            // Automatically resize the existing languages and add the new language to the mix
            for (int i = 0; i < header.size; ++i)
            {
                if (!HasLanguage(header[i]))
                {
                    int newSize = mLanguages.Length + 1;
#if UNITY_FLASH
                    string[] temp = new string[newSize];
                    for (int b = 0, bmax = arr.Length; b < bmax; ++b)
                    {
                        temp[b] = mLanguages[b];
                    }
                    mLanguages = temp;
#else
                    System.Array.Resize(ref mLanguages, newSize);
#endif
                    mLanguages[newSize - 1] = header[i];

                    Dictionary <string, string[]> newDict = new Dictionary <string, string[]>();

                    foreach (KeyValuePair <string, string[]> pair in mDictionary)
                    {
                        string[] arr = pair.Value;
#if UNITY_FLASH
                        temp = new string[newSize];
                        for (int b = 0, bmax = arr.Length; b < bmax; ++b)
                        {
                            temp[b] = arr[b];
                        }
                        arr = temp;
#else
                        System.Array.Resize(ref arr, newSize);
#endif
                        arr[newSize - 1] = arr[0];
                        newDict.Add(pair.Key, arr);
                    }
                    mDictionary = newDict;
                }
            }
        }

        Dictionary <string, int> languageIndices = new Dictionary <string, int>();
        for (int i = 0; i < mLanguages.Length; ++i)
        {
            if (languageIndices.ContainsKey(mLanguages[i]))
            {
                Debug.Log("same Language Key: " + mLanguages[i]);
                continue;
            }
            languageIndices.Add(mLanguages[i], i);
        }

        // Read the entire CSV file into memory
        for (;;)
        {
            BetterList <string> temp = reader.ReadCSV();
            if (temp == null || temp.size == 0)
            {
                break;
            }
            if (string.IsNullOrEmpty(temp[0]))
            {
                continue;
            }
            AddCSV(temp, languagesToAdd, languageIndices);
        }

        if (!mMerging && onLocalize != null)
        {
            mMerging = true;
            OnLocalizeNotification note = onLocalize;
            onLocalize = null;
            note();
            onLocalize = note;
            mMerging   = false;
        }
        return(true);
    }
示例#3
0
 public void GetProfile()
 {
     StartCoroutine(Twitter.API.GetProfileInfo(PlayerPrefs.GetString(ScreenName), PlayerPrefs.GetString(UserID), CONSUMER_KEY, CONSUMER_SECRET, m_AccessTokenResponse,
                                               new Twitter.PostGetProfileCallback(this.OnGettingProfile)));
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     username.text = PlayerPrefs.GetString("Name");
 }
示例#5
0
    public static Dictionary <string, object> getDictionary(string key)
    {
        Dictionary <string, object> info = JsonConvert.DeserializeObject <Dictionary <string, object> >(PlayerPrefs.GetString(key));

        return(info);
    }
示例#6
0
 void OnTriggerEnter(Collider col)
 {
     if (col.CompareTag("Player"))
     {
         string Url = "https://pbd-unity.000webhostapp.com/insert_score.php?nama=" + PlayerPrefs.GetString("name") + "&score=" + PlayerPrefs.GetInt("score");
         WWW    www = new WWW(Url);
         SceneManager.LoadScene("MainMenuScene");
     }
 }
示例#7
0
    // Use this for initialization
    void Awake()
    {
        if (PlayerPrefs.HasKey("SixDayCount"))
        {
            sixDayCount = PlayerPrefs.GetInt("SixDayCount");
            if (sixDayCount < 4)
            {
                sixDayCount++;
            }
        }
        else
        {
            sixDayCount = 1;
        }
        moneyText      = GameObject.Find("DailyReward/AnimationHolder/Body/CoinsHolder/AnimationHolder/Text").GetComponent <Text>();
        moneyText.text = GlobalVariables.coins.ToString();         // ovde upisujete vrednost koju cuvate za coine
        DateTime currentTime = DateTime.Now;

        enterDay   = currentTime.Day.ToString();
        enterMonth = currentTime.Month.ToString();
        enterYear  = currentTime.Year.ToString();

        if (PlayerPrefs.HasKey("LevelReward"))
        {
            LevelReward = PlayerPrefs.GetInt("LevelReward");
        }
        else
        {
            LevelReward = 0;
        }

        if (PlayerPrefs.HasKey("VremeQuit"))
        {
            lastPlayDate = PlayerPrefs.GetString("VremeQuit");
            quitTime     = DateTime.Parse(lastPlayDate);

            quitDay   = quitTime.Day.ToString();
            quitMonth = quitTime.Month.ToString();
            quitYear  = quitTime.Year.ToString();
            if ((int.Parse(enterYear) - int.Parse(quitYear)) < 1)
            {
                if ((int.Parse(enterMonth) - int.Parse(quitMonth)) == 0)
                {
                    if ((int.Parse(enterDay) - int.Parse(quitDay)) > 1)
                    {
                        LevelReward = 1;
                        GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                        SetActiveDay(LevelReward);
                        GameObject.Find("Day1").GetComponent <Animator>().Play("DailyRewardDay");
                        PlayerPrefs.SetInt("LevelReward", LevelReward);
                        PlayerPrefs.Save();
                        ShowDailyReward(LevelReward);
                    }
                    else if ((int.Parse(enterDay) - int.Parse(quitDay)) > 0)
                    {
                        if (LevelReward < DailyRewardAmount.Length - 1)
                        {
                            GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                            LevelReward++;
                            SetActiveDay(LevelReward);
                            GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                            PlayerPrefs.SetInt("LevelReward", LevelReward);
                            PlayerPrefs.Save();
                            ShowDailyReward(LevelReward);
                        }
                        else
                        {
                            LevelReward = 1;
                            GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                            SetActiveDay(LevelReward);
                            GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                            PlayerPrefs.SetInt("LevelReward", LevelReward);
                            PlayerPrefs.Save();
                            ShowDailyReward(LevelReward);
                        }

                        //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                    }
                    else
                    {
                    }
                }
                else
                {
                    if (int.Parse(enterDay) == 1)
                    {
                        if (int.Parse(quitMonth) == 1 || int.Parse(quitMonth) == 3 || int.Parse(quitMonth) == 5 || int.Parse(quitMonth) == 7 || int.Parse(quitMonth) == 8 || int.Parse(quitMonth) == 10 || int.Parse(quitMonth) == 12)
                        {
                            if (int.Parse(quitDay) == 31)
                            {
                                if (LevelReward < DailyRewardAmount.Length - 1)
                                {
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    LevelReward++;
                                    SetActiveDay(LevelReward);
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }
                                else
                                {
                                    LevelReward = 1;
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    SetActiveDay(LevelReward);
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }

                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                            else
                            {
                                LevelReward = 1;
                                GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                SetActiveDay(LevelReward);
                                GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                PlayerPrefs.SetInt("LevelReward", LevelReward);
                                PlayerPrefs.Save();
                                ShowDailyReward(LevelReward);

                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                        }
                        else if (int.Parse(quitMonth) == 4 || int.Parse(quitMonth) == 6 || int.Parse(quitMonth) == 9 || int.Parse(quitMonth) == 11)
                        {
                            if (int.Parse(quitDay) == 30)
                            {
                                if (LevelReward < DailyRewardAmount.Length - 1)
                                {
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    LevelReward++;
                                    SetActiveDay(LevelReward);
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }
                                else
                                {
                                    LevelReward = 1;
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }

                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                            else
                            {
                                LevelReward = 1;
                                GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                SetActiveDay(LevelReward);
                                GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                PlayerPrefs.SetInt("LevelReward", LevelReward);
                                PlayerPrefs.Save();
                                ShowDailyReward(LevelReward);
                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                        }
                        else
                        {
                            if (int.Parse(quitDay) > 27)
                            {
                                if (LevelReward < DailyRewardAmount.Length - 1)
                                {
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    LevelReward++;
                                    SetActiveDay(LevelReward);
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }
                                else
                                {
                                    LevelReward = 1;
                                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                    SetActiveDay(LevelReward);
                                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                                    PlayerPrefs.Save();
                                    ShowDailyReward(LevelReward);
                                }

                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                            else
                            {
                                LevelReward = 1;
                                GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                                SetActiveDay(LevelReward);
                                GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                                PlayerPrefs.SetInt("LevelReward", LevelReward);
                                PlayerPrefs.Save();
                                ShowDailyReward(LevelReward);
                                //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                            }
                        }
                    }
                    else
                    {
                        LevelReward = 1;
                        GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                        SetActiveDay(LevelReward);
                        GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                        PlayerPrefs.SetInt("LevelReward", LevelReward);
                        PlayerPrefs.Save();
                        ShowDailyReward(LevelReward);
                        //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                    }
                }
            }
            else
            {
                if (int.Parse(quitDay) == 31 && int.Parse(enterDay) == 1)
                {
                    if (LevelReward < DailyRewardAmount.Length - 1)
                    {
                        GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                        LevelReward++;
                        SetActiveDay(LevelReward);
                        GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                        PlayerPrefs.SetInt("LevelReward", LevelReward);
                        PlayerPrefs.Save();
                        ShowDailyReward(LevelReward);
                    }
                    else
                    {
                        LevelReward = 1;
                        GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                        SetActiveDay(LevelReward);
                        GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                        PlayerPrefs.SetInt("LevelReward", LevelReward);
                        PlayerPrefs.Save();
                        ShowDailyReward(LevelReward);
                    }

                    //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                }
                else
                {
                    LevelReward = 1;
                    GameObject.Find("DailyReward").GetComponent <Animator>().Play("DailyRewardArrival");
                    SetActiveDay(LevelReward);
                    GameObject.Find("Day" + LevelReward).GetComponent <Animator>().Play("DailyRewardDay");
                    PlayerPrefs.SetInt("LevelReward", LevelReward);
                    PlayerPrefs.Save();
                    ShowDailyReward(LevelReward);
                    //Ponisti notifikaciju za DailyReward i posalji novu i prikazi DailyRewards sa nivoom LevelReward na 24h
                }
            }
        }
        else
        {
//			Collect();
            LevelReward = 0;
            PlayerPrefs.SetInt("LevelReward", LevelReward);
            PlayerPrefs.Save();

            //Pokreni Notifikaciju za DailyReward na 24h
        }
    }
        void Awake()
        {
            if (PlayerPrefs.HasKey(particleSize.ToString()))
            {
                particleSizeInput.text = PlayerPrefs.GetFloat(particleSize.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(zoomTimes.ToString()))
            {
                zoomTimesInput.text = PlayerPrefs.GetFloat(zoomTimes.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(sensorAngle.ToString()))
            {
                sensorAngleInput.text = PlayerPrefs.GetFloat(sensorAngle.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(sensorOffsetX.ToString()))
            {
                sensorOffsetXInput.text = PlayerPrefs.GetFloat(sensorOffsetX.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(sensorOffsetY.ToString()))
            {
                sensorOffsetYInput.text = PlayerPrefs.GetFloat(sensorOffsetY.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(ratioMM.ToString()))
            {
                ratioMMInput.text = PlayerPrefs.GetFloat(ratioMM.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(ratioPX.ToString()))
            {
                ratioPXInput.text = PlayerPrefs.GetFloat(ratioPX.ToString()).ToString();
            }
            //if (PlayerPrefs.HasKey(neededAreaWidth.ToString())) neededAreaWidthInput.text = PlayerPrefs.GetFloat(neededAreaWidth.ToString()).ToString();
            //if (PlayerPrefs.HasKey(neededAreaHeight.ToString())) neededAreaHeightInput.text = PlayerPrefs.GetFloat(neededAreaHeight.ToString()).ToString();
            //if (PlayerPrefs.HasKey(neededAreaOffsetX.ToString())) neededAreaOffsetXInput.text = PlayerPrefs.GetFloat(neededAreaOffsetX.ToString()).ToString();
            //if (PlayerPrefs.HasKey(neededAreaOffsetY.ToString())) neededAreaOffsetYInput.text = PlayerPrefs.GetFloat(neededAreaOffsetY.ToString()).ToString();
            if (PlayerPrefs.HasKey(gridSizeX.ToString()))
            {
                gridSizeXInput.text = PlayerPrefs.GetFloat(gridSizeX.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(gridSizeY.ToString()))
            {
                gridSizeYInput.text = PlayerPrefs.GetFloat(gridSizeY.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(xmlPath.ToString()))
            {
                xmlPathInput.text = PlayerPrefs.GetString(xmlPath.ToString()).ToString();
            }
            if (PlayerPrefs.HasKey(portName.ToString()))
            {
                portNameInput.text = PlayerPrefs.GetString(portName.ToString()).ToString();
            }

            //assignment
            scf.particleSize  = float.Parse(particleSizeInput.text);
            scf.zoomTimes     = float.Parse(zoomTimesInput.text);
            scf.sensorAngle   = float.Parse(sensorAngleInput.text);
            scf.sensorOffsetX = float.Parse(sensorOffsetXInput.text);
            scf.sensorOffsetY = float.Parse(sensorOffsetYInput.text);
            scf.ratioMM       = float.Parse(ratioMMInput.text);
            scf.ratioPX       = float.Parse(ratioPXInput.text);
            //scf.neededAreaWidth = float.Parse(neededAreaWidthInput.text);
            //scf.neededAreaHeight = float.Parse(neededAreaHeightInput.text);
            //scf.neededAreaOffsetX = float.Parse(neededAreaOffsetXInput.text);
            //scf.neededAreaOffsetY = float.Parse(neededAreaOffsetYInput.text);
            scf.gridSizeX = int.Parse(gridSizeXInput.text);
            scf.gridSizeY = int.Parse(gridSizeYInput.text);
            scf.xmlPath   = xmlPathInput.text.ToString();

            rs.portName = portNameInput.text.ToString();

            //save playerPref
            PlayerPrefs.SetFloat(particleSize.ToString(), float.Parse(particleSizeInput.text));
            PlayerPrefs.SetFloat(zoomTimes.ToString(), float.Parse(zoomTimesInput.text));
            PlayerPrefs.SetFloat(sensorAngle.ToString(), float.Parse(sensorAngleInput.text));
            PlayerPrefs.SetFloat(sensorOffsetX.ToString(), float.Parse(sensorOffsetXInput.text));
            PlayerPrefs.SetFloat(sensorOffsetY.ToString(), float.Parse(sensorOffsetYInput.text));
            PlayerPrefs.SetFloat(ratioMM.ToString(), float.Parse(ratioMMInput.text));
            PlayerPrefs.SetFloat(ratioPX.ToString(), float.Parse(ratioPXInput.text));
            //PlayerPrefs.SetFloat(neededAreaWidth.ToString(), float.Parse(neededAreaWidthInput.text));
            //PlayerPrefs.SetFloat(neededAreaHeight.ToString(), float.Parse(neededAreaHeightInput.text));
            //PlayerPrefs.SetFloat(neededAreaOffsetX.ToString(), float.Parse(neededAreaOffsetXInput.text));
            //PlayerPrefs.SetFloat(neededAreaOffsetY.ToString(), float.Parse(neededAreaOffsetYInput.text));
            PlayerPrefs.SetFloat(gridSizeX.ToString(), int.Parse(gridSizeXInput.text));
            PlayerPrefs.SetFloat(gridSizeY.ToString(), int.Parse(gridSizeYInput.text));
            PlayerPrefs.SetString(xmlPath.ToString(), xmlPathInput.text.ToString());
            PlayerPrefs.SetString(portName.ToString(), portNameInput.text.ToString());

            isShown = false;
            inputfields.SetActive(isShown);
            textfields.SetActive(isShown);
            updatebutton.SetActive(isShown);
            reloadbutton.SetActive(isShown);
        }
示例#9
0
    IEnumerator Loading(int profile)
    {
        //load all face things with key + "face", key + "bh"; etc
        DressManager dm = transform.root.GetComponent <DressManager>();

        dm.load.startLoading(false);
        dm.LoadAll();
        yield return(null);

        while (dm.load.loaddd)
        {
            yield return(null);
        }
        foreach (var i in Enum.GetValues(typeof(itemType)))
        {
            itemType it      = (itemType)i;
            string   keyItem = i.ToString().Substring(0, 2);
            if (PlayerPrefs.HasKey(profile + keyItem))
            {
                string full = PlayerPrefs.GetString(profile + keyItem);
                Debug.LogWarning("load " + profile + keyItem + ":" + full);
                string[] halves = full.Split(new string[] { "|", "," }, StringSplitOptions.RemoveEmptyEntries);
                Sprite   s      = dm.getSpriteFromString(it, halves[0]);

                UndoInfo hm = dm.fm.faceSet(s, it);

                if (keyItem == "CH")
                {
                    dm.fm.skin[8].rectTransform.sizeDelta = new Vector2(dm.fm.skin[8].rectTransform.sizeDelta.x, float.Parse(halves[0]));
                    // PlayerPrefs.GetString(profile + keyItem, chin.y + "");
                    continue;
                }
                else if (keyItem == "BY")
                {
                    dm.fm.skin[4].rectTransform.sizeDelta = new Vector2(float.Parse(halves[0]), float.Parse(halves[1]));

                    ///  PlayerPrefs.SetString(num + keyItem, body.x + "|" + body.y);
                    continue;
                }
                else if (keyItem == "HD")
                {
                    dm.fm.skin[1].rectTransform.sizeDelta = new Vector2(float.Parse(halves[0]), float.Parse(halves[1]));

                    //   PlayerPrefs.SetString(num + keyItem, head.x + "|" + head.y);
                    continue;
                }

                if (it == itemType.GXlitch)
                {
                    Glitch g = Camera.main.GetComponent <Glitch>();
                    g.enabled      = true;
                    g.colorDrift   = float.Parse(halves[1]);
                    g.verticalJump = float.Parse(halves[2]);
                    float ratio = 0.4f;
                    g.scanLineJitter = g.colorDrift * ratio;
                    continue;
                }
                if (it == itemType.CXolor)
                {
                    ColorFX g;
                    g         = Camera.main.gameObject.GetComponent <ColorFX>();
                    g.enabled = true;
                    g.color   = convertAt(halves, 1, g.color);
                    g.Amount  = float.Parse(halves[4]);
                    g.updateColor();

                    continue;
                }
                if (it == itemType.BNry)
                {
                    Binary g;
                    g         = Camera.main.gameObject.GetComponent <Binary>();
                    g.enabled = true;
                    g.color0  = convertAt(halves, 1, g.color0);
                    g.color1  = convertAt(halves, 4, g.color1);
                    g.Opacity = float.Parse(halves[7]);
                    g.updateColor();
                    continue;
                }
                if (it == itemType.RPamp)
                {
                    Ramp g;
                    g             = Camera.main.gameObject.GetComponent <Ramp>();
                    g.enabled     = true;
                    g.FirstColor  = convertAt(halves, 1, g.FirstColor);
                    g.SecondColor = convertAt(halves, 4, g.SecondColor);
                    g._opacity    = float.Parse(halves[7]);
                    g.updateColors();
                    continue;
                }
                if (it == itemType.BMlm)
                {
                    Bloom g = Camera.main.gameObject.GetComponent <Bloom>();
                    g.enabled   = true;
                    g.intensity = float.Parse(halves[1]);
                    g.radius    = float.Parse(halves[2]);
                    g.UpdateParam();
                    continue;
                }


                if (keyItem.ToLower() == "pa")
                {
                    checkParticles(convertAt(halves, 1, Color.white), dm, it); continue;
                }


                if (it == itemType.bg)
                {
                    Camera.main.backgroundColor = convertAt(halves, 1, Color.white);
                    if (halves[0] == " ")
                    {
                        hm.set.color = Color.clear;
                    }
                    else if (halves[0][2] != 'p')
                    {
                        hm.set.color = new Color(1, 1, 1, 1 - HSBColor.FromColor(Camera.main.backgroundColor).b);
                    }
                    else
                    {
                        hm.set.color = convertAt(halves, 4, hm.set.color);
                    }
                }
                else if (keyItem == "wf")
                {
                    hm.set.GetComponent <WaterfallScript>().LightColor = convertAt(halves, 1, hm.set.color);
                }
                else if (keyItem == "FR")
                {
                    FourGradient fg = dm.fm.bangs.GetComponent <FourGradient>();
                    if (fg == null)
                    {
                        dm.fm.bangs.GetComponent <SoftMask>().enabled = false;
                        dm.fm.bangs.transform.GetChild(0).gameObject.SetActive(false);
                        fg = dm.fm.bangs.gameObject.AddComponent <FourGradient>();
                        dm.fm.hair.material = dm.fm.bangs.materialForRendering;
                    }
                    int index = 1;
                    fg._Color1 = convertAt(halves, index, fg._Color1);
                    index     += 3;
                    fg._Color2 = convertAt(halves, index, fg._Color2);
                    index     += 3;
                    fg._Color3 = convertAt(halves, index, fg._Color3);
                    index     += 3;
                    fg._Color4 = convertAt(halves, index, fg._Color4);
                    index     += 3;
                    fg.opacity = float.Parse(halves[index]);
                    fg.updateParams();
                }
                else
                {
                    if (hm.set != null)
                    {
                        hm.set.color = convertAt(halves, 1, hm.set.color);
                        hm.set.gameObject.SetActive(true);

                        if (keyItem == "bh" && halves.Length > 4)
                        {
                            Vector2 size = new Vector2(float.Parse(halves[4]), float.Parse(halves[5]));
                            dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta = size;
                        }
                        else if (keyItem == "b_" && halves.Length > 4)
                        {
                            Vector2 size = new Vector2(float.Parse(halves[4]), float.Parse(halves[5]));
                            dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta = size;
                        }
                        else if (keyItem == "l_" && halves.Length > 4)
                        {
                            Vector2 size = new Vector2(float.Parse(halves[4]), float.Parse(halves[5]));
                            dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta = size;
                            dm.fm.VertLip = float.Parse(halves[6]);
                        }
                        else if (keyItem == "eb" && halves.Length == 6)
                        {
                            RectTransform eb1 = dm.fm.XtraStuff[keyItem].rectTransform, eb2 = dm.fm.XtraStuff[keyItem + "2"].rectTransform;
                            float         z = float.Parse(halves[4]);
                            eb1.localRotation = Quaternion.Euler(0, 0, z);
                            eb2.localRotation = Quaternion.Euler(0, 0, z);
                            dm.fm.VertEB      = float.Parse(halves[5]);
                            hm.set2.color     = hm.set.color;
                            continue;
                        }
                        else if (keyItem == "e_" && halves.Length > 4)
                        {
                            RectTransform r = dm.fm.XtraStuff[keyItem].rectTransform;
                            Vector2       size = new Vector2(float.Parse(halves[4]), float.Parse(halves[5]));
                            float         z = float.Parse(halves[6]);
                            RectTransform e = dm.fm.XtraStuff[keyItem].rectTransform, e2 = dm.fm.XtraStuff[keyItem + "2"].rectTransform;
                            e.sizeDelta      = size;
                            e2.sizeDelta     = size;
                            e.localRotation  = Quaternion.Euler(0, 0, z);
                            e2.localRotation = Quaternion.Euler(0, 0, z);
                            hm.set2.color    = hm.set.color;
                            continue;
                        }

                        if (keyItem == "ey" && halves.Length > 4)
                        {
                            Debug.Log("set eyelid");
                            RectTransform r0 = dm.fm.skin[5].rectTransform, r2 = dm.fm.skin[7].rectTransform;
                            r0.anchoredPosition = new Vector2(r0.anchoredPosition.x, float.Parse(halves[4])); r2.anchoredPosition = r0.anchoredPosition;
                            r0.localRotation    = Quaternion.Euler(0, r0.localRotation.y, float.Parse(halves[5])); r2.localRotation = Quaternion.Euler(0, r2.localRotation.y, r0.eulerAngles.z);
                            hm.set2.color       = hm.set.color;
                            continue;
                        }
                        if (hm.set2 != null)
                        {
                            if (halves.Length > 4)
                            {
                                hm.set2.color = convertAt(halves, 4, hm.set2.color);
                                if (keyItem == "ir" && halves.Length == 9)
                                {   //rs += "|" + dm.fm.leftE[1].rectTransform.sizeDelta.x + "," + dm.fm.leftE[1].rectTransform.sizeDelta.y;
                                    hm.set.rectTransform.sizeDelta  = new Vector2(float.Parse(halves[7]), float.Parse(halves[8]));
                                    hm.set2.rectTransform.sizeDelta = hm.set.rectTransform.sizeDelta;
                                }
                                //new Color32(Convert.ToByte(halves[4]), Convert.ToByte(halves[5]), Convert.ToByte(halves[6]), 255);
                            }
                            else
                            {
                                hm.set2.color = hm.set.color;
                            }
                            hm.set2.gameObject.SetActive(true);
                        }
                    }
                }
            }
            else
            {
                dm.fm.Remove(keyItem);
            }
            dm.load.StopLoading();
        }

        // "HE", "VE", "VN", "SN", "lI", "rI", "W", "S"
        //    public float HorzEye, VertEye, VertNose, noseSize


        dm.fm.HorzEye  = PlayerPrefs.GetFloat(profile + "HE");
        dm.fm.VertEye  = PlayerPrefs.GetFloat(profile + "VE");
        dm.fm.VertNose = PlayerPrefs.GetFloat(profile + "VN");
        float SN = PlayerPrefs.GetFloat(profile + "SN");

        dm.fm.skin[0].rectTransform.sizeDelta = new Vector2(349 + SN, 304 + SN);
        // fs.set.rectTransform.sizeDelta = new Vector2(349 + ratio2 * val, 304 + ratio2 * val);


        string[] halves2 = //PlayerPrefs.GetString(profile + "lI").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                           // dm.fm.leftE[1].color = convertAt(halves2, 0, dm.fm.leftE[1].color);
                           // halves2 = PlayerPrefs.GetString(profile + "rI").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                           // dm.fm.rightE[1].color = convertAt(halves2, 0, dm.fm.rightE[1].color);
                           // halves2 =
                           //  PlayerPrefs.GetString(profile + "W").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                           // dm.fm.leftE[0].color = convertAt(halves2, 0, dm.fm.leftE[0].color);
                           // halves2 = PlayerPrefs.GetString(profile + "Wr").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                           // dm.fm.rightE[0].color = convertAt(halves2, 0, dm.fm.rightE[0].color);



                           // halves2 =
                           PlayerPrefs.GetString(profile + "S").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        dm.changeSkin(convertAt(halves2, 0, dm.fm.skin[1].color), Color.white, false);
    }
示例#10
0
    IEnumerator GardewiseLeaderBoard()
    {
        OverallScrollBar.SetActive(false);
        GradeScrollBar.SetActive(true);
        SchoolScrollBar.SetActive(false);
        if (GradeParent.childCount == 0)
        {
            string Hitting_Url = MainUrl + GradeDataApi + "?id_user="******"UID") + "&org_id=" + PlayerPrefs.GetInt("OID") +
                                 "&Usergrade=" + int.Parse(PlayerPrefs.GetString("User_grade"));

            WWW Leaderborad_url = new WWW(Hitting_Url);
            yield return(Leaderborad_url);

            if (Leaderborad_url.text != null)
            {
                Debug.Log(Leaderborad_url.text);
                JsonData leader_res = JsonMapper.ToObject(Leaderborad_url.text);
                for (int a = 0; a < leader_res.Count; a++)
                {
                    GameObject gb = Instantiate(Dataprefeb, GradeParent, false);
                    if (int.Parse(leader_res[a]["Rank"].ToString()) == 1)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = FirstRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 2)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = SecondRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 3)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = ThirdRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 0)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().text = leader_res[a]["Rank"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().text = leader_res[a]["Rank"].ToString();
                    }
                    if (PlayerPrefs.GetInt("UID") == int.Parse(leader_res[a]["id_user"].ToString()))
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().color = MydataColor;
                        gb.transform.GetChild(2).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(6).gameObject.GetComponent <Image>().enabled = false;
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().color = MydataColor;
                        gb.GetComponent <BarHeighter>().heighlitedimage = RowHighlighter;
                        gb.GetComponent <BarHeighter>().normalimage     = RowHighlighter;
                        gb.GetComponent <Image>().sprite = RowHighlighter;
                    }
                    gb.SetActive(true);
                    if (leader_res[a]["Name"] != null)
                    {
                        gb.transform.GetChild(2).gameObject.GetComponent <Text>().text = leader_res[a]["Name"].ToString();
                    }

                    if (leader_res[a]["Level"] != null)
                    {
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().text = leader_res[a]["Level"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().text = "0";
                    }
                    if (leader_res[a]["Grade"] != null)
                    {
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().text = leader_res[a]["Grade"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().text = "0";
                    }
                    if (leader_res[a]["SchoolName"] != null)
                    {
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().text = leader_res[a]["SchoolName"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().text = "----";
                    }

                    if (leader_res[a]["Score"] != null)
                    {
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().text = leader_res[a]["Score"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().text = "0";
                    }
                    UserlistCreated.Add(gb);
                }
            }
        }
    }
示例#11
0
    void FixedUpdate()
    {
        /* This is to ensure that all data was saved after entering previous task. However, take a note,
         * that all data must be erased, when the player enters the labyrinth for the first time.
         * Otherwise, worst scenario might happen. */

        if (!gameHasStarted)
        {
            taskLevel      = PlayerPrefs.GetInt("taskLevel", 1);                 // If the player makes 6 turns in the maze, the new task with an appropriate level will be spawned. So this is required to record current task level.
            previousStep   = PlayerPrefs.GetString("previousStep", "firstStep"); // Take a look in FixedUpdate () about this variable.
            turnsCount     = PlayerPrefs.GetInt("turnsCount", 0);
            playerPosX     = PlayerPrefs.GetInt("playerPosX", 0);
            playerPosZ     = PlayerPrefs.GetInt("playerPosZ", 0);
            completedTasks = PlayerPrefs.GetInt("CompletedTasks", 0);
            string     startingFloorName = "Floor_Column" + playerPosX.ToString() + "_Row" + playerPosZ.ToString();         // It will get the player to the cell, where he was previously stopped, once after he entered to the task scene.
            GameObject startingFloor     = GameObject.Find(startingFloorName);
            if (startingFloor != null)
            {
                transform.position = startingFloor.transform.position;
            }
            if (PlayerPrefs.GetInt("RowsCount", 0) != 0 && PlayerPrefs.GetInt("ColumnsCount", 0) != 0)
            {
                RowsCount    = PlayerPrefs.GetInt("RowsCount", 0);
                ColumnsCount = PlayerPrefs.GetInt("ColumnsCount", 0);
            }
            gameHasStarted = true;

            // After the player returns to the maze once again, the same portals with the same previous locations will be spawned.
            for (int i = 1; i < taskLevel; i++)
            {
                string nameIdentifier = "TaskPortal " + i;
                initTaskPortal(new Vector3(PlayerPrefs.GetFloat(nameIdentifier + "_PosX", 0), 0, PlayerPrefs.GetFloat(nameIdentifier + "_PosZ", 0)), i);
                GameObject taskPortal = GameObject.Find(nameIdentifier);
                if (taskPortal != null && taskPortal.transform.position == transform.position)
                {
                    enteredTask = taskPortal;
                    enteredTask.SetActive(false);                           // We have to hide the task portal, if the player is spawned on the same location as the task portal.
                    enteredTask.GetComponent <Collider> ().enabled = false; // and also turn off its collider, so ball won't bounce off, once hits it.
                }
            }
        }

        string wallDirection = "Wall_At_Column" + playerPosX.ToString() + "_Row" + playerPosZ.ToString();

        WallPlacement wallPlacement = getWallDirections(wallDirection);

        string     floorName = "Floor_Column" + playerPosX.ToString() + "_Row" + playerPosZ.ToString();
        GameObject floor     = GameObject.Find(floorName);

        if (floor != null)
        {
            //This snippet of code is required to identify whether the task is in the range of the current cell.

            foreach (GameObject taskPortal in taskPortals)
            {
                if (floor.transform.position == taskPortal.transform.position && taskPortal.activeSelf)
                {
                    turnsCount = 0;                     // we have to nullify the turns count

                    // This will get the length of TaskPortal, because once I named the mesh by this exact name that the player can go through to the next task,
                    // and substring it in such way that it will receive the task level, that the player currently intends to play. For example TaskPortal1,
                    // will leave just number '1', and the task 1 will be launched.
                    taskToComplete = Int32.Parse(taskPortal.name.Substring("TaskPortal".Length, taskPortal.name.Length - "TaskPortal".Length));
                    taskPortal.SetActive(false);                           // We have to hide the task portal, if the player stays on the same location as the task portal.
                    taskPortal.GetComponent <Collider> ().enabled = false; // and also turn off its collider, so ball won't bounce off, once hits it.
                    enteredTask = taskPortal;

                    // If the player enters the task portal, the notification will pop up, if ok button is clicked, it will proceed to the task.
                    switch (taskToComplete)
                    {
                    case 1:
                        NotificationOptions("Вы хотите сыграть в Викторину?");
                        break;

                    case 2:
                        NotificationOptions("Вы хотите сыграть в Игру Слов?");
                        break;

                    case 3:
                        NotificationOptions("Вы хотите сыграть в Классификацию?");
                        break;

                    case 4:
                        NotificationOptions("Вы хотите сыграть в Ассоциацию?");
                        break;
                    }
                    break;
                }
            }

            if (defaultFloorColor == null)
            {
                defaultFloorColor = floor.GetComponent <Renderer> ().material.color;
            }

            floor.GetComponent <Renderer> ().material.color = Color.green;            // current staying floor color

            // the player can make his moves after each second

            timer -= Time.deltaTime;

            if (allowMotion)
            {
                transform.position = Vector3.Lerp(transform.position, floor.transform.position, moveSpeed * Time.deltaTime);                  // this allows ball to move smoothly to the target
                if (timer <= 0)
                {
                    allowMotion = false;
                }
                // The current location of the player must be recorded, so on the next session the player is spawned on the same previous location. The same applies to the previous made step and number of turns.
                PlayerPrefs.SetString("previousStep", previousStep);
                PlayerPrefs.SetInt("turnsCount", turnsCount);
                PlayerPrefs.SetInt("playerPosX", playerPosX);
                PlayerPrefs.SetInt("playerPosZ", playerPosZ);
            }

            if (timer <= 0 && !allowMotion)
            {
                // previousStep is required to record the two-based steps for the player, so by this we can know whether the player will make a "turn".
                // turnsCount records information about how much turns were made by the player.
                // The following turns are available by the player, the previous step will record the first turn, and will compare it with current step:
                // ↑ + → |-------| ↓ + → |-------| → + ↑ |-------| → + ↓
                // ↑ + ← |-------| ↓ + ← |-------| ← + ↑ |-------| ← + ↓

                if (previousStep == null)
                {
                    previousStep = "firstStep";
                }
                Vector3 moveVector = (Vector3.back * joystick.Horizontal + Vector3.right * joystick.Vertical).normalized * moveSpeed;

                // The maze is defined in x and z manner. So z++ means the player goes up, z-- down, x++ right, x-- left.

                if (moveVector.x >= 5 & moveVector.x <= 10 && moveVector.z >= -3 && moveVector.z <= 3)                                       // The player moves joystick upwards
                {
                    if (playerPosZ + 1 < RowsCount && !wallPlacement.WallFront)                                                              // If the player makes his move to upper cell, we must ensure, that no wall in front exists, and the boundary is kept, so the system won't throw an error.
                    {
                        floor.GetComponent <Renderer> ().material.color = defaultFloorColor;                                                 // If the player moves to the next cell, the previous cell will change its color to its default.
                        if (taskLevel <= maxAvailableTasks && previousStep != "firstStep" && previousStep != "up" && previousStep != "down") // Take a look to all available turns of the player above. If and only the tasks are not completed the turns will be counted. "firstStep", iterative turns, reversed turns are not counted as a turn.
                        {
                            turnsCount++;
                        }
                        previousStep = "up";
                        playerPosZ++;                            // if the player makes his move up, so it will go to the upper cell
                        if (completedTasks == maxAvailableTasks) // Once all tasks are completed, the player will have to go to the exit, if he gets stuck the sound should play notifying him that this cell is the deadline.
                        {
                            if (StuckInDeadline("up"))
                            {
                                Debug.Log("You're stuck!");                                  // Here you stuck, and the sound should play
                            }
                        }
                        allowMotion = true;
                        timer       = 1.0;
                        checkForEnteredTask(floor);
                    }
                }
                else if (moveVector.x >= -10 & moveVector.x <= -5 && moveVector.z >= -3 && moveVector.z <= 3)                     // Downwards
                {
                    if (playerPosZ - 1 > -1 && !wallPlacement.WallBack)
                    {
                        floor.GetComponent <Renderer> ().material.color = defaultFloorColor;
                        if (taskLevel <= maxAvailableTasks && previousStep != "firstStep" && previousStep != "down" && previousStep != "up")
                        {
                            turnsCount++;
                        }
                        previousStep = "down";
                        playerPosZ--;
                        if (completedTasks == maxAvailableTasks)
                        {
                            if (StuckInDeadline("down"))
                            {
                                Debug.Log("You're stuck!");
                            }
                        }
                        allowMotion = true;
                        timer       = 1.0;
                        checkForEnteredTask(floor);
                    }
                }

                if (moveVector.x >= -3 & moveVector.x <= 3 && moveVector.z >= -10 && moveVector.z <= -5)                   // Right
                {
                    if (playerPosZ == RowsCount - 1 && playerPosX == ColumnsCount - 1)
                    {
                        // Once we exit from the labyrinth, we ensure that all data is deleted
                        foreach (string key in keysToDelete)
                        {
                            if (key == "Wall_At_Column")
                            {
                                for (int row = 0; row < RowsCount; row++)
                                {
                                    for (int column = 0; column < ColumnsCount; column++)
                                    {
                                        string Wall_At_Column = "Wall_At_Column" + column.ToString() + "_Row" + row.ToString();
                                        PlayerPrefs.DeleteKey(Wall_At_Column + "_Right");
                                        PlayerPrefs.DeleteKey(Wall_At_Column + "_Front");
                                        PlayerPrefs.DeleteKey(Wall_At_Column + "_Left");
                                        PlayerPrefs.DeleteKey(Wall_At_Column + "_Back");
                                    }
                                }
                            }
                            else if (key == "TaskPortal")
                            {
                                for (int i = 1; i <= maxAvailableTasks; i++)
                                {
                                    PlayerPrefs.DeleteKey(key + i + "_PosX");
                                    PlayerPrefs.DeleteKey(key + i + "_PosZ");
                                }
                            }
                            else
                            {
                                PlayerPrefs.DeleteKey(key);
                            }
                        }
                        SceneManager.LoadScene("Exit");                          // Go to the stage where final comics scene will be presented to the player
                    }
                    else if (playerPosX + 1 < ColumnsCount && !wallPlacement.WallRight)
                    {
                        floor.GetComponent <Renderer> ().material.color = defaultFloorColor;
                        if (taskLevel <= maxAvailableTasks && previousStep != "firstStep" && previousStep != "right" && previousStep != "left")
                        {
                            turnsCount++;
                        }
                        previousStep = "right";
                        playerPosX++;
                        if (completedTasks == maxAvailableTasks)
                        {
                            if (StuckInDeadline("right"))
                            {
                                Debug.Log("You're stuck!");
                            }
                        }
                        allowMotion = true;
                        timer       = 1.0;
                        checkForEnteredTask(floor);
                    }
                }
                else if (moveVector.x >= -3 & moveVector.x <= 3 && moveVector.z >= 5 && moveVector.z <= 10)                     // Left
                {
                    if (playerPosX - 1 > -1 && !wallPlacement.WallLeft)
                    {
                        floor.GetComponent <Renderer> ().material.color = defaultFloorColor;
                        if (taskLevel <= maxAvailableTasks && previousStep != "firstStep" && previousStep != "left" && previousStep != "right")
                        {
                            turnsCount++;
                        }
                        previousStep = "left";
                        playerPosX--;
                        if (completedTasks == maxAvailableTasks)
                        {
                            if (StuckInDeadline("left"))
                            {
                                Debug.Log("You're stuck!");
                            }
                        }
                        allowMotion = true;
                        timer       = 1.0;
                        checkForEnteredTask(floor);
                    }
                }

                // this is where the new task is generated.
                if (turnsCount == 5)
                {
                    string availableFloorName;
                    int    xOffset = 0, zOffset = 0;                  // these are required to generate mesh, in the cell next to the current player position.

                    wallDirection = "Wall_At_Column" + playerPosX.ToString() + "_Row" + playerPosZ.ToString();
                    wallPlacement = getWallDirections(wallDirection);

                    if (previousStep == "up" || previousStep == "down")                       // if the player made his previous move towards up or down, the mesh will be generated to the next appropriate direction.
                    {
                        if (previousStep == "up" && !wallPlacement.WallFront)
                        {
                            zOffset = 1;
                        }
                        else if (previousStep == "down" && !wallPlacement.WallBack)
                        {
                            zOffset = -1;
                        }
                        else if (!wallPlacement.WallRight)
                        {
                            xOffset = 1;
                        }
                        else if (!wallPlacement.WallLeft)
                        {
                            xOffset = -1;
                        }
                    }
                    else if (previousStep == "right" || previousStep == "left")
                    {
                        if (!wallPlacement.WallFront)
                        {
                            zOffset = 1;
                        }
                        else if (!wallPlacement.WallBack)
                        {
                            zOffset = -1;
                        }
                        else if (previousStep == "right" && !wallPlacement.WallRight)
                        {
                            xOffset = 1;
                        }
                        else if (previousStep == "left" && !wallPlacement.WallLeft)
                        {
                            xOffset = -1;
                        }
                    }

                    availableFloorName = "Floor_Column" + (playerPosX + xOffset).ToString() + "_Row" + (playerPosZ + zOffset).ToString();
                    GameObject nextFloor = GameObject.Find(availableFloorName);

                    // We have to check whether the task is not generated in the same place as the previous one.
                    foreach (GameObject taskPortal in taskPortals)
                    {
                        if (taskPortal.transform.position == new Vector3(nextFloor.transform.position.x, 0, nextFloor.transform.position.z))
                        {
                            turnsCount--;
                            break;
                        }
                    }

                    if (turnsCount == 5)
                    {
                        turnsCount = 0;
                        initTaskPortal(nextFloor.transform.position, taskLevel);
                        GameObject taskPortal = taskPortals[taskPortals.Count - 1];                       // It will get the last created task portal, and record its location & taskLevel.
                        taskLevel++;
                        PlayerPrefs.SetFloat(taskPortal.name + "_PosX", taskPortal.transform.position.x);
                        PlayerPrefs.SetFloat(taskPortal.name + "_PosZ", taskPortal.transform.position.z);
                        PlayerPrefs.SetInt("taskLevel", taskLevel);
                    }
                }
            }
        }

        if (ViewCamera != null)
        {
            Vector3    direction = (Vector3.up * 2 + Vector3.back) * 2;
            RaycastHit hit;
            Debug.DrawLine(viewCameraPosition, viewCameraPosition + direction, Color.red);
            ViewCamera.transform.position = new Vector3(viewCameraPosition.x, viewCameraPosition.y, viewCameraPosition.z);
            ViewCamera.transform.LookAt(viewCameraPosition);             // this is how camera will look to the player position or any other defined position.
        }
    }
    public void OnRegisterBtn()
    {
        AccountManager.AccountState usernameState;
        AccountManager.AccountState passwordState;
        usernameState = AccountManager.CheckUsername(userNameInput.text);
        passwordState = AccountManager.CheckPassword(passwordInput_1.text);
        switch (usernameState)
        {
        case AccountManager.AccountState.NONE:
            break;

        case AccountManager.AccountState.NULLOREMPTY:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg22);
            return;

        case AccountManager.AccountState.TOOSHORT:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg29);
            return;

        case AccountManager.AccountState.TOOLONG:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg30);
            return;

        case AccountManager.AccountState.NOTEMAIL:
            BoxManager.showMessage("请使用正确的邮箱格式", "账号格式错误");
            return;

        default:
            BoxManager.showMessage("账号应为5-16位小写字母、数字、下划线组成", "账号格式错误");           //WML MARK
            return;
        }
        if (passwordInput_1.text != passwordInput_2.text)
        {
//			BoxManager.showMessage("密码不一致!重新输入!");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg31);
            return;
        }
        switch (passwordState)
        {
        case AccountManager.AccountState.NONE:
            break;

        case AccountManager.AccountState.NULLOREMPTY:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg23);
            return;

        case AccountManager.AccountState.TOOSHORT:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg33);
            return;

        case AccountManager.AccountState.TOOLONG:
            BoxManager.showMessageByID((int)MessageIdEnum.Msg34);
            return;

        default:
            BoxManager.showMessage("密码应为4-16位,且不包含空格、逗号、单双引号", "密码格式错误");           //WML MARK
            return;
        }

        /*
         * if(! agreeCheckBox.isChecked)
         * {
         * //			BoxManager.showMessage("请阅读并同意用户协议");
         *      BoxManager.showMessageByID((int)MessageIdEnum.Msg32);
         *      return;
         * }
         */
        userName = userNameInput.text;         //WML MARK
        Debug.LogWarning("UserName = "******"ACCOUNT_ID"));
        //NetworkSender.Instance().CyouLogin(OnRegisterRet, 2, userName, password, PlayerPrefs.GetString("ACCOUNT_ID"));
    }
    void OnRegisterRet(bool bSuccess)
    {
        if (bSuccess)
        {
            switch (Obj_MyselfPlayer.GetMe().cyouCode)
            {
            case -1:
//				BoxManager.showMessage("Billing异常");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg24);
                break;

            case 0:
//				引起注册同名可绑定bug
//				Obj_MyselfPlayer.GetMe().accountID = Obj_MyselfPlayer.GetMe().cyouAccountId;
//				AccountInfo info = new AccountInfo();
//				info.accountId = Obj_MyselfPlayer.GetMe().cyouAccountId;
//				info.email = userName;
//				info.password = password;
//				AccountManager.Instance.CurAccount = info;
                //gameObject.SetActive(false);//TT10628
                //在这儿登陆--
                //NetworkSender.Instance().CyouLogin(OnLoginRet, 1, userName, password, PlayerPrefs.GetString("ACCOUNT_ID"));
                NetworkSender.Instance().BindCyouAccount(OnLoginRet, 1, userName, password, PlayerPrefs.GetString("ACCOUNT_ID"));
                break;

            case 1:
//				BoxManager.showMessage("参数不完整");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg26);
                break;

            case 2:
//				BoxManager.showMessage("用户名已存在");
                Debug.LogWarning("Uesr Exist");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg6);
                break;

            case 3:
//				BoxManager.showMessage("该ip地址禁止注册(黑名单)");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg35);
                break;

            case 4:
//				BoxManager.showMessage("同ip注册间隔必须大于3分钟,3分钟不得超过6个");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg36);
                break;

            case 5:
//				BoxManager.showMessage("该ip今天不能注册账号");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg37);
                break;

            case 6:
//				BoxManager.showMessage("用户名长度非5-16位");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg38);
                break;

            case 7:
//				BoxManager.showMessage("用户名首字母必须为字母或数字");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg39);
                break;

            case 8:
//				BoxManager.showMessage("用户名只能使用英文字母或数字以及 _ ");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg38);
                break;

            case 9:
//				BoxManager.showMessage("禁用词(密码不合法)");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg66);
                break;

            case 99:
//				BoxManager.showMessage("账号系统异常");
                BoxManager.showMessageByID((int)MessageIdEnum.Msg26);
                break;

            default:
                break;
            }
        }
    }
示例#14
0
 void Update()
 {
     textComp.text = "HIGHSCORES" + "\n" + "1st - " + PlayerPrefs.GetString("highscoreName") + " - " + PlayerPrefs.GetInt("highScore");
 }
 public void Finalizar()
 {
     fechaTerminoActiv = DateTime.Now;
     EnvioDatosBD.instanciaEDBD.EnviarDatosActiv(fechaInicioActiv, fechaTerminoActiv, Duracion(), PlayerPrefs.GetString("id_usuario"));
     SceneManager.LoadScene("SeleccionarActividad");
 }
示例#16
0
    public void Save(TMP_InputField t, int n, int overwrite = -1)
    {
        n = (overwrite == -1) ? getNext() : n;
        DressManager dm = transform.root.GetComponent <DressManager>();

        dm.load.startLoading(true);


        string num = n.ToString();
        string key = "SAVE" + num;

        if (overwrite == -1)
        {
            Debug.LogWarning("saving at " + key);
            PlayerPrefs.SetString(key, t.text);
        }


        //save all face things with key + "face", key + "bh"; etc



        foreach (var i in Enum.GetValues(typeof(itemType)))
        {
            itemType it      = (itemType)i;
            string   keyItem = i.ToString().Substring(0, 2);
            if (keyItem == "CH")
            {
                Vector2 chin = dm.fm.skin[8].rectTransform.sizeDelta;
                PlayerPrefs.SetString(num + keyItem, chin.y + "");
                continue;
            }
            else if (keyItem == "BY")
            {
                Vector2 body = dm.fm.skin[4].rectTransform.sizeDelta;
                PlayerPrefs.SetString(num + keyItem, body.x + "|" + body.y);
                continue;
            }
            else if (keyItem == "HD")
            {
                Vector2 head = dm.fm.skin[1].rectTransform.sizeDelta;
                PlayerPrefs.SetString(num + keyItem, head.x + "|" + head.y);
                continue;
            }
            if (dm.fm.XtraStuff.ContainsKey(keyItem))
            {
                string colors;
                string name;
                if (dm.fm.XtraStuff[keyItem] != null && dm.fm.XtraStuff[keyItem].sprite != null)
                {
                    name = dm.fm.XtraStuff[keyItem].sprite.name;
                }
                else
                {
                    name = " ";
                }
                if (it == itemType.bg)
                {
                    Color32 tempC = Camera.main.backgroundColor;
                    colors = tempC.r + "," + tempC.g + "," + tempC.b;
                    if (name != " " && name[2] == 'p')
                    {
                        tempC   = dm.fm.XtraStuff[keyItem].color;
                        colors += "|" + tempC.r + "," + tempC.g + "," + tempC.b;
                    }
                }
                else if (it == itemType.GXlitch)
                {
                    Glitch g = Camera.main.GetComponent <Glitch>();
                    colors = g.colorDrift + "|" + g.verticalJump;
                }
                else if (it == itemType.CXolor)
                {
                    ColorFX g     = Camera.main.GetComponent <ColorFX>();
                    Color32 tempC = g.color;
                    colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + g.Amount;
                }
                else if (it == itemType.BNry)
                {
                    Binary  g      = Camera.main.GetComponent <Binary>();
                    Color32 tempC  = g.color0;
                    Color32 tempC2 = g.color1;
                    colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + tempC2.r + "," + tempC2.g + "," + tempC2.b + "|" + g.Opacity;
                }
                else if (it == itemType.RPamp)
                {
                    Ramp    g      = Camera.main.GetComponent <Ramp>();
                    Color32 tempC  = g.FirstColor;
                    Color32 tempC2 = g.SecondColor;
                    colors = tempC.r + "," + tempC.g + "," + tempC.b + "|" + tempC2.r + "," + tempC2.g + "," + tempC2.b + "|" + g._opacity;
                }
                else if (it == itemType.BMlm)
                {
                    Bloom g = Camera.main.GetComponent <Bloom>();
                    colors = g.intensity + "|" + g.radius;
                }
                else
                {
                    Color32 tempC;
                    if (keyItem.ToLower() == "pa")
                    {
                        Transform ps = GameObject.FindGameObjectWithTag("Finish").transform.Find(it.ToString());
                        if (ps == null)
                        {
                            continue;
                        }
                        tempC  = ps.GetComponent <ParticleSystem>().main.startColor.colorMin;
                        colors = tempC.r + "," + tempC.g + "," + tempC.b;
                    }
                    else if (keyItem == "wf")
                    {
                        tempC  = dm.fm.XtraStuff[keyItem].GetComponent <WaterfallScript>().LightColor;
                        colors = tempC.r + "," + tempC.g + "," + tempC.b;
                    }
                    else if (keyItem == "FR")
                    {
                        FourGradient fg = dm.fm.bangs.GetComponent <FourGradient>();
                        tempC   = fg._Color1;
                        colors  = tempC.r + "," + tempC.g + "," + tempC.b + "|";
                        tempC   = fg._Color2;
                        colors += tempC.r + "," + tempC.g + "," + tempC.b + "|";
                        tempC   = fg._Color3;
                        colors += tempC.r + "," + tempC.g + "," + tempC.b + "|";
                        tempC   = fg._Color4;
                        colors += tempC.r + "," + tempC.g + "," + tempC.b + "|";
                        colors += fg.opacity.ToString();
                    }
                    else
                    {
                        tempC = dm.fm.XtraStuff[keyItem].color;

                        colors = tempC.r + "," + tempC.g + "," + tempC.b;

                        if (keyItem == "bh")
                        {
                            Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta;
                            colors += "|" + size.x + "," + size.y;
                        }
                        else if (keyItem == "b_")
                        {
                            Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta;
                            colors += "|" + size.x + "," + size.y;
                        }
                        else if (keyItem == "l_")
                        {
                            Vector2 size = dm.fm.XtraStuff[keyItem].rectTransform.sizeDelta;
                            colors += "|" + size.x + "," + size.y + "|" + dm.fm.VertLip;
                        }
                        else if (keyItem == "eb")
                        {
                            colors += "|" + dm.fm.XtraStuff[keyItem].rectTransform.eulerAngles.z + "|" + dm.fm.VertEB;
                        }
                        else if (keyItem == "e_")
                        {
                            RectTransform r = dm.fm.XtraStuff[keyItem].rectTransform;
                            colors += "|" + r.sizeDelta.x + "," + r.sizeDelta.y + "|" + r.eulerAngles.z;
                        }
                        else if (keyItem == "ey")
                        {
                            RectTransform r2 = dm.fm.skin[5].rectTransform;
                            colors += "|" + r2.anchoredPosition.y + "|" + r2.eulerAngles.z;
                        }

                        else if (dm.fm.XtraStuff.ContainsKey(keyItem + "2"))
                        {
                            Image im2 = dm.fm.XtraStuff[keyItem + "2"];
                            if (im2 != null)
                            {
                                tempC   = im2.color;
                                colors += "|" + tempC.r + "," + tempC.g + "," + tempC.b;
                                if (keyItem == "ir")
                                {
                                    colors += "|" + dm.fm.leftE[1].rectTransform.sizeDelta.x + "," + dm.fm.leftE[1].rectTransform.sizeDelta.y;
                                }//iris.sizeDelta = new Vector2(120.2f + ratio * val, 107.8f + ratio * val);
                            }
                        }
                    }
                }

                string val = name + "|" + colors;
                PlayerPrefs.SetString(num + keyItem, val);
                Debug.LogWarning("save" + num + keyItem + " as: " + val);
            }
        }
        PlayerPrefs.SetFloat(num + "HE", dm.fm.HorzEye);
        PlayerPrefs.SetFloat(num + "VE", dm.fm.VertEye);
        PlayerPrefs.SetFloat(num + "VN", dm.fm.VertNose);
        PlayerPrefs.SetFloat(num + "SN", dm.fm.skin[0].rectTransform.sizeDelta.y - 304);
        // fs.set.rectTransform.sizeDelta = new Vector2(349 + ratio2 * val, 304 + ratio2 * val);
        //    public float HorzEye, VertEye, VertNose, noseSize
        //   Color32 c = dm.fm.leftE[1].color;
        // PlayerPrefs.SetString(num + "lI", c.r + "," + c.g + "," + c.b);
        // c = dm.fm.rightE[1].color;
        // PlayerPrefs.SetString(num + "rI", c.r + "," + c.g + "," + c.b);
        // c = dm.fm.leftE[0].color;
        // PlayerPrefs.SetString(num + "W", c.r + "," + c.g + "," + c.b);
        // c = dm.fm.rightE[0].color;
        // PlayerPrefs.SetString(num + "Wr", c.r + "," + c.g + "," + c.b);
        Color32 c = dm.fm.skin[1].color;

        PlayerPrefs.SetString(num + "S", c.r + "," + c.g + "," + c.b);


        /*
         *
         * hm.set = leftE[1];
         *              hm.set2 = rightE[1];
         *              hm.before = hm.set.sprite;
         *              break;
         *          case "whites":
         *              hm.set = leftE[0];
         *              hm.set2 = rightE[0];
         */



        if (overwrite == -1)
        {
            Button b = InstantiateButton(PlayerPrefs.GetString(key), n);

            Color32    prev = new Color32((byte)PlayerPrefs.GetInt("themeR"), (byte)PlayerPrefs.GetInt("themeG"), (byte)PlayerPrefs.GetInt("themeB"), 255);
            ColorBlock cb   = b.colors;
            cb.normalColor   = prev;
            cb.disabledColor = prev;
            b.colors         = cb;

            setNext(n);
        }
        PlayerPrefs.Save();
        dm.load.StopLoading();
    }
    public void Salir()
    {
        if (estado == 2)
        {
            retiroActiv       = true;
            fechaTerminoActiv = DateTime.Now;
            fechaRetiro       = DateTime.Now;
            CalcularPorcentaje();
            EnvioDatosBD.instanciaEDBD.EnviarDatos(PlayerPrefs.GetString("id_usuario"), buenas, malas, ValorPorcentaje, can_intro, fechaInicioIntento, fechaTerminoIntento, fechaInicioActiv, retiroActiv, listareg, DuracionIntento());
        }

        EnvioDatosBD.instanciaEDBD.EnviarDatosActiv(fechaInicioActiv, fechaTerminoActiv, Duracion(), PlayerPrefs.GetString("id_usuario"));
        SceneManager.LoadScene("SeleccionarActividad");
    }
示例#18
0
 public void Start()
 {
     PlayerName      = PlayerPrefs.GetString("playername");
     PlayerText.text = PlayerName;
 }
示例#19
0
 public void OnClickSound()
 {
     PlayerPrefs.SetString("SoundActive", (!PlayerPrefs.GetString("SoundActive").Equals("True")).ToString());
     Debug.Log(PlayerPrefs.GetString("SoundActive"));
 }
    void OnMouseDown()
    {
        Time.timeScale = 1;
        this.audio.Play();

        PlayerPrefs.SetInt("Player Score", money.moneyLeft);
        PlayerPrefs.SetString("chaPos1", chaPos1);
        PlayerPrefs.SetString("chaPos2", chaPos2);
        PlayerPrefs.SetString("chaPos3", chaPos3);
        PlayerPrefs.SetString("chaPos4", chaPos4);

        if (((PlayerPrefs.GetString("chaPos1") == "zebra") || (PlayerPrefs.GetString("chaPos2") == "zebra") || (PlayerPrefs.GetString("chaPos3") == "zebra") || (PlayerPrefs.GetString("chaPos4") == "zebra")) &&
            (rhinoScript.rhinoIsOnShelf == true || monkeyScript.monkeyIsOnShelf))
        {
            Application.LoadLevel("L8_final");
        }
    }
示例#21
0
 // Update is called once per frame
 void Update()
 {
     print(PlayerPrefs.GetString("Name"));
 }
示例#22
0
    public void UpdateMapsAndMenu()
    {
        if (!Application.isEditor)
        {
            allLoadedBundles.ForEach(b => b.Unload(false));
            allLoadedBundles.Clear();
        }

        MapDropdown.ClearOptions();
        loadableSceneNames.Clear();
        MapSprites.Clear();

        int selectedMapIndex = 0;
        var selectedMapName  = PlayerPrefs.GetString("SELECTED_MAP", null);

#if UNITY_EDITOR
        if (assetBundleManager != null)
        {
            foreach (var map in assetBundleManager.assetBundleSettings.maps)
            {
                var scn = map.sceneAsset as UnityEditor.SceneAsset;
                if (scn != null)
                {
                    var sceneName = scn.name;
                    if (Application.CanStreamedLevelBeLoaded(sceneName) && !loadableSceneNames.Contains(sceneName))
                    {
                        if (sceneName == selectedMapName)
                        {
                            selectedMapIndex = loadableSceneNames.Count;
                        }
                        loadableSceneNames.Add(sceneName);
                        MapSprites.Add(map.spriteImg);
                    }
                }
            }
            MapDropdown.AddOptions(loadableSceneNames);
        }
#endif

        if (!Application.isEditor)
        {
            var bundleRoot = Path.Combine(Application.dataPath, "..", "AssetBundles");
            var files      = Directory.GetFiles(bundleRoot);
            foreach (var f in files)
            {
                if (Path.HasExtension(f))
                {
                    continue;
                }
                var filename = Path.GetFileName(f);
                if (filename.StartsWith("map_"))
                {
                    var mapName = filename.Substring("map_".Length);
                    var bundle  = AssetBundle.LoadFromFile(f); //will take long with many scenes so change to async later
                    if (bundle != null)
                    {
                        allLoadedBundles.Add(bundle);
                    }
                    string[] scenes = bundle.GetAllScenePaths(); //assume each bundle has at most one scene
                    if (scenes.Length > 0)
                    {
                        string sceneName = Path.GetFileNameWithoutExtension(scenes[0]);
                        if (sceneName == selectedMapName)
                        {
                            selectedMapIndex = loadableSceneNames.Count;
                        }
                        loadableSceneNames.Add(sceneName);
                        Sprite spriteImg        = null;
                        var    spriteBundleFile = f.Replace($"map_{mapName}", $"mapimage_{mapName}");
                        if (File.Exists(spriteBundleFile))
                        {
                            var spriteBundle = AssetBundle.LoadFromFile(spriteBundleFile);
                            if (spriteBundle != null)
                            {
                                allLoadedBundles.Add(spriteBundle);
                                spriteImg = spriteBundle.LoadAsset <Sprite>($"mapimage_{mapName}");
                            }
                        }
                        MapSprites.Add(spriteImg);
                    }
                }
            }
            MapDropdown.AddOptions(loadableSceneNames);
        }

        MapDropdown.value = selectedMapIndex;
        ChangeMapImage();
    }
示例#23
0
 public string GetStringData(string key)
 {
     return(PlayerPrefs.GetString(key));
 }
示例#24
0
 public static void LoadAllInfomation()
 {
     GameInfomation.Playername = PlayerPrefs.GetString("CATCHEGGS_PLAYERNAME");
     GameInfomation.Playerage = PlayerPrefs.GetInt("CATCHEGGS_PLAYERAGE");
 }
示例#25
0
    public static object getObject(string key)
    {
        object info = JsonUtility.FromJson <object>(PlayerPrefs.GetString(key));

        return(info);
    }
 // Use this for initialization
 void Start()
 {
     this.GetComponent <Text>().text = (LanguageManager.Instance.Get("Phrases/HighScore") + PlayerPrefs.GetInt("Best score"));
     _currentLanguage = PlayerPrefs.GetString("Language");
 }
示例#27
0
    /// <summary>
    /// Localize the specified value.
    /// </summary>

    static public string Get(string key)
    {
        // [dev]
        key = key.Replace("\\n", "\n");

        // Ensure we have a language to work with
        if (!localizationHasBeenSet)
        {
            LoadDictionary(PlayerPrefs.GetString("Language", "English"));
        }

        if (mLanguages == null)
        {
            Debug.LogError("No localization data present");
            return(null);
        }

        string lang = language;

        if (mLanguageIndex == -1)
        {
            for (int i = 0; i < mLanguages.Length; ++i)
            {
                if (mLanguages[i] == lang)
                {
                    mLanguageIndex = i;
                    break;
                }
            }
        }

        if (mLanguageIndex == -1)
        {
            mLanguageIndex = 0;
            mLanguage      = mLanguages[0];
            Debug.LogWarning("Language not found: " + lang);
        }

        string val;

        string[] vals;

        UICamera.ControlScheme scheme = UICamera.currentScheme;


        if (scheme == UICamera.ControlScheme.Touch)
        {
            string altKey = key + " Mobile";
            if (mReplacement.TryGetValue(altKey, out val))
            {
                return(val);
            }

            if (mLanguageIndex != -1 && mDictionary.TryGetValue(altKey, out vals))
            {
                if (mLanguageIndex < vals.Length)
                {
                    return(vals[mLanguageIndex]);
                }
            }
            if (mOldDictionary.TryGetValue(altKey, out val))
            {
                return(val);
            }
        }
        else if (scheme == UICamera.ControlScheme.Controller)
        {
            string altKey = key + " Controller";
            if (mReplacement.TryGetValue(altKey, out val))
            {
                return(val);
            }

            if (mLanguageIndex != -1 && mDictionary.TryGetValue(altKey, out vals))
            {
                if (mLanguageIndex < vals.Length)
                {
                    return(vals[mLanguageIndex]);
                }
            }
            if (mOldDictionary.TryGetValue(altKey, out val))
            {
                return(val);
            }
        }

        if (mReplacement.TryGetValue(key, out val))
        {
            return(val);
        }

        if (mLanguageIndex != -1 && mDictionary.TryGetValue(key, out vals))
        {
            if (mLanguageIndex < vals.Length)
            {
                string s = vals[mLanguageIndex];
                if (string.IsNullOrEmpty(s))
                {
                    s = vals[0];
                }
                return(s);
            }
            return(vals[0]);
        }
        if (mOldDictionary.TryGetValue(key, out val))
        {
            return(val);
        }

#if UNITY_EDITOR
        Debug.LogWarning("Localization key not found: '" + key + "' for language " + lang);
#endif
        return(key);
    }
示例#28
0
 // Use this for initialization
 void Start()
 {
     AddDebug("Chaîne vide", (PlayerPrefs.GetString("PlayerPseudo") == "").ToString());
     AddDebug("Pseudo", PlayerPrefs.GetString("PlayerPseudo"));
 }
    public static GameValuesController.Difficulty GetSavedDifficulty()
    {
        string difficultyString = PlayerPrefs.GetString(DIFFICULTY_PLAYERPREFS_KEY, GameValuesController.Difficulty.Easy.ToString());

        return((GameValuesController.Difficulty)Enum.Parse(typeof(GameValuesController.Difficulty), difficultyString));
    }
 public string GetString(string fullPath)
 {
     return(PlayerPrefs.GetString(fullPath));
 }