Ejemplo n.º 1
0
 public ITUNSettings(ITUNSettings setting)
     : this(setting.mName)
 {
     mAutonomous        = setting.mAutonomous;
     mUserDirected      = setting.mUserDirected;
     mAgeSpecies        = setting.mAgeSpecies;
     mAvailability      = setting.mAvailability;
     mAdvertisedOutputs = new Dictionary <CommodityKind, float>(mAdvertisedOutputs);
     mFlags             = setting.mFlags;
 }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        public void SetToDefault()
        {
            List <ITUNSettings> itunSettings = InteractionBooter.GetSettings(mKey);

            foreach (ITUNSettings setting in itunSettings)
            {
                mSettings[setting.mName] = setting;
            }

            Dictionary <string, bool> matched = new Dictionary <string, bool>();

            foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
            {
                ITUNSettings setting = GetSettings(tuning, false);
                if (setting == null)
                {
                    continue;
                }

                matched.Add(setting.mName, true);
            }

            foreach (ITUNSettings setting in itunSettings)
            {
                if (matched.ContainsKey(setting.mName))
                {
                    continue;
                }

                BooterLogger.AddError("Unmatched ITUN:" + Common.NewLine + " ObjectName: " + setting.mName.Replace("|", Common.NewLine + " InteractionName:"));
            }

            foreach (TunableStore setting in TuningBooter.GetSettings(mKey))
            {
                AddTunable(setting, true);
            }

            foreach (ActionDataSetting setting in SocialBooter.GetSettings(mKey))
            {
                ActionData data = ActionData.Get(setting.mName);
                if (data != null)
                {
                    mActionData[data.Key] = setting;
                }
            }
        }
Ejemplo n.º 4
0
        protected ITUNSettings PrivateGetSettings(InteractionTuning tuning, bool create, bool isDefault)
        {
            string name = Retuner.TuningName(tuning.FullObjectName, tuning.FullInteractionName);

            ITUNSettings settings;

            if (!mSettings.TryGetValue(name, out settings))
            {
                if (create)
                {
                    settings = new ITUNSettings(name, tuning, isDefault);
                    mSettings.Add(name, settings);
                }
                else
                {
                    return(null);
                }
            }

            return(settings);
        }
Ejemplo n.º 5
0
 public ITUNSettings(ITUNSettings setting)
     : this(setting.mName)
 {
     mAutonomous = setting.mAutonomous;
     mUserDirected = setting.mUserDirected;
     mAgeSpecies = setting.mAgeSpecies;
     mAvailability = setting.mAvailability;
     mAdvertisedOutputs = new Dictionary<CommodityKind, float>(mAdvertisedOutputs);
     mFlags = setting.mFlags;
 }
Ejemplo n.º 6
0
        protected ITUNSettings PrivateGetSettings(InteractionTuning tuning, bool create, bool isDefault)
        {
            string name = Retuner.TuningName(tuning.FullObjectName, tuning.FullInteractionName);

            ITUNSettings settings;
            if (!mSettings.TryGetValue(name, out settings)) 
            {
                if (create)
                {
                    settings = new ITUNSettings(name, tuning, isDefault);
                    mSettings.Add(name, settings);
                }
                else
                {
                    return null;
                }
            }

            return settings;
        }