Exemplo n.º 1
0
    public static bool SetData(string json)
    {
#if UNITY_EDITOR
        if (Instance.offline)
        {
            SeganX.Console.Logger.Enabled = true;
            return(true);
        }
#endif

        var newdata = JsonUtilityEx.FromJson <Data>(json, false);
        if (newdata == null)
        {
            return(false);
        }

        //  set new data
        Instance.data = newdata;
        SaveData(newdata);
        SeganX.Console.Logger.Enabled = DebugMode;

        // select cohort
        Cohort = PlayerPrefsEx.GetInt("GlobalConfig.Cohort", -1);
        if (Cohort < 0)
        {
            Cohort = Random.Range(0, 100) % 2;
            PlayerPrefsEx.SetInt("GlobalConfig.Cohort", Cohort);
        }
        return(true);
    }
Exemplo n.º 2
0
        protected static int DrawIntPopup(string label, string key, int value, string[] displayedOptions, int[] optionValues)
        {
            value = PlayerPrefsEx.GetInt(key, value);
            int newValue = EditorGUILayout.IntPopup(label, value, displayedOptions, optionValues);

            if (newValue != value)
            {
                PlayerPrefsEx.SetInt(key, newValue);
            }
            return(newValue);
        }
Exemplo n.º 3
0
    protected override void OnInitialize()
    {
#if UNITY_EDITOR
        if (offline)
        {
            SaveData(data);
            PlayerPrefsEx.SetInt("GlobalConfig.Group", offlineGroup);
        }
#else
        data = LoadData(data);
        if (DebugMode)
        {
            Console.Enabled = true;
        }
#endif
    }