Ejemplo n.º 1
0
        private void Create_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Data.HostOrClient   = true;
            Data.CreateToServer = false;

            WriteSetting();

            ComboBoxItem typeItem = (ComboBoxItem)LobbyType.SelectedItem;
            string       value    = typeItem.Content.ToString();

            if (Data.SettingCh.St.UseMod)
            {
                Data.ModOrOrigin = "Mod";
            }
            else
            {
                Data.ModOrOrigin = "Orig";
            }

            Data.LobbyTitle = Data.SettingCh.St.Name + "'s Lobby [ " + ModOrig.Text + " | " + typeItem.Content.ToString() + "]";

            Get _max = new Get();

            Data.MaxGamers            = _max.GetMaxCountGamers(LobbyType.SelectedIndex);
            Data.GamersList.LobbyType = typeItem.Content.ToString();
            Data.GamersList.ModOrig   = ModOrig.Text.ToString();

            Host host = new Host();

            host.StartListening(Data.SettingCh.St.TcpPort);
        }
Ejemplo n.º 2
0
        private void Btn_Create(object sender, RoutedEventArgs e)
        {
            Data.HostOrClient   = true;
            Data.CreateToServer = true;

            WriteSetting();

            // Get the value from the combobox to the string
            ComboBoxItem typeItem = (ComboBoxItem)LobbyType.SelectedItem;
            string       value    = typeItem.Content.ToString();
            string       _usePass;

            if ((bool)PassUse.IsChecked == true)
            {
                _usePass = "******" + PasswInput.Text;
            }
            else
            {
                _usePass = "******";
            }

            if (Data.SettingCh.St.UseMod)
            {
                Data.ModOrOrigin = "Mod";
            }
            else
            {
                Data.ModOrOrigin = "Orig";
            }


            Data.Password = PasswInput.Text;

            Get _max = new Get();

            // Assign the name of the lobby
            if (LobbyName.Text != "")
            {
                Data.NameSession = LobbyName.Text;
            }
            else
            {
                Data.NameSession = "Lobby by " + Data.SettingCh.St.Name;
            }


            string name;

            if (Data.NameSession.Length > 16)
            {
                name = Data.NameSession.Substring(0, 16) + "...";
            }
            else
            {
                name = Data.NameSession;
            }

            Data.LobbyTitle = name + " [ " + ModOrig.Text + " | " + typeItem.Content.ToString() + _usePass + "]";

            // Assign a comment
            Data.Comment = CommentInput.Text;

            Data.MaxGamers            = _max.GetMaxCountGamers(LobbyType.SelectedIndex);
            Data.GamersList.LobbyType = typeItem.Content.ToString();
            Data.GamersList.ModOrig   = ModOrig.Text.ToString();

            Host host = new Host();

            host.StartListening(Data.SettingCh.St.TcpPort);
        }