Exemplo n.º 1
0
    protected Color AssignBalloonColor(ChatUI.BalloonTypes type)
    {
        Color temp = Color.magenta;         //nonsense initialization for error-checking

        switch (type)
        {
        case ChatUI.BalloonTypes.Player:
            ColorUtility.TryParseHtmlString(PLAYER_BALLOON_COLOR_HEX, out temp);
            break;

        case ChatUI.BalloonTypes.Opponent:
            ColorUtility.TryParseHtmlString(OPPONENT_BALLOON_COLOR_HEX, out temp);
            break;

        case ChatUI.BalloonTypes.Object:
            ColorUtility.TryParseHtmlString(OBJECT_BALLOON_COLOR_HEX, out temp);
            break;

        default:
            Debug.Log("Invalid balloon type: " + type.ToString());
            break;
        }

        Debug.Assert(temp != Color.magenta, "Failed to parse color string.");

        return(temp);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Choose the appropriate speech balloon, based on who (or what) is speaking.
    ///
    /// Right now everyone uses the same image. If that changes, this function allows for that.
    /// </summary>
    /// <returns>The balloon image.</returns>
    /// <param name="type">The type of speech balloon.</param>
    protected Sprite AssignBalloonImage(ChatUI.BalloonTypes type)
    {
        Sprite temp;

        switch (type)
        {
        case ChatUI.BalloonTypes.Player:
        case ChatUI.BalloonTypes.Opponent:
        case ChatUI.BalloonTypes.Object:
            temp = Resources.Load <Sprite>(PLAYER_BALLOON_IMG);
            break;

        default:
            Debug.Log("Invalid balloon type: " + type.ToString());
            temp = Resources.Load <Sprite>(PLAYER_BALLOON_IMG);
            break;
        }

        return(temp);
    }