예제 #1
0
        void LateUpdate()
        {
            if (ConsoleState == State.Open && Input.GetKeyUp(KeyCode.Return))
            {
                Console.SubmitInput(InputField.text);
                InputField.text = "";
                InputField.Focus();
            }

            if (Input.GetKeyUp(KeyCode.Tab) || Input.GetKeyUp(KeyCode.F1))
            {
                StopAllCoroutines();
                StartCoroutine(Toggle());
                InputField.Focus();
            }
        }
예제 #2
0
 public static void ClearAll()
 {
     KeyValues = null;
     keysPressed.Clear();
     InputField.Text = "";
     InputField.Focus();
 }
예제 #3
0
        void Connect(string s)
        {
            char split = ' ';

            string[] parsedIP = s.Split(split); // 1 : client, 2 : server, 3 : server Port

            try
            {
                IPEndPoint clientAddr = new IPEndPoint(IPAddress.Parse(parsedIP[1]), 0);
                IPEndPoint serverAddr = new IPEndPoint(IPAddress.Parse(parsedIP[2]), Int32.Parse(parsedIP[3]));
                client = new TcpClient(clientAddr);
                client.Connect(serverAddr);
                stream = client.GetStream();
                Display("Chat Server Connected...");
            }
            catch (Exception e)
            {
                Display("Failed to Connect...");
            }
            if (!client.Connected)
            {
                MessageBox.Show("usage : /connect 클라이언트IP 서버IP 서버PORT");
                InputField.Text = string.Empty;
                InputField.Focus();
            }
            else
            {
                byte[] buffer = Encoding.Default.GetBytes(ID);
                stream.Write(buffer, 0, buffer.Length);

                Thread clientThread = new Thread(Receiver);
                clientThread.IsBackground = true;
                clientThread.Start();
            }
        }
예제 #4
0
        private void EnterBtn_Click(object sender, EventArgs e)
        {
            string input = InputField.Text;

            Controller(input);
            InputField.Text = string.Empty;
            InputField.Focus();
        }
예제 #5
0
 private void HelperDropBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (HelperDropBox.SelectedValue != null)
     {
         InputField.Text = (string)HelperDropBox.SelectedValue;
         InputField.Focus();
     }
 }
예제 #6
0
 void OnSend()
 {
     if (!string.IsNullOrEmpty(InputField.text))
     {
         Client.Messenger.Say(InputField.text);
         InputField.text = "";
         InputField.Focus();
     }
 }
예제 #7
0
        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            if (_client.SendSecure(InputField.Text))
            {
                InputField.Clear();
                InputField.Focus();
            }

            GetUserList();
        }
예제 #8
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            //if (_client.TcpSendPacket(new ChatMessagePacket(InputField.Text))) {
            //if (_client.UdpSendPacket(new ChatMessagePacket(InputField.Text))) {
            if (_client.SendSecure(InputField.Text))
            {
                InputField.Clear();
                InputField.Focus();
            }

            GetUserList();
        }
예제 #9
0
 private void ChangeName_Button_Click(object sender, EventArgs e)
 {
     if (ChangeName_textbox.TextLength > 0)
     {
         if (_client.Send(new ClientNamePacket(ChangeName_textbox.Text)
         {
             _packetSrc = _client._nick
         }))
         {
             ChangeName_textbox.Clear();
             InputField.Focus();
         }
     }
 }
예제 #10
0
        /*   CONNECT/DISCONNECT FROM THE SERVER   */
        private void Connect()
        {
            connected    = true;
            disconnected = false;

            NicknameButton.Enabled  = false;
            ClientNameField.Enabled = false;

            InputField.Enabled   = true;
            SubmitButton.Enabled = true;

            InputField.ReadOnly = false;
            InputField.Focus();

            ConnectButton.Text = "Disconnect";
            client.TcpSendMessage(new EncryptedClientListPacket(client.EncryptString(ClientNameField.Text),
                                                                BitConverter.GetBytes(false)));
        }
예제 #11
0
 void Controller(string s)
 {
     if (s.StartsWith("/connect "))
     {
         Connect(s);
     }
     else if (!client.Connected)
     {
         MessageBox.Show("서버에 먼저 연결해주세요.");
         InputField.Text = string.Empty;
         InputField.Focus();
     }
     else if (s.Equals("/exit"))
     {
         Disconnect();
     }
     else
     {
         Sender(s);
     }
 }
 public void FocusTextbox(FocusState focusState)
 {
     InputField.Focus(focusState);
 }
예제 #13
0
 public void Initialize(string initialText)
 {
     InputField.Text = initialText;
     InputField.SelectAll();
     InputField.Focus();
 }