コード例 #1
0
ファイル: RegionTrigger.cs プロジェクト: xRainCloud/guardian
    private void OnTriggerEnter(Collider other)
    {
        GameObject gameObject = other.transform.gameObject;

        if (gameObject.layer == 8)
        {
            if (playerEventEnter == null)
            {
                return;
            }
            HERO component = gameObject.GetComponent <HERO>();
            if (component != null)
            {
                string key = (string)FengGameManagerMKII.RCVariableNames["OnPlayerEnterRegion[" + myName + "]"];
                if (FengGameManagerMKII.PlayerVariables.ContainsKey(key))
                {
                    FengGameManagerMKII.PlayerVariables[key] = component.photonView.owner;
                }
                else
                {
                    FengGameManagerMKII.PlayerVariables.Add(key, component.photonView.owner);
                }
                playerEventEnter.CheckEvent();
            }
        }
        else
        {
            if (gameObject.layer != 11 || titanEventEnter == null)
            {
                return;
            }
            TITAN component2 = gameObject.transform.root.gameObject.GetComponent <TITAN>();
            if (component2 != null)
            {
                string key = (string)FengGameManagerMKII.RCVariableNames["OnTitanEnterRegion[" + myName + "]"];
                if (FengGameManagerMKII.TitanVariables.ContainsKey(key))
                {
                    FengGameManagerMKII.TitanVariables[key] = component2;
                }
                else
                {
                    FengGameManagerMKII.TitanVariables.Add(key, component2);
                }
                titanEventEnter.CheckEvent();
            }
        }
    }
コード例 #2
0
ファイル: InRoomChat.cs プロジェクト: Mi-Sad/guardian
    public void OnGUI()
    {
        if (!IsVisible)
        {
            return;
        }

        // Chat messages
        if (boxStyle == null)
        {
            boxStyle = new GUIStyle(GUI.skin.box);
            Texture2D flat = new Texture2D(1, 1);
            flat.SetPixel(0, 0, new Color(0.125f, 0.125f, 0.125f, 0.6f));
            flat.Apply();
            boxStyle.normal.background = flat;
        }

        GUI.SetNextControlName(string.Empty);
        GUILayout.BeginArea(MessagesRect, boxStyle);
        GUILayout.FlexibleSpace();

        ScrollPosition = GUILayout.BeginScrollView(ScrollPosition);

        if (labelStyle == null)
        {
            labelStyle = new GUIStyle(GUI.skin.label)
            {
                margin  = new RectOffset(0, 0, 0, 0),
                padding = new RectOffset(0, 0, 0, 0),
                border  = new RectOffset(0, 0, 0, 0)
            };
        }

        foreach (Message message in Messages)
        {
            try
            {
                GUILayout.Label(message.ToString(), labelStyle);
                if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition) &&
                    Event.current.type != EventType.Repaint &&
                    GUI.GetNameOfFocusedControl().Equals(TextFieldName))
                {
                    if (Input.GetMouseButtonDown(0)) // Mouse1/Left Click
                    {
                        Mod.Commands.Find("translate").Execute(this, message.Content.Split(' '));
                    }
                    else if (Input.GetMouseButtonDown(1)) // Mouse2/Right Click
                    {
                        TextEditor te = new TextEditor();
                        te.content = new GUIContent(message.Content);
                        te.SelectAll();
                        te.Copy();
                    }
                }
            }
            catch { }
        }

        GUILayout.EndScrollView();
        GUILayout.EndArea();

        // Sends chat messages
        KeyCode rcChatKey = FengGameManagerMKII.InputRC.humanKeys[InputCodeRC.Chat];

        if (Event.current.type == EventType.KeyUp && Event.current.keyCode == rcChatKey && rcChatKey != KeyCode.None && !GUI.GetNameOfFocusedControl().Equals(TextFieldName))
        {
            GUI.FocusControl(TextFieldName);
            inputLine = "\t";
        }
        else if (Event.current.type == EventType.KeyDown)
        {
            if ((Event.current.keyCode == KeyCode.Tab || Event.current.character == '\t') && rcChatKey != KeyCode.Tab && !IN_GAME_MAIN_CAMERA.IsPausing)
            {
                Event.current.Use();
            }
            else if (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return)
            {
                if (GUI.GetNameOfFocusedControl().Equals(TextFieldName))
                {
                    if (!string.IsNullOrEmpty(inputLine) && inputLine != "\t")
                    {
                        if (FengGameManagerMKII.RCEvents.ContainsKey("OnChatInput"))
                        {
                            string key = (string)FengGameManagerMKII.RCVariableNames["OnChatInput"];
                            if (FengGameManagerMKII.StringVariables.ContainsKey(key))
                            {
                                FengGameManagerMKII.StringVariables[key] = inputLine;
                            }
                            else
                            {
                                FengGameManagerMKII.StringVariables.Add(key, inputLine);
                            }
                            RCEvent rcEvent = (RCEvent)FengGameManagerMKII.RCEvents["OnChatInput"];
                            rcEvent.CheckEvent();
                        }

                        if (!inputLine.StartsWith("/"))
                        {
                            string name = GExtensions.AsString(PhotonNetwork.player.customProperties[PhotonPlayerProperty.Name]).Colored();
                            if (name.Uncolored().Length <= 0)
                            {
                                name = GExtensions.AsString(PhotonNetwork.player.customProperties[PhotonPlayerProperty.Name]);
                            }
                            FengGameManagerMKII.Instance.photonView.RPC("Chat", PhotonTargets.All, Mod.HandleChat(inputLine, name));
                        }
                        else
                        {
                            Guardian.Mod.Commands.HandleCommand(this);
                        }
                    }

                    GUI.FocusControl(string.Empty);
                    inputLine = string.Empty;
                }
                else
                {
                    GUI.FocusControl(TextFieldName);
                    inputLine = "\t";
                }
            }
        }

        // Chat text-field
        if (textboxStyle == null)
        {
            textboxStyle = new GUIStyle(GUI.skin.textField);
            Texture2D flat = new Texture2D(1, 1);
            flat.SetPixel(0, 0, new Color(0.125f, 0.125f, 0.125f, 0.2f));
            flat.Apply();
            textboxStyle.normal.background = flat;

            Texture2D flatFocused = new Texture2D(1, 1);
            flatFocused.SetPixel(0, 0, new Color(0.125f, 0.125f, 0.125f, 0.6f));
            flatFocused.Apply();
            textboxStyle.focused.background = flatFocused;
        }

        GUILayout.BeginArea(ChatBoxRect);
        GUILayout.BeginHorizontal();
        GUI.SetNextControlName(TextFieldName);
        inputLine = GUILayout.TextField(inputLine, textboxStyle, GUILayout.MaxWidth(300));
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
コード例 #3
0
ファイル: RCAction.cs プロジェクト: xRainCloud/guardian
    public void DoAction()
    {
        switch (actionClass)
        {
        case 0:
            nextEvent.CheckEvent();
            break;

        case 1:
        {
            string text5 = parameters[0].returnString(null);
            int    num3  = parameters[1].ReturnInt(null);
            switch (actionType)
            {
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
                break;

            case 0:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    FengGameManagerMKII.IntVariables.Add(text5, num3);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = num3;
                }
                break;

            case 1:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] + num3;
                }
                break;

            case 2:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] - num3;
                }
                break;

            case 3:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] * num3;
                }
                break;

            case 4:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] / num3;
                }
                break;

            case 5:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)FengGameManagerMKII.IntVariables[text5] % num3;
                }
                break;

            case 6:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    CallException("Variable not found: " + text5);
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = (int)Math.Pow((int)FengGameManagerMKII.IntVariables[text5], num3);
                }
                break;

            case 12:
                if (!FengGameManagerMKII.IntVariables.ContainsKey(text5))
                {
                    FengGameManagerMKII.IntVariables.Add(text5, UnityEngine.Random.Range(num3, parameters[2].ReturnInt(null)));
                }
                else
                {
                    FengGameManagerMKII.IntVariables[text5] = UnityEngine.Random.Range(num3, parameters[2].ReturnInt(null));
                }
                break;
            }
            break;
        }

        case 2:
        {
            string text4 = parameters[0].returnString(null);
            bool   flag  = parameters[1].returnBool(null);
            switch (actionType)
            {
            case 0:
                if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4))
                {
                    FengGameManagerMKII.BoolVariables.Add(text4, flag);
                }
                else
                {
                    FengGameManagerMKII.BoolVariables[text4] = flag;
                }
                break;

            case 11:
                if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4))
                {
                    CallException("Variable not found: " + text4);
                }
                else
                {
                    FengGameManagerMKII.BoolVariables[text4] = !(bool)FengGameManagerMKII.BoolVariables[text4];
                }
                break;

            case 12:
                if (!FengGameManagerMKII.BoolVariables.ContainsKey(text4))
                {
                    FengGameManagerMKII.BoolVariables.Add(text4, Convert.ToBoolean(UnityEngine.Random.Range(0, 2)));
                }
                else
                {
                    FengGameManagerMKII.BoolVariables[text4] = Convert.ToBoolean(UnityEngine.Random.Range(0, 2));
                }
                break;
            }
            break;
        }

        case 3:
        {
            string key3 = parameters[0].returnString(null);
            switch (actionType)
            {
            case 0:
            {
                string value2 = parameters[1].returnString(null);
                if (!FengGameManagerMKII.StringVariables.ContainsKey(key3))
                {
                    FengGameManagerMKII.StringVariables.Add(key3, value2);
                }
                else
                {
                    FengGameManagerMKII.StringVariables[key3] = value2;
                }
                break;
            }

            case 7:
            {
                string text3 = string.Empty;
                for (int i = 1; i < parameters.Length; i++)
                {
                    text3 += parameters[i].returnString(null);
                }
                if (!FengGameManagerMKII.StringVariables.ContainsKey(key3))
                {
                    FengGameManagerMKII.StringVariables.Add(key3, text3);
                }
                else
                {
                    FengGameManagerMKII.StringVariables[key3] = text3;
                }
                break;
            }

            case 8:
            {
                string str = parameters[1].returnString(null);
                if (!FengGameManagerMKII.StringVariables.ContainsKey(key3))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.StringVariables[key3] = (string)FengGameManagerMKII.StringVariables[key3] + str;
                }
                break;
            }

            case 9:
            {
                string text = parameters[1].returnString(null);
                if (!FengGameManagerMKII.StringVariables.ContainsKey(key3))
                {
                    CallException("No Variable");
                    break;
                }
                string text2 = (string)FengGameManagerMKII.StringVariables[key3];
                FengGameManagerMKII.StringVariables[key3] = text2.Replace(parameters[1].returnString(null), parameters[2].returnString(null));
                break;
            }
            }
            break;
        }

        case 4:
        {
            string key2 = parameters[0].returnString(null);
            float  num2 = parameters[1].returnFloat(null);
            switch (actionType)
            {
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
                break;

            case 0:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    FengGameManagerMKII.FloatVariables.Add(key2, num2);
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = num2;
                }
                break;

            case 1:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] + num2;
                }
                break;

            case 2:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] - num2;
                }
                break;

            case 3:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] * num2;
                }
                break;

            case 4:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] / num2;
                }
                break;

            case 5:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)FengGameManagerMKII.FloatVariables[key2] % num2;
                }
                break;

            case 6:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    CallException("No Variable");
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = (float)Math.Pow((int)FengGameManagerMKII.FloatVariables[key2], num2);
                }
                break;

            case 12:
                if (!FengGameManagerMKII.FloatVariables.ContainsKey(key2))
                {
                    FengGameManagerMKII.FloatVariables.Add(key2, UnityEngine.Random.Range(num2, parameters[2].returnFloat(null)));
                }
                else
                {
                    FengGameManagerMKII.FloatVariables[key2] = UnityEngine.Random.Range(num2, parameters[2].returnFloat(null));
                }
                break;
            }
            break;
        }

        case 5:
        {
            string       key4   = parameters[0].returnString(null);
            PhotonPlayer value3 = parameters[1].returnPlayer(null);
            if (actionType == 0)
            {
                if (!FengGameManagerMKII.PlayerVariables.ContainsKey(key4))
                {
                    FengGameManagerMKII.PlayerVariables.Add(key4, value3);
                }
                else
                {
                    FengGameManagerMKII.PlayerVariables[key4] = value3;
                }
            }
            break;
        }

        case 6:
        {
            string key   = parameters[0].returnString(null);
            TITAN  value = parameters[1].returnTitan(null);
            if (actionType == 0)
            {
                if (!FengGameManagerMKII.TitanVariables.ContainsKey(key))
                {
                    FengGameManagerMKII.TitanVariables.Add(key, value);
                }
                else
                {
                    FengGameManagerMKII.TitanVariables[key] = value;
                }
            }
            break;
        }

        case 7:
        {
            PhotonPlayer photonPlayer = parameters[0].returnPlayer(null);
            switch (actionType)
            {
            case 0:
            {
                if (FengGameManagerMKII.HeroHash.ContainsKey(photonPlayer.Id))
                {
                    HERO hERO2 = (HERO)FengGameManagerMKII.HeroHash[photonPlayer.Id];
                    hERO2.MarkDead();
                    hERO2.photonView.RPC("netDie2", PhotonTargets.All, -1, parameters[1].returnString(null) + " ");
                }
                else
                {
                    CallException("Player Not Alive");
                }
                break;
            }

            case 1:
                FengGameManagerMKII.Instance.photonView.RPC("respawnHeroInNewRound", photonPlayer);
                break;

            case 2:
                FengGameManagerMKII.Instance.photonView.RPC("spawnPlayerAtRPC", photonPlayer, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null));
                break;

            case 3:
            {
                int iD = photonPlayer.Id;
                if (FengGameManagerMKII.HeroHash.ContainsKey(iD))
                {
                    HERO hERO = (HERO)FengGameManagerMKII.HeroHash[iD];
                    hERO.photonView.RPC("moveToRPC", photonPlayer, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null));
                }
                else
                {
                    CallException("Player Not Alive");
                }
                break;
            }

            case 4:
            {
                Hashtable hashtable11 = new Hashtable();
                hashtable11.Add(PhotonPlayerProperty.Kills, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable11);
                break;
            }

            case 5:
            {
                Hashtable hashtable10 = new Hashtable();
                hashtable10.Add(PhotonPlayerProperty.Deaths, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable10);
                break;
            }

            case 6:
            {
                Hashtable hashtable9 = new Hashtable();
                hashtable9.Add(PhotonPlayerProperty.MaxDamage, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable9);
                break;
            }

            case 7:
            {
                Hashtable hashtable8 = new Hashtable();
                hashtable8.Add(PhotonPlayerProperty.TotalDamage, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable8);
                break;
            }

            case 8:
            {
                Hashtable hashtable7 = new Hashtable();
                hashtable7.Add(PhotonPlayerProperty.Name, parameters[1].returnString(null));
                photonPlayer.SetCustomProperties(hashtable7);
                break;
            }

            case 9:
            {
                Hashtable hashtable6 = new Hashtable();
                hashtable6.Add(PhotonPlayerProperty.Guild, parameters[1].returnString(null));
                photonPlayer.SetCustomProperties(hashtable6);
                break;
            }

            case 10:
            {
                Hashtable hashtable5 = new Hashtable();
                hashtable5.Add(PhotonPlayerProperty.RCTeam, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable5);
                break;
            }

            case 11:
            {
                Hashtable hashtable4 = new Hashtable();
                hashtable4.Add(PhotonPlayerProperty.CustomInt, parameters[1].ReturnInt(null));
                photonPlayer.SetCustomProperties(hashtable4);
                break;
            }

            case 12:
            {
                Hashtable hashtable3 = new Hashtable();
                hashtable3.Add(PhotonPlayerProperty.CustomBool, parameters[1].returnBool(null));
                photonPlayer.SetCustomProperties(hashtable3);
                break;
            }

            case 13:
            {
                Hashtable hashtable2 = new Hashtable();
                hashtable2.Add(PhotonPlayerProperty.CustomString, parameters[1].returnString(null));
                photonPlayer.SetCustomProperties(hashtable2);
                break;
            }

            case 14:
            {
                Hashtable hashtable = new Hashtable();
                hashtable.Add(PhotonPlayerProperty.RCTeam, parameters[1].returnFloat(null));
                photonPlayer.SetCustomProperties(hashtable);
                break;
            }
            }
            break;
        }

        case 8:
            switch (actionType)
            {
            case 0:
            {
                TITAN    titanObj = parameters[0].returnTitan(null);
                object[] array    = new object[2]
                {
                    parameters[1].returnPlayer(null).Id,
                    parameters[2].ReturnInt(null)
                };
                titanObj.photonView.RPC("titanGetHit", titanObj.photonView.owner, array);
                break;
            }

            case 1:
                FengGameManagerMKII.Instance.SpawnTitanAction(parameters[0].ReturnInt(null), parameters[1].returnFloat(null), parameters[2].ReturnInt(null), parameters[3].ReturnInt(null));
                break;

            case 2:
                FengGameManagerMKII.Instance.SpawnTitanAtAction(parameters[0].ReturnInt(null), parameters[1].returnFloat(null), parameters[2].ReturnInt(null), parameters[3].ReturnInt(null), parameters[4].returnFloat(null), parameters[5].returnFloat(null), parameters[6].returnFloat(null));
                break;

            case 3:
            {
                TITAN titanObj = parameters[0].returnTitan(null);
                int   num      = titanObj.currentHealth = parameters[1].ReturnInt(null);
                if (titanObj.maxHealth == 0)
                {
                    titanObj.maxHealth = titanObj.currentHealth;
                }
                titanObj.photonView.RPC("labelRPC", PhotonTargets.AllBuffered, titanObj.currentHealth, titanObj.maxHealth);
                break;
            }

            case 4:
            {
                TITAN titanObj = parameters[0].returnTitan(null);
                if (titanObj.photonView.isMine)
                {
                    titanObj.MoveTo(parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null));
                }
                else
                {
                    titanObj.photonView.RPC("moveToRPC", titanObj.photonView.owner, parameters[1].returnFloat(null), parameters[2].returnFloat(null), parameters[3].returnFloat(null));
                }
                break;
            }
            }
            break;

        case 9:
            switch (actionType)
            {
            case 0:
                FengGameManagerMKII.Instance.photonView.RPC("Chat", PhotonTargets.All, parameters[0].returnString(null), string.Empty);
                break;

            case 2:
                FengGameManagerMKII.Instance.LoseGame();
                if (parameters[0].returnBool(null))
                {
                    FengGameManagerMKII.IntVariables.Clear();
                    FengGameManagerMKII.BoolVariables.Clear();
                    FengGameManagerMKII.StringVariables.Clear();
                    FengGameManagerMKII.FloatVariables.Clear();
                    FengGameManagerMKII.PlayerVariables.Clear();
                    FengGameManagerMKII.TitanVariables.Clear();
                }
                break;

            case 1:
                FengGameManagerMKII.Instance.WinGame();
                if (parameters[0].returnBool(null))
                {
                    FengGameManagerMKII.IntVariables.Clear();
                    FengGameManagerMKII.BoolVariables.Clear();
                    FengGameManagerMKII.StringVariables.Clear();
                    FengGameManagerMKII.FloatVariables.Clear();
                    FengGameManagerMKII.PlayerVariables.Clear();
                    FengGameManagerMKII.TitanVariables.Clear();
                }
                break;

            case 3:
                if (parameters[0].returnBool(null))
                {
                    FengGameManagerMKII.IntVariables.Clear();
                    FengGameManagerMKII.BoolVariables.Clear();
                    FengGameManagerMKII.StringVariables.Clear();
                    FengGameManagerMKII.FloatVariables.Clear();
                    FengGameManagerMKII.PlayerVariables.Clear();
                    FengGameManagerMKII.TitanVariables.Clear();
                }
                FengGameManagerMKII.Instance.RestartGame();
                break;
            }
            break;
        }
    }
コード例 #4
0
    private void HandleInput()
    {
        if (Event.current == null)
        {
            return;
        }

        KeyCode rcChatKey = FengGameManagerMKII.InputRC.humanKeys[InputCodeRC.Chat];

        if (Event.current.type == EventType.KeyUp)
        {
            if (rcChatKey == KeyCode.None || Event.current.keyCode != rcChatKey ||
                GUI.GetNameOfFocusedControl().Equals(TextFieldName))
            {
                return;
            }
            GUI.FocusControl(TextFieldName);
            inputLine = "\t";
        }

        if (Event.current.type != EventType.KeyDown)
        {
            return;
        }

        if (Event.current.character == '/' &&
            !GUI.GetNameOfFocusedControl().Equals(TextFieldName))
        {
            GUI.FocusControl(TextFieldName);
            inputLine = "/";
        }
        else if (Event.current.character == '\t' && rcChatKey != KeyCode.Tab &&
                 !IN_GAME_MAIN_CAMERA.IsPausing)
        {
            Event.current.Use();
        }

        if (Event.current.keyCode != KeyCode.KeypadEnter && Event.current.keyCode != KeyCode.Return)
        {
            return;
        }

        if (GUI.GetNameOfFocusedControl().Equals(TextFieldName))
        {
            if (!string.IsNullOrEmpty(inputLine) && inputLine != "\t")
            {
                if (FengGameManagerMKII.RCEvents.ContainsKey("OnChatInput"))
                {
                    string key = (string)FengGameManagerMKII.RCVariableNames["OnChatInput"];
                    if (FengGameManagerMKII.StringVariables.ContainsKey(key))
                    {
                        FengGameManagerMKII.StringVariables[key] = inputLine;
                    }
                    else
                    {
                        FengGameManagerMKII.StringVariables.Add(key, inputLine);
                    }
                    RCEvent rcEvent = (RCEvent)FengGameManagerMKII.RCEvents["OnChatInput"];
                    rcEvent.CheckEvent();
                }

                if (!inputLine.StartsWith("/"))
                {
                    string name = GExtensions.AsString(PhotonNetwork.player.customProperties[PhotonPlayerProperty.Name]).NGUIToUnity();
                    if (name.StripNGUI().Length < 1)
                    {
                        name = GExtensions.AsString(PhotonNetwork.player.customProperties[PhotonPlayerProperty.Name]);
                    }
                    FengGameManagerMKII.Instance.photonView.RPC("Chat", PhotonTargets.All, FormatMessage(inputLine, name));
                }
                else
                {
                    Guardian.Mod.Commands.HandleCommand(this);
                }
            }

            GUI.FocusControl(string.Empty);
            inputLine = string.Empty;
        }
        else
        {
            GUI.FocusControl(TextFieldName);
            inputLine = "\t";
        }
    }