Esempio n. 1
0
        private void HostBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host(false, (ServerTabs.SelectedTab.Name == "Ranked"));

            if (ServerTabs.SelectedTab.Name == "Ranked")
            {
                form.Mode.Items.Clear();
                form.Mode.Items.AddRange(new object[] { "Match", "Tag" });
                form.Mode.SelectedItem     = "Match";
                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[] { "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(), (ServerTabs.SelectedTab.Name == "Ranked") ? true : false));
                LauncherHelper.RunGame("-j");
            }
        }
Esempio n. 2
0
        private void QuickBtn_Click(object sender, EventArgs e)
        {
            Host form = new Host(false, false);

            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;
            form.BanList.SelectedItem   = Program.Config.BanList;
            form.TimeLimit.SelectedItem = Program.Config.TimeLimit;

            LauncherHelper.GenerateConfig(form.GenerateURI(Program.Config.ServerAddress, Program.Config.GamePort.ToString(), (ServerTabs.SelectedTab.Name == "Ranked") ? true : false));
            LauncherHelper.RunGame("-j");
            return;
        }
        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");
            }
        }