public void AddTunable(TunableStore newSetting, bool replace) { List <TunableStore> list; if (!Tunables.TryGetValue(newSetting.ParentType, out list)) { list = new List <TunableStore>(); Tunables.Add(newSetting.ParentType, list); } for (int i = list.Count - 1; i >= 0; i--) { TunableStore oldSetting = list[i]; if (oldSetting.IsEqual(newSetting)) { if (!replace) { return; } mTunables.Remove(oldSetting); list.RemoveAt(i); break; } } list.Add(newSetting); mTunables.Add(newSetting); }
public void SetValue(SettingsKey key, object value) { TunableStore store = GetParentStore(new ValueStore(mField, value)); store.Apply(key); Retuner.SeasonSettings.AddTunable(store, true); }
public virtual TunableStore GetParentStore(TunableStore child) { if (mParentInfo != null) { return(mParentInfo.GetParentStore(new NestedStore(mParentInfo.Field, child))); } else { return(child); } }
public object GetValue(bool pure) { if (!pure) { TunableStore value = Retuner.SeasonSettings.GetTunable(GetParentStore(new ValueStore(mField, null))); if (value != null) { return(value.GetValue(true)); } } return(PrivateGetValue()); }
public static bool StoreDefault(SettingsKey key, TunableStore store) { if (!key.IsActive) { return(false); } if (store == null) { return(false); } sDefaultSettings.AddTunable(store, false); return(true); }
public void Apply() { foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values) { ITUNSettings setting = GetSettings(tuning, false); if (setting == null) { continue; } setting.Apply(Key, tuning); } for (int i = mTunables.Count - 1; i >= 0; i--) { TunableStore setting = mTunables[i]; if (!setting.Valid) { mTunables.RemoveAt(i); } else { setting.Apply(Key); } } List <string> remove = new List <string>(); foreach (ActionDataSetting setting in mActionData.Values) { ActionData data = ActionData.Get(setting.mName); if (data != null) { setting.Apply(Key, data); } else { remove.Add(setting.mName); } } foreach (string key in remove) { mActionData.Remove(key); } }
public TunableStore GetTunable(TunableStore setting) { List <TunableStore> list; if (Tunables.TryGetValue(setting.ParentType, out list)) { foreach (TunableStore store in list) { if (setting.IsEqual(store)) { return(store); } } } return(null); }
public override TunableStore GetParentStore(TunableStore child) { ValueStore store = child as ValueStore; return(base.GetParentStore(new ArrayValueStore(Field, mIndex, store.Value))); }