private void QuickSettingsBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host();
            form.Text = lang.QuickHostSetting;
            form.HostBtn.Text = lang.QuickHostBtn;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Program.Config.CardRules = form.CardRules.Text;
                Program.Config.Mode = form.Mode.Text;
                Program.Config.EnablePrority = form.Priority.Checked;
                Program.Config.DisableCheckDeck = form.CheckDeck.Checked;
                Program.Config.DisableShuffleDeck = form.ShuffleDeck.Checked;
                Program.Config.Lifepoints = form.LifePoints.Text;
                Program.Config.GameName = form.GameName.Text;
            }
        }
        private void QuickBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host();
            form.CardRules.Text = Program.Config.CardRules;
            form.Mode.Text = Program.Config.Mode;
            form.Priority.Checked = Program.Config.EnablePrority;
            form.CheckDeck.Checked = Program.Config.DisableCheckDeck;
            form.ShuffleDeck.Checked = Program.Config.DisableShuffleDeck;
            form.LifePoints.Text = Program.Config.Lifepoints;
            form.GameName.Text = Program.Config.GameName;

            LauncherHelper.GenerateConfig(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), (GameType.Text == "Ranked") ? true : false));
            LauncherHelper.RunGame("-j");
            return;
        }
        private void HostBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host();
            if (GameType.Text == "Ranked")
            {
                form.Mode.Items.Clear();
                form.Mode.Items.AddRange(new object[] { "Match", "Tag" });
                form.Mode.SelectedItem = "Match";
                form.Priority.Enabled = false;
                form.ShuffleDeck.Enabled = false;
                form.CheckDeck.Enabled = false;
                form.LifePoints.Enabled = false;
                form.CardRules.Items.Clear();
                form.CardRules.Items.AddRange(new object[] { "OCG/TCG", "TCG", "OCG" });
                form.CardRules.SelectedItem = "OCG/TCG";
            }

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LauncherHelper.GenerateConfig(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), (GameType.Text == "Ranked") ? true : false));
                LauncherHelper.RunGame("-j");
            }
        }
        private void QuickHost(string mode,bool isranked)
        {
            Host form = new Host(false, false);
            form.CardRules.Text = Program.Config.CardRules;
            form.Mode.Text = mode;
            form.Priority.Checked = Program.Config.EnablePrority;
            form.CheckDeck.Checked = Program.Config.DisableCheckDeck;
            form.ShuffleDeck.Checked = Program.Config.DisableShuffleDeck;
            form.LifePoints.Text = Program.Config.Lifepoints;
            form.GameName = LauncherHelper.GenerateString().Substring(0, 5);
            form.BanList.SelectedItem = Program.Config.BanList;
            form.TimeLimit.SelectedItem = Program.Config.TimeLimit;

            ListBox list = (isranked) ? RankedList : UnrankedList;

            if (isranked)
            {
                form.BanList.SelectedIndex = 0;
                form.CheckDeck.Checked = false;
                form.ShuffleDeck.Checked = false;
                form.Priority.Checked = false;
                form.CardRules.SelectedIndex = 2;
                if (form.Mode.Text == "Tag")
                    form.LifePoints.Text = "16000";
                else
                    form.LifePoints.Text = "8000";
            }
            else
            {
                if(Program.Config.Lifepoints != ((mode == "Tag") ? "16000":"8000"))
                {
                    if (MessageBox.Show(Program.LanguageManager.Translation.GameLPChange, Program.LanguageManager.Translation.hostLifep, MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        if (mode == "Tag")
                            form.LifePoints.Text = "16000";
                        else
                            form.LifePoints.Text = "8000";

                    }
                }
            }

            RoomInfos userinfo = RoomInfos.FromName(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), isranked).Split('/')[3], "", false);

            List<RoomInfos> MatchedRooms = new List<RoomInfos>();

            foreach (object room in list.Items)
            {
                if (!m_rooms.ContainsKey(room.ToString()))
                    continue;
                RoomInfos info = m_rooms[room.ToString()];
                if (!RoomInfos.CompareRoomInfo(userinfo, info))
                    continue;
                else
                    MatchedRooms.Add(info);
            }

            Random random = new Random();
            if (MatchedRooms.Count > 0)
            {
                int selectroom = random.Next(MatchedRooms.Count);
                form.GameName = MatchedRooms[selectroom].RoomName;
            }

            LauncherHelper.GenerateConfig(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), isranked));
            LauncherHelper.RunGame("-j");
            return;
        }
        private void HostBtn_Click(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            Host form = new Host(false, (button.Name == "RankedHostBtn"));
            if (button.Name == "RankedHostBtn")
            {
                form.Mode.Items.Clear();
                form.Mode.Items.AddRange(new object[] {"Single", "Match", "Tag" });
                form.Mode.SelectedItem = "Match";
                if (form.BanList.Items.Count > 0)
                    form.BanList.SelectedIndex = 0;
                form.BanList.Enabled = false;
                form.TimeLimit.Items.Clear();
                form.TimeLimit.Items.Add("Server Defualt");
                form.TimeLimit.SelectedItem = "Server Defualt";
                form.TimeLimit.Enabled = false;
                form.Priority.Enabled = false;
                form.ShuffleDeck.Enabled = false;
                form.CheckDeck.Enabled = false;
                form.LifePoints.Enabled = false;
                form.CardRules.Items.Clear();
                form.CardRules.Items.AddRange(new object[] { "TCG", "OCG"});
                form.CardRules.SelectedItem = "TCG";
            }

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

                if (m_rooms.ContainsKey(form.PasswordInput.Text))
                {
                    MessageBox.Show(Program.LanguageManager.Translation.GamePasswordExsists);
                    return;
                }
                LauncherHelper.GenerateConfig(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), (button.Name == "RankedHostBtn") ? true : false));
                LauncherHelper.RunGame("-j");
            }
        }
Esempio n. 6
0
        private void QuickSettingsBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host(true, false);
            form.Text = Program.LanguageManager.Translation.QuickHostSetting;
            form.HostBtn.Text = Program.LanguageManager.Translation.QuickHostBtn;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Program.Config.CardRules = form.CardRules.Text;
                Program.Config.Mode = form.Mode.Text;
                Program.Config.EnablePrority = form.Priority.Checked;
                Program.Config.DisableCheckDeck = form.CheckDeck.Checked;
                Program.Config.DisableShuffleDeck = form.ShuffleDeck.Checked;
                Program.Config.Lifepoints = form.LifePoints.Text;
                Program.Config.BanList = form.BanList.Text;
                Program.Config.TimeLimit = form.TimeLimit.Text;
            }
        }
Esempio n. 7
0
        private void RequestSettingsbtn_Click(object sender, EventArgs e)
        {
            Host form = new Host();
            form.Text = Program.LanguageManager.Translation.chatoptionsRequestFormText;
            form.HostBtn.Text = Program.LanguageManager.Translation.chatoptionsBtnSave;
            form.ShuffleDeck.Enabled = false;
            form.CheckDeck.Enabled = false;
            form.Priority.Enabled = false;
            form.LifePoints.Enabled = false;
            form.Mode.Items.Remove("Tag");

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Program.Config.chtCardRules = form.CardRules.Text;
                Program.Config.chtMode = form.Mode.Text;
                Program.Config.chtEnablePrority = form.Priority.Checked;
                Program.Config.chtDisableCheckDeck = form.CheckDeck.Checked;
                Program.Config.chtDisableShuffleDeck = form.ShuffleDeck.Checked;
                Program.Config.chtLifepoints = form.LifePoints.Text;
                Program.Config.chtBanList = form.BanList.Text;
                Program.Config.chtTimeLimit = form.TimeLimit.Text;
            }
        }