Ejemplo n.º 1
0
 public void OnGUI()
 {
     if (chatView)
     {
         if (!BrickManager.Instance.IsLoaded)
         {
             GlobalVars.Instance.BeginGUI(null);
         }
         GUISkin skin = GUI.skin;
         GUI.skin    = GUISkinFinder.Instance.GetGUISkin();
         GUI.depth   = 25;
         GUI.enabled = !DialogManager.Instance.IsModal;
         string       buttonText = string.Empty;
         GUIContent[] array      = new GUIContent[chatModes.Length];
         for (int i = 0; i < array.Length; i++)
         {
             array[i] = new GUIContent(chatModes[i]);
             if (selected == i)
             {
                 buttonText = chatModes[i];
             }
         }
         int num = selected;
         selected = cbox.List(crdCombo, buttonText, array);
         if (num != selected)
         {
             if (selected == 0)
             {
                 chatMode = ChatText.CHAT_TYPE.NORMAL;
             }
             else if (selected == 1)
             {
                 chatMode = ChatText.CHAT_TYPE.CLAN;
             }
             else if (selected == 2)
             {
                 chatMode = ChatText.CHAT_TYPE.TEAM;
             }
             changeParentChatMode();
         }
         GUI.skin    = skin;
         GUI.enabled = true;
         if (!BrickManager.Instance.IsLoaded)
         {
             GlobalVars.Instance.EndGUI();
         }
     }
 }
Ejemplo n.º 2
0
    public void Start()
    {
        chatQ      = new Queue <ChatText>();
        chatMode   = ChatText.CHAT_TYPE.NORMAL;
        bBtnActive = true;
        GameObject gameObject = GameObject.Find("Main");

        if (null != gameObject)
        {
            ChatSelectBtns component = gameObject.GetComponent <ChatSelectBtns>();
            if (component != null)
            {
                component.chatModeLobby();
            }
        }
    }
Ejemplo n.º 3
0
    public void changeChildIdx(ChatText.CHAT_TYPE chatType)
    {
        switch (chatType)
        {
        case ChatText.CHAT_TYPE.NORMAL:
            cbox.SetSelectedItemIndex(0);
            break;

        case ChatText.CHAT_TYPE.CLAN:
            cbox.SetSelectedItemIndex(1);
            break;

        case ChatText.CHAT_TYPE.TEAM:
            cbox.SetSelectedItemIndex(2);
            break;

        case ChatText.CHAT_TYPE.WHISPER:
            cbox.SetSelectedItemIndex(3);
            break;
        }
    }
Ejemplo n.º 4
0
 private void CheckChatKey2()
 {
     if (custom_inputs.Instance.GetButtonDown("K_NORMAL_CHAT"))
     {
         chatMode = ChatText.CHAT_TYPE.NORMAL;
         changeChildButton();
     }
     else if (custom_inputs.Instance.GetButtonDown("K_CLAN_CHAT"))
     {
         if (MyInfoManager.Instance.IsClanMember)
         {
             chatMode = ChatText.CHAT_TYPE.CLAN;
             changeChildButton();
         }
     }
     else if (custom_inputs.Instance.GetButtonDown("K_TEAM_CHAT"))
     {
         chatMode = ChatText.CHAT_TYPE.TEAM;
         changeChildButton();
     }
 }
Ejemplo n.º 5
0
 private void Awake()
 {
     chatQ    = new Queue <ChatText>();
     chatMode = ChatText.CHAT_TYPE.NORMAL;
 }
Ejemplo n.º 6
0
    private void CheckChatKey()
    {
        if (Event.current.type == EventType.KeyDown && !DialogManager.Instance.IsModal)
        {
            if (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)
            {
                chatting = !chatting;
                if (chatting)
                {
                    SetTranceparancy(0);
                }
                else
                {
                    SetTranceparancy(1);
                }
                if (!chatting && message.Length > 0)
                {
                    CommandInterpreter.Instance.IsWhisper = false;
                    if (ChatLogManager.Instance.Log(message) && !CommandInterpreter.Instance.Parse(message))
                    {
                        message = RemoveSystemKey(message);
                        switch (chatMode)
                        {
                        case ChatText.CHAT_TYPE.NORMAL:
                            if (MyInfoManager.Instance.CheckChatTime())
                            {
                                CSNetManager.Instance.Sock.SendCS_CHAT_REQ(message);
                            }
                            else
                            {
                                string text = string.Format(StringMgr.Instance.Get("LIMITED_CHAT_TIME"), CustomGameConfig.limitChatTime, CustomGameConfig.limitChatCount, CustomGameConfig.chatBlockTime);
                                Enqueue(new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, string.Empty, text));
                            }
                            break;

                        case ChatText.CHAT_TYPE.CLAN:
                            CSNetManager.Instance.Sock.SendCS_CLAN_CHAT_REQ(message);
                            break;

                        case ChatText.CHAT_TYPE.TEAM:
                            CSNetManager.Instance.Sock.SendCS_TEAM_CHAT_REQ(message);
                            break;

                        case ChatText.CHAT_TYPE.SYSTEM:
                            CSNetManager.Instance.Sock.SendCS_GM_SAYS_REQ(message);
                            break;
                        }
                    }
                    message = string.Empty;
                    if (!CommandInterpreter.Instance.IsWhisper)
                    {
                        GlobalVars.Instance.whisperNickTo = string.Empty;
                    }
                    if (GlobalVars.Instance.whisperNickTo.Length > 0)
                    {
                        message     = "/w " + GlobalVars.Instance.whisperNickTo + " ";
                        cursorToEnd = true;
                    }
                }
            }
            else if (chatting && Event.current.keyCode == KeyCode.Escape)
            {
                chatting = !chatting;
                message  = string.Empty;
                GlobalVars.Instance.resetMenuEx();
            }
            else if (MyInfoManager.Instance.IsGM && Input.GetKeyDown(KeyCode.F4))
            {
                chatMode = ChatText.CHAT_TYPE.SYSTEM;
                if (!chatting)
                {
                    chatting = true;
                }
            }
            else if (Event.current.keyCode == KeyCode.UpArrow)
            {
                if (chatting)
                {
                    string command = message;
                    command = CommandInterpreter.Instance.GetNextCommand(command);
                    if (command.Length > 0)
                    {
                        message = command;
                    }
                }
            }
            else if (Event.current.keyCode == KeyCode.DownArrow && chatting)
            {
                string command2 = message;
                command2 = CommandInterpreter.Instance.GetPrevCommand(command2);
                if (command2.Length > 0)
                {
                    message = command2;
                }
            }
        }
    }
Ejemplo n.º 7
0
    public void OnGUI()
    {
        int  num3     = GUI.depth = (GUI.depth = 50);
        Rect position = new Rect(crdClient);

        GUI.Box(position, string.Empty, "BoxChatBase");
        Rect position2 = new Rect(crdChatRead);

        position2.y      = crdChatRead.y - 35f;
        position2.width  = crdChatRead.width - 120f;
        position2.height = 34f;
        string[] array = new string[3]
        {
            StringMgr.Instance.Get("ALL"),
            StringMgr.Instance.Get("WHISPER"),
            StringMgr.Instance.Get("CLAN")
        };
        if (!DialogManager.Instance.IsModal && !bBtnActive)
        {
            GUI.enabled = false;
        }
        int num4 = selected;

        selected = GUI.SelectionGrid(position2, selected, array, array.Length, "BtnChat");
        if (num4 != selected)
        {
            if (selected == 0)
            {
                chatMode = ChatText.CHAT_TYPE.NORMAL;
            }
            else if (selected == 1)
            {
                chatMode = ChatText.CHAT_TYPE.NORMAL;
            }
            else if (selected == 2 && MyInfoManager.Instance.IsClanMember)
            {
                chatMode = ChatText.CHAT_TYPE.CLAN;
            }
            changeChildButton();
        }
        CheckChatKey();
        ApplyFocus();
        string nextControlName = "ChatInput";
        string text            = message;

        switch (chatMode)
        {
        case ChatText.CHAT_TYPE.NORMAL:
            GUI.SetNextControlName(nextControlName);
            message = GUI.TextField(crdInputTxtFld, message);
            break;

        case ChatText.CHAT_TYPE.CLAN:
            GUI.SetNextControlName(nextControlName);
            message = GUI.TextField(crdInputTxtFld, message, "ClanChat");
            break;

        case ChatText.CHAT_TYPE.TEAM:
            GUI.SetNextControlName(nextControlName);
            message = GUI.TextField(crdInputTxtFld, message, "TeamChat");
            break;

        case ChatText.CHAT_TYPE.SYSTEM:
            GUI.SetNextControlName(nextControlName);
            message = GUI.TextField(crdInputTxtFld, message, "GmChat");
            break;
        }
        if (message.Length > maxMessageLength)
        {
            message = text;
        }
        if (GlobalVars.Instance.whisperNickFrom.Length > 0 && CommandInterpreter.Instance.IsReturnWhisper(message))
        {
            message     = "/w " + GlobalVars.Instance.whisperNickFrom + " ";
            cursorToEnd = true;
        }
        if (cursorToEnd)
        {
            cursorToEnd = false;
            TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
            if (textEditor != null)
            {
                textEditor.pos       = 1000;
                textEditor.selectPos = 1000;
            }
        }
        float num5 = viewSizeCopy.y - crdChatRead.height;

        if (num5 < 0f)
        {
            num5 = 0f;
        }
        bool flag = num5 <= scrollPosition.y;

        CalcViewSize(selected);
        if (flag)
        {
            scrollPosition.y = viewSizeCopy.y - crdChatRead.height;
            if (scrollPosition.y < 0f)
            {
                scrollPosition.y = 0f;
            }
        }
        scrollPosition = GUI.BeginScrollView(crdChatRead, scrollPosition, new Rect(0f, 0f, viewSizeCopy.x, viewSizeCopy.y));
        float   y    = scrollPosition.y;
        float   num6 = scrollPosition.y + crdChatRead.height;
        Vector2 pos  = new Vector2(0f, 0f);

        foreach (ChatText item in chatQ)
        {
            if (item.Filtered(selected))
            {
                Vector2 vector = LabelUtil.CalcSize("MissionLabel", item.FullMessage, viewSizeCopy.x);
                float   y2     = pos.y;
                float   num7   = pos.y + vector.y;
                if (num7 >= y && y2 <= num6)
                {
                    LabelUtil.TextOut(pos, item.FullMessage, "MissionLabel", item.TextColor, item.OutlineColor, TextAnchor.UpperLeft, viewSizeCopy.x);
                    if (GlobalVars.Instance.MyButton(new Rect(pos.x, pos.y, vector.x, vector.y), string.Empty, "InvisibleButton") && Event.current.button == 1 && item.Seq >= 0 && item.Seq != MyInfoManager.Instance.Seq)
                    {
                        UserMenu userMenu = ContextMenuManager.Instance.Popup();
                        if (userMenu != null)
                        {
                            bool flag2 = MyInfoManager.Instance.IsClanee(item.Seq);
                            userMenu.InitDialog(MouseUtil.ScreenToPixelPoint(Input.mousePosition), item.Seq, item.Speaker, !flag2, masterAssign: false);
                        }
                    }
                }
                pos.y += vector.y;
            }
        }
        GUI.EndScrollView();
        if (!DialogManager.Instance.IsModal && !bBtnActive)
        {
            GUI.enabled = true;
        }
    }