Exemple #1
0
 // get the instance of ChatBubbleContainer, or create it
 public static ChatBubbleContainer Instance()
 {
     if (null == _instance)
     {
         _instance = new ChatBubbleContainer();
     }
     return(_instance);
 }
Exemple #2
0
 // we're finished with the chat bubble
 public void Hide()
 {
     if (null != _chatBubble)
     {
         ChatBubbleContainer.Instance().StopUsingChatBubble(_chatBubble);
         _chatBubble = null;
     }
     _chatBubbleLabel  = null;
     _chatBubbleSprite = null;
 }
Exemple #3
0
    private void Start()
    {
        _gameCam = Camera.main;
        _UICam   = UICamera.mainCamera;

        if (PlayerManager.IsLocalPlayer(gameObject))
        {
            ChatBubbleContainer.Instance().EnsureMinimumAmountOfChatBubblesExist();
        }

        CalculateOffsetToTopOfCharactersHead();

        if (PlayerManager.IsPlayer(gameObject))         // we only need the inventory component for the player
        {
            //_inventory = GetComponent<InventoryComponent>();
        }
    }
Exemple #4
0
    //private InventoryComponent _inventory;

    // show the specified text
    public void Show(string chatText)
    {
        if (null == _chatBubbleLabel)
        {
            ChatBubbleContainer.Instance().StartUsingChatBubble(bubbleTypeRequired, ref _chatBubble, ref _chatBubbleLabel, ref _chatBubbleSprite);

            if (!_chatBubble || !_chatBubbleLabel || !_chatBubbleSprite)             // if we are missing any of the objects we need
            {
                Hide();
            }
        }

        if (null != _chatBubbleLabel)
        {
            _chatBubbleLabel.text = StringUtils.ReplaceTokens(chatText);

            bool hasColorBeenSet = false;
            //if (_inventory) // we only cache the inventory component for the player (see Start function)
            //{
            //DyeModel dye = _inventory.GetArmorDye();
            //if (dye)
            //{
            //	_chatBubbleLabel.color = new Color(dye.displayColor.r, dye.displayColor.g, dye.displayColor.b, 1f);
            //	hasColorBeenSet = true;
            //}
            //}

            if (!hasColorBeenSet)
            {
                CharacterModel model = GameUtils.GetCharacterModel(gameObject);
                if (null != model)
                {
                    _chatBubbleLabel.color = model.dialogueTextColor;
                }
            }

            _displayStartTime = Time.time;

            CalculateOffsetToTopOfCharactersHead();
        }
    }