Example #1
0
    private void Start()
    {
        SetColor();

        GetComponent <SpriteRenderer>().color = myColor.GetColor();

        transform = gameObject.transform;
    }
Example #2
0
    private void Btn_ChooseColor(MyEnumColor colorEnum, bool isNull = false)
    {
        if (isShowLeftTip)
        {
            isShowLeftTip = false;
            go_MouseLeftClick.SetActive(false);

            switch (go_CurrentSelect.name)
            {
            case FLODER_NAME:             // 文件夹
                GameObject biaoJi = go_CurrentSelect.transform.Find("BiaoJi").gameObject;
                biaoJi.SetActive(!isNull);
                if (!isNull)
                {
                    biaoJi.GetComponent <Image>().color = MyColor.GetColor(colorEnum);
                    Ctrl_DaoRuInfo.Instance.AddBiaoJi(m_CurrentSelectFile.FullName, colorEnum);
                }
                else
                {
                    Ctrl_DaoRuInfo.Instance.RemoveBiaoJi(m_CurrentSelectFile.FullName);
                }
                break;
            }
        }
    }
Example #3
0
    private void DrawElement(Rect rect, int index, bool isActive, bool isFocused)
    {
        BookPro book = target as BookPro;

        var serialzedpaper = list.serializedProperty.GetArrayElementAtIndex(index);

        rect.y += 2;

        GUIStyle style = new GUIStyle();

        EditorGUI.DrawRect(new Rect(rect.x, rect.y, rect.width, rect.height - 6), MyColor.GetColor(MyEnumColor.LightGreen));
        EditorGUI.LabelField(new Rect(rect.x, rect.y, 100, EditorGUIUtility.singleLineHeight), "第 " + index + " 页");

        if (index == book.CurrentPaper)
        {
            EditorGUI.DrawRect(new Rect(rect.x, rect.y + EditorGUIUtility.singleLineHeight, 140, EditorGUIUtility.singleLineHeight), new Color(1, 0.3f, 0.3f));
        }
        EditorGUI.LabelField(new Rect(rect.x, rect.y + EditorGUIUtility.singleLineHeight, 40, EditorGUIUtility.singleLineHeight), "前面:");
        EditorGUI.PropertyField(
            new Rect(rect.x + 40, rect.y + EditorGUIUtility.singleLineHeight, 100, EditorGUIUtility.singleLineHeight), serialzedpaper.FindPropertyRelative("Front"), GUIContent.none);

        if (index == book.CurrentPaper - 1)
        {
            EditorGUI.DrawRect(new Rect(rect.x, rect.y + 3 * EditorGUIUtility.singleLineHeight, 140, EditorGUIUtility.singleLineHeight), new Color(1, 0.3f, 0.3f));
        }
        EditorGUI.LabelField(new Rect(rect.x, rect.y + 3 * EditorGUIUtility.singleLineHeight, 35, EditorGUIUtility.singleLineHeight), "背面:");
        EditorGUI.PropertyField(
            new Rect(rect.x + 40, rect.y + 3 * EditorGUIUtility.singleLineHeight, 100, EditorGUIUtility.singleLineHeight), serialzedpaper.FindPropertyRelative("Back"), GUIContent.none);


        style.padding = new RectOffset(2, 2, 2, 2);
        if (GUI.Button(new Rect(rect.x + 70, rect.y + 2 * EditorGUIUtility.singleLineHeight, 20, EditorGUIUtility.singleLineHeight), tex, GUIStyle.none))
        {
            Debug.Log("Clicked at index:" + index);
            Paper      paper = book.papers[index];
            GameObject temp  = paper.Back;
            paper.Back  = paper.Front;
            paper.Front = temp;
        }
        if (GUI.Button(new Rect(rect.x + 150, rect.y + EditorGUIUtility.singleLineHeight, 80, (int)(1.5 * EditorGUIUtility.singleLineHeight)), "Show"))
        {
            Paper paper = book.papers[index];
            BookUtility.ShowPage(paper.Back);
            paper.Back.transform.SetAsLastSibling();
            BookUtility.ShowPage(paper.Front);
            paper.Front.transform.SetAsLastSibling();

            book.LeftPageShadow.gameObject.SetActive(false);
            book.LeftPageShadow.transform.SetParent(book.transform);

            book.RightPageShadow.gameObject.SetActive(false);
            book.RightPageShadow.transform.SetParent(book.transform);
        }
        if (GUI.Button(new Rect(rect.x + 150, rect.y + (int)(2.5 * EditorGUIUtility.singleLineHeight), 80, (int)(1.5 * EditorGUIUtility.singleLineHeight)), "Set Current"))
        {
            book.CurrentPaper = index;
        }
    }
Example #4
0
        public override void OnGUI(Rect position)
        {
            string      descriptionText = ((MyHeadAttribute)attribute).Description;
            MyEnumColor color           = ((MyHeadAttribute)attribute).TextColor;
            int         offsetX         = ((MyHeadAttribute)attribute).OffsetX;

            position.y += 4f;
            position.x += offsetX;
            Color firstColor = GUI.color;

            GUI.color = MyColor.GetColor(color);
            MyGUI.Text(position, descriptionText);
            GUI.color = firstColor;
        }
Example #5
0
    void AddSomeColor()
    {
        if (null == L_Colors)
        {
            L_Colors = new List <Color>();
        }

        L_Colors.Add(MyColor.GetColor(MyEnumColor.LightBlue));
        L_Colors.Add(MyColor.GetColor(MyEnumColor.Blue));
        L_Colors.Add(MyColor.GetColor(MyEnumColor.Yellow));
        L_Colors.Add(MyColor.GetColor(MyEnumColor.Orange));
        L_Colors.Add(MyColor.GetColor(MyEnumColor.Green));
        L_Colors.Add(MyColor.GetColor(MyEnumColor.LightGreen));
    }
Example #6
0
    public void SetLight(bool isLit, ColorName spaceColor)
    {
        if (MyColor.ToColor(spaceColor) == myColor.GetColor())
        {
            correctSprite.enabled   = true;
            incorrectSprite.enabled = false;
            return;
        }

        //If space isn't lit up or if the color is a composite of the target, don't do anything
        if (!isLit || (MyColor.IsComposite(myColor.GetColorName(), spaceColor)))
        {
            correctSprite.enabled   = false;
            incorrectSprite.enabled = false;
            return;
        }

        incorrectSprite.enabled = true;
        correctSprite.enabled   = false;
    }
Example #7
0
    private Transform AddMiddleButton(FileSystemInfo fileInfo, MiddleButtonType type)     // 按分类添加中间按钮
    {
        Transform t;

        switch (type)
        {
        case MiddleButtonType.File:           // 文件
            t = InstantiateMoBan(moBan_File, t_MiddleGrid, FILE_NAME, true);
            t.Find("Text").GetComponent <Text>().text        = GetShortName(Path.GetFileNameWithoutExtension(fileInfo.FullName));
            t.Find("GeiShi/Text").GetComponent <Text>().text = fileInfo.Extension.Substring(1);
            break;

        case MiddleButtonType.Folder:        // 文件夹
            t = InstantiateMoBan(moBan_Folder, t_MiddleGrid, FLODER_NAME, true);
            t.Find("Text").GetComponent <Text>().text = GetShortName(fileInfo.Name);

            MyEnumColor biaoJiColor = MyEnumColor.Hui;
            bool        isBiaoJi    = Ctrl_DaoRuInfo.Instance.GetIsBiaoJi(fileInfo.FullName, ref biaoJiColor);
            if (isBiaoJi)
            {
                GameObject biaoJi = t.Find("BiaoJi").gameObject;
                biaoJi.SetActive(true);
                biaoJi.GetComponent <Image>().color = MyColor.GetColor(biaoJiColor);
            }
            break;

        case MiddleButtonType.Drive:         // 磁盘
            t = InstantiateMoBan(moBan_YinPan, t_MiddleGrid, YINPAN_NAME, true);
            string reStr = fileInfo.Name;
            reStr = reStr.Replace(":\\", " 盘");
            t.Find("Text").GetComponent <Text>().text = reStr;
            break;

        case MiddleButtonType.Computer:      // 我的电脑
            t = InstantiateMoBan(moBan_Computer, t_MiddleGrid, COMPUTER_NAME, true);
            t.Find("Text").GetComponent <Text>().text = "我的电脑";
            break;

        case MiddleButtonType.ZhuoMain:      // 桌面
            t = InstantiateMoBan(moBan_ZhuoMain, t_MiddleGrid, ZHUOMAIN_NAME, true);
            t.Find("Text").GetComponent <Text>().text = "桌面";
            break;

        case MiddleButtonType.Music:        // 音频文件
            t = InstantiateMoBan(moBan_Music, t_MiddleGrid, MUSIC_NAME, true);
            t.Find("Text").GetComponent <Text>().text        = GetShortName(Path.GetFileNameWithoutExtension(fileInfo.FullName));
            t.Find("GeiShi/Text").GetComponent <Text>().text = fileInfo.Extension.Substring(1);
            break;

        default:
            throw new Exception("未定义");
        }

        GameObject go = t.gameObject;

        if (type != MiddleButtonType.File)                             // 文件加载完图才添加按钮事件
        {
            t.GetComponent <Button>().onClick.AddListener(() =>
            {
                if (go.Equals(go_CurrentSelect) && isSelect)            // 双击
                {
                    isSelect = false;
                    switch (go_CurrentSelect.name)
                    {
                    case FLODER_NAME:           //双击文件夹
                    case YINPAN_NAME:           //双击硬盘
                        mFileBrowser.GoInSubDirectory(fileInfo.Name);
                        RefreshMiddleContent(); // 刷新
                        break;

                    case COMPUTER_NAME:         // 双击我的电脑
                        mFileBrowser.GoToRoot(true);
                        RefreshMiddleContent(); // 刷新
                        break;

                    case ZHUOMAIN_NAME:     // 双击桌面
                        string Desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        mFileBrowser.RetrieveFiles(new DirectoryInfo(Desktop), true);
                        RefreshMiddleContent();          // 刷新
                        break;

                    case MUSIC_NAME:        //音乐文件
//                            MyEventCenter.SendEvent(E_GameEvent.ShowMusicInfo, t.Find("Text").GetComponent<Text>(),(FileInfo)fileInfo,true);
                        break;

                    default:
                        throw new Exception("没有定义 —— " + go_CurrentSelect.name);
                    }
                }
                else
                {
                    if (isShowLeftTip)
                    {
                        isShowLeftTip = false;
                        go_MouseLeftClick.SetActive(false);
                    }
                    go_CurrentSelect    = go;
                    m_CurrentSelectFile = fileInfo;
                    Ctrl_Coroutine.Instance.StartCoroutine(CheckoubleClick());
                }
            });
        }
        l_MiddleItems.Add(go);
        return(t);
    }
Example #8
0
        private static List <GUIStyle> GeneralStyles()
        {
            List <GUIStyle> styles = new List <GUIStyle>
            {
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonCollapseSideBar), EZResources.sideButtonCollapseSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonExpandSideBar), EZResources.sideButtonExpandSideBar, QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(2, 28, 2, 2), new RectOffset(2, 32, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton1), EZResources.sideButtonControlPanel, QUI.IsProSkin ? QColors.BlueLight.Color : QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton2), EZResources.sideButtonDefineSymbols, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton3), EZResources.sideButtonDataManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton4), EZResources.sideButtonDataBind, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton5), EZResources.sideButtonPooly, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton6), EZResources.sideButtonAdsManager, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton7), EZResources.sideButtonHelp, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButton8), EZResources.sideButtonAbout, QUI.IsProSkin ? QColors.BlueLight.Color :QColors.BlueDark.Color, QColors.BlueDark.Color, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),

                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonTwitter), EZResources.sideButtonTwitter, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(0, 153, 209), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonBlue), EZResources.sideButtonFacebook, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(74, 112, 186), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),
                GetSideButtonStyle(QStyles.GetStyleName(General.SideButtonRed), EZResources.sideButtonYoutube, MyColor.GetColor(128, 128, 128), MyColor.GetColor(242, 242, 242), MyColor.GetColor(255, 102, 102), new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4), 14),



                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected1), EZResources.sideButtonControlPanelSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected2), EZResources.sideButtonDefineSymbolsSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected3), EZResources.sideButtonDataManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected4), EZResources.sideButtonDataBindSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected5), EZResources.sideButtonPoolySelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected6), EZResources.sideButtonAdsManagerSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected7), EZResources.sideButtonHelpSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
                GetSideButtonSelectedStyle(QStyles.GetStyleName(General.SideButtonSelected8), EZResources.sideButtonAboutSelected, QColors.GreenLight.Color, new RectOffset(28, 2, 2, 2), new RectOffset(32, 2, 2, 4)),
            };

            return(styles);
        }
Example #9
0
 public Color GetColor()
 {
     return(myColor.GetColor());
 }
Example #10
0
 private void SetColor(ColorName color)
 {
     myColor = new MyColor(color);
     GetComponent <SpriteRenderer>().color = myColor.GetColor();
 }
Example #11
0
 public QColor(int rDark, int gDark, int bDark, int aDark, int rLight, int gLight, int bLight, int aLight, bool from256 = true)
 {
     Dark  = from256 ? MyColor.GetColor(rDark, gDark, bDark, aDark) : new Color(rDark, gDark, bDark, aDark);
     Light = from256 ? MyColor.GetColor(rLight, gLight, bLight, aLight) : new Color(rLight, gLight, bLight, aLight);
 }
Example #12
0
 public QColor(int r, int g, int b, int a, bool from256 = true)
 {
     Dark  = from256 ? MyColor.GetColor(r, g, b, a) : new Color(r, g, b, a);
     Light = from256 ? MyColor.GetColor(r, g, b, a) : new Color(r, g, b, a);
 }
Example #13
0
        public virtual void DrawMenuItem(int indentLevel)        // 画菜单项
        {
            var newRect = GUILayoutUtility.GetRect(this.Style.Height, this.Style.Height);

            if (Event.current.type == EventType.Repaint)
            {
                this.rect = newRect;
            }

            if (Event.current.type == EventType.Repaint)
            {
                this.labelRect = this.rect.AddXMin(this.Style.Offset + indentLevel * this.Style.IndentAmount);
                bool selected = this.IsSelected;

                // 鼠标点击中的背景颜色
                if (selected)
                {
                    if (EditorGUIUtility.isProSkin)      // 专业与个人版选择的颜色不同
                    {
                        EditorGUI.DrawRect(this.rect, this.Style.SelectedColorDarkSkin);
                    }
                    else
                    {
                        EditorGUI.DrawRect(this.rect, this.Style.SelectedColorLightSkin);
                    }
                }

                // 设置鼠标悬空时的颜色
                if (this.rect.Contains(Event.current.mousePosition))
                {
                    EditorGUI.DrawRect(this.rect, new Color(1.000f, 1f, 1.000f, 0.028f));
                }

                // 三角形
                if (this.isFoldable && this.ChildMenuItems.Any())
                {
                    var icon = this.Toggled ? EditorIcons.TriangleDown : EditorIcons.TriangleRight;

                    if (this.Style.AlignTriangleLeft)
                    {
                        this.triangleRect    = this.labelRect.AlignLeft(this.Style.TriangleSize).AlignMiddle(this.Style.TriangleSize);
                        this.triangleRect.x -= this.Style.TriangleSize - this.Style.TrianglePadding;
                    }
                    else
                    {
                        this.triangleRect    = this.rect.AlignRight(this.Style.TriangleSize).AlignMiddle(this.Style.TriangleSize);
                        this.triangleRect.x -= this.Style.TrianglePadding;
                    }

                    if (Event.current.type == EventType.Repaint)
                    {
                        if (EditorGUIUtility.isProSkin)
                        {
                            if (selected || this.triangleRect.Contains(Event.current.mousePosition))
                            {
                                GUI.DrawTexture(this.triangleRect, icon.Highlighted);
                            }
                            else
                            {
                                GUI.DrawTexture(this.triangleRect, icon.Active);
                            }
                        }
                        else
                        {
                            if (selected)
                            {
                                GUI.DrawTexture(this.triangleRect, icon.Raw);
                            }
                            else if (this.triangleRect.Contains(Event.current.mousePosition))
                            {
                                GUI.DrawTexture(this.triangleRect, icon.Active);
                            }
                            else
                            {
                                GUIHelper.PushColor(new Color(1, 1, 1, 0.7f));
                                GUI.DrawTexture(this.triangleRect, icon.Active);
                                GUIHelper.PopColor();
                            }
                        }
                    }
                }

                // 图标
                if (this.Icon || selected && this.IconSelected)
                {
                    var iconRect = this.labelRect.AlignLeft(this.Style.IconSize).AlignMiddle(this.Style.IconSize);
                    iconRect.x += this.Style.IconOffset;
                    if (!selected)
                    {
                        GUIHelper.PushColor(new Color(1, 1, 1, this.Style.NotSelectedIconAlpha));
                    }

                    if (selected && this.IconSelected)
                    {
                        GUI.DrawTexture(iconRect, this.IconSelected);
                    }
                    else
                    {
                        GUI.DrawTexture(iconRect, this.Icon);
                    }

                    this.labelRect.xMin += this.Style.IconSize + this.Style.IconPadding;

                    if (!selected)
                    {
                        GUIHelper.PopColor();
                    }
                }

                // 字体
                var   labelStyle = selected ? SirenixGUIStyles.WhiteLabel : SirenixGUIStyles.Label;
                Color c          = GUI.color;
                GUI.color            = MyColor.GetColor(TextColor);
                labelStyle.fontStyle = FontStyle.Bold;
                GUI.Label(this.labelRect.AlignMiddle(16), this.SmartName, labelStyle);
                GUI.color = c;



                // 边界
                if (this.Style.Borders)
                {
                    var borderPadding = this.Style.BorderPadding;
                    var draw          = true;

                    if (selected || previousMenuItemWasSelected)
                    {
                        borderPadding = 0;
                        if (!EditorGUIUtility.isProSkin)
                        {
                            draw = false;
                        }
                    }

                    previousMenuItemWasSelected = selected;

                    if (draw)
                    {
                        //下脚颜色
                        Color dColor = darkerLinerColor;
                        Color lColor = lighterLineColor;
                        //上脚颜色
                        dColor.a *= this.Style.BorderAlpha;
                        lColor.a *= this.Style.BorderAlpha;

                        Rect border = this.rect.AlignTop(1);
                        border.y     -= 1;
                        border.x     += borderPadding;
                        border.width -= borderPadding * 2;

                        EditorGUI.DrawRect(border, dColor);
                        border.y += 1;
                        EditorGUI.DrawRect(border, lColor);
                    }
                }
            }

            this.OnDrawMenuItem(this.rect, this.labelRect);

            if (this.OnDrawItem != null)
            {
                this.OnDrawItem(this);
            }

            this.HandleMouseEvents(rect, this.triangleRect);
        }