Ejemplo n.º 1
0
        private void createButtons()
        {
            blue = GUIExt.Add("RedButton", "TestButton", (go) =>
            {
                blue_enabled = !blue_enabled;
                if (blue_enabled)
                {
                    GUIExt.SetFrameColor(blue, Color.blue);
                    WriteLine("Blue Enabled!");
                }
                else
                {
                    GUIExt.ResetFrameColor(blue);
                    WriteLine("Blue Disabled!");
                }
            });

            green = GUIExt.Add("GreenButton", "TestButton2", (go) =>
            {
                green_enabled = !green_enabled;
                if (green_enabled)
                {
                    GUIExt.SetFrameColor(green, Color.green);
                    WriteLine("Green Enabled!");
                }
                else
                {
                    GUIExt.ResetFrameColor(green);
                    WriteLine("Green Disabled!");
                }
            });
        }
Ejemplo n.º 2
0
    public void SetupGUI()
    {
        backgroundStyle = new GUIStyle(GUI.skin.box);
        backgroundStyle.contentOffset = new Vector2(2, 2);
        expandRight = ResourceManager.LoadTexture("Textures/expandRight.png");
        itemHeight  = GUI.skin.label.CalcHeight(new GUIContent("text"), 100);

        selectedLabel = new GUIStyle(GUI.skin.label);
        selectedLabel.normal.background = GUIExt.ColorToTex(new Color(0.4f, 0.4f, 0.4f));
    }
Ejemplo n.º 3
0
    public override void NodeGUI()
    {
        value = (GameObject)GUIExt.ObjectField(value, this);
        OutputKnob(0);

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Ejemplo n.º 4
0
    public override void NodeGUI()
    {
        value = GUIExt.FloatField(new GUIContent("Value", "The input value of type float"), value);
        OutputKnob(0);

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Ejemplo n.º 5
0
 private void WriteLine2(string message, bool prefix = true, bool error = false)
 {
     if (prefix)
     {
         GUIExt.WriteLine("[TestPlugin] ", ConsoleColor.Green, message, ConsoleColor.White, error);
     }
     else
     {
         GUIExt.WriteLine(message, ConsoleColor.White, error);
     }
 }
Ejemplo n.º 6
0
        public void DrawCap(Vector3 pos, Vector3 startPos, Vector3 endPos, Quaternion rot, Color shadowColor, Color lineColor)
        {
            if (FlowSystem.GetZoom() < 1f)
            {
                return;
            }

            if (this.arrow == null)
            {
                this.arrow = Resources.Load <Texture2D>("UI.Windows/Flow/Arrow");
            }

            var size = 12f;

            size /= FlowSystem.GetZoom();

            //pos = this.editor.zoomDrawer.ConvertScreenCoordsToZoomCoords(pos, topLeft: true);

            var scrollPos = -FlowSystem.GetScrollPosition();
            var offset    = -8f;

            if (this.editor.scrollRect.Contains(new Vector3(pos.x - scrollPos.x + FlowSystemEditorWindow.SETTINGS_WIDTH + offset, pos.y - scrollPos.y + FlowSystemEditorWindow.TOOLBAR_HEIGHT + offset, 0f)) == false)
            {
                return;
            }

            var shadowOffset = Vector3.one * 1f;

            shadowOffset.z = 0f;

            var v1 = startPos - endPos;

            v1.x = -v1.x;
            var v2 = Vector3.left;

            var angle = Mathf.Atan2(
                Vector3.Dot(Vector3.back, Vector3.Cross(v1, v2)),
                Vector3.Dot(v1, v2)) * Mathf.Rad2Deg;

            var oldColor = GUI.color;

            GUI.color = shadowColor;
            GUIExt.DrawTextureRotated(new Rect(pos.x - size * 0.5f + shadowOffset.x, pos.y - size * 0.5f + shadowOffset.y, size, size), arrow, -angle + 180f);
            GUI.color = lineColor;
            GUIExt.DrawTextureRotated(new Rect(pos.x - size * 0.5f, pos.y - size * 0.5f, size, size), arrow, -angle + 180f);

            GUI.color = oldColor;

            /*Handles.color = shadowColor;
             * Handles.ConeCap(-1, pos + shadowOffset, rot, 15f);
             * Handles.color = lineColor;
             * Handles.ConeCap(-1, pos, rot, 15f);*/
        }
Ejemplo n.º 7
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();

        if (Inputs [0].connection != null)
        {
            GUILayout.Label(Inputs [0].name);
        }
        else
        {
            Input1Val = GUIExt.FloatField(GUIContent.none, Input1Val);
        }
        InputKnob(0);
        // --
        if (Inputs [1].connection != null)
        {
            GUILayout.Label(Inputs [1].name);
        }
        else
        {
            Input2Val = GUIExt.FloatField(GUIContent.none, Input2Val);
        }
        InputKnob(1);

        GUILayout.EndVertical();
        GUILayout.BeginVertical();

        Outputs [0].DisplayLayout();

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

#if UNITY_EDITOR
        type = (CalcType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Calculation Type", "The type of calculation performed on Input 1 and Input 2"), type);
#else
        GUILayout.Label(new GUIContent("Calculation Type: " + type.ToString(), "The type of calculation performed on Input 1 and Input 2"));
#endif

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Ejemplo n.º 8
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();

        if (Inputs [0].connection != null)
        {
            GUILayout.Label(Inputs [0].name);
        }
        else
        {
            Input1Val = (GameObject)GUIExt.ObjectField(Input1Val, this);
        }
        InputKnob(0);
        // --
        if (Inputs [1].connection != null)
        {
            GUILayout.Label(Inputs [1].name);
        }
        else
        {
            Input2Val = (GameObject)GUIExt.ObjectField(Input2Val, this);
        }
        InputKnob(1);

        objectMaterial = (Material)UnityEditor.EditorGUILayout.ObjectField(objectMaterial, typeof(Material));

        GUILayout.EndVertical();
        GUILayout.BeginVertical();

        Outputs [0].DisplayLayout();

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        type = (CalcType)UnityEditor.EditorGUILayout.EnumPopup(
            new GUIContent("CSG Operation", "The type of calculation performed on Input 1 and Input 2"), type);

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Ejemplo n.º 9
0
    private void DrawItem(MenuItem item, Rect groupRect)
    {
        if (item.separator)
        {
            if (Event.current.type == EventType.Repaint)
            {
                GUIExt.Seperator(new Rect(backgroundStyle.contentOffset.x + 1, currentItemHeight + 1, groupRect.width - 2, 1));
            }
            currentItemHeight += 3;
        }
        else
        {
            Rect labelRect = new Rect(backgroundStyle.contentOffset.x, currentItemHeight, groupRect.width, itemHeight);

            bool selected = selectedPath.Contains(item.path);
            if (labelRect.Contains(Event.current.mousePosition))
            {
                selectedPath = item.path;
                selected     = true;
            }

            GUI.Label(labelRect, item.content, selected? selectedLabel : GUI.skin.label);

            if (item.group)
            {
                GUI.DrawTexture(new Rect(labelRect.x + labelRect.width - 12, labelRect.y + (labelRect.height - 12) / 2, 12, 12), expandRight);
                if (selected)
                {
                    item.groupPos = new Rect(groupRect.x + groupRect.width + 4, groupRect.y + currentItemHeight - 2, 0, 0);
                    groupToDraw   = item;
                }
            }
            else if (selected && (Event.current.type == EventType.MouseDown || (Event.current.button != 1 && Event.current.type == EventType.MouseUp)))
            {
                item.Execute();
                close = true;
                Event.current.Use();
            }

            currentItemHeight += itemHeight;
        }
    }
Ejemplo n.º 10
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();

        parent = (GameObject)GUIExt.ObjectField(parent, this);
        InputKnob(0);

        location = UnityEditor.EditorGUILayout.Vector3Field("", location, GUILayout.Height(20));

        type = (PrimitiveType)UnityEditor.EditorGUILayout.EnumPopup("Primitive", type);

        Outputs [0].DisplayLayout();
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            NodeEditor.RecalculateFrom(this);
        }
    }
Ejemplo n.º 11
0
        public void Awake()
        {
            WriteLine("Test Message!");
            WriteLine("Test Error Message!", true);
            Write("c", ConsoleColor.Red);
            Write("o", ConsoleColor.Yellow);
            Write("l", ConsoleColor.Green);
            Write("o", ConsoleColor.Cyan);
            Write("r", ConsoleColor.Blue);
            Write("s", ConsoleColor.Magenta);
            Write("\n", ConsoleColor.White);
            WriteLine2("Test Message without Prefix!", false, false);

            GameObject.DontDestroyOnLoad(this);
            button = GUIExt.Add("TestPlugin", "Toggle TestPlugin", icon, (go) => { enabled = !enabled; });

            createButtons();
            enabled = false;

            WriteLine("Loaded.");
        }
Ejemplo n.º 12
0
        public static bool Init()
        {
            Background = ResourceManager.LoadTexture("Textures/background.png");
            AALineTex  = ResourceManager.LoadTexture("Textures/AALine.png");
            GUIBox     = ResourceManager.LoadTexture("Textures/NE_Box.png");
            GUIButton  = ResourceManager.LoadTexture("Textures/NE_Button.png");

            if (!Background || !AALineTex || !GUIBox || !GUIButton)
            {
                return(false);
            }

            // Styles

            nodeSkin = Object.Instantiate <GUISkin> (GUI.skin);

            nodeSkin.label.normal.textColor = new Color(0.7f, 0.7f, 0.7f);

            nodeSkin.box.normal.textColor  = new Color(0.7f, 0.7f, 0.7f);
            nodeSkin.box.normal.background = GUIBox;

            nodeSkin.button.normal.textColor  = new Color(0.7f, 0.7f, 0.7f);
            nodeSkin.button.normal.background = GUIButton;

            nodeSkin.textArea.normal.background = GUIBox;
            nodeSkin.textArea.active.background = GUIBox;

            nodeLabel = nodeSkin.label;

            nodeLabelBold           = new GUIStyle(nodeLabel);
            nodeLabelBold.fontStyle = FontStyle.Bold;

            nodeLabelSelected = new GUIStyle(nodeLabel);
            nodeLabelSelected.normal.background = GUIExt.ColorToTex(new Color(0.4f, 0.4f, 0.4f));

            return(true);
        }
Ejemplo n.º 13
0
 private void destroyButtons()
 {
     GUIExt.Destroy(blue);
     GUIExt.Destroy(green);
 }
Ejemplo n.º 14
0
 private void OnEnable()
 {
     WriteLine("Plugin Enabled!");
     GUIExt.SetFrameColor(button, Color.red);
     createButtons();
 }
Ejemplo n.º 15
0
 public override void NodeGUI()
 {
     stateName = GUIExt.TextField(new GUIContent("State Name"), stateName);
 }
Ejemplo n.º 16
0
 private void OnDisable()
 {
     WriteLine("Plugin Disabled!");
     GUIExt.ResetFrameColor(button);
     destroyButtons();
 }
Ejemplo n.º 17
0
    void OnGUI()
    {
        if (remembersettings)
        {
            if (tosavegozz.Count == 0)
            {
                if (EditorPrefs.HasKey("tosaveZZOG"))
                {
                    string mysavezz911911;
                    mysavezz911911 = EditorPrefs.GetString("tosaveZZOG");
                    Debug.Log(mysavezz911911);
                    if (mysavezz911911 == null)
                    {
                        tosavegozz = (List <PMGameObject>)JSONExt.Deserialize(mysavezz911911);
                    }
                }
            }
            else
            {
                string tosaveGOZZ6969 = JSONExt.Serialize(tosavegozz);
                Debug.Log(tosaveGOZZ6969);
                EditorPrefs.SetString("tosaveZZOG", tosaveGOZZ6969);
            }
        }
        EditorApplication.playModeStateChanged -= ChangedPM;
        EditorApplication.playModeStateChanged += ChangedPM;
        if (whitendblack == null)
        {
            whitendblack                   = new GUIStyle();
            whitendblack.fontSize          = 16;
            whitendblack.normal.background = MakeTex(2, 2, Color.white);
            whitendblack.normal.textColor  = Color.black;
        }
        showcomponents   = GUILayout.Toggle(showcomponents, "Show Components");
        showfields       = GUILayout.Toggle(showfields, "Show Fields");
        serializefields  = GUILayout.Toggle(serializefields, "Serialize All Fields");
        serializeChildzz = GUILayout.Toggle(serializefields, "Serialize Children");
        GUILayout.Label("Tags to Save", EditorStyles.boldLabel);
        ShowList(ref tagzz911420, ",", ref sotbox);
        GUILayout.Label("Layers to Save", EditorStyles.boldLabel);
        ShowList(ref layerzz911420, ",", ref sotbox22);
        for (int curi8778 = 1; curi8778 < tagzz911420.Count + 1; curi8778++)
        {
            try
            {
                List <GameObject> tagzzobzz6996;
                tagzzobzz6996 = GameObject.FindGameObjectsWithTag(tagzz911420[curi8778 - 1]).ToList <GameObject>();
                for (int curi9449 = 1; curi9449 < tosavegozz.Count + 1; curi9449++)
                {
                    if (!ContainsGMObjects(tosavegozz, tagzzobzz6996[curi9449]))
                    {
                        tosavegozz.Add(new PMGameObject(tagzzobzz6996[curi9449], true));
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        List <GameObject> layerzzobzz6996;

        GUILayout.Label("GameObjects to Save", EditorStyles.boldLabel);
        List <PMGameObject> toremove9969 = new List <PMGameObject>();

        for (int curi = 1; curi < tosavegozz.Count + 1; curi++)
        {
            PMGameObject gmobj;
            gmobj = tosavegozz[curi - 1];
            EditorGUI.indentLevel = 0;
            gmobj.enabled         = EditorGUILayout.BeginToggleGroup("Object #" + curi.ToString() + " - " + gmobj.myobject.name, gmobj.enabled);
            foreach (Component gmcomp in gmobj.myobject.GetComponents <Component>())
            {
                if (gmobj.mycomponents.Where(x => x.mycomponent == gmcomp).Count() == 0)
                {
                    PMComponent mycomp9886;
                    mycomp9886 = new PMComponent(gmcomp, true);
                    foreach (FieldInfo fld6991113373371 in gmcomp.GetType().GetFields())
                    {
                        mycomp9886.myproperties.Add(new PMProperty(fld6991113373371.Name, true, PMPropertyTypeTeh.Field));
                    }
                    foreach (PropertyInfo prop3371133791169 in gmcomp.GetType().GetProperties())
                    {
                        if (prop3371133791169.CanRead && prop3371133791169.CanWrite)
                        {
                            mycomp9886.myproperties.Add(new PMProperty(prop3371133791169.Name, true, PMPropertyTypeTeh.Property));
                        }
                    }
                    gmobj.mycomponents.Add(mycomp9886);
                }
            }
            List <PMComponent> toremove6699 = new List <PMComponent>();
            foreach (PMComponent gmcomp22 in gmobj.mycomponents)
            {
                if (gmobj.myobject.GetComponents <Component>().Where(x => x == gmcomp22.mycomponent).Count() == 0)
                {
                    toremove6699.Add(gmcomp22);
                }
            }
            foreach (PMComponent gmremoveem in toremove6699)
            {
                //gmobj.mycomponents.Remove(gmremoveem);
            }
            if (showcomponents)
            {
                for (int curi3 = 1; curi3 < gmobj.mycomponents.Count + 1; curi3++)
                {
                    PMComponent gmcomp;
                    gmcomp = gmobj.mycomponents[curi3 - 1];
                    EditorGUI.indentLevel = 2;
                    gmcomp.enabled        = EditorGUILayout.BeginToggleGroup("Component #" + curi3.ToString() + " - " + gmcomp.mycomponent.GetType().FullName, gmcomp.enabled);
                    if (showfields)
                    {
                        for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                        {
                            PMProperty gmprop;
                            gmprop = gmcomp.myproperties[curi4 - 1];
                            EditorGUI.indentLevel = 4;
                            gmprop.enabled        = EditorGUILayout.BeginToggleGroup("Field #" + curi4.ToString() + " - " + gmprop.name, gmprop.enabled);
                            EditorGUILayout.EndToggleGroup();
                        }
                        if (GUILayout.Button("Select All", new GUILayoutOption[] { GUILayout.ExpandWidth(false) }))
                        {
                            for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                            {
                                PMProperty gmprop;
                                gmprop         = gmcomp.myproperties[curi4 - 1];
                                gmprop.enabled = true;
                            }
                        }
                        if (GUILayout.Button("Deselect All", new GUILayoutOption[] { GUILayout.ExpandWidth(false) }))
                        {
                            for (int curi4 = 1; curi4 < gmcomp.myproperties.Count + 1; curi4++)
                            {
                                PMProperty gmprop;
                                gmprop         = gmcomp.myproperties[curi4 - 1];
                                gmprop.enabled = false;
                            }
                        }
                    }
                    EditorGUILayout.EndToggleGroup();
                }
            }
            EditorGUILayout.EndToggleGroup();
            if (GUILayout.Button("-", whitendblack, new GUILayoutOption[] { GUILayout.Width(21), GUILayout.Height(21) }))
            {
                toremove9969.Add(gmobj);
            }
            curi += 1;
        }
        foreach (PMGameObject gmgm911911 in toremove9969)
        {
            tosavegozz.Remove(gmgm911911);
        }
        if (GUIExt.DropArea(ref myobjzz, whitendblack, "+", 21, 21, false, false))
        {
            foreach (object myobjtmmt in myobjzz)
            {
                GameObject mb6969;
                mb6969 = (GameObject)myobjtmmt;
                tosavegozz.Add(new PMGameObject(mb6969, true));
            }
        }
    }
Ejemplo n.º 18
0
 private void WriteLine(string message, bool error = false)
 {
     GUIExt.WriteLine("[TestPlugin] ", ConsoleColor.Green, message, ConsoleColor.White, error);
 }
Ejemplo n.º 19
0
 private void Write(string message, ConsoleColor color)
 {
     GUIExt.Write(message, color, false);
 }