Example #1
0
        private void BtnSend_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int    MR       = 5 - cb_masterrules.SelectedIndex;
            string password = chb_password.IsChecked == true ? tb_password.Text : string.Empty;

            if (_id != -1)
            {
                _admin.SendRequest(_id, password, (RoomType)cb_dueltype.SelectedIndex, FormExecution.GetBanlistValue(cb_banlist.SelectedItem.ToString()), RoomRules.TCG, Convert.ToInt32(tb_handcard.Text), Convert.ToInt32(tb_lpstartduel.Text), MR, Convert.ToInt32(tb_drawcount.Text), chb_shuffledeck.IsChecked == true, tb_captiontext.Text);
            }
            else
            {
                _admin.SendHost((RoomType)cb_dueltype.SelectedIndex, password, FormExecution.GetBanlistValue(cb_banlist.SelectedItem.ToString()), RoomRules.TCG, Convert.ToInt32(tb_handcard.Text), Convert.ToInt32(tb_lpstartduel.Text), MR, Convert.ToInt32(tb_drawcount.Text), chb_shuffledeck.IsChecked == true, tb_captiontext.Text);
            }

            Close();
        }
Example #2
0
        private void BtnSend_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int    MR       = 5 - cb_masterrules.SelectedIndex;
            string password = string.Empty;

            _admin.SendShadowDuelRequest(_id, password, (RoomType)cb_dueltype.SelectedIndex, FormExecution.GetBanlistValue(cb_banlist.SelectedItem.ToString()), RoomRules.TCG, Convert.ToInt32(tb_handcard.Text), Convert.ToInt32(tb_lpstartduel.Text), MR, Convert.ToInt32(tb_drawcount.Text), chb_shuffledeck.IsChecked == true, "Duel des ombres...", _bettype, _bet);

            Close();
        }
        public ChoicePopBox(PlayerInfo player, RoomConfig config, ChoiceBoxType type, string pass = "", string deckname = "")
        {
            InitializeComponent();
            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;

            string txt = string.Empty;

            _type = type;
            switch (_type)
            {
            case ChoiceBoxType.Duel:
                txt = string.Format("Vous avez été invité en duel par {0}. \r\nType : {1}", player.Username, config.Type);

                if (config.MasterRules > 0)
                {
                    txt += Environment.NewLine + string.Format("MasterRules : {0}", config.MasterRules);
                }
                else
                {
                    txt += Environment.NewLine + string.Format("Turbo duel", config.MasterRules);
                }

                txt += Environment.NewLine + string.Format("Banlist : {0}", FormExecution.GetBanlistValue(config.Banlist));
                txt += Environment.NewLine + string.Format("Point de vie : {0}", config.StartDuelLP);
                txt += Environment.NewLine + string.Format("Carte dans la main au départ : {0}", config.CardByHand);
                txt += Environment.NewLine + string.Format("Pioche par tour : {0}", config.DrawCount);
                txt += Environment.NewLine + string.Format("Info : {0}", config.CaptionText);
                txt += Environment.NewLine + (config.NoShuffleDeck ? "Deck non mélangé" : "Deck mélangé");

                if (pass != string.Empty)
                {
                    txt += Environment.NewLine + "Partie privée";
                }
                Title = "Requête de duel";
                break;

            case ChoiceBoxType.Trade:
                Title = "Requête d'échange";
                txt   = string.Format("Vous avez été invité en échange par {0}.", player.Username);
                break;

            case ChoiceBoxType.Deck:
                txt = "Vous avez reçu le deck " + deckname + " de la part de " + player.Username + ".";
                break;

            case ChoiceBoxType.Replay:
                txt = "Vous avez reçu le replay " + deckname + " de la part de " + player.Username + ".";
                break;

            case ChoiceBoxType.DeckChoiceRanked:
                txt = "Vous vous apprêtez à rentrer dans la file classée avec le deck : " + deckname;
                break;
            }
            popText.Text = txt;

            Loaded += PopBox_Loaded;

            packet = new StandardClientDuelRequestAnswer {
                Player = player, Config = config, Roompass = pass
            };
        }
        public ShadowDuelRequest(PlayerInfo player, RoomConfig config, Bet bet, DuelRequestAdministrator admin)
        {
            InitializeComponent();
            this.MaxHeight  = SystemParameters.MaximizedPrimaryScreenHeight;
            this.MouseDown += Window_MouseDown;

            LoadStyle();

            _bet   = bet;
            _admin = admin;

            btnChoose.Visibility = Visibility.Hidden;
            btnAgree.Visibility  = Visibility.Visible;
            lbPanel.Visibility   = Visibility.Hidden;

            tb_popup_banlist.Foreground   = new SolidColorBrush(Colors.White);
            tb_popup_lp.Foreground        = new SolidColorBrush(Colors.White);
            tb_popup_MR.Foreground        = new SolidColorBrush(Colors.White);
            tb_popup_starthand.Foreground = new SolidColorBrush(Colors.White);
            tb_shuffledeck.Foreground     = new SolidColorBrush(Colors.White);
            tb_drawcount.Foreground       = new SolidColorBrush(Colors.White);

            if (config.Banlist != 0)
            {
                tb_popup_banlist.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
            }
            tb_popup_banlist.Text = FormExecution.GetBanlistValue(config.Banlist);

            if ((config.StartDuelLP != 8000 && config.Type != RoomType.Tag) || (config.StartDuelLP != 16000 && config.Type == RoomType.Tag))
            {
                tb_popup_lp.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
            }
            tb_popup_lp.Text = config.StartDuelLP.ToString();

            if (config.MasterRules != 5)
            {
                tb_popup_MR.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
            }
            tb_popup_MR.Text = config.MasterRules.ToString();

            if (config.CardByHand != 5)
            {
                tb_popup_starthand.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
            }
            tb_popup_starthand.Text = config.CardByHand.ToString();

            if (config.DrawCount != 1)
            {
                tb_drawcount.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
            }
            tb_drawcount.Text = config.DrawCount.ToString();

            if (config.NoShuffleDeck)
            {
                tb_shuffledeck.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                tb_shuffledeck.Text       = "Deck non mélangé";
            }

            tb_popup_type.Text = config.Type.ToString();

            tb_captiontext.Text = config.CaptionText;
            tb_title.Text       = string.Format("Vous avez été invité en duel des ombres par {0}", player.Username);


            switch (bet.BType)
            {
            case BetType.BPs:
                tb_mise.Text = string.Format("{0}", ((BPsBet)bet).Amount + "BPs");
                break;

            case BetType.Ban:
                tb_mise.Text = string.Format("{0}", "Ban - " + ((SanctionBet)bet).Time + "H");
                break;

            case BetType.Mute:
                tb_mise.Text = string.Format("{0}", "Mute - " + ((SanctionBet)bet).Time + "H");
                break;
            }

            btnAgree.MouseLeftButtonDown    += (sender, e) => RequestResult(sender, e, true);
            btnDisagree.MouseLeftButtonDown += (sender, e) => RequestResult(sender, e, false);
        }
Example #5
0
        private void Room_MouseEnter(object sender, MouseEventArgs e)
        {
            try
            {
                ListBox Itemslist = ((ListBox)sender);
                var     item      = VisualTreeHelper.HitTest(Itemslist, Mouse.GetPosition(Itemslist)).VisualHit;

                // find ListViewItem (or null)
                while (item != null && !(item is ListBoxItem))
                {
                    item = VisualTreeHelper.GetParent(item);
                }

                if (item == null)
                {
                    return;
                }

                int      i    = Itemslist.Items.IndexOf(((ListBoxItem)item).DataContext);
                RoomItem room = Itemslist.Items[i] as RoomItem;
                if (room != null)
                {
                    //popup_dueltype_img.Background = new ImageBrush(room.Image);

                    duel_popup.Placement        = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
                    duel_popup.HorizontalOffset = 10;
                    duel_popup.VerticalOffset   = 10;

                    tb_popup_banlist.Foreground   = new SolidColorBrush(Colors.Black);
                    tb_popup_lp.Foreground        = new SolidColorBrush(Colors.Black);
                    tb_popup_MR.Foreground        = new SolidColorBrush(Colors.Black);
                    tb_popup_starthand.Foreground = new SolidColorBrush(Colors.Black);
                    tb_shuffledeck.Foreground     = new SolidColorBrush(Colors.Black);
                    tb_drawcount.Foreground       = new SolidColorBrush(Colors.Black);
                    tb_info.Foreground            = new SolidColorBrush(Colors.Black);
                    tb_captiontext.Foreground     = new SolidColorBrush(Colors.Black);

                    if (room.Config.Banlist != 0)
                    {
                        tb_popup_banlist.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                    }
                    tb_popup_banlist.Text = FormExecution.GetBanlistValue(room.Config.Banlist);

                    if ((room.Config.StartDuelLP != 8000 && room.Type != RoomType.Tag) || (room.Config.StartDuelLP != 16000 && room.Type == RoomType.Tag))
                    {
                        tb_popup_lp.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                    }
                    tb_popup_lp.Text = room.Config.StartDuelLP.ToString();

                    if (room.Config.MasterRules != 5)
                    {
                        tb_popup_MR.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                    }
                    if (room.IsTurboDuel)
                    {
                        tb_popup_MR_title.Text       = "🎮 Turbo Duel 🎮";
                        tb_popup_MR.Text             = "";
                        tb_popup_MR_title.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("TurboDuelRoomColor"));
                        Grid.SetColumnSpan(tb_popup_MR_title, 2);
                    }
                    else
                    {
                        tb_popup_MR_title.Text = "Master Rules : ";
                        tb_popup_MR.Text       = room.Config.MasterRules.ToString();
                    }

                    tb_popup_players1.Text = room.Players1;
                    tb_popup_players2.Text = room.Players2;

                    if (room.Config.CardByHand != 5)
                    {
                        tb_popup_starthand.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                    }
                    tb_popup_starthand.Text = room.Config.CardByHand.ToString();

                    if (room.Config.DrawCount != 1)
                    {
                        tb_drawcount.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                    }
                    tb_drawcount.Text = room.Config.DrawCount.ToString();

                    if (room.Config.NoShuffleDeck)
                    {
                        tb_shuffledeck.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("CustomRoomColor"));
                        tb_shuffledeck.Text       = "Deck non mélangé";
                    }

                    if (room.IsShadowDuel)
                    {
                        this.tb_info.Text = "Mise : ";

                        switch (room.Bet.BType)
                        {
                        case BetType.BPs:
                            this.tb_captiontext.Text = ((BPsBet)room.Bet).Amount + " BPs";
                            break;

                        case BetType.Mute:
                            this.tb_captiontext.Text = "Mute " + ((SanctionBet)room.Bet).Time + "h";
                            break;

                        case BetType.Ban:
                            this.tb_captiontext.Text = "Ban " + ((SanctionBet)room.Bet).Time + "h";
                            break;
                        }

                        this.tb_info.Foreground        = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("ShadowRoomColor"));
                        this.tb_captiontext.Foreground = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("ShadowRoomColor"));
                    }
                    else
                    {
                        tb_captiontext.Text = room.Config.CaptionText;
                    }

                    tb_popup_type.Text = room.Type.ToString();


                    duel_popup.IsOpen = true;
                }
            }
            catch (Exception ex)
            {
                logger.Warn(ex.ToString());
            }
        }