Example #1
0
        protected override ConsoleWindow BuildInterface(string suggestedName = "")
        {
            var window = NewWindow("Mod Notifier", WindowSizing.GetCentralNarrowTall());
            var seg0   = window.Screen.CreateStandardSegment();

            seg0.AddInterpretter(SubjectiveButton <ModNotifierBlock> .Quick(_focus, "Refresh mod list", new ToolTip(""), x =>
            {
                _focus.Refresh();
                TriggerRebuild();
            }));

            foreach (var pair in _focus.mods)
            {
                var mod = pair.Value;
                window.Screen.CreateHeader(mod.name.ToString(), new ToolTip(pair.Key.ToString()));

                var seg1 = window.Screen.CreateStandardSegment();
                seg1.AddInterpretter(SubjectiveToggle <ModNotifierBlock.Mod> .Quick(mod,
                                                                                    "Is dependency",
                                                                                    new ToolTip("Do our construct depend on this mod?"),
                                                                                    (x, value) => x.enabled = value,
                                                                                    x => x.enabled));

                seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod,
                                                                             M.m <ModNotifierBlock.Mod>(x => x.description),
                                                                             "Mod description",
                                                                             new ToolTip("You can include a description of the mod, why do we need this, what will not work if it's not installed, etc"),
                                                                             (x, value) => x.description = value));

                seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod,
                                                                             M.m <ModNotifierBlock.Mod>(x => x.manifest),
                                                                             "modmanifest.json URI",
                                                                             new ToolTip("Leave blank if the mod doesn't use FtdModManager"),
                                                                             (x, value) => x.manifest = value));

                seg1.AddInterpretter(TextInput <ModNotifierBlock.Mod> .Quick(mod,
                                                                             M.m <ModNotifierBlock.Mod>(x => x.link),
                                                                             "External link",
                                                                             new ToolTip("An external link for the mod. Leave blank if you don't have one"),
                                                                             (x, value) => x.link = value));
            }
            return(window);
        }
Example #2
0
        public override void Build()
        {
            CreateHeader("Settings", new ToolTip("BuildingTools mod settings"));
            var data = BtSettings.Data;
            var seg  = CreateTableSegment(2, 2);

            seg.AddInterpretter(SubjectiveToggle <BtSettings.InternalData> .Quick(data,
                                                                                  "Disable CapsLock",
                                                                                  new ToolTip("Automagically revert CapsLock when you press it, so you won't accidentally type cAPITALIZED lETTERS"),
                                                                                  (x, val) => x.DisableCapsLock = val,
                                                                                  x => x.DisableCapsLock));
            seg.AddInterpretter(SubjectiveToggle <BtSettings.InternalData> .Quick(data,
                                                                                  "Enable changelog report",
                                                                                  new ToolTip("After each update, show a list of new changes made to FtD at start, if any"),
                                                                                  (x, val) => x.EnableNewFeaturesReport = val,
                                                                                  x => x.EnableNewFeaturesReport));

            CreateHeader("Key Bindings", new ToolTip("Configure key bindings for BuildingTools"));
            base.Build();

            CreateSpace();
            WriteLink("BuildingTools GitHub repository", "https://github.com/Why7090/BuildingTools", "Introduction and latest update of the mod");
            WriteLink("Official FtD Discord server", "https://discord.gg/8DS4P8V", "Ping me (WengH) if you have questions or issues with my mod");
        }
Example #3
0
        protected override ConsoleWindow BuildInterface(string suggestedName = "")
        {
            var window = NewWindow(135317, "3D Hologram Projector", WindowSizing.GetSizeCentral(0.7f, 0.5f));

            window.DisplayTextPrompt = false;

            window.Screen.CreateHeader("File", new ToolTip("Configure loading options"));

            var seg1 = window.Screen.CreateStandardSegment();

            seg1.AddInterpretter(TextInput <Holo3D> .Quick(_focus, M.m <Holo3D>(x => x.Path), "Path",
                                                           new ToolTip("Type a local path into the box below to load an .obj file for the hologram"), (x, value) => x.Path = value));
            seg1.AddInterpretter(SubjectiveButton <Holo3D> .Quick(_focus, "Reload 3D Model",
                                                                  new ToolTip("Load the .obj and all related files and display the model as a hologram"), (x) => x.Reload()));

            var seg2 = window.Screen.CreateStandardHorizontalSegment();

            seg2.AddInterpretter(SubjectiveToggle <Holo3D> .Quick(_focus, "Enabled",
                                                                  new ToolTip("Should the hologram display?"), (x, value) => x.Enabled = value, x => x.Enabled));
            seg2.AddInterpretter(SubjectiveToggle <Holo3D> .Quick(_focus, "Display on start",
                                                                  new ToolTip("If turned off, the hologram will only load when you press the \"Reload\" button. " +
                                                                              "Otherwise, it will load immediately after the Construct is loaded (it may cause some serious lag)."),
                                                                  (x, value) => x.displayOnStart = value, x => x.displayOnStart));

            var items = Holo3D.shaders.Select(x => new DropDownMenuAltItem <Shader>
            {
                Name            = x.name,
                ObjectForAction = x,
                ToolTip         = "Shader to use\nPress \"Reload 3D Model\" button to apply"
            }).ToArray();
            var menu = new DropDownMenuAlt <Shader>();

            menu.SetItems(items);
            seg2.AddInterpretter(new DropDown <Holo3D, Shader>(_focus, menu, (x, shader) => x.shader == shader, (x, shader) => x.shader = shader));

            window.Screen.CreateHeader("Transform", new ToolTip("Configure position, rotation and scale"));

            var seg3 = window.Screen.CreateStandardSegment();

            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0,
                                                                                         M.m <Holo3D>(x => x.pos.z), "Forward/Back translation {0}m",
                                                                                         (x, value) => { x.pos.z = value; x.SetLocalTransform(); }, new ToolTip("Position.z")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0,
                                                                                         M.m <Holo3D>(x => x.pos.x), "Left/Right translation {0}m",
                                                                                         (x, value) => { x.pos.x = value; x.SetLocalTransform(); }, new ToolTip("Position.x")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -100, 100, 0.1f, 0,
                                                                                         M.m <Holo3D>(x => x.pos.y), "Up/Down translation {0}m",
                                                                                         (x, value) => { x.pos.y = value; x.SetLocalTransform(); }, new ToolTip("Position.y")));

            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0,
                                                                                         M.m <Holo3D>(x => x.rot.x), "Pitch {0}°",
                                                                                         (x, value) => { x.rot.x = value; x.SetLocalTransform(); }, new ToolTip("Rotation.x")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0,
                                                                                         M.m <Holo3D>(x => x.rot.z), "Roll {0}°",
                                                                                         (x, value) => { x.rot.z = value; x.SetLocalTransform(); }, new ToolTip("Rotation.z")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, -180, 180, 1, 0,
                                                                                         M.m <Holo3D>(x => x.rot.y), "Yaw {0}°",
                                                                                         (x, value) => { x.rot.y = value; x.SetLocalTransform(); }, new ToolTip("Rotation.y")));

            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1,
                                                                                         M.m <Holo3D>(x => x.scale.z), "Forward/Back scale {0}x",
                                                                                         (x, value) => { x.scale.z = value; x.SetLocalTransform(); }, new ToolTip("Scale.z")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1,
                                                                                         M.m <Holo3D>(x => x.scale.x), "Left/Right scale {0}x",
                                                                                         (x, value) => { x.scale.x = value; x.SetLocalTransform(); }, new ToolTip("Scale.x")));
            seg3.AddInterpretter(SubjectiveFloatClampedWithBarFromMiddle <Holo3D> .Quick(_focus, 0.01f, 100, 0.01f, 1,
                                                                                         M.m <Holo3D>(x => x.scale.y), "Up/Down scale {0}x",
                                                                                         (x, value) => { x.scale.y = value; x.SetLocalTransform(); }, new ToolTip("Scale.y")));

            return(window);
        }