Beispiel #1
0
        private void SendBtn_Click(object sender, EventArgs e)
        {
            string text = ChatBox.Text;

            if (!text.Equals(""))
            {
                if (ContentBox.Text.Equals(""))
                {
                    ContentBox.Text = "나: " + text;
                }
                else
                {
                    ContentBox.Text += "\n" + "나: " + text;
                }
                ChatBox.Text = "";
                ChatBox.Focus();
                ContentBox.SelectionStart = ContentBox.Text.Length;
                ContentBox.ScrollToCaret();
            }
            //else
            //{
            //    MessageBox.Show("내용을 입력해주세요.", "SocketChat",
            //        MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
        }
        private void ChatHook(On.RoR2.UI.ChatBox.orig_SubmitChat orig, ChatBox chatbox)
        {
            var field = chatbox.inputField;
            var text  = field.text;
            var args  = text.Split(' ');

            if (text.StartsWith("/"))
            {
                text = text.Substring(1);

                if (text.StartsWith("dump"))
                {
                    Dump();
                    field.text = "";
                }
                else if (text.StartsWith("swapi"))
                {
                    if (args.Length > 2)
                    {
                        Swap(args[1], args[2]);
                    }
                    else
                    {
                        Chat.AddMessage("usage: /swapi <slot> <skill_index>");
                    }
                    field.text = "";
                }
                else if (text.StartsWith("swap"))
                {
                    if (args.Length > 2)
                    {
                        SwapS(args[1], args[2]);
                    }
                    else
                    {
                        Chat.AddMessage("usage: /swap <slot> <skill_name>");
                    }
                    field.text = "";
                }
                else if (text.StartsWith("reapply"))
                {
                    Reapply();
                    field.text = "";
                }
                else if (text.StartsWith("reset"))
                {
                    if (args.Length > 1)
                    {
                        Reset(args[1]);
                    }
                    else
                    {
                        Chat.AddMessage("usage: /reset <slot>");
                    }
                    field.text = "";
                }
            }

            orig.Invoke(chatbox);
        }
Beispiel #3
0
        public override void LoadContent()
        {
            var abilityIcon = _content.Load <Texture2D>("Battle/AbilityIcon");

            var position = new Vector2(200, 500);

            _actors = _players.Select(c =>
            {
                var player = new Player(_content, position, _graphics.GraphicsDevice)
                {
                    ActorModel     = c,
                    LeftHandWeapon = GetWeapon(c.EquipmentModel.EquipmentType, c.EquipmentModel.LeftHandEquipmentPath),
                    Lower          = !string.IsNullOrEmpty(c.Lower) ? new Clothing(_content.Load <Texture2D>(c.Lower)) : null,
                    Upper          = !string.IsNullOrEmpty(c.Upper) ? new Clothing(_content.Load <Texture2D>(c.Upper)) : null,
                };

                position += new Vector2(200, 0);

                return(player);
            }).Cast <Actor>().ToList();

            var grassTexture = _content.Load <Texture2D>("Battle/Grasses/Grass");

            _background = new Sprite(grassTexture)
            {
                Position = new Vector2(grassTexture.Width / 2, grassTexture.Height / 2),
            };

            EnemyLoader eLoader = new EnemyLoader(_content);

            var enemies = eLoader.Load(EnemyLoader.Areas.CalmLands);

            var enemyPosition = new Vector2(200, 100);

            _actors.AddRange(enemies.Select(c =>
            {
                var enemy = new Enemy(_content, enemyPosition, _graphics.GraphicsDevice)
                {
                    ActorModel     = c,
                    LeftHandWeapon = GetWeapon(c.EquipmentModel.EquipmentType, c.EquipmentModel.LeftHandEquipmentPath),
                };
                enemyPosition += new Vector2(200, 0);

                return(enemy);
            }
                                            ).Cast <Actor>().ToList());

            _actors = _actors.OrderByDescending(c => c.ActorModel.Speed).ToList();

            _battleGUI = new BattleStateGUI(_gameModel);
            _battleGUI.SetAbilities(_actors.First().ActorModel);
            _battleGUI.SetTurns(_actors.Select(c => c.ActorModel).ToList());

            _chatBox = new ChatBox(_gameModel, _content.Load <SpriteFont>("Fonts/Font"));

            if (_conversation != null && _conversation.Count > 0)
            {
                _chatBox.Write(_conversation.First());
            }
        }
Beispiel #4
0
 static void EnterNext()
 {
     CurrentDay += 1;
     ChatBox.ClearQueue();
     SaveSystem.Save();
     SceneManager.LoadScene(CurrentDay);
 }
Beispiel #5
0
 void ReceiveMessage()               // функция приема даных
 {
     byte[] buffer = new byte[1024]; // буфер для приема сообщений от сервера
     for (int i = 0; i < buffer.Length; i++)
     {
         buffer[i] = 0; // чистим буфер заполняя "0"
     }
     for (; ;)          // безконечный цикл
     {
         try
         {
             Client.Receive(buffer);                           // принимаем даные от сервера, записав их в "buffer"
             string message = Encoding.UTF8.GetString(buffer); // декодируем сообщение с "buffer" заннося полученый текст в строку "message"
             int    count   = message.IndexOf(";;;5");         // инициализируем размер сообщения начало и конец строки с помощью функции IndexOF которая будет задавать конец сообщения когда найдет последователость ";;;5" в строке
             if (count == -1)                                  // если IndexOF не сработал, игнорируеем сообщение.
             {
                 continue;
             }
             string Clear_Message = ""; // создаем буфер для отображения сообщения в чате
             for (int i = 0; i < count; i++)
             {
                 Clear_Message += message[i]; // заносим в него уже отформаттированый текст (декодированый, с задаными параметрами начала и конца строки)
             }
             for (int i = 0; i < buffer.Length; i++)
             {
                 buffer[i] = 0;                     // чистим буфер приема сообщений с сервера
             }
             this.Invoke((MethodInvoker) delegate() // ф-ция "this" нужна для возможности получения доступа для потока к элементу формы (окно отображения сообщений)
             {
                 ChatBox.AppendText(Clear_Message); // выводим в чат буфер с отформатированым текстом с помщью фунции "AppendText"
             });
         }
         catch (Exception ex) { }
     }
 }
Beispiel #6
0
        private GameScreen()
        {
            handlers  = new Stack <IInputHandler>();
            mapCursor = new MapCursor();

            titleFont   = IO.LoadFont("Data/Global/TitleFont");
            actionFont  = IO.LoadFont("Data/Global/ActionFont");
            messageFont = IO.LoadFont("Data/Global/MessageFont");

            topEdgePosition    = Vector2.Zero;
            bottomEdgePosition = new Vector2(0, 788);
            leftEdgePosition   = new Vector2(0, 12);
            midleEdgePosition  = new Vector2(980, 12);
            rightEdgePosition  = new Vector2(1268, 12);

            hEdgeTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "horizontaledge");
            vEdgeTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "verticaledge");

            tacticsTitlePosition = new Vector2(183, 339);
            battleTitlePosition  = new Vector2(137, 339);
            titleColor           = new Color(0, 0, 0, 255);

            actionBoxTexture = IO.LoadSingleTexture(GAME_ROOT_DIRECTORY + "actionbox");
            actionBox        = new ActionBox(actionFont, actionBoxTexture);
            infoBox          = new InfoBox();
            chatBox          = new ChatBox();
        }
Beispiel #7
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            while (chatMessages.Count > 0)
            {
                if (chatMessages[0].name != "" && chatMessages[0].msg != "")
                {
                    realChatBox.SelectionStart  = realChatBox.TextLength;
                    realChatBox.SelectionLength = 0;
                    Font name = new Font(realChatBox.Font.FontFamily, 10, FontStyle.Bold);
                    realChatBox.SelectionFont  = name;
                    realChatBox.SelectionColor = chatMessages[0].color;
                    realChatBox.AppendText(chatMessages[0].name + ": ");

                    realChatBox.SelectionStart  = realChatBox.TextLength;
                    realChatBox.SelectionLength = 0;
                    Font msg = new Font(realChatBox.Font.FontFamily, 8, FontStyle.Regular);
                    realChatBox.SelectionFont  = msg;
                    realChatBox.SelectionColor = Color.Black;
                    realChatBox.AppendText(chatMessages[0].msg);
                }


                ChatBox.AppendText(chatMessages[0].rawMsg);
                chatMessages.RemoveAt(0);
            }
        }
Beispiel #8
0
 public virtual void DrawChatSnippet(SpriteBatch spriteBatch, ChatSnippet snippet, ref float offset, bool drawShadow = true)
 {
     if (snippet.emojiIndex != -1)
     {
         spriteBatch.Draw(
             ChatBox.emojiTexture,
             new Vector2(offset, DrawOrigin.Y),
             new Rectangle?(new Rectangle(
                                snippet.emojiIndex * 9 % ChatBox.emojiTexture.Width,
                                snippet.emojiIndex * 9 / ChatBox.emojiTexture.Width * 9,
                                9,
                                9)),
             Color.White,
             0f,
             Vector2.Zero,
             4f,
             SpriteEffects.None,
             0.99f);
     }
     else if (snippet.message != null)
     {
         spriteBatch.DrawString(
             ChatBox.messageFont(LocalizedContentManager.CurrentLanguageCode),
             snippet.message,
             new Vector2(offset, DrawOrigin.Y),
             ChatMessage.getColorFromName(Game1.player.defaultChatColor),
             0f, Vector2.Zero,
             1f,
             SpriteEffects.None,
             0.99f);
     }
     offset += snippet.myLength;
 }
Beispiel #9
0
        public Program()
        {
            RpcManager.Instance.TriggerRPC("announce", new ElementRpc <Player>(Player.Local));

            RpcManager.Instance.RegisterRPC <EmptyRpc>("announce-response", (rpc) =>
            {
                ChatBox.WriteLine("Hey, we responded!");
            });

            RpcManager.Instance.RegisterRPC <EmptyRpc>("queue", (rpc) =>
            {
                ChatBox.WriteLine("I was queued!");
            });

            RpcManager.Instance.RegisterAsyncRPC <SingleCastRpc <string>, EmptyRpc>("Async.RequestLocalization", (request) =>
            {
                return(new SingleCastRpc <string>(GameClient.Localization.Item1));
            });

            Task.Run(async() =>
            {
                var responseRpc = await RpcManager.Instance.TriggerAsyncRpc <SingleCastRpc <string> >("Async.RequestMapName", new EmptyRpc());
                string name     = responseRpc.Value;
                ChatBox.WriteLine($"Map name: {name}");
            });

            Dx.DrawCircle(Vector2.Zero, 4);

            var vehicle = new Vehicle(VehicleModel.Cars.Alpha, new Vector3(20, 20, 5), Vector3.Zero, "CLIENT");

            vehicle.OnStreamIn  += (o, args) => ChatBox.WriteLine("Streamed in!");
            vehicle.OnStreamOut += (o, args) => ChatBox.WriteLine("Streamed out!");
        }
        private ChatBoxViewModel CreateChatboxViewModel(ChatBox chatbox)
        {
            var chatBoxVM = new ChatBoxViewModel(chatbox);

            chatBoxVM.NewMessage += SendMessage;
            return(chatBoxVM);
        }
Beispiel #11
0
    void Start()
    {
        Chat      = ChatboxCanvas.GetComponent <ChatBox> ();
        _Animator = GetComponent <Animator> ();

        for (int i = 0; i < 3; i++)
        {
            if (SceneManager.GetActiveScene().name == Menu.Instance.SpeakeasyBuilding[i])
            {
                ManagerID = i;
            }
            else if (SceneManager.GetActiveScene().name == "SpeakEasy_" + i)
            {
                if (NPC_Type == "Tattooer")
                {
                    ManagerID = i;
                    Doors.GetComponent <SwitchScene> ().DesiredScene = Menu.Instance.SpeakeasyBuilding[i];
                }
            }
        }

        if ((NPC_Type == "Manager") || (NPC_Type == "Tattooer"))
        {
            NPCS = GameObject.FindGameObjectsWithTag("NPC_Normal");
            if ((NPC_Type == "Manager") && (ManagerID != -1))
            {
                GenerateValidNPC(true);
                GenerateValidNPC(false);
            }
        }
    }
Beispiel #12
0
 private void ChatBox_SourceUpdated(object sender, TextChangedEventArgs e)
 {
     if (m_autoScroll)
     {
         ChatBox.ScrollToEnd();
     }
 }
Beispiel #13
0
        /// <summary>
        /// Callback that allows the entry of messages from any user in the game chat.
        /// </summary>
        /// <param name="username"> The username of the user who is sending the incoming message. </param>
        /// <param name="message"> The incoming message. </param>
        public void ReciveMessage(string username, string message)
        {
            string format = "\n" + username + ": " + message;

            ChatBox.AppendText(format);
            ChatBox.ScrollToEnd();
        }
Beispiel #14
0
        private void InitProjSpecific()
        {
            inGameHUD = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas), style: null)
            {
                CanBeFocused = false
            };

            cameraFollowsSub = new GUITickBox(new RectTransform(new Vector2(0.05f, 0.05f), inGameHUD.RectTransform, anchor: Anchor.TopCenter)
            {
                AbsoluteOffset = new Point(0, 5),
                MaxSize        = new Point(25, 25)
            }, TextManager.Get("CamFollowSubmarine"))
            {
                Selected   = Camera.FollowSub,
                OnSelected = (tbox) =>
                {
                    Camera.FollowSub = tbox.Selected;
                    return(true);
                }
            };
            cameraFollowsSub.OnSelected(cameraFollowsSub);

            chatBox = new ChatBox(inGameHUD, isSinglePlayer: false);
            chatBox.OnEnterMessage         += EnterChatMessage;
            chatBox.InputBox.OnTextChanged += TypingChatMessage;
        }
Beispiel #15
0
 public static void receiveChatMessage(ChatBox __instance, long sourceFarmer, int chatKind, LocalizedContentManager.LanguageCode language, string message)
 {
     if (Game1.player.UniqueMultiplayerID != sourceFarmer && (chatKind == 3 || chatKind == 0))
     {
         SpeechHandlerPolly.chats.Enqueue(message);
     }
 }
        public override void Startup()
        {
            base.Startup();

            _gameChat = new ChatBox();

            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetAnchorAndMarginPreset(_gameChat, LayoutContainer.LayoutPreset.TopRight, margin: 10);
            LayoutContainer.SetMarginLeft(_gameChat, -475);
            LayoutContainer.SetMarginBottom(_gameChat, 235);

            _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
            _gameChat.Input.PlaceHolder = Loc.GetString("Say something! [ for OOC");

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => FocusChat(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
                                          InputCmdHandler.FromDelegate(s => FocusOOC(_gameChat)));

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
                                          InputCmdHandler.FromDelegate(s => FocusAdminChat(_gameChat)));
        }
        // GET: ChatBoxes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChatBox chatBox = db.ChatBoxes.Find(id);

            if (chatBox == null)
            {
                return(HttpNotFound());
            }
            ViewBag.name    = chatBox.Name;
            ViewBag.message = chatBox.Message;
            if (ViewBag.reply == null)
            {
                ViewBag.reply = " ";
            }
            else
            {
                ViewBag.reply = chatBox.Reply;
            }

            Session["chatname"]    = chatBox.Name;
            Session["chatmessage"] = chatBox.Message;
            Session["chatmail"]    = chatBox.Email;
            return(View(chatBox));
        }
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Dispose();
                _lobby = null;
            }

            _gameChat = new ChatBox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
            _gameChat.Input.PlaceHolder = _localization.GetString("Say something! [ for OOC");

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(s => _focusChat(_gameChat)));
        }
        public bool UpdateForNewRecepient(long id, string to = null)
        {
            if (!Context.IsMultiplayer)
            {
                return(false);
            }

            if (to == null)
            {
                to = this.GetOtherPlayerNameFromUniqueId(id);
            }

            if (to == null)
            {
                this.toOffset             = 0;
                this.CurrentRecipientId   = -1;
                this.CurrentRecipientName = null;
                return(false);
            }

            this.CurrentRecipientId   = id;
            this.CurrentRecipientName = to;
            this.displayTo            = $"To: {to}";
            this.toOffset             = (int)ChatBox.messageFont(LocalizedContentManager.CurrentLanguageCode)
                                        .MeasureString(this.displayTo).X;
            this.toOffset += 16 + 16;
            return(true);
        }
Beispiel #20
0
        /// <summary>
        /// Allows each chat box to run logic
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            //Make a copy of the master list
            _update.Clear();
            foreach (ChatBox chat in _chats)
            {
                _update.Add(chat);
            }

            while (_update.Count > 0)
            {
                ChatBox chat = null;
                if (_update.Count == 1)
                {
                    //Just update the first one
                    chat = _update[1];
                    _update.RemoveAt(1);
                }
                else
                {
                    chat = _update[_update.Count - 1];
                    _update.RemoveAt(_update.Count - 1);
                }

                if (chat != null)
                {
                    chat.Update(gameTime);
                }
            }
        }
Beispiel #21
0
        private void ChatBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && Settings.isConnected)
            {
                string message = ChatBox.Text.Replace("\r\n", string.Empty);

                ChatWindow.AppendText(Settings.displayName + ": " + message + "\n");


                Console.WriteLine(message);
                if (message.StartsWith("/"))
                {
                    if (message.StartsWith("/me"))
                    {
                        try
                        {
                            client.SendAction(message.Substring(4), client.Channels[0].Name);
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            //This means they sent nothing after /me
                        }
                    }
                    else
                    {
                        //action switch case here.. I lazy MAyne.
                    }
                }
                else
                {
                    client.SendMessage(message, client.Channels[0].Name);
                }
                ChatBox.Clear();
            }
        }
Beispiel #22
0
    private void BuddyListView_ItemActivate(object sender, System.EventArgs e)
    {
        if (Token == -1)
        {
            return;
        }

        ChatBox     c;
        String      buddy = BuddyListView.SelectedItems[0].Text;
        IEnumerator boxes = ChatBoxes.GetEnumerator();

        while (boxes.MoveNext())
        {
            c = (ChatBox)boxes.Current;
            if (String.Compare(c.Buddy, buddy) == 0)
            {
                return;
            }
        }
        c        = new ChatBox();
        c.Buddy  = buddy;
        c.Window = new ChatForm(buddy, this);
        c.Window.Show();
        ChatBoxes.Add(c);
    }
Beispiel #23
0
 public void ThreadSend(object Message)
 {
     try
     {
         String MessageText = "";
         if (Message is string)
         {
             MessageText = Message as string;
         }
         else
         {
             throw new Exception("Нужен текст, а не хрен знает что!");
         }
         IPEndPoint EndPoint  = new IPEndPoint(IPAddress.Parse(IP.Text), 7000);
         Socket     Connector = new Socket(EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
         Connector.Connect(EndPoint);
         Byte[] SendBytes = Encoding.Default.GetBytes(MessageText);
         Connector.Send(SendBytes);
         Connector.Close();
         ChatBox.BeginInvoke(AcceptDelegate, new object[] { "Send " + MessageText, ChatBox });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #24
0
        public static async Task AttemptLogin(Player player, string user, string pass)
        {
            vPlayer p = (vPlayer)player;
            int     id;
            string  username;
            string  passhash = "";

            var results = await database.Query("SELECT * FROM users WHERE username = '******'");

            id       = results[0]["id"];
            username = results[0]["username"];
            passhash = results[0]["password"];
            bool correct = await Bcrypt.Verify(pass, passhash);

            if (correct)
            {
                p.accountID = id;
                p.loadPlayerData(results[0]["money"], results[0]["skin"], results[0]["bank"], results[0]["staff_level"], results[0]["dim"], results[0]["int"], results[0]["x"], results[0]["y"], results[0]["z"], results[0]["rot"], results[0]["job"]);
                ChatBox.WriteLine("Welcome " + user, player, Slipe.Shared.Utilities.Color.Green);
            }
            else
            {
                ChatBox.WriteLine("Wrong login info.", player, Slipe.Shared.Utilities.Color.Red);
                Slipe.MtaDefinitions.MtaServer.KickPlayer(player.MTAElement, "Xoa", "Invalid login info");
            }
        }
Beispiel #25
0
 private void Btn_Send_Click(object sender, RoutedEventArgs e)
 {
     ChatBox.AppendText(username + ": " + InputBox.Text + "\n");
     Net.TCPClient.SendChatMessage(InputBox.Text);
     InputBox.Text = "";
     ChatBox.ScrollToEnd();
 }
        /// <summary>Gets the current offset of the cursor from the left of the textbox.</summary>
        private float GetCursorOffset()
        {
            float offset = 0;

            if (!this.finalText.Any())
            {
                return(offset);
            }
            for (int i = 0; i < this.currentSnippetIndex; i++)
            {
                offset += this.finalText[i].myLength;
            }

            if (this.finalText[this.currentSnippetIndex].message == null)
            {
                offset += this.currentInsertPosition == 1 ? 40 : 0;
            }
            else
            {
                offset += ChatBox.messageFont(LocalizedContentManager.CurrentLanguageCode)
                          .MeasureString(this.finalText[this.currentSnippetIndex].message
                                         .Substring(0, this.currentInsertPosition)).X;
            }
            return(offset);
        }
        public async void enemyStrike()
        {
            updateStuff();
            await sleeper(3);

            bool didStrike = false;

            for (int i = 0; i < noobFighter.possibleMoves.Count(); i++)
            {
                int   index = rand.Next(0, noobFighter.possibleMoves.Count());
                moves move  = noobFighter.possibleMoves[index];
                if (noobFighter.energy - move.cost > -1)
                {
                    EnemyImgBox.Source = new BitmapImage(new Uri(move.spriteLocation));
                    char1.health       = char1.health - move.damage;
                    noobFighter.energy = noobFighter.energy - move.cost;
                    ChatBox.AppendText(noobFighter.name + " used " + move.name + "." + Environment.NewLine);
                    ChatBox.ScrollToEnd();
                    didStrike     = true;
                    userCanStrike = true;
                    break;
                }
                updateStuff();
                await sleeper(2);

                EnemyImgBox.Source = new BitmapImage(new Uri("../CodeDay/Amish ginger.png", UriKind.Relative));
            }
            if (didStrike == false)
            {
                winLose(true);
            }

            updateStuff();
        }
        private ChatBox AddChatBox(IRoom room)
        {
            ChatBox chatBox = CreateChatbox(room);

            _chatBoxList.Add(chatBox);
            return(chatBox);
        }
Beispiel #29
0
        private void _joinGame(MsgTickerJoinGame message)
        {
            if (_tickerState == TickerState.InGame)
            {
                return;
            }

            _tickerState = TickerState.InGame;

            if (_lobby != null)
            {
                _lobby.Dispose();
                _lobby = null;
            }

            _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
                                          InputCmdHandler.FromDelegate(session =>
            {
                _gameChat.Input.IgnoreNext = true;
                _gameChat.Input.GrabKeyboardFocus();
            }));

            _gameChat = new ChatBox();
            _userInterfaceManager.StateRoot.AddChild(_gameChat);
            _chatManager.SetChatBox(_gameChat);
            _gameChat.DefaultChatFormat = "say \"{0}\"";
        }
        public static void ChatBoxAddedMessage(this ChatBox chatBox, string message, Color color)
        {
            ChatMessageKind messageKind;

            if (color == Game1.chatBox.chatBox.TextColor)
            {
                messageKind = ChatMessageKind.Normal;
            }
            else if (color == Color.Yellow)
            {
                messageKind = ChatMessageKind.Notification;
            }
            else
            {
                messageKind = ChatMessageKind.Error;
            }

            ChatMessageEventArgs args = new ChatMessageEventArgs {
                SourcePlayer = Game1.player,
                ChatKind     = messageKind,
                Language     = LocalizedContentManager.CurrentLanguageCode,
                Message      = message
            };

#if DEBUG
            ModEntry.ModLogger.LogToMonitor = false;
            ModEntry.ModLogger.LogTrace();
            ModEntry.ModLogger.LogToMonitor = true;
#endif
            OnChatBoxAddedMessage(null, args);
        }
Beispiel #31
0
 public RichEditOle(ChatBox _richEdit)
 {
     agileRichTextBox = _richEdit;
 }
Beispiel #32
0
 protected void Awake()
 {
     Instance = this;
 }