Exemplo n.º 1
0
        private Rect GetBtnPos(int aIdPos, int aIdRow, int aNbOfBtnInRow, sToolDefaultRect aRect)
        {
            m_BtnWidth = (position.width - ((aRect.MargeSide * 4) + (aNbOfBtnInRow * 2))) / aNbOfBtnInRow;
            float checkMax = aRect.MaxBtnWidth;

            if (aNbOfBtnInRow > 5)
            {
                checkMax = aRect.MinBtnWidth;
            }
            if (m_BtnWidth > checkMax && aIdRow != 0)
            {
                m_BtnWidth = checkMax;
            }
            else if (m_BtnWidth < aRect.MinBtnWidth)
            {
                m_BtnWidth = aRect.MinBtnWidth;
            }
            float heightMarge = aRect.MargeTitle + (aIdRow * (aRect.Btnheight + (aRect.MargeHeight * 2.0f)));

            if (aIdPos <= 0)
            {
                return(new Rect(aRect.MargeSide + (aRect.MargeSide * 0.5f), heightMarge, m_BtnWidth, aRect.Btnheight));
            }

            return(new Rect(aRect.MargeSide + (aRect.MargeSide * 0.5f) + (aRect.MargeSide + m_BtnWidth) * (aIdPos), heightMarge, m_BtnWidth, aRect.Btnheight));
        }
Exemplo n.º 2
0
        protected Rect GetBtnRect(int aIdPos, int aIdGroup, int aNbOfBtnInGroup, sToolDefaultRect aRect)
        {
            if (aIdGroup == 0)
            {
                return(GetBtnPos(aIdPos, aIdGroup, aNbOfBtnInGroup, aRect));
            }
            int row = GetRowId(ref aIdPos, aNbOfBtnInGroup, aIdGroup, aRect);

            return(GetBtnPos(aIdPos, row, aNbOfBtnInGroup, aRect));
        }
Exemplo n.º 3
0
        protected sToolDefaultRect SetDefaultToolRect(float aBtnHeight, float aMargeTitle, float aMargeSide, float aMargeHeight, float aMinBtnWidth, float aMaxBtnWidth)
        {
            sToolDefaultRect toolRect = new sToolDefaultRect();

            toolRect.Btnheight   = aBtnHeight;
            toolRect.MargeTitle  = aMargeTitle;
            toolRect.MargeHeight = aMargeHeight;
            toolRect.MargeSide   = aMargeSide;
            toolRect.MinBtnWidth = aMinBtnWidth;
            toolRect.MaxBtnWidth = aMaxBtnWidth;
            return(toolRect);
        }
Exemplo n.º 4
0
        private int GetRowId(ref int aIdPos, int aNbOfBtnInGroup, int aGroup, sToolDefaultRect aRect)
        {
            float width   = position.width - (aRect.MargeSide * 2);
            float btnSize = aRect.MinBtnWidth + (aRect.MargeSide);

            while ((aIdPos + 1) * btnSize > width)
            {
                aIdPos -= Mathf.FloorToInt(width / btnSize);
                aGroup++;
            }
            return(aGroup);
        }
Exemplo n.º 5
0
        protected void DrawBackgroundMenu(int aRow, float aMinY, float aMaxY, sToolDefaultRect aRect)
        {
            if (aRow > 0)
            {
                aMinY -= aRect.MargeHeight;
            }
            aMinY -= aRect.MargeHeight;
            Rect backgroundRect = new Rect(aRect.MargeSide, aMinY, position.width - (aRect.MargeSide * 2f), aMaxY - aMinY + aRect.MargeHeight);

            EditorGUI.DrawRect(backgroundRect, m_CompanyColor02);
            backgroundRect.y     += backgroundRect.height;
            backgroundRect.height = 2;
            EditorGUI.DrawRect(backgroundRect, Color.white);
        }
Exemplo n.º 6
0
        protected void DrawBtnInfo(string aTitle, float aY, sToolDefaultRect aRect)
        {
            Rect baseRect = new Rect(aRect.MargeSide, aY + aRect.Btnheight + aRect.MargeHeight, position.width - aRect.MargeSide * 2f, 28);

            EditorGUI.DrawRect(baseRect, m_CompanyColor02);

            baseRect.x += aRect.MargeSide;
            EditorGUI.LabelField(baseRect, aTitle, m_TitleStyle);
            baseRect.x -= aRect.MargeSide;

            baseRect.y     += baseRect.height;
            baseRect.height = 1;
            EditorGUI.DrawRect(baseRect, Color.white);

            baseRect.y            += baseRect.height;
            baseRect.height        = position.height - baseRect.height;
            m_CompanyColor01Fade   = m_CompanyColor01;
            m_CompanyColor01Fade.a = 0.5f;
            EditorGUI.DrawRect(baseRect, m_CompanyColor01Fade);
        }
Exemplo n.º 7
0
        protected void DrawManagerBtn(Rect aRect, eManagers aManager, Texture aIcon, bool aEnable, string aTitle, string aVETip, string aVFTip, System.Action aBtnCallBack, sToolDefaultRect aToolRect)
        {
            if (MouseOverBtn(aRect))
            {
                DrawBtnInfo(aTitle, aRect.y, aToolRect);

                if (SceneAutoLoader.IsUsingTooltip)
                {
                    DrawToolTipBox(aVETip, aVFTip, aRect.y, aToolRect);
                }
            }
            Color oldBack = GUI.backgroundColor;

            GUI.backgroundColor = ColorManager.GetColor(aManager, !aEnable);
            if (GUI.Button(aRect, aIcon))
            {
                aBtnCallBack();
            }
            GUI.backgroundColor = oldBack;
        }
Exemplo n.º 8
0
        protected void DrawButton(Rect aRect, string aText, string aTitle, string aVETip, string aVFTip, System.Action aBtnCallBack, sToolDefaultRect aToolRect)
        {
            if (MouseOverBtn(aRect))
            {
                DrawBtnInfo(aTitle, aRect.y, aToolRect);

                if (SceneAutoLoader.IsUsingTooltip)
                {
                    DrawToolTipBox(aVETip, aVFTip, aRect.y, aToolRect);
                }
            }
            if (GUI.Button(aRect, aText))
            {
                aBtnCallBack();
            }
        }
Exemplo n.º 9
0
        protected void DrawToolTipBox(string aToolTipVO, string aToolTipVF, float aY, sToolDefaultRect aRect)
        {
            Vector2 vec           = new Vector2();
            int     amountOfLine  = 0;
            Rect    textBpxBack   = new Rect();
            Rect    textBoxSizeEN = new Rect();
            Rect    textBoxSizeFR = new Rect();

            aToolTipVO = "<color=#FFFFFF>EN </color>" + aToolTipVO;
            aToolTipVF = "<color=#FFFFFF>FR </color>" + aToolTipVF;

            vec          = m_HelpBoxStyle.CalcSize(new GUIContent(aToolTipVO));
            amountOfLine = Mathf.CeilToInt(vec.x / position.width);

            textBoxSizeEN = new Rect(10f, aY + aRect.Btnheight + aRect.MargeHeight + (aRect.Btnheight * 0.6f), position.width - 19, 19 * amountOfLine);

            vec          = m_HelpBoxStyle.CalcSize(new GUIContent(aToolTipVF));
            amountOfLine = Mathf.CeilToInt(vec.x / position.width);

            textBoxSizeFR = new Rect(10f, textBoxSizeEN.yMax, position.width - 19, 19 * amountOfLine);


            textBpxBack = new Rect(aRect.MargeSide, textBoxSizeEN.yMin, position.width - aRect.MargeSide * 2, textBoxSizeEN.height + textBoxSizeFR.height + 8f);


            EditorGUI.DrawRect(textBpxBack, m_CompanyColor02);
            GUI.color = Color.white;
            EditorGUI.HelpBox(textBoxSizeEN, aToolTipVO, MessageType.None);
            EditorGUI.HelpBox(textBoxSizeFR, aToolTipVF, MessageType.None);
            GUI.color          = Color.white;
            textBpxBack.y     += textBpxBack.height;
            textBpxBack.height = 1;
            EditorGUI.DrawRect(textBpxBack, Color.white);
        }
Exemplo n.º 10
0
 protected void DrawTitleWithinRow(string aTitle, int aRow, sToolDefaultRect aRect)
 {
     GUI.color = Color.white;
     GUI.Label(new Rect(10, GetBtnPos(0, aRow, 1, aRect).y, position.width - 20, 50), aTitle, m_TitleCenterStyle);
     GUI.color = Color.white;
 }