Esempio n. 1
0
        public static void Postfix(ref Rect rect)
        {
            ITab_Storage tab = ITab_StorageFillTabsPatcher.currentTab;

            if (tab == null)
            {
                return;
            }

            IStoreSettingsParent storeSettingsParent = (IStoreSettingsParent)typeof(ITab_Storage).GetProperty("SelStoreSettingsParent", BindingFlags.NonPublic | BindingFlags.Instance).GetGetMethod(true).Invoke(tab, new object[0]);
            StorageSettings      settings            = storeSettingsParent.GetStoreSettings();

            int  limit    = Limits.GetLimit(settings);
            bool hasLimit = limit != -1;

            Widgets.CheckboxLabeled(new Rect(rect.xMin, rect.yMin - 24f - 3f - 32f, rect.width / 2, 24f), "Total stack limit", ref hasLimit);

            if (hasLimit)
            {
                if (oldSettings != settings)
                {
                    buffer = limit.ToString();
                }

                Widgets.TextFieldNumeric <int>(new Rect(rect.xMin + (rect.width / 2) + 60f, rect.yMin - 24f - 3f - 32f, rect.width / 2 - 60f, 24f), ref limit, ref buffer, 0, max);
            }

            Limits.SetLimit(settings, hasLimit ? limit : -1);

            oldSettings = settings;
        }
Esempio n. 2
0
 public static void Postfix(StorageSettings __instance)
 {
     if (Scribe.mode == LoadSaveMode.Saving)
     {
         Scribe.saver.WriteElement("stacklimit", Limits.GetLimit(__instance).ToString());
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         Limits.SetLimit(__instance,
                         ScribeExtractor.ValueFromNode(Scribe.loader.curXmlParent["stacklimit"], -1));
     }
 }
Esempio n. 3
0
 public static void Postfix(StorageSettings s)
 {
     Limits.SetLimit(s, Clipboard1.clipboardLimit);
 }