예제 #1
0
    void Load()
    {
        int        dataInt    = MyPlayerPrefs.GetInt("SimpleInt", 0);
        float      dataFloat  = MyPlayerPrefs.GetFloat("SimpleFloat", 0.8f);
        string     dataString = MyPlayerPrefs.GetString("SimpleString", "wrong");
        Vector3    dataVector = MyPlayerPrefs.GetVector3("SimpleVector", Vector3.zero);
        Quaternion dataQuat   = MyPlayerPrefs.GetQuaternion("SimpleQuat", new Quaternion(0f, 0f, 0f, 0f));
        Color      dataColor  = MyPlayerPrefs.GetColor("SimpleColor", new Color(0f, 0f, 0f, 0f));

        Debug.LogWarning(string.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", dataInt, dataFloat, dataString, dataVector, dataQuat, dataColor));
    }
        static void LoadLang()
        {
            LangCode lt;
            string   l = MyPlayerPrefs.GetString(key, null);

            if (l == null)
            {
                var sl = Application.systemLanguage;
                if (!LocData.TryGetCode(sl, out lt))
                {
                    lt = LangCode.en;
                }
            }
            else
            {
                if (!LocData.TryParseCode(l, out lt))
                {
                    lt = LangCode.en;
                }
            }
            MyPlayerPrefs.SetString(key, lt.ToString());
            MyLogger.LogFormat("Localization: {0}", lt);
            lang = lt;
        }