public static void DownloadUpdates(string[] updates) { int i = 0; int n = updates.Length; using (WebClient wc = new WebClient()) { for (int u = updates.Length - 1; u >= 0; u--) { i++; Application.Current.Dispatcher.Invoke(() => LoadingProgress?.Invoke(i, n)); UnzipFromStream(wc.OpenRead(GetUpdateFileLink(updates[u])), FormExecution.path); } } Application.Current.Dispatcher.Invoke(() => UpdateCompleted?.Invoke()); FormExecution.ClientConfig.CardsStuffVersion = FormExecution.GetLastVersion(updates); FormExecution.SaveConfig(); }
private void Client_DailyQuestReward(bool success, DailyQuestType dqtype, int amount, bool allquest) { if (allquest) { FormExecution.Client_PopMessageBox("Félicitations ! Tu as rempli toutes les quêtes possible aujourd'hui ! Tu remportes un bonus de 400 BPs supplémentaire !", "Quête journalière !"); } else { if (success) { ChangeQuestState?.Invoke(dqtype, success); FormExecution.Client_PopMessageBox("Félicitations ! La quête est complétée ! Tu remportes " + amount + " BPs." + Environment.NewLine + "Reviens demain pour de nouveaux défis !", "Quête journalière !"); } else { FormExecution.Client_PopMessageBox("La quête n'est pas encore terminée ! Encore un petit effort...", "Quête journalière !"); } } }
private void BCA_ColorButton_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) { if (lb_choice.Items.Count <= 0) { FormExecution.Client_PopMessageBox("Il faut proposer au moins une carte !", "Echange"); return; } if (!validate) { btnProposition.IsEnabled = false; btnValidate.IsEnabled = false; validate = true; _admin.SendTradeProposition(_id, GlobalTools.GetDictionnaryValues(_cardsToOffer)); } else { btnProposition.IsEnabled = false; btnValidate.IsEnabled = false; _admin.SendTradeAnswer(_id, true); } }
private void DailyQuestWindow_Loaded(object sender, RoutedEventArgs e) { if (FormExecution.ClientConfig.DoTutoQuests) { BCA_TutoPopup tutopopup = new BCA_TutoPopup(); maingrid.Children.Add(tutopopup); tutopopup.HorizontalAlignment = HorizontalAlignment.Center; tutopopup.VerticalAlignment = VerticalAlignment.Center; tutopopup.tuto_popup.IsOpen = true; tutopopup.tuto_popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Center; tutopopup.tuto_popup.PlacementTarget = maingrid; tutopopup.SetText(StartDisclaimer.QuestsTutorial); tutopopup.tuto_popup.MaxWidth = FormExecution.GetChat().Width - 200; tutopopup.btnNext.Visibility = Visibility.Hidden; tutopopup.btnSkip.ButtonText = "Fin !"; tutopopup.btnSkip.Update(); tutopopup.SkipTuto += SkipTutorial; tutopopup.NextStep += Tutopopup_NextStep; } }
private void SendLogin() { if (tbUsername.Text == string.Empty || pbPassword.Password == string.Empty) { _admin.Client.OpenPopBox("Vous ne pouvez pas laisser de champs vide.", "Problème de connexion"); return; } try { if (cbRememberMe.IsChecked == true) { FormExecution.AppConfig.Username = tbUsername.Text; FormExecution.AppConfig.Password = pbPassword.Password; FormExecution.AppConfig.RememberMe = true; FormExecution.AppConfig.Save(); } } catch (Exception ex) { logger.Warn(ex.ToString()); } string username = tbUsername.Text; string password = pbPassword.Password; string HID = FormExecution.HID; FormExecution.Username = username; string encryptKey = File.ReadAllText("rsa_publickey.xml"); if (!_admin.Client.IsConnected) { FormExecution.StartConnexion(); _admin.Client.Connected += () => Client_Connected(username, password, HID, encryptKey); } else { _admin.SendAuthentification(username, password, encryptKey, HID); } }
private void btn_playranked_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (FormExecution.ClientConfig.FirstTimeRanked) { FormExecution.Client_PopMessageBoxShowDialog(StartDisclaimer.RankedText, "Premièr duel classé !"); FormExecution.ClientConfig.FirstTimeRanked = false; FormExecution.ClientConfig.Save(); } if (RankedTimer.IsEnabled) { _admin.SendStopPlayRanked(); StopTimer(); } else { ChoicePopBox cpb = new ChoicePopBox(FormExecution.PlayerInfos, new RoomConfig(), ChoiceBoxType.DeckChoiceRanked, "", YgoproConfig.GetDefaultDeck()); cpb.Choice += Cpb_Choice; cpb.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => cpb.Activate())); } }
public ShadowDuel(DuelRequestAdministrator admin, int id) { InitializeComponent(); _admin = admin; _id = id; this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; this.MouseDown += Window_MouseDown; rb_BP.IsChecked = true; _bettype = BetType.BPs; rb_BP.Checked += Rb_BP_Checked; rb_ban.Checked += Rb_ban_Checked; rb_mute.Checked += Rb_mute_Checked; cb_dueltype.Items.Add(RoomType.Single); cb_dueltype.Items.Add(RoomType.Match); cb_masterrules.Items.Add("MR5 (Avril 2020)"); cb_masterrules.Items.Add("MR4 (Link)"); cb_masterrules.Items.Add("MR3 (Pendules)"); cb_masterrules.Items.Add("MR2 (Synchro/XYZ)"); cb_masterrules.Items.Add("MR1 (Basique)"); cb_banlist.ItemsSource = FormExecution.GetBanlists().Keys.ToArray(); cb_banlist.SelectedIndex = 0; cb_dueltype.SelectedIndex = 0; tb_handcard.Text = "5"; tb_lpstartduel.Text = "8000"; cb_masterrules.SelectedIndex = 0; tb_drawcount.Text = "1"; chb_shuffledeck.IsChecked = false; btnChoose.MouseLeftButtonDown += BtnChoose_MouseLeftButtonDown; btnSend.MouseLeftButtonDown += BtnSend_MouseLeftButtonDown; LoadStyle(); }
private void btn_save_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { client_config.Greet = (bool)cb_greet.IsChecked; client_config.IgnoreDuelRequest = (bool)cb_duelrequest.IsChecked; client_config.IgnoreCustomDuelRequest = (bool)cb_customduelrequest.IsChecked; client_config.IgnoreShadowDuelRequest = (bool)cb_shadowduelrequest.IsChecked; client_config.IgnoreTradeRequest = (bool)cb_traderequest.IsChecked; client_config.Connexion_Message = (bool)cb_connectionmsg.IsChecked; client_config.Autoscroll = (bool)cb_autoscroll.IsChecked; client_config.PMPopup = (bool)cb_popuppm.IsChecked; client_config.AllowDeckShare = (bool)!cb_allowsharedeck.IsChecked; client_config.AllowReplayShare = (bool)!cb_allowsharereplay.IsChecked; client_config.PMEndDuel = (bool)cb_popupduelend.IsChecked; client_config.ShowChatScrollbar = (bool)cb_showchatscrollbar.IsChecked; client_config.UserlistScrollbar = (bool)cb_showuserlistscrollbar.IsChecked; client_config.ChatBackgroundIsPic = (bool)cb_backgroundchatpic.IsChecked; client_config.ShowArenaWaitingRoomMessage = (bool)cb_showarenamessage.IsChecked; client_config.TradeScrollBar = (bool)cb_scrollbartrade.IsChecked; client_config.AlternativePurchaseWindow = (bool)cb_alternativeshopwindow.IsChecked; client_config.DisplayTagTeam = (bool)cb_tagteam.IsChecked; style.Font = (FontFamily)cb_fontFamily.SelectedItem; if (style.Font == null) { style.Font = new FontFamily("Arial"); } style.FontSize = Convert.ToInt32(tb_fontsize.Text); style.Save(); client_config.Save(); FormExecution.RefreshChatStyle(); FormExecution.Client.OpenPopBox("Configurations mises à jour.", "Configurations"); Close(); }
public void Flash() { WindowInteropHelper wih = new WindowInteropHelper(FormExecution.GetChat()); FlashWindow(wih.Handle, true); }
private void btn_prestigeshop_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenPrestigeShop(); }
private NetworkData ParseMessage(string txt) { try { if (txt[0] == '/') { txt = txt.Substring(1); string cmd = txt.Split(' ')[0].ToString().ToUpper(); switch (cmd) { case "ANIM": return(new NetworkData(PacketType.ChatMessage, _cmdParser.AnimationMessage(txt.Substring(cmd.Length + 1)))); case "INFO": return(new NetworkData(PacketType.ChatMessage, _cmdParser.InformationMessage(txt.Substring(cmd.Length + 1)))); case "SETMOTD": return(new NetworkData(PacketType.ChatMessage, _cmdParser.SetMessageOfTheDay(txt.Substring(cmd.Length + 1)))); case "SETGREET": return(new NetworkData(PacketType.ChatMessage, _cmdParser.SetGreet(txt.Substring(cmd.Length + 1)))); case "KICK": return(new NetworkData(PacketType.Kick, _cmdParser.Kick(txt.Substring(cmd.Length + 1)))); case "BAN": return(new NetworkData(PacketType.Ban, _cmdParser.Ban(txt.Substring(cmd.Length + 1)))); case "UNBAN": return(new NetworkData(PacketType.Unban, _cmdParser.Unban(txt.Substring(cmd.Length + 1)))); case "MUTE": return(new NetworkData(PacketType.Mute, _cmdParser.Mute(txt.Substring(cmd.Length + 1)))); case "UNMUTE": return(new NetworkData(PacketType.Unmute, _cmdParser.Unmute(txt.Substring(cmd.Length + 1)))); case "CLEAR": return(new NetworkData(PacketType.Clear, _cmdParser.ClearChat(txt.Length > cmd.Length ? txt.Substring(cmd.Length + 1) : "."))); case "MUTECHAT": return(new NetworkData(PacketType.Mutechat, _cmdParser.MuteChat(txt.Length > cmd.Length ? txt.Substring(cmd.Length + 1) : "."))); case "MPALL": return(new NetworkData(PacketType.MPAll, _cmdParser.MPAll(txt.Substring(cmd.Length + 1)))); case "PANEL": Panel panel = new Panel(Client.PanelAdmin); panel.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => panel.Activate())); return(null); case "BANLIST": return(new NetworkData(PacketType.Banlist, new StandardClientBanlist { })); case "MUTELIST": return(new NetworkData(PacketType.Mutelist, new StandardClientMutelist { })); case "HELP": return(new NetworkData(PacketType.Help, new StandardClientAskHelp { })); case "GIVEBATTLEPOINTS": return(new NetworkData(PacketType.GivePoints, _cmdParser.GiveBattlePoints(txt.Substring(cmd.Length + 1)))); case "GIVEPRESTIGEPOINTS": return(new NetworkData(PacketType.GivePoints, _cmdParser.GivePrestigePoints(txt.Substring(cmd.Length + 1)))); case "GIVECARD": return(new NetworkData(PacketType.GiveCard, _cmdParser.GiveCard(txt.Substring(cmd.Length + 1)))); case "GIVEAVATAR": return(new NetworkData(PacketType.GiveAvatar, _cmdParser.GiveAvatar(txt.Substring(cmd.Length + 1)))); case "GIVEBORDER": return(new NetworkData(PacketType.GiveBorder, _cmdParser.GiveBorder(txt.Substring(cmd.Length + 1)))); case "GIVESLEEVE": return(new NetworkData(PacketType.GiveSleeve, _cmdParser.GiveSleeve(txt.Substring(cmd.Length + 1)))); case "GIVEPARTNER": return(new NetworkData(PacketType.GivePartner, _cmdParser.GivePartner(txt.Substring(cmd.Length + 1)))); case "GIVETITLE": return(new NetworkData(PacketType.GiveTitle, _cmdParser.GiveTitle(txt.Substring(cmd.Length + 1)))); case "ENABLED": return(new NetworkData(PacketType.EnabledAccount, _cmdParser.EnabledAccount(txt.Substring(cmd.Length + 1)))); case "DISABLED": return(new NetworkData(PacketType.DisabledAccount, _cmdParser.DisabledAccount(txt.Substring(cmd.Length + 1)))); case "PROMOTE": return(new NetworkData(PacketType.Ranker, _cmdParser.Ranker(txt.Substring(cmd.Length + 1)))); case "MAINTENANCE": return(new NetworkData(PacketType.Maintenance, _cmdParser.AskMaintenance(txt.Substring(cmd.Length + 1)))); case "MAINTENANCESTOP": return(new NetworkData(PacketType.StopMaintenance, _cmdParser.StopMaintenance())); case "DUELSERVERSTOP": return(new NetworkData(PacketType.DuelServerStop, _cmdParser.DuelServerStop(txt.Substring(cmd.Length + 1)))); case "DUELSERVERRESTART": return(new NetworkData(PacketType.DuelServerRestart, _cmdParser.DuelServerRestart())); case "NEXTRANKINGSEASON": return(new NetworkData(PacketType.NextRankingSeason, _cmdParser.AskNextRankingSeason())); case "BLACKLIST": Blacklist blacklist = new Blacklist(Client.BlacklistManager); blacklist.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => blacklist.Activate())); return(null); case "STATS": SpecialChatMessage?.Invoke(FormExecution.AppDesignConfig.GetGameColor("LauncherMessageColor"), "••• Il y a " + FormExecution.GetChatWindow().Players.Count + " utilisateurs connectés.", false, false); return(null); case "SMILEYS": ShowSmileys?.Invoke(); return(null); case "LOGS": _cmdParser.OpenLogFolder(); return(null); case "ROOMSLIST": return(new NetworkData(PacketType.RoomList, new StandardClientAskRoomList { })); case "KILLROOM": return(new NetworkData(PacketType.KillRoom, _cmdParser.KillRoom(txt.Substring(cmd.Length + 1)))); case "TEAMADD": return(new NetworkData(PacketType.AddTeamPlayer, _cmdParser.AddTeamMember(txt.Substring(cmd.Length + 1)))); case "TEAMREMOVE": return(new NetworkData(PacketType.RemoveTeamPlayer, _cmdParser.RemoveTeamMember(txt.Substring(cmd.Length + 1)))); case "TEAMCHANGELEADER": return(new NetworkData(PacketType.UpdateTeamLeader, _cmdParser.ChangeTeamLeader(txt.Substring(cmd.Length + 1)))); case "TEAMCHANGECOLEADER": return(new NetworkData(PacketType.UpdateTeamColeader, _cmdParser.ChangeTeamCoLeader(txt.Substring(cmd.Length + 1)))); case "TEAMLEAVE": return(new NetworkData(PacketType.LeaveTeam, _cmdParser.LeaveTeam())); case "RESTARTASTRAL": return(new NetworkData(PacketType.RestartAstral, new StandardClientRestartAstral { })); case "STORY": StoryModeConsole console = new StoryModeConsole(); console.Show(); return(null); default: SpecialChatMessage?.Invoke(FormExecution.AppDesignConfig.GetGameColor("LauncherMessageColor"), "••• Cette commande n'existe pas.", false, false); return(null); } } return(new NetworkData(PacketType.ChatMessage, _cmdParser.StandardMessage(txt))); } catch (Exception ex) { SpecialChatMessage?.Invoke(FormExecution.AppDesignConfig.GetGameColor("LauncherMessageColor"), "••• Une erreur s'est produite.", false, false); logger.Error("Chat input error : {0}", ex.ToString()); return(null); } }
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(); }
private void btn_brocante_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenBrocante(); }
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 }; }
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()); } }
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 void OnPlayerColoredMessage(Color color, PlayerInfo player, string text, bool canHighlight = false) { Paragraph pr = new Paragraph(); Run date = new Run("[" + DateTime.Now.ToString("HH:mm") + "] ["); date.Foreground = new SolidColorBrush(color); Run pl = new Run(ParseUsername(player.Username, player.Rank, player.VIP)); if (player.Team != 0 && FormExecution.ClientConfig.DisplayTagTeam) { pl.Text = player.TeamTag + " - " + pl.Text; } pl.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + player.ChatColorString)); Run txt = new Run("]: "); txt.Foreground = new SolidColorBrush(color); /*Image avatar = new Image(); * avatar.Width = FormExecution.AppDesignConfig.FontSize + 10; * avatar.Height = FormExecution.AppDesignConfig.FontSize + 10; * avatar.Source = DrawingImageToBitmapImage(RoundCorners(FormExecution.AssetsManager.GetCustom(player.Avatar), 300, System.Drawing.Color.Transparent)); * avatar.Margin = new Thickness(3);*/ date.BaselineAlignment = BaselineAlignment.Center; pl.BaselineAlignment = BaselineAlignment.Center; txt.BaselineAlignment = BaselineAlignment.Center; //pr.Inlines.Add(avatar); pr.Inlines.Add(date); pr.Inlines.Add(pl); pr.Inlines.Add(txt); string[] args = text.Split(' '); bool highlight = false; if (!canHighlight && args.Contains(FormExecution.Username)) { highlight = true; } bool bold = false; bool italic = false; bool underline = false; foreach (string word in args) { Run normalTxt = new Run(); normalTxt.BaselineAlignment = BaselineAlignment.Center; if (bold) { normalTxt.FontWeight = FontWeights.Bold; } if (italic) { normalTxt.FontStyle = FontStyles.Italic; } if (underline) { normalTxt.TextDecorations = TextDecorations.Underline; } if (highlight) { normalTxt.Background = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("HighlighMessageColor")); } if (word.StartsWith("http://") || word.StartsWith("www.") || word.StartsWith("https://")) { string url = word; if (word.EndsWith(".")) { url = word.Substring(0, word.Length - 2); } Hyperlink textLink = new Hyperlink(new Run(url)); if (highlight) { textLink.Background = new SolidColorBrush(FormExecution.AppDesignConfig.GetGameColor("HighlighMessageColor")); } textLink.NavigateUri = new Uri(url); textLink.RequestNavigate += TextLink_RequestNavigate; textLink.BaselineAlignment = BaselineAlignment.Center; pr.Inlines.Add(textLink); normalTxt.Text = " "; } else if (word.Length > 2 && word.StartsWith(":") && word.EndsWith(":") && FormExecution.AssetsManager.CheckSmiley(word.Substring(1, word.Length - 2)) != null) { Image img = new Image(); img.Source = FormExecution.AssetsManager.CheckSmiley(word.Substring(1, word.Length - 2)).Pic.Source.Clone(); img.Width = FormExecution.AppDesignConfig.FontSize + 10; img.Height = FormExecution.AppDesignConfig.FontSize + 10; img.MouseEnter += (sender, e) => Smiley_Hover(sender, e, word); img.MouseLeave += Smiley_Leave; pr.Inlines.Add(img); normalTxt.Text = " "; } else if (word == "**") { bold = !bold; continue; } else if (word == "*") { italic = !italic; continue; } else if (word == "__") { underline = !underline; continue; } else if (word.StartsWith("**")) { normalTxt.Text = (word.Substring(2) + " "); normalTxt.FontWeight = FontWeights.Bold; bold = true; } else if (word.EndsWith("**")) { normalTxt.Text = (word.Substring(0, word.Length - 2) + " "); bold = false; } else if (word.StartsWith("*")) { normalTxt.Text = (word.Substring(1) + " "); normalTxt.FontStyle = FontStyles.Italic; italic = true; } else if (word.EndsWith("*")) { normalTxt.Text = (word.Substring(0, word.Length - 1) + " "); italic = false; } else if (word.StartsWith("__")) { normalTxt.Text = (word.Substring(2) + " "); normalTxt.TextDecorations = TextDecorations.Underline; underline = true; } else if (word.EndsWith("__")) { normalTxt.Text = (word.Substring(0, word.Length - 2) + " "); underline = false; } else if (word == FormExecution.Username) { normalTxt.Text = (word + " "); normalTxt.FontWeight = FontWeights.Bold; FormExecution.FlashChat(); } else { normalTxt.Text = (word + " "); } normalTxt.BaselineAlignment = BaselineAlignment.Center; normalTxt.Foreground = new SolidColorBrush(color); pr.Inlines.Add(normalTxt); } pr.Margin = new Thickness(0); chat.Document.Blocks.Add(pr); if (FormExecution.ClientConfig.Autoscroll) { ScrollToCarret(); } }
private void btnArene_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Application.Current.Dispatcher.Invoke(() => FormExecution.OpenArena()); }
public void OnSpecialColoredMessage(Color color, string text) { Paragraph pr = new Paragraph(); Run date = new Run("[" + DateTime.Now.ToString("HH:mm") + "] "); date.Foreground = new SolidColorBrush(color); pr.Inlines.Add(date); string[] args = text.Split(' '); bool bold = false; bool italic = false; bool underline = false; foreach (string word in args) { Run normalTxt = new Run(); if (bold) { normalTxt.FontWeight = FontWeights.Bold; } if (italic) { normalTxt.FontStyle = FontStyles.Italic; } if (underline) { normalTxt.TextDecorations = TextDecorations.Underline; } if (word.StartsWith("http://") || word.StartsWith("www.") || word.StartsWith("https://")) { string url = word; if (word.EndsWith(".")) { url = word.Substring(0, word.Length - 2); } Hyperlink textLink = new Hyperlink(new Run(url)); textLink.NavigateUri = new Uri(url); textLink.RequestNavigate += TextLink_RequestNavigate; pr.Inlines.Add(textLink); normalTxt.Text = " "; } else if (word == "**") { bold = !bold; continue; } else if (word == "*") { italic = !italic; continue; } else if (word == "__") { underline = !underline; continue; } else if (word.StartsWith("**")) { normalTxt.Text = (word.Substring(2) + " "); normalTxt.FontWeight = FontWeights.Bold; bold = true; } else if (word.EndsWith("**")) { normalTxt.Text = (word.Substring(0, word.Length - 2) + " "); bold = false; } else if (word.StartsWith("*")) { normalTxt.Text = (word.Substring(1) + " "); normalTxt.FontStyle = FontStyles.Italic; italic = true; } else if (word.EndsWith("*")) { normalTxt.Text = (word.Substring(0, word.Length - 1) + " "); italic = false; } else if (word.StartsWith("__")) { normalTxt.Text = (word.Substring(2) + " "); normalTxt.TextDecorations = TextDecorations.Underline; underline = true; } else if (word.EndsWith("__")) { normalTxt.Text = (word.Substring(0, word.Length - 2) + " "); underline = false; } else if (word == FormExecution.Username) { normalTxt.Text = (word + " "); normalTxt.FontWeight = FontWeights.Bold; FormExecution.FlashChat(); } else { normalTxt.Text = (word + " "); } normalTxt.Foreground = new SolidColorBrush(color); pr.Inlines.Add(normalTxt); } pr.Margin = new Thickness(0); chat.Document.Blocks.Add(pr); if (FormExecution.ClientConfig.Autoscroll) { ScrollToCarret(); } }
private void BtnRegister_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenRegisterForm(); }
private void btnTools_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenTools(); }
private void btn_datasretrieval_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenDatasRetrievalWindow(); }
private void btn_choosepics_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Application.Current.Dispatcher.Invoke(() => FormExecution.OpenChangePicsWindow()); }
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); }
private void closeIcon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.ActivateShop(); this.Close(); }
private void Btn_host_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { FormExecution.OpenDuelRequest(-1); }