Ejemplo n.º 1
0
        public override CommandParameterAutoComplete <Color> AddValue(string alias, Color value)
        {
            base.AddValue(alias, value);

            if (!colorTextures.ContainsKey(alias))
            {
                colorTextures.Add(alias, MonkeyStyle.ColorTexture(1, 1, value));
            }

            return(this);
        }
Ejemplo n.º 2
0
    private static void InitGraphics(GettingStartedPanel panel)
    {
        MonkeyStyle.Instance.PostInstanceCreation();
        panel.monKeyBanner      = MonkeyStyle.Instance.GetTextureFromName("MonKeyBanner");
        panel.monKeyBannerStyle = new GUIStyle()
        {
            fixedWidth  = 601,
            fixedHeight = 260,
            normal      = { background = panel.monKeyBanner }
        };
        panel.welcomeTitleStyle = new GUIStyle()
        {
            fontSize     = 28,
            stretchWidth = true,
            alignment    = TextAnchor.MiddleCenter,
            padding      = new RectOffset(10, 10, 10, 5),
            normal       = { background = MonkeyStyle.Instance.WindowBackgroundTex }
        };

        panel.rateUsSectionStyle = new GUIStyle(panel.welcomeTitleStyle)
        {
            padding = new RectOffset(15, 10, 10, 5),
            normal  = { background = MonkeyStyle.Instance.TopPanelGradientTexture }
        };

        panel.sectionTitleStyle = new GUIStyle()
        {
            fontSize     = 20,
            stretchWidth = true,
            alignment    = TextAnchor.MiddleLeft,
            padding      = new RectOffset(5, 5, 5, 0),
            margin       = new RectOffset(30, 0, 0, 0)
        };

        panel.welcomeTextStyle = new GUIStyle(MonkeyStyle.Instance.CommandNameStyle)
        {
            fontSize     = 12,
            stretchWidth = true,
            alignment    = TextAnchor.MiddleCenter,
            padding      = new RectOffset(5, 5, 5, 5),
            //  normal = { background = MonkeyStyle.Instance.SelectedResultFieldTex }
        };

        panel.sectionSubtitleStyle = new GUIStyle(panel.welcomeTextStyle)
        {
            alignment = TextAnchor.MiddleLeft,
            margin    = new RectOffset(30, 0, 0, 0)
        };

        panel.sectionBackgroundStyle = new GUIStyle()
        {
            normal = { background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("3a3a3a")) }
        };

        panel.titleColor           = ColorExt.HTMLColor("cbcbcb");
        panel.sectionSubtitleColor = ColorExt.HTMLColor("ae8d4d");

        panel.buttonStyle = new GUIStyle()
        {
            fixedHeight = 50,
            fixedWidth  = 250,
            fontSize    = 12,
            alignment   = TextAnchor.MiddleCenter,
            normal      = { background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("4d4d4d")) },
            hover       = { background = MonkeyStyle.ColorTexture(1, 1,
                                                                  ColorExt.HTMLColor("4d4d4d").DarkerBrighter(-.1f)) },
        };

        panel.newVersionButtonStyle = new GUIStyle()

        {
            fixedHeight  = 30,
            stretchWidth = true,
            fontSize     = 12,
            alignment    = TextAnchor.MiddleCenter,
            normal       = { background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("4d4d4d")) },
            hover        = { background = MonkeyStyle.ColorTexture(1, 1,
                                                                   ColorExt.HTMLColor("4d4d4d").DarkerBrighter(-.05f)) },
        };


        panel.rateUsButtonBoxStyle = new GUIStyle()
        {
            margin       = new RectOffset(1, 1, 1, 1),
            stretchWidth = true,
        };

        panel.newVersionButtonBoxStyle = new GUIStyle()
        {
            margin       = new RectOffset(1, 1, 1, 1),
            padding      = new RectOffset(5, 5, 0, 0),
            stretchWidth = true,
        };

        panel.buttonTop = new GUIStyle()
        {
            fixedHeight  = 2,
            stretchWidth = true,
            normal       = { background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("616161")) },
            hover        = { background = MonkeyStyle.ColorTexture(1, 1,
                                                                   ColorExt.HTMLColor("616161").DarkerBrighter(-.1f)) }
        };

        panel.buttonBottom = new GUIStyle()
        {
            fixedHeight  = 2,
            stretchWidth = true,
            normal       = { background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("2d2d2d")) },
            hover        = { background = MonkeyStyle.ColorTexture(1, 1,
                                                                   ColorExt.HTMLColor("2d2d2d").DarkerBrighter(-.1f)) }
        };

        panel.buttonHighlightStyle = new GUIStyle()
        {
            margin = new RectOffset(10, 10, 10, 10),
            normal =
            {
                background = MonkeyStyle.ColorTexture(1, 1, ColorExt.HTMLColor("8FC225"))
            }
        };
    }
Ejemplo n.º 3
0
        private static void ComputeDragAndDrop(CommandConsoleWindow window)
        {
            Type currentParameterType = window.CurrentExecution.CurrentParameterInfo.ParameterType;

            if (window.CurrentExecution.CurrentParameterInfo.IsArray)
            {
                currentParameterType = currentParameterType.GetElementType();
            }

            if (!currentParameterType.IsSubclassOf(typeof(UnityEngine.Object)) &&
                currentParameterType != typeof(string))
            {
                return;
            }

            Event evt      = Event.current;
            Rect  dropArea = GUILayoutUtility.GetLastRect();

            bool isDrag = EventType.DragUpdated == evt.type || evt.type == EventType.DragPerform;

            if (isDrag && !startedDrag)
            {
                startedDrag = true;
            }

            bool   stringParam = currentParameterType == typeof(string);
            string message     = stringParam ? "Drop Your Asset Here!"
                : "Drop Your Scene Object Here!";

            GUI.Box(dropArea, startedDrag ? message : "", new GUIStyle()
            {
                alignment = TextAnchor.MiddleCenter,
                normal    =
                {
                    background = MonkeyStyle.ColorTexture(1, 1, startedDrag?
                                                          Color.white.Alphaed(1f) : Color.white.Alphaed(0))
                }
            });

            if (isDrag)
            {
                if (!dropArea.Contains(evt.mousePosition))
                {
                    return;
                }

                bool validDragAndDrop = false;

                if (stringParam)
                {
                    validDragAndDrop = !DragAndDrop.objectReferences.Where(_ => _ is GameObject)
                                       .Any(_ => ((GameObject)_).scene.IsValid());
                }
                else
                {
                    validDragAndDrop =
                        DragAndDrop.objectReferences
                        .All(_ => _ is GameObject && ((GameObject)_).scene.IsValid());
                }

                DragAndDrop.visualMode = validDragAndDrop ? DragAndDropVisualMode.Copy
                    : DragAndDropVisualMode.Rejected;

                if (evt.type == EventType.DragPerform && validDragAndDrop)
                {
                    if (window.CurrentExecution.CurrentParameterInfo.IsArray)
                    {
                        window.CurrentExecution.NotifyFewInputs(DragAndDrop.objectReferences.Convert(_ => _.name).ToArray(), window);
                    }
                    else
                    {
                        window.SearchTerms = DragAndDrop.objectReferences[0].name;
                        window.CurrentExecution.NotifyNewInput(DragAndDrop.objectReferences[0].name, window);
                    }
                    DragAndDrop.AcceptDrag();
                }
            }
            else if (evt.type == EventType.DragExited)
            {
                startedDrag = false;
            }
        }