コード例 #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);
            //}
        }
コード例 #2
0
        /// <summary>
        /// 截屏
        /// </summary>
        /// <param name="cbx"></param>
        public static void ScreenShot(ChatBox cbx)
        {
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                cbx.InsertImage(image);
                cbx.Focus();
                cbx.ScrollToCaret();
            }
        }
コード例 #3
0
        private void Connection_StrangerFound(object sender, StrangerFoundEventArgs e)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                ChatBox.IsEnabled = true;
                ChatBox.Focus();

                MessageLog.AddPresence(true, e.StrangerInfo.FlaggedAsUnpleasant);
                StatusTextBlock.Text = LocaleSelector.GetLocaleString("StatusIndicator_StrangerIdle");

                Toolbar.FlagStrangerButton.IsEnabled           = true;
                Toolbar.DisconnectFromStrangerButton.IsEnabled = true;
                Toolbar.RequestRandomTopicButton.IsEnabled     = true;
            });
        }
コード例 #4
0
        //***************************************************************************************************************
        //
        // Method: AppendMessageToChat
        //
        // Description:
        //    Method for the message receiving thread to call as to append the new message to the chatbox. This also
        //    makes sure to automatically scroll the chatbox to the bottom (newest messages) as it overflows the normal
        //    chatbox area.
        //
        // Arguments:
        //    N/A
        //
        // Return:
        //    N/A
        //
        //***************************************************************************************************************
        private void AppendMessageToChat(String theMessage)
        {
            // Append the received message to the chatbox.
            ChatBox.AppendText(theMessage);

            // Get the component that is currently focused.
            UIElement elementWithFocus = Keyboard.FocusedElement as UIElement;

            // Set focus to the chatbox and make sure to scroll to the end of the chatbox.
            ChatBox.Focus();
            ChatBox.CaretIndex = ChatBox.Text.Length;
            ChatBox.ScrollToEnd();

            // Reset the focus to the previous focused component.
            elementWithFocus.Focus();
        }
コード例 #5
0
        public override void Update(float deltaTime)
        {
            // Complete handshake when terrain is done
            if (handshake != null && World.Terrain != null && World.Terrain.UnfinishedChunks == 0)
            {
                handshake.Complete();
            }

            // Toggle the menu via user input
            if (Input.GetControlDown("ToggleMenu"))
            {
                chat.Unfocus();
                menu.Visible = !menu.Visible;
                ToggleFPSUserInput(!menu.Visible);
            }

            // Toggle chat focus
            if (Input.GetControlDown("Chat"))
            {
                ToggleFPSUserInput(false);
                chat.Focus();
            }

            // Show the leaderboard via user input
            if (leaderboard != null)
            {
                leaderboard.Visible = Input.GetControl("ShowLeaderboard");
            }

            // Read terrain changes
            if (client != null && snapshotComponent.WorldSnapshot != null)
            {
                TerrainDeltaSnapshot terrainDelta = snapshotComponent.WorldSnapshot.TerrainSnapshot;

                // Simply apply each change sent by the server to the specified chunks.
                foreach (TerrainDeltaChange change in terrainDelta.ReceivedChanges)
                {
                    Chunk chunk;
                    if (World.Terrain.Chunks.TryGetValue(change.ChunkIndex, out chunk))
                    {
                        if (change.Block.Material == Block.AIR.Material)
                        {
                            chunk.RemoveBlock(change.BlockIndex);
                        }
                        else
                        {
                            chunk.SetBlock(change.Block, change.BlockIndex);
                        }
                    }
                    else
                    {
                        DashCMD.WriteError("[AOSNet - TerrainDelta] Received update for non-existant chunk! IPos: {0}",
                                           change.ChunkIndex);
                    }
                }

                // Clear the changes so we don't apply them twice
                terrainDelta.ReceivedChanges.Clear();
            }

            // Update the world
            if (World != null)
            {
                World.Update(deltaTime);
            }

            // Update the gamemode
            if (currentGamemode != null && currentGamemode.IsActive)
            {
                currentGamemode.Update(deltaTime);
            }

            // Update the hud
            hud.Update(deltaTime);

            // Run down the message timer if shown
            if (messageTime > 0)
            {
                messageTime -= deltaTime;
            }
            if (announcementTime > 0)
            {
                announcementTime -= deltaTime;
            }
        }