Exemple #1
0
        public void ResolvePostToSettings(VehicleDef def, ref Dictionary <SaveableField, SavedField <object> > currentDict)
        {
            FieldInfo dictField = SettingsCache.GetCachedField(typeof(StatUpgrade), nameof(values));

            foreach (var statUpgrade in values)
            {
                SaveableDefPair <StatUpgradeCategoryDef> saveable = new SaveableDefPair <StatUpgradeCategoryDef>(def, dictField, string.Concat(statUpgrade.Key.defName, "_", upgradeID), statUpgrade.Key, LookMode.Value);
                currentDict.Add(saveable, new SavedField <object>(statUpgrade.Value));
            }
        }
Exemple #2
0
        public override void SettingsWindow(VehicleDef def, Listing_Settings listing)
        {
            FieldInfo dictField = SettingsCache.GetCachedField(typeof(StatUpgrade), nameof(values));

            Rect buttonRect = listing.GetRect(16);

            buttonRect.x      = buttonRect.width - 24;
            buttonRect.width  = 24;
            buttonRect.height = 24;
            listing.Header(label, GameFont.Medium, TextAnchor.MiddleCenter);
            if (Widgets.ButtonImage(buttonRect, VehicleTex.ResetPage))
            {
                SettingsCustomizableFields.PopulateSaveableUpgrades(def, true);
            }
            listing.Gap();

            foreach (var statUpgrade in values)
            {
                SaveableDefPair <StatUpgradeCategoryDef> saveable = new SaveableDefPair <StatUpgradeCategoryDef>(def, dictField, string.Concat(statUpgrade.Key.defName, "_", upgradeID), statUpgrade.Key, LookMode.Value);
                statUpgrade.Key.DrawStatLister(def, listing, saveable, statUpgrade.Value);
            }
        }