Пример #1
0
        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);
        }
Пример #2
0
        public void SetValue(SettingsKey key, object value)
        {
            TunableStore store = GetParentStore(new ValueStore(mField, value));

            store.Apply(key);

            Retuner.SeasonSettings.AddTunable(store, true);
        }
Пример #3
0
 public virtual TunableStore GetParentStore(TunableStore child)
 {
     if (mParentInfo != null)
     {
         return(mParentInfo.GetParentStore(new NestedStore(mParentInfo.Field, child)));
     }
     else
     {
         return(child);
     }
 }
Пример #4
0
        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());
        }
Пример #5
0
        public static bool StoreDefault(SettingsKey key, TunableStore store)
        {
            if (!key.IsActive)
            {
                return(false);
            }

            if (store == null)
            {
                return(false);
            }

            sDefaultSettings.AddTunable(store, false);
            return(true);
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
        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);
        }
Пример #8
0
        public override TunableStore GetParentStore(TunableStore child)
        {
            ValueStore store = child as ValueStore;

            return(base.GetParentStore(new ArrayValueStore(Field, mIndex, store.Value)));
        }