Пример #1
0
    private void InitializeMessages()
    {
        CreateNewPrivateDialog("Default", ChatTypeEnum.Default, false);
        BtnChatManager.BtnChangeLastCommunication(ChatTypeEnum.Default, "Default");

        Message msg1 = new Message("Tibia3d", "Welcome");

        Chat.Enqueue(msg1);
    }
Пример #2
0
    private void CreateNewPrivateDialog(string nick, ChatTypeEnum chatTypeEnum = ChatTypeEnum.Private, bool canClose = false)
    {
        ChatType newChatBtn = (Instantiate(GUIHandler.instance.prefabChatBtn, GUIHandler.instance.ChatSwitchPanel.transform)).GetComponent <ChatType>();

        newChatBtn._chatTypeEnum = chatTypeEnum;
        newChatBtn.name_chat     = nick;
        newChatBtn.canClose      = canClose;

        newChatBtn.Initialize();

        BtnChatManager.ChatTypeOpen.Add(newChatBtn);
        GUIHandler.instance.MenuCreateNewChat.SetActive(false);
        newChatBtn.GetComponent <Button>().onClick.AddListener(() => BtnChatManager.BtnChangeLastCommunication(newChatBtn._chatTypeEnum, newChatBtn.name_chat));


        BtnChatManager.BtnChangeLastCommunication(newChatBtn._chatTypeEnum, newChatBtn.name_chat);
        RefreshChat();
    }
Пример #3
0
    public void RefreshChat(bool displayPrivateMessageOnCenter = false)
    {
        string tempContent = "";

        foreach (Message msg in Chat)
        {
            if (BtnChatManager.lastClickedEnum == ChatTypeEnum.Default)
            {
                if (msg.chatTypeEnum == ChatTypeEnum.Default)
                {
                    tempContent += "<color=orange>" + msg.whoSaid + ": " + msg.whatSaid + "</color>" + "\n";
                }
                else if (msg.chatTypeEnum == ChatTypeEnum.Private)
                {
                    if (BtnChatManager.ChatTypeIsOpen(msg.whoSaid) == false && msg.whoSaid != ClientGameManager.instance.mainPlayer.nick)
                    {
                        tempContent += "<color=aqua>" + msg.whoSaid + ": " + msg.whatSaid + "</color>" + "\n";
                    }
                }
            }

            else if (BtnChatManager.lastClickedEnum == ChatTypeEnum.Private)
            {
                if (msg.chatTypeEnum == ChatTypeEnum.Private)
                {
                    if (msg.whoSaid == BtnChatManager.name_chat)
                    {
                        tempContent += "<color=aqua>" + msg.whoSaid + ": " + msg.whatSaid + "</color>" + "\n";
                    }
                    else if (msg.whoSaid == ClientGameManager.instance.mainPlayer.nick && msg.name_chat == BtnChatManager.name_chat)
                    {
                        tempContent += "<color=blue>" + msg.whoSaid + ": " + msg.whatSaid + "</color>" + "\n";
                    }
                }
            }
        }


        contentText.text = tempContent;
    }