Button() public static method

public static Button ( string text ) : bool
text string
return bool
コード例 #1
0
ファイル: InspectorSearch.cs プロジェクト: patel22p/dorumon
    protected virtual void OnGUI()
    {
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        GUI.EndHorizontal();
        DrawObjects();
        DrawSearch();
    }
コード例 #2
0
ファイル: InspectorSearch.cs プロジェクト: patel22p/dorumon
    protected virtual void OnGUI()
    {
        if (GUI.Button("Init"))
        {
            foreach (var go in Selection.gameObjects)
            {
                foreach (var scr in go.GetComponents <Base>())
                {
                    scr.Init();
                }
            }
        }
        foreach (var a in GameObject.FindGameObjectsWithTag("EditorGUI").Where(a => a != Selection.activeGameObject))
        {
            a.GetComponent <Base>().OnEditorGui();
        }

        if (Selection.activeGameObject != null)
        {
            var bs2 = Selection.activeGameObject.GetComponent <Base>();
            if (bs2 != null)
            {
                bs2.OnEditorGui();
            }
        }
        GUI.BeginHorizontal();
        Base.debug = GUI.Toggle(Base.debug, "debug", GUI.ExpandWidth(false));
        GUI.EndHorizontal();
        DrawSearch();
    }
コード例 #3
0
ファイル: Node.cs プロジェクト: patel22p/dorumon
 public override void OnEditorGui()
 {
     if (GUI.Button("Link Nodes"))
     {
         Undo.RegisterSceneUndo("rtools");
         Node[] nds = GetNodes();
         foreach (Node a in nds)
         {
             foreach (var node in nds)
             {
                 if (a != node && !a.nodes.Contains(node))
                 {
                     a.nodes.Add(node);
                 }
             }
         }
     }
     if (GUI.Button("UnLink Nodes"))
     {
         Undo.RegisterSceneUndo("rtools");
         Node[] nds = GetNodes();
         foreach (Node a in nds)
         {
             foreach (var node in nds)
             {
                 a.nodes.Remove(node);
             }
         }
     }
 }
コード例 #4
0
            public override void OnGUI(Rect rect)
            {
                searchText = searchField.OnGUI(searchText);

                scrollPosition = EGL.BeginScrollView(scrollPosition);

                foreach (var type in behaviourTypes)
                {
                    if (type.ToLower().Contains(searchText.ToLower()))
                    {
                        EGL.BeginHorizontal();
                        EGL.LabelField(type, GL.Width(140));
                        if (GL.Button("Add", GL.Width(40)))
                        {
                            var instance = (StateBehaviour)ScriptableObject.CreateInstance(type);
                            instance.name      = type;
                            instance.hideFlags = HideFlags.HideInHierarchy;
                            list.Add(instance);

                            AssetDatabase.AddObjectToAsset(instance, profile);
                            AssetDatabase.SaveAssets();

                            editorWindow.Close();
                        }
                        EGL.EndHorizontal();
                    }
                }

                EGL.EndScrollView();
            }
コード例 #5
0
ファイル: InspectorSearch.cs プロジェクト: patel22p/dorumon
    private void DrawObjects()
    {
        List <string> toremove = new List <string>();

        foreach (var inst in instances)
        {
            GUI.BeginHorizontal();
            if (GUI.Button(inst))
            {
                Object o = GameObject.Find(inst) != null?GameObject.Find(inst) : GameObject.FindObjectsOfTypeIncludingAssets(typeof(GameObject)).FirstOrDefault(a => a.name == inst);

                Selection.activeObject = o;
            }
            if (GUI.Button("X", GUI.ExpandWidth(false)))
            {
                toremove.Add(inst);
            }
            GUI.EndHorizontal();
        }
        foreach (var inst in toremove)
        {
            instances.Remove(inst);
            SaveParams();
        }
    }
コード例 #6
0
        static bool TogglePrivate(
            String title,
            ref bool value,
            bool disclosureStyle = false,
            bool forceHorizontal = true,
            float width          = 0,
            params GUILayoutOption[] options
            )
        {
            bool changed = false;

            options = options.AddItem(width == 0 ? UI.AutoWidth() : UI.Width(width)).ToArray();
            if (!disclosureStyle)
            {
                title = value ? title.bold() : title.color(RGBA.lightgrey);
                if (GL.Button("" + (value ? onMark : offMark) + " " + title, UI.buttonStyle, options))
                {
                    value = !value; changed = true;
                }
            }
            else
            {
                if (Private.UI.DisclosureToggle(title, value, options))
                {
                    value = !value; changed = true;
                }
            }
            return(changed);
        }
コード例 #7
0
        private void DrawDatas()
        {
            var packages = BaseData["Packages"];

            if (packages.Count > 0)
            {
                for (int i = 0; i < packages.Count; i++)
                {
                    var value = packages[i];
                    GL.BeginVertical("OL box");
                    GL.BeginHorizontal("box");
                    GL.Label(value["name"].ToString());
                    GL.Label(value["version"].ToString());

                    if (Directory.Exists(value["localpath"].ToString()))
                    {
                        if (GL.Button("pack", GUILayout.Width(100)))
                        {
                            Export(value["name"].ToString(), value["localpath"].ToString());
                        }
                    }
                    else if (ExistsLocalPackage(value["name"].ToString()))
                    {
                        if (GL.Button("Import", GUILayout.Width(100)))
                        {
                        }
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                }
            }
        }
コード例 #8
0
 private void CopyComponent()
 {
     if (GUI.Button("CloneComp"))
     {
         selectedGameObject = selectedGameObject == null ? Selection.activeGameObject : null;
     }
     if (selectedGameObject != null)
     {
         foreach (var c in selectedGameObject.GetComponents <Component>())
         {
             if (GUI.Button(c.GetType().Name))
             {
                 foreach (GameObject g in Selection.gameObjects)
                 {
                     var c2 = g.AddComponent(c.GetType());
                     foreach (FieldInfo f in c.GetType().GetFields())
                     {
                         f.SetValue(c2, f.GetValue(c));
                     }
                     //foreach (PropertyInfo p in c.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
                     //    if(p.CanRead && p.CanWrite)
                     //        p.SetValue(c2, p.GetValue(c,null),null);
                     //Debug.Log(c.GetType().GetProperties().Length+"+");
                 }
             }
         }
         GUI.Space(10);
     }
 }
コード例 #9
0
        public static void SetKeyBinding(ref KeyCode keyCode)
        {
            string label = (keyCode == KeyCode.None) ? Strings.GetText("button_PressKey") : keyCode.ToString();

            if (GL.Button(label, GL.ExpandWidth(false)))
            {
                keyCode = KeyCode.None;
            }
            if (keyCode == KeyCode.None && Event.current != null)
            {
                if (Event.current.isKey)
                {
                    keyCode = Event.current.keyCode;
                    Input.ResetInputAxes();
                }
                else
                {
                    foreach (KeyCode mouseButton in mouseButtonsValid)
                    {
                        if (Input.GetKey(mouseButton))
                        {
                            keyCode = mouseButton;
                            Input.ResetInputAxes();
                        }
                    }
                }
            }
        }
コード例 #10
0
 public static void SetModifiedValueButtonDiceFormula <T>(int rolls, DiceType dice, string name, string guid)
 {
     if (GL.Button(Strings.GetText("button_SetTo") + $" {rolls} * {dice}", GL.ExpandWidth(false)))
     {
         ModifiedDiceFormula diceFormula = new ModifiedDiceFormula();
         diceFormula.m_Rolls = rolls;
         diceFormula.m_Dice  = dice;
         FileInfo file = new FileInfo(Storage.modEntryPath + Storage.modifiedBlueprintsFolder + "\\" + guid + ".json");
         if (File.Exists(file.FullName))
         {
             T modifiedItem = ModifiedBlueprintTools.DeserialiseItem <T>(file);
             Traverse.Create(modifiedItem).Property(name).SetValue(diceFormula);
             string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
             File.WriteAllText(file.FullName, json);
         }
         else
         {
             T modifiedItem = default(T);
             modifiedItem = Activator.CreateInstance <T>();
             Traverse.Create(modifiedItem).Property(name).SetValue(diceFormula);
             string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
             File.WriteAllText(file.FullName, json);
         }
         ModifiedBlueprintTools.blueprintLists = false;
         ModifiedBlueprintTools.Patch();
     }
 }
コード例 #11
0
 public static void SetModifiedValueButtonAttackType <T>(string name, string guid)
 {
     foreach (AttackType attackType in (AttackType[])Enum.GetValues(typeof(AttackType)))
     {
         if (GL.Button(Strings.GetText("button_SetTo") + $" {attackType}", GL.ExpandWidth(false)))
         {
             FileInfo file = new FileInfo(Storage.modEntryPath + Storage.modifiedBlueprintsFolder + "\\" + guid + ".json");
             if (File.Exists(file.FullName))
             {
                 T modifiedItem = ModifiedBlueprintTools.DeserialiseItem <T>(file);
                 Traverse.Create(modifiedItem).Property(name).SetValue(attackType);
                 string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
                 File.WriteAllText(file.FullName, json);
             }
             else
             {
                 T modifiedItem = default(T);
                 modifiedItem = Activator.CreateInstance <T>();
                 Traverse.Create(modifiedItem).Property(name).SetValue(attackType);
                 string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
                 File.WriteAllText(file.FullName, json);
             }
             ModifiedBlueprintTools.blueprintLists = false;
             ModifiedBlueprintTools.Patch();
         }
     }
 }
コード例 #12
0
        private void OnGUI()
        {
            scrollView = Gl.BeginScrollView(scrollView);
            {
                Gl.TextArea(log);
            }
            Gl.EndScrollView();

            EditorUtil.HorizontalRule();

            Gl.BeginHorizontal();
            {
                Gl.Label("Save Log:", Gl.ExpandWidth(false));
                outputPath = Gl.TextField(outputPath);
            }
            Gl.EndHorizontal();

            Gl.BeginHorizontal();
            {
                if (Gl.Button("Save"))
                {
                    PrintLog();
                }

                if (Gl.Button("Close"))
                {
                    Close();
                }
            }
            Gl.EndHorizontal();
        }
コード例 #13
0
    public override void OnInspectorGUI()
    {
        var script = (BehaviourScript)target;

        if (script.compileOkay)
        {
            EGL.HelpBox("The script is compiled and up to date!", MessageType.Info);
        }
        if (script.notUpToDate)
        {
            EGL.HelpBox("The compiled script is not up to date.", MessageType.Warning);
        }
        if (script.notCompiled)
        {
            EGL.HelpBox("The script is not yet compiled.", MessageType.Error);
        }

        if (GL.Button("Compile"))
        {
            script.Compile();
        }

        if (GL.Button("Print AST"))
        {
            script.PrintAST();
        }
    }
コード例 #14
0
        private void OnGUIVendors(Vendors.Vendor vendor)
        {
            using (new GUISubScope())
            {
                using (new GL.HorizontalScope())
                {
                    GL.Label(string.Format("{0}: ", vendor.DisplayName), MenuHelpers.LabelStyleFixed, falseWidth);
                    if (GL.Button(Local["Menu_Btn_MoveVendor"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        var position = Game.Instance.Player.MainCharacter.Value.Position;
                        var rotation = Game.Instance.Player.MainCharacter.Value.OrientationDirection;

                        SettingsWrapper.Positions[vendor.UnitGuid] = position;
                        SettingsWrapper.Rotations[vendor.UnitGuid] = rotation;
                        vendor.Move(position, rotation);
                    }
                    if (GL.Button(Local["Menu_Btn_Enable"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        SettingsWrapper.VendorEnabled[vendor.UnitGuid] = true;
                        vendor.Enable();
                    }
                    if (GL.Button(Local["Menu_Btn_Disable"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        SettingsWrapper.VendorEnabled[vendor.UnitGuid] = false;
                        vendor.Disable();
                    }
                }
            }
        }
コード例 #15
0
        private void OnGUIThroneRoom()
        {
            using (new GUISubScope(Local["Menu_Tab_TRV"], "box"))
            {
                if (!HamHelpers.InThroneRoom())
                {
                    GL.Label(Local["Menu_Txt_NotInThrone"]);
                    return;
                }

                GL.Label(Local["Menu_Lbl_MoveVendor"], MenuHelpers.LabelStyleWrap, falseWidth);

                foreach (KeyValuePair <string, Vendors.Vendor> kvp in Vendors.VendorBlueprints.NewVendors.Where(n => n.Value.AreaId == Vendors.Vendor.Area.ThroneRoom))
                {
                    OnGUIVendors(kvp.Value);
                }

                GL.Label(Local["Menu_Txt_CleanOld"]);
                if (GL.Button(Local["Menu_Btn_CleanOld"], MenuHelpers.ButtonStyle, falseWidth))
                {
                    foreach (UnitEntityData unit in Game.Instance.State.Units)
                    {
                        if (oldVendors.Contains(unit.Blueprint.AssetGuid))
                        {
                            unit.Destroy();
                        }
                    }
                }
                GUI.enabled = true;
            }
        }
コード例 #16
0
ファイル: AssetViewer.cs プロジェクト: Vin129/VEFramework
        private void DrawAssurer(VAssetManager Manager)
        {
            GL.BeginVertical("OL box");
            GL.Label(Manager.ManagerName);
            var list = Manager.GetAssurerList();

            if (list.Count == 0)
            {
                EGL.HelpBox("暂无资产", MessageType.Info);
            }
            else
            {
                list.ForEach(assurer =>
                {
                    GL.BeginVertical("GroupBox");
                    GL.BeginHorizontal();
                    GL.Label(String.Format("{0} : Ref {1}", assurer.Value.AssetPath, assurer.Value.UseCount));
                    if (GL.Button("Kill", GUILayout.Width(100)))
                    {
                        assurer.Value.ForceRecycle();
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                    GL.Space(2);
                });
            }



            GL.EndVertical();
        }
コード例 #17
0
ファイル: QuickLuaViewer.cs プロジェクト: Vin129/VEFramework
        public void DrawLuaScript(string filePath)
        {
            FindLuaTableInfo(filePath);
            // 以上是初始化环节
            var luaName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1).Replace(".lua", "");

            GL.BeginVertical("OL box");
            GL.Label(luaName, EditorStyles.boldLabel);
            if (mExecuteFunctionDirt == null || mExecuteFunctionDirt.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法", MessageType.Warning);
            }
            else
            {
                foreach (var m in mExecuteFunctionDirt)
                {
                    GL.BeginHorizontal("box");
                    var methodName = string.Format("{0}:{1}", luaName, m.Key);
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        UnityEngine.Debug.LogFormat("<color=#FFA80B>Execute {0}:{1}</color>", luaName, m.Key);
                        m.Value.Invoke();
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
コード例 #18
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void ToggleButton(Setting <bool> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts);
     UGUI.EndHorizontal();
 }
コード例 #19
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static void ToggleButton(Setting <bool> val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
 }
コード例 #20
0
ファイル: InspectorSearch.cs プロジェクト: patel22p/dorumon
    protected virtual void OnGUI()
    {
        if (Camera.main == null)
        {
            return;
        }
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        Camera.main.renderingPath = (RenderingPath)gui.EnumPopup(Camera.main.renderingPath);
        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        if (GUI.Button("Init"))
        {
            foreach (var a in Selection.gameObjects.Select(a => a.GetComponent <MonoBehaviour>()))
            {
                a.SendMessage("Init", SendMessageOptions.DontRequireReceiver);
            }
        }
        GUI.EndHorizontal();
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);
        if (Selection.activeGameObject != null)
        {
            LayerDistances();
            var bs = Selection.activeGameObject.GetComponent <Base>();
            if (bs != null)
            {
                bs.OnInspectorGUI();
            }
        }



        DrawObjects();
        DrawSearch();
    }
コード例 #21
0
 public static void SetModifiedValueStatType <T>(string name, string guid)
 {
     StatType[] statTypes = (StatType[])Enum.GetValues(typeof(StatType));
     for (int i = 0; i < statTypes.Count(); i++)
     {
         switch (i)
         {
         case 0:
         case 4:
         case 8:
         case 12:
         case 16:
         case 20:
         case 24:
         case 28:
         case 32:
         case 36:
             GL.BeginHorizontal();
             break;
         }
         if (GL.Button(Strings.GetText("button_SetTo") + $" {statTypes[i]}", GL.Width(210f)))
         {
             FileInfo file = new FileInfo(Storage.modEntryPath + Storage.modifiedBlueprintsFolder + "\\" + guid + ".json");
             if (File.Exists(file.FullName))
             {
                 T modifiedItem = ModifiedBlueprintTools.DeserialiseItem <T>(file);
                 Traverse.Create(modifiedItem).Property(name).SetValue(statTypes[i]);
                 string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
                 File.WriteAllText(file.FullName, json);
             }
             else
             {
                 T modifiedItem = default(T);
                 modifiedItem = Activator.CreateInstance <T>();
                 Traverse.Create(modifiedItem).Property(name).SetValue(statTypes[i]);
                 string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented);
                 File.WriteAllText(file.FullName, json);
             }
             ModifiedBlueprintTools.blueprintLists = false;
             ModifiedBlueprintTools.Patch();
         }
         switch (i)
         {
         case 3:
         case 7:
         case 11:
         case 15:
         case 19:
         case 23:
         case 27:
         case 31:
         case 35:
         case 37:
             GL.EndHorizontal();
             break;
         }
     }
 }
コード例 #22
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static bool ToggleButton(bool val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts);
     UGUI.EndHorizontal();
     return(val);
 }
コード例 #23
0
ファイル: GUILayout.cs プロジェクト: kmlkmljkl2/Anarchy
 public static bool ToggleButton(bool val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
     return(val);
 }
コード例 #24
0
 static bool CenteredButton(string content)
 {
     EGL.BeginHorizontal();
     GL.FlexibleSpace();
     var res = GL.Button(content, GL.Width(150));
     GL.FlexibleSpace();
     EGL.EndHorizontal();
     return res;
 }
コード例 #25
0
        private bool DrawForceGenButton()
        {
            bool clicked = GL.Button(
                new GUIContent("Force Generate", "Deletes the current file thus forcing the generator to create a new one."),
                GL.Height(20)
                );

            return(clicked);
        }
コード例 #26
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var tree   = (BehaviourTree)target;
            var script = tree.source;

            if (script)
            {
                if (script.notCompiled)
                {
                    EGL.HelpBox("Script is not compiled.", MessageType.Error);
                }
                if (script.notUpToDate)
                {
                    EGL.HelpBox("Script is not up to date.", MessageType.Warning);
                }
                if (script.compileOkay)
                {
                    EGL.HelpBox("Script is compiled and up to date.", MessageType.Info);
                }
                if (GL.Button("Compile"))
                {
                    script.Compile();
                }
            }

            if (Application.isPlaying)
            {
                EGL.Space();
                EGL.LabelField("Conditions");
                GUI.enabled = false;
                foreach (var cond in tree.blackboard)
                {
                    var k = cond.Key;
                    var v = cond.Value;
                    if (v is float)
                    {
                        EGL.FloatField(k, (float)v);
                    }
                    else if (v is int)
                    {
                        EGL.IntField(k, (int)v);
                    }
                    else if (v is bool)
                    {
                        EGL.Toggle(k, (bool)v);
                    }
                    else if (v is string)
                    {
                        EGL.TextField(k, (string)v);
                    }
                }
                GUI.enabled = true;
                Repaint();
            }
        }
コード例 #27
0
        void OnGUI()
        {
            if (!model.enable)
            {
                model.enable = ToggleLeft("Log", model.enable); return;
            }
            instance = this; // TODO: why do this here?
            BeginHorizontal();
            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                model.SelectPreviousFrame();
                SceneView.RepaintAll();
            }
            GL.Button(frameNo, GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                model.SelectNextFrame();
                SceneView.RepaintAll();
            }
            GL.FlexibleSpace();
            EndHorizontal();
            //
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            GL.TextArea(model.output, GL.ExpandHeight(true));
            EndScrollView();
            //
            GUI.backgroundColor = Color.white;
            //
            var w30 = GL.MaxWidth(30f);

            BeginHorizontal();
            model.enable = ToggleLeft($"Log", model.enable, GL.MaxWidth(60));
            model.trails = ToggleLeft("Trails", model.trails, GL.MaxWidth(50));
            GL.Label("Offset: ", GL.ExpandWidth(false));
            var rs = model.renderSettings;

            rs.offset = FloatField(model.renderSettings.offset, w30);
            GL.Label("Size: ", w30);
            rs.size = FloatField(rs.size, w30);
            GL.Label("Col: ", w30);
            rs.color = EditorGUILayout.ColorField(rs.color);
            EndHorizontal();
        }
コード例 #28
0
        private bool DrawGenButton()
        {
            GUI.backgroundColor = Color.white * 2.5f;
            GUI.contentColor    = Color.black * 5;
            bool clicked = GL.Button(
                new GUIContent("Generate", "Generates the file by writing new updated contents or generates the file is none is present."),
                GL.Height(20)
                );

            return(clicked);
        }
コード例 #29
0
        private void DrawScript(Type t)
        {
            var att = t.RTGetAttribute <QuickExecuteAttribute>(false);

            if (att == null)
            {
                return;
            }
            GL.BeginVertical("OL box");
            GL.Label(t.Name, EditorStyles.boldLabel);
            var methods = t.GetMethods().Where((i) => { return(i.RTGetAttribute <ExecuteMethodAttribute>(false) != null); });

            if (methods.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法(请检查是否添加了[ExecuteMethodAttribute])", MessageType.Warning);
            }
            else
            {
                foreach (var m in methods)
                {
                    GL.Space(2);
                    GL.BeginHorizontal();
                    var methodName = m.Name + ":(";
                    var param      = m.GetParameters();
                    for (int i = 0; i < param.Length; i++)
                    {
                        var p = param[i];
                        if (i != param.Length - 1)
                        {
                            methodName += string.Format("<b>{0}</b> , ", p.ToString());
                        }
                        else
                        {
                            methodName += string.Format("<b>{0}</b>", p.ToString());
                        }
                    }
                    methodName += ")";
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        var o = ReflectionTools.CreateObject(t);
                        //TODO 扩展编辑参数
                        if (param.Length == 0)
                        {
                            m.Invoke(o, null);
                        }
                        Log.I(string.Format("<color=#FFA80B>Execute {0}</color>", methodName));
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
コード例 #30
0
ファイル: UI+Controls.cs プロジェクト: ThyWoof/ToyBox
 public static void ActionButton(String title, Action action, params GUILayoutOption[] options)
 {
     if (options.Length == 0)
     {
         options = new GUILayoutOption[] { GL.Width(300f) };
     }
     if (GL.Button(title, options))
     {
         action();
     }
 }