Example #1
0
        public static void LoadBinds()
        {
            Console.AddBind("BackQuote", "console");
            if (Console.Get().configFile != "")
            {
                return;
            }
            if (!PlayerPref.Has("binds"))
            {
                PlayerPref.Set <string>("binds", "|");
            }
            string binds = PlayerPref.Get <string>("binds");

            string[] bindList = binds.Split('|');
            foreach (string item in bindList)
            {
                string[] dataList = item.Split('-');
                if (dataList.Length < 3)
                {
                    continue;
                }
                string key         = dataList[1];
                string action      = dataList[2];
                bool   toggle      = dataList[0] == "toggle";
                bool   repeat      = dataList[0] == "repeat";
                float  repeatDelay = dataList.Length > 3 ? Convert.ToSingle(dataList[3]) : 0;
                Console.AddBind(key, action, toggle, repeat, repeatDelay);
            }
        }
Example #2
0
 public void UpdateEffects()
 {
                 #if UNITY_EDITOR
     var updateShaders   = PlayerPref.Get <bool>("EditorSettings-AlwaysUpdateShaders");
     var updateParticles = PlayerPref.Get <bool>("EditorSettings-AlwaysUpdateParticles");
     if (updateShaders)
     {
         Shader.SetGlobalFloat("timeConstant", Time.Get());
     }
     foreach (var system in Locate.GetSceneComponents <ParticleSystem>())
     {
         if (system.IsNull())
         {
             continue;
         }
         var updater = system.gameObject.GetComponent <UpdateParticle>();
         if (updateParticles && updater.IsNull())
         {
             updater           = system.gameObject.AddComponent <UpdateParticle>();
             updater.hideFlags = HideFlags.DontSaveInBuild | HideFlags.NotEditable | HideFlags.HideInInspector;
         }
         if (!updateParticles && !updater.IsNull())
         {
             DestroyImmediate(updater);
         }
     }
     if (updateShaders || updateParticles)
     {
         ProxyEditor.RepaintSceneView();
     }
                 #endif
 }
Example #3
0
 public static void LoadCvar(Cvar data)
 {
     if (Console.Get().configFile != "")
     {
         return;
     }
     if (PlayerPref.Has(data.fullName))
     {
         object value = data.value.Get();
         Type   type  = data.value.type;
         if (type == typeof(float))
         {
             value = PlayerPref.Get <float>(data.fullName);
         }
         else if (type == typeof(string))
         {
             value = PlayerPref.Get <string>(data.fullName);
         }
         else if (type == typeof(int) || type == typeof(byte))
         {
             value = PlayerPref.Get <int>(data.fullName);
         }
         else if (type == typeof(bool))
         {
             value = PlayerPref.Get <int>(data.fullName) == 1 ? true : false;
         }
         data.value.Set(value);
     }
 }
Example #4
0
        public override void Load()
        {
            string path = this.value.info.fullPath;

            this.value.x = PlayerPref.Get <float>(path + "x");
            this.value.y = PlayerPref.Get <float>(path + "y");
            this.value.z = PlayerPref.Get <float>(path + "z");
        }
Example #5
0
        public static void ResetCvars(string[] values)
        {
            string binds = PlayerPref.Get <string>("binds");

            PlayerPref.ClearAll();
            PlayerPref.Set <string>("binds", binds);
            foreach (var item in Console.cvars)
            {
                Cvar data = item.Value;
                data.value.Set(data.defaultValue);
            }
            Console.AddLog("^10All stored ^3cvars^10 have been reset to default values.");
        }
Example #6
0
 public void OnWillRenderObject()
 {
     if (Proxy.IsEditor() && !Proxy.IsPlaying() && Camera.current != null)
     {
         if (PlayerPref.Get <bool>("EditorSettings-AlwaysUpdateParticles"))
         {
             float   range          = PlayerPref.Get <float>("EditorSettings-ParticleUpdateRange");
             Vector3 cameraPosition = Camera.current.transform.position;
             Vector3 objectPosition = this.transform.position;
             if (Vector3.Distance(cameraPosition, objectPosition) <= range)
             {
                 this.GetComponent <ParticleSystem>().Simulate(Time.Get() % 60 + 10);
             }
         }
     }
 }
Example #7
0
        public override void Load()
        {
            float value = PlayerPref.Get <float>(this.value.info.fullPath);

            this.value.Set(value);
        }
        public override void Load()
        {
            string value = PlayerPref.Get <string>(this.value.info.fullPath);

            this.value.Set(value);
        }
        public override void Load()
        {
            bool value = PlayerPref.Get <int>(this.value.info.fullPath) == 1;

            this.value.Set(value);
        }
Example #10
0
 public Type Get()
 {
     return(PlayerPref.Get <Type>(this.name, this.defaultValue));
 }