Esempio n. 1
0
    /// <summary>
    /// Creates a new chat window with the supplied tab data.
    /// Adds a tab to an existing window if an existing window is supplied.
    /// </summary>
    /// <param name="tabData">tab data that decides which channels the chat listens to</param>
    /// <param name="existingWindow">an existing windwo to add a chat tab to rather than create a new window</param>
    /// <param name="position">position for the new window (vector2.zero for default position)</param>
    public void CreateChatWindow(ChatTabData tabData, ChatWindow existingWindow, Vector2 position)
    {
        if (existingWindow)
        {
            existingWindow.AddTab(tabData);
        }
        else
        {
            chatWindow = Instantiate(chatWindowPrefab, transform);
            if (position != Vector2.zero)
            {
                chatWindow.transform.position = position;
            }

            chatWindow.Init(tabData, this, sender.GetComponent <ChatRegister>());
        }
    }