Beispiel #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();
            }
        }
Beispiel #2
0
 public static void ClearAll()
 {
     KeyValues = null;
     keysPressed.Clear();
     InputField.Text = "";
     InputField.Focus();
 }
        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();
            }
        }
        private void EnterBtn_Click(object sender, EventArgs e)
        {
            string input = InputField.Text;

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

            GetUserList();
        }
Beispiel #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();
        }
Beispiel #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();
         }
     }
 }
        /*   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)));
        }
 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);
 }
Beispiel #13
0
 public void Initialize(string initialText)
 {
     InputField.Text = initialText;
     InputField.SelectAll();
     InputField.Focus();
 }