private void AddValue(string Key, string DisplayName, double Min, double Max, bool Multiplayer, Type valueType) { if (name2value.ContainsKey(Key)) { return; } StoredVariable sv = new StoredVariable(DisplayName, Multiplayer, valueType); sv.SetMinMax(Min, Max); name2value.Add(Key, sv); nameOrder.Enqueue(Key); }
/// <summary> /// Add a comment for the configuration, with custom scale /// </summary> /// <param name="Comment"></param> /// <param name="scale"></param> public void AddComment(string Comment, float scale) { string uID = "c" + Comment.Length + ":" + Comment.GetHashCode(); if (name2value.ContainsKey(uID)) { return; } StoredVariable sv = new StoredVariable(Comment, scale); name2value.Add(uID, sv); nameOrder.Enqueue(uID); }
internal void GetConfig <T>(string Key, ref T Value, StoredVariable sv) { if (!_enableAutoConfig) { return; } if (_loadOnceCounter == 0) { return; } try { _config.Get(Key, ref Value); sv.Set(Value); _loadOnceCounter--; // Need to save new value in case of conflict // if (_loadConflict) { _config.Put(Key, Value); } // save once values are stored // if (_loadOnceCounter == 0) _config.Save(); } catch { } }