Ejemplo n.º 1
0
        void SetupScrollView()
        {
            scrollView.AddClass("root-scroll");

            foreach (var evt in FluentUITK.GetCallbacks(scrollView))
            {
                if (evt.Is <WheelEvent>())
                {
                    evt.Unregister();
                }
            }
            scrollView.Register <WheelEvent>(OnScrollWheel);
        }
        public InspectorPatchesUI()
        {
            var me = this.Fluent();

            var importantBox = me.NewHelpBox(ImportantMessage, HelpMessageType.Important);

            importantBox.x.content.icon.size = 16;
            me.Add(importantBox);


            var toolsIcon = FluentUITK.GetEditorIcon("SceneViewTools");

            var group = me.NewHeader("Patches", toolsIcon).Style(Styles.Separator);

            me.Add(group);

            var bar = me.NewRow().Add(
                me.NewFlexibleSpace(),
                me.NewButton("Enable All").OnClick(_ => AllToggles().ForEach(e => e.value  = true)),
                me.NewButton("Disable All").OnClick(_ => AllToggles().ForEach(e => e.value = false))
                );

            group.x.content.Add(bar);

            UQueryBuilder <Toggle> AllToggles()
            {
                return(group.x.Query <Toggle>());
            }

            foreach (var patch in Patcher.GetPatches())
            {
                var text = patch.GetType().Name;

                var toggle = new Toggle(text).Fluent();

                toggle.x.value = !patch.state.forceSkip;


                toggle.OnChange <bool>((evt, c) =>
                {
                    var state       = patch.state;
                    state.forceSkip = !evt.newValue;
                    patch.state     = state;

                    if (!prefs.enabled)
                    {
                        return;
                    }

                    if (state.forceSkip)
                    {
                        patch.UnpatchAll();
                    }
                    else
                    {
                        patch.ApplyPatches(PatchBase.Apply.OnLoad);
                        patch.ApplyPatches(PatchBase.Apply.OnGUI);
                    }
                });

                group.Add(toggle);
            }
        }
 public static T FindAsset <T>(string name = null, string guid = null) where T : Object
 {
     return(FluentUITK.FindAsset <T>(name, guid));
 }
 public static IEnumerable <Object> FindAssets(Type type, string name = null)
 {
     return(FluentUITK.FindAssets <Object>(name));
 }
 public static IEnumerable <T> FindAssets <T>(string name = null) where T : Object
 {
     return(FluentUITK.FindAssets <T>(name));
 }
 public static StyleSheet FindStyleSheet(string name = null, string guid = null)
 {
     return(FluentUITK.FindStyleSheet(name, guid));
 }
Ejemplo n.º 7
0
        Button PresetsButton()
        {
            var icon = FluentUITK.GetEditorIcon("Preset.Context");

            return(ui.NewButton(icon: icon).Style(Styles.Tab).OnClick(_ => EditorUtils.Presets.ShowMenu(prefs)));
        }