Beispiel #1
0
        /// <summary>
        /// Updates the points label.
        /// </summary>
        public void UpdatePointsLabel()
        {
            if (this.m_PointsText == null)
            {
                return;
            }

            // Set the points string on the label
            this.m_PointsText.text = "";

            // No points assigned
            if (this.m_CurrentPoints == 0)
            {
                this.m_PointsText.text += "<color=#" + CommonColorBuffer.ColorToString(this.m_pointsMinColor) + ">" + this.m_CurrentPoints.ToString() + "</color>";
                this.m_PointsText.text += "<color=#" + CommonColorBuffer.ColorToString(this.m_pointsMaxColor) + ">/" + this.m_TalentInfo.maxPoints.ToString() + "</color>";
            }
            // Assigned but not maxed
            else if (this.m_CurrentPoints > 0 && this.m_CurrentPoints < this.m_TalentInfo.maxPoints)
            {
                this.m_PointsText.text += "<color=#" + CommonColorBuffer.ColorToString(this.m_pointsMinColor) + ">" + this.m_CurrentPoints.ToString() + "</color>";
                this.m_PointsText.text += "<color=#" + CommonColorBuffer.ColorToString(this.m_pointsMaxColor) + ">/" + this.m_TalentInfo.maxPoints.ToString() + "</color>";
            }
            // Maxed
            else
            {
                this.m_PointsText.text += "<color=#" + CommonColorBuffer.ColorToString(this.m_pointsActiveColor) + ">" +
                                          this.m_CurrentPoints.ToString() + "/" +
                                          this.m_TalentInfo.maxPoints.ToString() + "</color>";
            }
        }
 public void OnSendMessage(int tabId, string text)
 {
     if (this.m_Chat != null)
     {
         this.m_Chat.ReceiveChatMessage(tabId, "<color=#" + CommonColorBuffer.ColorToString(this.m_PlayerColor) + "><b>" + this.m_PlayerName + "</b></color> <color=#59524bff>said:</color>" + text);
     }
 }
    public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
    {
        label = EditorGUI.BeginProperty(pos, label, prop);

        // Draw label
        pos = EditorGUI.PrefixLabel(pos, GUIUtility.GetControlID(FocusType.Passive), label);

        // Don't make child fields be indented
        var indent = EditorGUI.indentLevel;

        EditorGUI.indentLevel = 0;

        float colorWidth = (pos.width - hexFieldWidth - spacing - alphaFieldWidth - spacing);

        Color32 color  = prop.colorValue;
        Color32 color2 = EditorGUI.ColorField(new Rect(pos.x, pos.y, colorWidth, pos.height), prop.colorValue);

        if (!color2.Equals(color))
        {
            prop.colorValue = color = color2;
        }

        string colorString = EditorGUI.TextField(new Rect((pos.x + colorWidth + spacing), pos.y, hexFieldWidth, pos.height), CommonColorBuffer.ColorToString(color));

        try
        {
            color2 = CommonColorBuffer.StringToColor(colorString);

            if (!color2.Equals(color))
            {
                prop.colorValue = color = color2;
            }
        }
        catch { }


        float newAlpha = EditorGUI.Slider(new Rect((pos.x + colorWidth + hexFieldWidth + (spacing * 2f)), pos.y, alphaFieldWidth, pos.height), prop.colorValue.a, 0f, 1f);

        if (!newAlpha.Equals(prop.colorValue.a))
        {
            prop.colorValue = new Color(prop.colorValue.r, prop.colorValue.g, prop.colorValue.b, newAlpha);
        }

        // Set indent back to what it was
        EditorGUI.indentLevel = indent;

        EditorGUI.EndProperty();
    }
Beispiel #4
0
        private void UpdatePagesVisibility()
        {
            if (this.m_PagesContainer == null)
            {
                return;
            }

            if (this.m_PagesContainer.childCount > 0)
            {
                for (int i = 0; i < this.m_PagesContainer.childCount; i++)
                {
                    this.m_PagesContainer.GetChild(i).gameObject.SetActive((i == activePage) ? true : false);
                }
            }

            // Format and update the label text
            if (this.m_LabelText != null)
            {
                this.m_LabelText.text = "<color=#" + CommonColorBuffer.ColorToString(this.m_LabelActiveColor) + ">" + (this.activePage + 1).ToString() + "</color> / "
                                        + this.m_PagesContainer.childCount.ToString();
            }
        }
    public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
    {
        label = EditorGUI.BeginProperty(pos, label, prop);

        // Draw label
        pos = EditorGUI.PrefixLabel(pos, GUIUtility.GetControlID(FocusType.Passive), label);

        // Don't make child fields be indented
        var indent = EditorGUI.indentLevel;

        EditorGUI.indentLevel = 0;

        Color32 color  = prop.colorValue;
        Color32 color2 = EditorGUI.ColorField(new Rect(pos.x, pos.y, (pos.width - textFieldWidth - spacing), pos.height), prop.colorValue);

        if (!color2.Equals(color))
        {
            prop.colorValue = color = color2;
        }

        string colorString = EditorGUI.TextField(new Rect((pos.x + (pos.width - textFieldWidth) + spacing), pos.y, (textFieldWidth - spacing - 5f), pos.height), CommonColorBuffer.ColorToString(color));

        try
        {
            color2 = CommonColorBuffer.StringToColor(colorString);
            if (!color2.Equals(color))
            {
                prop.colorValue = color = color2;
            }
        }
        catch
        {
        }

        // Set indent back to what it was
        EditorGUI.indentLevel = indent;

        EditorGUI.EndProperty();
    }
 public static Color GetColor(UIItemQuality quality)
 {
     return(CommonColorBuffer.StringToColor(GetHexColor(quality)));
 }
Beispiel #7
0
 public string GetMessageTypeColorHex(MessageType msgType)
 {
     return(CommonColorBuffer.ColorToString(this.GetMessageTypeColor(msgType)));
 }