private void BindMessageEventHandler(BindMessageEventArgs inObj) { // If a message came along, we show the message overlay if (inObj.Title != null && inObj.Message != null) { MessageOverlay.ShowOverlay(inObj.Title, inObj.Message); } }
private void ServerThread(object data) { var pipeServer = new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifJidafd", PipeDirection.InOut, NumThreads); pipeServer.WaitForConnection(); Client.SendPIPE = new StreamString(pipeServer); Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on"); var assembly = Assembly.GetExecutingAssembly(); var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); var version = fvi.FileVersion; Client.SendPIPE.WriteString("LegendaryClient Version: " + version); Client.SendPIPE.WriteString("AwaitStart"); var output = new NamedPipeClientStream(".", "LegendaryClientPipe@191537514598135486vneaoifJidafdOUTPUT", PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation); output.Connect(); var ss = new StreamString(output); Client.InPIPE = ss; Started = true; while (Started) { var x = ss.ReadString(); if (x.Contains("SendOVERLAY")) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { var mmm = x.Split('|'); var messageOver = new MessageOverlay { MessageTitle = { Content = mmm[1] }, MessageTextBox = { Text = mmm[2] } }; if (!x.ToLower().Contains("fullover")) { Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; } else { Client.FullNotificationOverlayContainer.Content = messageOver.Content; Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible; } Client.SendPIPE.WriteString("Overlay received!"); })); } else if (x == "Server_STOPPED") { Started = false; } } }
internal static void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { if (OnMessage != null) { OnMessage(sender, msg); } if (msg.Subject != null) { ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true); if (subject == ChatSubjects.PRACTICE_GAME_INVITE || subject == ChatSubjects.GAME_INVITE) { MainWin.FlashWindow(); NotificationPopup pop = new NotificationPopup(subject, msg); pop.Height = 230; pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; NotificationGrid.Children.Add(pop); } else if (subject == ChatSubjects.GAME_MSG_OUT_OF_SYNC) { MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = "Game no longer exists"; messageOver.MessageTextBox.Text = "The game you are looking for no longer exists."; Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; } } })); //On core thread if (msg.Subject != null) { return; } if (AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body)) { ChatPlayerItem chatItem = AllPlayers[msg.From.User]; chatItem.Messages.Add(chatItem.Username + "|" + msg.Body); MainWin.FlashWindow(); } }
public PlotterUi(Game game, AppSettings appSettings, ScriptManager scriptManager, OnScreenLogger onScreenLogger) { _appSettings = appSettings; _scriptManager = scriptManager; _onScreenLogger = onScreenLogger; var renderer = new MonoGameImGuiRenderer(game); renderer.Initialize(); _imGuiManager = new ImGuiManager(renderer); _imGuiDemoWindow = new ImGuiDemoWindow(); _imGuiManager.AddElement(_imGuiDemoWindow); var messageOverlay = new MessageOverlay(onScreenLogger) { IsVisible = true }; messageOverlay.DismissMostRecentMessageClicked += (sender, args) => _onScreenLogger.RemoveMostRecentMessage(); _imGuiManager.AddElement(messageOverlay); AppToolbar = new AppToolbar(_scriptManager, _appSettings) { IsVisible = true }; _imGuiManager.AddElement(AppToolbar); _imGuiManager.AddElement(new ImGuiSettings { IsVisible = true }); AppToolbar.SettingsClicked += (sender, args) => CreateSettingsWindow(); AppToolbar.NewClicked += (sender, args) => CreateNewFileDialog(); AppToolbar.OpenClicked += (sender, args) => OpenScriptFile(args); }
private SoundEffect LoadSound(string name) { if (SoundsEnabled) { SoundEffect sound; try { sound = Game.Content.Load <SoundEffect>(name); } catch (Microsoft.Xna.Framework.Audio.NoAudioHardwareException e) { // If no audio hardware is installed, print a warning and don't try to load sounds again MessageOverlay.Show("Audio error", e.Message); SoundsEnabled = false; return(null); } loadedSounds.Add(name, sound); return(sound); } else { return(null); } }
//internal static Inviter CurrentInviter; #pragma warning disable 4014 internal static void OnMessageReceived(object sender, object message) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (message is StoreAccountBalanceNotification) { StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message; InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp; Client.LoginPacket.IpBalance = newBalance.Ip; Client.LoginPacket.RpBalance = newBalance.Rp; } else if (message is GameNotification) { GameNotification notification = (GameNotification)message; MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = notification.Type; switch (notification.Type) { case "PLAYER_BANNED_FROM_GAME": messageOver.MessageTitle.Content = "Banned from custom game"; messageOver.MessageTextBox.Text = "You have been banned from this custom game!"; break; default: messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine; messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument); break; } Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; Client.ClearPage(typeof(CustomGameLobbyPage)); if (messageOver.MessageTitle.Content.ToString() != "PLAYER_QUIT") { Client.SwitchPage(new MainPage()); } } else if (message is PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats) { PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats stats = message as PVPNetConnect.RiotObjects.Platform.Statistics.EndOfGameStats; EndOfGamePage EndOfGame = new EndOfGamePage(stats); Client.ClearPage(typeof(TeamQueuePage)); Client.OverlayContainer.Visibility = Visibility.Visible; Client.OverlayContainer.Content = EndOfGame.Content; } else if (message is StoreFulfillmentNotification) { PlayerChampions = await PVPNet.GetAvailableChampions(); } else if (message is Inviter) { Inviter stats = message as Inviter; //CurrentInviter = stats; } else if (message is InvitationRequest) { InvitationRequest stats = message as InvitationRequest; //TypedObject body = (TypedObject)to["body"]; if (stats.Inviter != null) { try { //Already existant popup. Do not create a new one var x = Client.InviteData[stats.InvitationId]; if (x.Inviter != null) { return; } } catch { } MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { GameInvitePopup pop = new GameInvitePopup(stats); pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; pop.Height = 230; Client.NotificationGrid.Children.Add(pop); })); } } })); }
internal static void OnMessageReceived(object sender, MessageReceivedEventArgs message) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (message.Body is StoreAccountBalanceNotification) { StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message.Body; InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp; LoginPacket.IpBalance = newBalance.Ip; LoginPacket.RpBalance = newBalance.Rp; } else if (message.Body is GameNotification) { GameNotification notification = (GameNotification)message.Body; MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = notification.Type; switch (notification.Type) { case "PLAYER_BANNED_FROM_GAME": messageOver.MessageTitle.Content = "Banned from custom game"; messageOver.MessageTextBox.Text = "You have been banned from this custom game!"; break; case "PLAYER_QUIT": string[] Name = await RiotCalls.GetSummonerNames(new double[1] { Convert.ToDouble((string)notification.MessageArgument) }); messageOver.MessageTitle.Content = "Player has left the queue"; messageOver.MessageTextBox.Text = Name[0] + " has left the queue"; break; default: messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine; messageOver.MessageTextBox.Text += Convert.ToString(notification.MessageArgument); break; } OverlayContainer.Content = messageOver.Content; OverlayContainer.Visibility = Visibility.Visible; QuitCurrentGame(); } else if (message.Body is EndOfGameStats) { EndOfGameStats stats = message.Body as EndOfGameStats; EndOfGamePage EndOfGame = new EndOfGamePage(stats); OverlayContainer.Visibility = Visibility.Visible; OverlayContainer.Content = EndOfGame.Content; } else if (message.Body is StoreFulfillmentNotification) { PlayerChampions = await RiotCalls.GetAvailableChampions(); } else if (message.Body is GameDTO) { GameDTO Queue = message.Body as GameDTO; if (!IsInGame && Queue.GameState != "TERMINATED" && Queue.GameState != "TERMINATED_IN_ERROR") { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { Client.OverlayContainer.Content = new QueuePopOverlay(Queue).Content; Client.OverlayContainer.Visibility = Visibility.Visible; })); } } else if (message.Body is SearchingForMatchNotification) { SearchingForMatchNotification Notification = message.Body as SearchingForMatchNotification; if (Notification.PlayerJoinFailures != null && Notification.PlayerJoinFailures.Count > 0) { MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = "Could not join the queue"; foreach (QueueDodger x in Notification.PlayerJoinFailures) { messageOver.MessageTextBox.Text += x.Summoner.Name + " is unable to join the queue as they recently dodged a game." + Environment.NewLine; TimeSpan time = TimeSpan.FromMilliseconds(x.PenaltyRemainingTime); messageOver.MessageTextBox.Text += "You have " + string.Format("{0:D2}m:{1:D2}s", time.Minutes, time.Seconds) + " remaining until you may queue again"; } OverlayContainer.Content = messageOver.Content; OverlayContainer.Visibility = Visibility.Visible; } } })); }
private void ServerThread(object data) { NamedPipeServerStream pipeServer = new NamedPipeServerStream("LegendaryClientPipe@191537514598135486vneaoifjidafd", PipeDirection.InOut, numThreads); int threadId = Thread.CurrentThread.ManagedThreadId; pipeServer.WaitForConnection(); try { Client.SendPIPE = new StreamString(pipeServer); Client.SendPIPE.WriteString("Logger started. All errors will be logged from now on"); Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; Client.SendPIPE.WriteString("LegendaryClient Version: " + version); Client.SendPIPE.WriteString("AwaitStart"); NamedPipeClientStream output = new NamedPipeClientStream(".", "LegendaryClientPipe@191537514598135486vneaoifjidafdOUTPUT", PipeDirection.InOut, PipeOptions.None, TokenImpersonationLevel.Impersonation); output.Connect(); StreamString ss = new StreamString(output); Client.InPIPE = ss; started = true; while (started) { string x = ss.ReadString(); if (x.Contains("SendOVERLAY")) { try { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { string[] mmm = x.Split('|'); var messageOver = new MessageOverlay { MessageTitle = { Content = mmm[1] }, MessageTextBox = { Text = mmm[2] } }; if (!x.ToLower().Contains("fullover")) { Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; } else { Client.FullNotificationOverlayContainer.Content = messageOver.Content; Client.FullNotificationOverlayContainer.Visibility = Visibility.Visible; } Client.SendPIPE.WriteString("Overlay received!"); })); } catch { Client.SendPIPE.WriteString("Unable to show the overlay :("); } } else if (x == "Server_STOPPED") { started = false; } } } catch (IOException e) { Client.Log(e.Message, "IOException"); Client.Log(e.StackTrace, "IOException"); Client.Log(e.Source, "IOException"); } }
//internal static Inviter CurrentInviter; internal static void OnMessageReceived(object sender, object message) { MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (message is StoreAccountBalanceNotification) { StoreAccountBalanceNotification newBalance = (StoreAccountBalanceNotification)message; InfoLabel.Content = "IP: " + newBalance.Ip + " ∙ RP: " + newBalance.Rp; Client.LoginPacket.IpBalance = newBalance.Ip; Client.LoginPacket.RpBalance = newBalance.Rp; } else if (message is GameNotification) { GameNotification notification = (GameNotification)message; MessageOverlay messageOver = new MessageOverlay(); messageOver.MessageTitle.Content = notification.Type; switch (notification.Type) { case "PLAYER_BANNED_FROM_GAME": messageOver.MessageTitle.Content = "Banned from custom game"; messageOver.MessageTextBox.Text = "You have been banned from this custom game!"; break; default: messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine; messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument); break; } Client.OverlayContainer.Content = messageOver.Content; Client.OverlayContainer.Visibility = Visibility.Visible; Client.ClearPage(new CustomGameLobbyPage()); Client.SwitchPage(new MainPage()); } else if (message is EndOfGameStats) { EndOfGameStats stats = message as EndOfGameStats; EndOfGamePage EndOfGame = new EndOfGamePage(stats); Client.OverlayContainer.Visibility = Visibility.Visible; Client.OverlayContainer.Content = EndOfGame.Content; } else if (message is StoreFulfillmentNotification) { PlayerChampions = await PVPNet.GetAvailableChampions(); } else if (message is Inviter) { Inviter stats = message as Inviter; //CurrentInviter = stats; } else if (message is InvitationRequest) { InvitationRequest stats = message as InvitationRequest; Inviter Inviterstats = message as Inviter; //TypedObject body = (TypedObject)to["body"]; MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { //Gameinvite stuff GameInvitePopup pop = new GameInvitePopup(stats); //await Invite.Callback; //Invite.InvitationRequest(body); pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; pop.Height = 230; Client.NotificationGrid.Children.Add(pop); //Client.InviteJsonRequest = LegendaryClient.Logic.JSON.InvitationRequest.PopulateGameInviteJson(); //message.GetType() == typeof(GameInvitePopup) })); } })); }
public void DrawMessageOverlay(MessageOverlay overlay) { DrawMessageOverlay(overlay.HeaderText, overlay.MessageText, overlay.FooterText); }
public void RenderLeague() { if (myLeagues == null) { //MessageBox.Show("You are not in League."); var overlay = new MessageOverlay { MessageTextBox = { Text = "You are not in League." }, MessageTitle = { Content = "Not in League" } }; Client.OverlayContainer.Content = overlay.Content; Client.OverlayContainer.Visibility = Visibility.Visible; return; } LeaguesListView.Items.Clear(); foreach (var leagues in myLeagues.SummonerLeagues.Where(leagues => leagues.Queue == queue)) { switch (selectedRank) { case "V": UpTierButton.IsEnabled = true; DownTierButton.IsEnabled = false; break; case "I": UpTierButton.IsEnabled = false; DownTierButton.IsEnabled = true; break; default: UpTierButton.IsEnabled = true; DownTierButton.IsEnabled = true; break; } CurrentLeagueLabel.Content = leagues.Tier + " " + selectedRank; CurrentLeagueNameLabel.Content = leagues.Name; var players = leagues.Entries.OrderBy(o => o.LeaguePoints).Where(item => item.Rank == selectedRank).ToList(); players.Reverse(); var i = 0; foreach (var player in players) { i++; var item = new LeagueItem { PlayerRankLabel = {Content = i} }; if (i - player.PreviousDayLeaguePosition != 0) { item.RankChangeLabel.Content = i - player.PreviousDayLeaguePosition; } item.PlayerLabel.Content = player.PlayerOrTeamName; if (player.FreshBlood) { item.RecruitLabel.Visibility = Visibility.Visible; } if (player.Veteran) { item.VeteranLabel.Visibility = Visibility.Visible; } if (player.HotStreak) { item.HotStreakLabel.Visibility = Visibility.Visible; } item.WinsLabel.Content = player.Wins; item.LpLabel.Content = player.LeaguePoints; var miniSeries = player.MiniSeries; if (miniSeries != null) { item.LpLabel.Content = player.MiniSeries.Progress.Replace('N', '-'); } LeaguesListView.Items.Add(item); } } LeaguesListView.SelectedIndex = 0; }