Example #1
0
        private static void StoredColorsMenu()
        {//type T|F - Pos|Rot
            var storedMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3ColumnsSlim);

            foreach (KeyValuePair <int, System.Tuple <float, float, float> > slot in SaveSlots.GetSavedColors())
            {
                string label = $"Slot: {slot.Key}\nR:{Utils.NumFormat(slot.Value.Item1)}\nG:{Utils.NumFormat(slot.Value.Item2)}\nB:{Utils.NumFormat(slot.Value.Item3)}";
                storedMenu.AddLabel(label);
                storedMenu.AddSimpleButton($"Load", () =>
                {
                    colorList["Red"]   = slot.Value.Item1;
                    colorList["Green"] = slot.Value.Item2;
                    colorList["Blue"]  = slot.Value.Item3;
                    storedMenu.Hide();
                    ColorMenuAdj(); //Return to previous on load
                });
                storedMenu.AddSimpleButton($"Save", () =>
                {
                    SaveSlots.Store(slot.Key, new System.Tuple <float, float, float>(colorList["Red"], colorList["Green"], colorList["Blue"]));
                    storedMenu.Hide();
                    StoredColorsMenu();
                });
            }
            storedMenu.AddSimpleButton("<-Back", (() =>
            {
                ColorMenuAdj();
            }));
            string current = $"Current:\nR:{Utils.NumFormat(colorList["Red"])}\nG:{Utils.NumFormat(colorList["Green"])}\nB:{Utils.NumFormat(colorList["Blue"])}";

            storedMenu.AddLabel(current);

            storedMenu.Show();
        }
Example #2
0
        private static void SavedPrefSlots()
        {//pickupOrient;pickupable;lightType;lightRange;lightSpotAngle;lightColor;lightIntensity;lightBounceIntensity;lightShadows;name;
            var storedMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu6Columns);

            foreach (KeyValuePair <int, (bool, bool, LightType, float, float, Color, float, float, LightShadows, float, string, bool)> slot in SaveSlots.GetSavedPrefs())
            {
                string label = $"Slot: {slot.Key}\n{slot.Value.Item11}\n{slot.Value.Item3}\nR:{slot.Value.Item6.r} G:{slot.Value.Item6.g} B:{slot.Value.Item6.b}\nInten:{slot.Value.Item7}\nHidden:{slot.Value.Item12}";//\nUp:{Utils.NumberFormat(slot.Value.Item1)}\nForward:{Utils.NumberFormat(slot.Value.Item2)}\nSide:{Utils.NumberFormat(slot.Value.Item3)}"
                storedMenu.AddLabel(label);
                storedMenu.AddSimpleButton($"Load", () =>
                {
                    Main.Config.name                 = slot.Value.Item11;
                    Main.Config.pickupOrient         = slot.Value.Item1;
                    Main.Config.pickupable           = slot.Value.Item2;
                    Main.Config.lightType            = slot.Value.Item3;
                    Main.Config.lightRange           = slot.Value.Item4;
                    Main.Config.lightSpotAngle       = slot.Value.Item5;
                    Main.Config.lightColor           = slot.Value.Item6;
                    Main.Config.lightIntensity       = slot.Value.Item7;
                    Main.Config.lightBounceIntensity = slot.Value.Item8;
                    Main.Config.lightShadows         = slot.Value.Item9;
                    Main.Config.lightShadowStr       = slot.Value.Item10;
                    Main.Config.hideMeshRender       = slot.Value.Item12;

                    SavedPrefSlots();
                });
                storedMenu.AddSimpleButton($"Save", () =>
                {
                    var menu2 = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu1ColumnWideSlim);
                    menu2.AddLabel($"Are you sure you want to save to slot:\n{slot.Key} | {slot.Value.Item11}");
                    menu2.AddSimpleButton($"Yes", () =>
                    {
                        SaveSlots.StorePrefs(slot.Key, (Main.Config.pickupOrient, Main.Config.pickupable, Main.Config.lightType, Main.Config.lightRange, Main.Config.lightSpotAngle, Main.Config.lightColor, Main.Config.lightIntensity, Main.Config.lightBounceIntensity, Main.Config.lightShadows, Main.Config.lightShadowStr, Main.Config.name, Main.Config.hideMeshRender));
                        SavedPrefSlots();
                    });
                    menu2.AddSimpleButton($"No", () =>
                    {
                        SavedPrefSlots();
                    });
                    menu2.Show();
                });

                if (slot.Key == 4)
                {
                    storedMenu.AddSimpleButton("<-Back", (() =>
                    {
                        LightTypeMenu();
                    }));
                    string current = CurrentConfig();
                    storedMenu.AddLabel(current);
                    storedMenu.AddSimpleButton($"-Update Active Light-", () =>
                    {
                        Main.UpdateLight(Main.activeLight);
                    });
                }
            }

            storedMenu.Show();
        }
Example #3
0
        public override void OnApplicationStart()
        {
            Logger = new MelonLogger.Instance("LocalLightMod");

            cat = MelonPreferences.CreateCategory(catagory, "Local Light Mod");

            loadDefaults  = MelonPreferences.CreateEntry(catagory, nameof(loadDefaults), false, "Load Slot 1 as Default");
            textureLights = MelonPreferences.CreateEntry(catagory, nameof(textureLights), true, "Texture Lights with Name");

            savedPrefs  = MelonPreferences.CreateEntry(catagory, nameof(savedPrefs), "1,False,True,Point,10.,30.,1,1,1,1.,1.,Hard,1.,N/A,False;2,False,True,Point,10.,30.,1,1,1,1.,1.,Hard,1.,N/A,False;3,False,True,Point,10.,30.,1,1,1,1.,1.,Hard,1.,N/A,False;4,False,True,Point,10.,30.,1,1,1,1.,1.,Hard,1.,N/A,False;5,False,True,Point,10.,30.,1,1,1,1.,1.,Hard,1.,N/A,False", "saved perfs", "", true);
            savedColors = MelonPreferences.CreateEntry(catagory, nameof(savedColors), "1,0.0,0.0,0.0;2,0.0,0.0,0.0;3,0.0,0.0,0.0;4,0.0,0.0,0.0;5,0.0,0.0,0.0;6,0.0,0.0,0.0", "saved colors", "", true);

            UIX.SetupUI();
            if (loadDefaults.Value)
            {
                SaveSlots.LoadDefaultSlot();
            }
        }