public void OnMissionChange(object sender, EventArgs args) { if (!(sender is MissionInstance)) { return; } MissionInstance mission = (MissionInstance)sender; DialogueInfo dialogueInfo = mission.CurrentMission.NewDialogueOption; if (dialogueInfo != null) { IChattable npc = EntityService.GetInstance().GetNpcById(dialogueInfo.NpcId); DialogueManager.GetInstance().AssignNewDialogue(dialogueInfo); } NotificationPopup.GetInstance().AddNotification(string.Format("Mission log updated")); hasChanged = true; }
public void Redesign(IActivityDesigner designer, IRedesignRequest request) { CreateAndOpenRunspace(); NotificationPopup dlg = new NotificationPopup(); dlg.Show(); SetCurrentInputValues(request.RedesignInputs); if (string.IsNullOrEmpty(request.ChangedPropertyName)) { //Redesign was called because the user opened a saved activity in the UI (no property changed) AddModuleNames(designer); dlg.ProgressValue = 20; AddCmdletNames(designer); dlg.ProgressValue = 40; AddParametersets(designer); dlg.ProgressValue = 70; AddCmdletProperties(designer); dlg.ProgressValue = 90; dlg.Close(); return; } switch (request.ChangedPropertyName) { case ("Module Name"): _cmdletName = string.Empty; _parameterSetName = string.Empty; break; case ("Cmdlet Name"): _parameterSetName = string.Empty; break; case ("ParameterSet"): break; case ("Output Parameter Count"): break; default: //should not be here. break; } AddModuleNames(designer); dlg.ProgressValue = 20; AddCmdletNames(designer); dlg.ProgressValue = 40; AddParametersets(designer); dlg.ProgressValue = 70; AddCmdletProperties(designer); dlg.ProgressValue = 90; dlg.Close(); CloseRunspace(); }
/// <summary> /// Main logic behind Champion Select /// </summary> /// <param name="sender"></param> /// <param name="message"></param> private void ChampSelect_OnMessageReceived(object sender, object message) { if (message.GetType() == typeof(GameDTO)) { #region In Champion Select GameDTO ChampDTO = message as GameDTO; LatestDto = ChampDTO; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { //Allow all champions to be selected (reset our modifications) ListViewItem[] ChampionArray = new ListViewItem[ChampionSelectListView.Items.Count]; ChampionSelectListView.Items.CopyTo(ChampionArray, 0); foreach (ListViewItem y in ChampionArray) { y.IsHitTestVisible = true; y.Opacity = 1; } //Push all teams into one array to save a foreach call (looks messy) List <Participant> AllParticipants = new List <Participant>(ChampDTO.TeamOne.ToArray()); AllParticipants.AddRange(ChampDTO.TeamTwo); foreach (Participant p in AllParticipants) { if (p is PlayerParticipant) { PlayerParticipant play = (PlayerParticipant)p; //If it is our turn to pick if (play.PickTurn == ChampDTO.PickTurn) { if (play.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId) { ChampionSelectListView.IsHitTestVisible = true; ChampionSelectListView.Opacity = 1; GameStatusLabel.Content = "Your turn to pick!"; break; } } } //Otherwise block selection of champions unless in dev mode if (!DevMode) { ChampionSelectListView.IsHitTestVisible = false; ChampionSelectListView.Opacity = 0.5; } GameStatusLabel.Content = "Waiting for others to pick..."; } //Champion select was cancelled if (ChampDTO.GameState == "TEAM_SELECT") { if (CountdownTimer != null) { CountdownTimer.Stop(); } FixChampSelect(); FakePage fakePage = new FakePage(); fakePage.Content = LobbyContent; Client.SwitchPage(fakePage); return; } else if (ChampDTO.GameState == "PRE_CHAMP_SELECT") { //Banning phase. Enable banning phase and this will render only champions for ban BanningPhase = true; PurpleBansLabel.Visibility = Visibility.Visible; BlueBansLabel.Visibility = Visibility.Visible; BlueBanListView.Visibility = Visibility.Visible; PurpleBanListView.Visibility = Visibility.Visible; GameStatusLabel.Content = "Bans are on-going"; counter = configType.BanTimerDuration - 3; #region Render Bans BlueBanListView.Items.Clear(); PurpleBanListView.Items.Clear(); foreach (var x in ChampDTO.BannedChampions) { Image champImage = new Image(); champImage.Height = 58; champImage.Width = 58; champImage.Source = champions.GetChampion(x.ChampionId).icon; if (x.TeamId == 100) { BlueBanListView.Items.Add(champImage); } else { PurpleBanListView.Items.Add(champImage); } foreach (ListViewItem y in ChampionArray) { if ((int)y.Tag == x.ChampionId) { ChampionSelectListView.Items.Remove(y); //Remove from arrays foreach (ChampionDTO PlayerChamps in ChampList.ToArray()) { if (x.ChampionId == PlayerChamps.ChampionId) { ChampList.Remove(PlayerChamps); break; } } foreach (ChampionBanInfoDTO BanChamps in ChampionsForBan.ToArray()) { if (x.ChampionId == BanChamps.ChampionId) { ChampionsForBan.Remove(BanChamps); break; } } } } } #endregion Render Bans } else if (ChampDTO.GameState == "CHAMP_SELECT") { //Picking has started. If pickturn has changed reset timer LastPickTurn = ChampDTO.PickTurn; BanningPhase = false; } else if (ChampDTO.GameState == "POST_CHAMP_SELECT") { //Post game has started. Allow trading CanTradeWith = await Client.PVPNet.GetPotentialTraders(); HasLockedIn = true; GameStatusLabel.Content = "All players have picked!"; if (configType != null) { counter = configType.PostPickTimerDuration - 2; } else { counter = 10; } } else if (ChampDTO.GameState == "START_REQUESTED") { GameStatusLabel.Content = "The game is about to start!"; DodgeButton.IsEnabled = false; //Cannot dodge past this point! counter = 1; } else if (ChampDTO.GameState == "TERMINATED") { //TODO } #region Display players BlueListView.Items.Clear(); PurpleListView.Items.Clear(); int i = 0; bool PurpleSide = false; //Aram hack, view other players champions & names (thanks to Andrew) List <PlayerChampionSelectionDTO> OtherPlayers = new List <PlayerChampionSelectionDTO>(ChampDTO.PlayerChampionSelections.ToArray()); bool AreWePurpleSide = false; foreach (Participant participant in AllParticipants) { Participant tempParticipant = participant; i++; ChampSelectPlayer control = new ChampSelectPlayer(); //Cast AramPlayers as PlayerParticipants. This removes reroll data if (tempParticipant is AramPlayerParticipant) { tempParticipant = new PlayerParticipant(tempParticipant.GetBaseTypedObject()); } if (tempParticipant is PlayerParticipant) { PlayerParticipant player = tempParticipant as PlayerParticipant; control.PlayerName.Content = player.SummonerName; foreach (PlayerChampionSelectionDTO selection in ChampDTO.PlayerChampionSelections) { #region Disable picking selected champs foreach (ListViewItem y in ChampionArray) { if ((int)y.Tag == selection.ChampionId) { y.IsHitTestVisible = false; y.Opacity = 0.5; if (configType != null) { if (configType.DuplicatePick) { y.IsHitTestVisible = true; y.Opacity = 1; } } } } #endregion Disable picking selected champs if (selection.SummonerInternalName == player.SummonerInternalName) { //Clear our teams champion selection for aram hack OtherPlayers.Remove(selection); control = RenderPlayer(selection, player); //If we have locked in render skin select if (HasLockedIn && selection.SummonerInternalName == Client.LoginPacket.AllSummonerData.Summoner.InternalName && !DevMode) { if (PurpleSide) { AreWePurpleSide = true; } RenderLockInGrid(selection); if (player.PointSummary != null) { LockInButton.Content = string.Format("Reroll ({0}/{1})", player.PointSummary.CurrentPoints, player.PointSummary.PointsCostToRoll); if (player.PointSummary.NumberOfRolls > 0) { LockInButton.IsEnabled = true; } else { LockInButton.IsEnabled = false; } } } } } } else if (tempParticipant is ObfuscatedParticipant) { control.PlayerName.Content = "Summoner " + i; } else if (tempParticipant is BotParticipant) { BotParticipant bot = tempParticipant as BotParticipant; string botChamp = bot.SummonerName.Split(' ')[0]; //Why is this internal name rito? champions botSelectedChamp = champions.GetChampion(botChamp); PlayerParticipant part = new PlayerParticipant(); PlayerChampionSelectionDTO selection = new PlayerChampionSelectionDTO(); selection.ChampionId = botSelectedChamp.id; part.SummonerName = botSelectedChamp.displayName + " bot"; control = RenderPlayer(selection, part); } else { control.PlayerName.Content = "Unknown Summoner"; } //Display purple side if we have gone through our team if (i > ChampDTO.TeamOne.Count) { i = 0; PurpleSide = true; } if (!PurpleSide) { BlueListView.Items.Add(control); } else { PurpleListView.Items.Add(control); } } //Do aram hack! if (OtherPlayers.Count > 0) { if (AreWePurpleSide) { BlueListView.Items.Clear(); } else { PurpleListView.Items.Clear(); } foreach (PlayerChampionSelectionDTO hackSelection in OtherPlayers) { ChampSelectPlayer control = new ChampSelectPlayer(); PlayerParticipant player = new PlayerParticipant(); player.SummonerName = hackSelection.SummonerInternalName; control = RenderPlayer(hackSelection, player); if (AreWePurpleSide) { BlueListView.Items.Add(control); } else { PurpleListView.Items.Add(control); } } } #endregion Display players })); #endregion In Champion Select } else if (message.GetType() == typeof(PlayerCredentialsDto)) { #region Launching Game PlayerCredentialsDto dto = message as PlayerCredentialsDto; Client.CurrentGame = dto; if (!HasLaunchedGame) { HasLaunchedGame = true; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { if (CountdownTimer != null) { CountdownTimer.Stop(); } QuitCurrentGame(); })); Client.LaunchGame(); } #endregion Launching Game } else if (message.GetType() == typeof(TradeContractDTO)) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { TradeContractDTO TradeDTO = message as TradeContractDTO; if (TradeDTO.State == "PENDING") { PlayerTradeControl.Visibility = System.Windows.Visibility.Visible; PlayerTradeControl.Tag = TradeDTO; PlayerTradeControl.AcceptButton.Visibility = System.Windows.Visibility.Visible; PlayerTradeControl.DeclineButton.Content = "Decline"; champions MyChampion = champions.GetChampion((int)TradeDTO.ResponderChampionId); PlayerTradeControl.MyChampImage.Source = MyChampion.icon; PlayerTradeControl.MyChampLabel.Content = MyChampion.displayName; champions TheirChampion = champions.GetChampion((int)TradeDTO.RequesterChampionId); PlayerTradeControl.TheirChampImage.Source = TheirChampion.icon; PlayerTradeControl.TheirChampLabel.Content = TheirChampion.displayName; PlayerTradeControl.RequestLabel.Content = string.Format("{0} wants to trade!", TradeDTO.RequesterInternalSummonerName); } else if (TradeDTO.State == "CANCELED" || TradeDTO.State == "DECLINED" || TradeDTO.State == "BUSY") { PlayerTradeControl.Visibility = System.Windows.Visibility.Hidden; NotificationPopup pop = new NotificationPopup(ChatSubjects.INVITE_STATUS_CHANGED, string.Format("{0} has {1} this trade", TradeDTO.RequesterInternalSummonerName, TradeDTO.State)); if (TradeDTO.State == "BUSY") { pop.NotificationTextBox.Text = string.Format("{0} is currently busy", TradeDTO.RequesterInternalSummonerName); } pop.Height = 200; pop.OkButton.Visibility = System.Windows.Visibility.Visible; pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; Client.NotificationGrid.Children.Add(pop);//*/ } })); } }
protected override void ShowNotificationPopupInternal(NotificationPopup popup) { IntPtr hError = IntPtr.Zero; IntPtr hNotification = Internal.Notify.Methods.notify_notification_new (popup.Summary, popup.Content, popup.IconName); Internal.Notify.Methods.notify_notification_show (hNotification, hError); }
private void Awake() { instance = this; }
private void LoadWindows() { Rectangle screenRectangle = gameRef.ScreenRectangle; ContentManager content = Game.Content; SpriteFont font = content.Load <SpriteFont>(@"Fonts\ItemDataFont"); notifications = NotificationPopup.GetInstance(); notifications.Font = font; notifications.Size = new Vector2(300, 0); notifications.Position = new Vector2((screenRectangle.Width - notifications.Size.X) / 2, screenRectangle.Height * (3f / 4f)); Texture2D tooltipBackground = content.Load <Texture2D>(@"GUI\Inventory\Tooltip\background-v2"); Texture2D tooltipBorder = content.Load <Texture2D>(@"GUI\Inventory\Tooltip\border-v6"); SimpleHUDWindow pauseWindow = new SimpleHUDWindow(font); PauseGameComponent pauseMenu = new PauseGameComponent(font, gameRef.Content); pauseMenu.RegisterExitButtonEvent(new EventHandler(CloseWindow)); pauseMenu.RegisterResumeButtonEvent(new EventHandler(ClosePauseMenuWindow)); pauseMenu.RegisterCommand(Keys.Escape, ClosePauseMenuWindow, ClickState.RELEASED); //pauseMenu.BackgroundTexture = tooltipBackground; //TODO: hardcoded offset pauseMenu.ButtonOffset = new Vector2(100, 50); pauseWindow.BorderTexture = tooltipBorder; //TODO: hardcoded size pauseWindow.Size = new Vector2(400, 400); Vector2 position = new Vector2((screenRectangle.Width - pauseWindow.Size.X) / 2, (screenRectangle.Height - pauseWindow.Size.Y) / 2); pauseWindow.Position = position; pauseWindow.Component = pauseMenu; hudManager.Put(Window.PAUSE, pauseWindow); InventoryHUDWindow inventoryEquipmentWindow = new InventoryHUDWindow(this, font, gameRef.Content, tooltipBorder, screenRectangle); ItemPickedUp += inventoryEquipmentWindow.OnItemPickup; hudManager.Put(Window.INVENTORY, inventoryEquipmentWindow); commandManager.RegisterCommand(Keys.I, inventoryEquipmentWindow.ShowEquipment); commandManager.RegisterCommand(Keys.U, inventoryEquipmentWindow.ShowInventory); inventoryEquipmentWindow.RegisterCommand(Keys.I, inventoryEquipmentWindow.ToggleEquipment); inventoryEquipmentWindow.RegisterCommand(Keys.U, inventoryEquipmentWindow.ToggleInventory); inventoryEquipmentWindow.RegisterCommand(Keys.Escape, inventoryEquipmentWindow.Close); inventoryEquipmentWindow.RegisterStatChangeEvent(ChangePlayerStats); SimpleHUDWindow missionLogWindow = new SimpleHUDWindow(font); MissionLogComponent missionLogComponent = new MissionLogComponent(font, gameRef.Content); //TODO: hardcoded position and size missionLogWindow.Size = new Vector2(800, 600); position = new Vector2((screenRectangle.Width - missionLogWindow.Size.X) / 2, (screenRectangle.Height - missionLogWindow.Size.Y) / 2); missionLogWindow.Position = position; missionLogWindow.Component = missionLogComponent; missionLogWindow.BorderTexture = tooltipBorder; //TODO: hardcoded title missionLogWindow.Title = "Mission Log"; missionLogComponent.RegisterCommand(Keys.L, CloseMissionLogWindow, ClickState.RELEASED); missionLogComponent.RegisterCommand(Keys.Escape, CloseMissionLogWindow, ClickState.RELEASED); hudManager.Put(Window.MISSION_LOG, missionLogWindow); SimpleHUDWindow playerInfoWindow = new SimpleHUDWindow(font); PlayerInfoComponent playerInfoComponent = new PlayerInfoComponent(font, content, player); //TODO: hardcoded size and test position playerInfoWindow.Size = new Vector2(400, 300); position = new Vector2((screenRectangle.Width - playerInfoWindow.Size.X) / 2, (screenRectangle.Height - playerInfoWindow.Size.Y) / 2); playerInfoWindow.Position = position; playerInfoWindow.Component = playerInfoComponent; playerInfoWindow.BorderTexture = tooltipBorder; //TODO: hardcoded title playerInfoWindow.Title = "Player Stats"; playerInfoComponent.RegisterCommand(Keys.C, ClosePlayerInfoWindow, ClickState.RELEASED); playerInfoComponent.RegisterCommand(Keys.Escape, ClosePlayerInfoWindow, ClickState.RELEASED); hudManager.Put(Window.PLAYER_INFO, playerInfoWindow); gameInterface = new GameInterface(player, font); //TODO: hardcoded position gameInterface.Position = new Vector2(screenRectangle.Width - 200, screenRectangle.Height - 60); }
private void createMissions() { missions = new List <Mission>(); Type[] missionsClassesList = Assembly.GetExecutingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(Mission))).ToArray(); foreach (Type missionClass in missionsClassesList) { Mission newMission = (Mission)Activator.CreateInstance(missionClass); if (Globals.debug == true || newMission.getIsActivated()) { newMission.OnStarted += (sender) => { if (DemagoScript.currentMission != null) { DemagoScript.currentMission.stop(); } DemagoScript.currentMission = (Mission)sender; GTA.UI.Notify(sender.getName()); if (!Globals.debug) { GUIManager.Instance.menu.getMenuPool().hide("Outils"); GUIManager.Instance.menu.getMenuPool().hide("Modèles"); GUIManager.Instance.menu.getMenuPool().hide("Véhicules"); } }; newMission.OnAccomplished += (sender, time) => { string missionTime = "Temps inconnu"; if (Tools.getTextFromMilliSeconds(time) != "") { missionTime = "En " + Tools.getTextFromMilliSeconds(time); } SuccessMissionPopup successPopup = new SuccessMissionPopup(sender.getName(), missionTime); successPopup.OnPopupClose += () => { GUIManager.Instance.popupManager.remove(successPopup); AudioManager.Instance.FilesSubFolder = @"joe\joe"; AudioManager.Instance.startSound("anticonformiste"); NotificationPopup creditsPopup = new NotificationPopup(); creditsPopup.add(new UIRectElement(0.5, 0.5, 1, 1, UIColor.BLACK, 200)); creditsPopup.add(new UITextElement("GTA Démago", 0.5, 0.2, 1.5, true, Font.Pricedown, UIColor.GTA_YELLOW)); creditsPopup.add(new UITextElement("Merci d’avoir jouer à GTA Démago !", 0.5, 0.29, 0.7, true, Font.ChaletLondon, UIColor.WHITE)); creditsPopup.add(new UITextElement("De nouvelles missions seront bientôt disponibles alors rejoignez nous sur ", 0.5, 0.33, 0.7, true, Font.ChaletLondon, UIColor.WHITE)); creditsPopup.add(new UITextElement("Twitch : http://twitch.tv/realmyop2", 0.5, 0.39, 0.5, true, Font.ChaletLondon, UIColor.WHITE)); creditsPopup.add(new UITextElement("Facebook : http://facebook.com/realmyop", 0.5, 0.42, 0.5, true, Font.ChaletLondon, UIColor.WHITE)); creditsPopup.add(new UITextElement("Twitter : http://twitter.com/RealMyop", 0.5, 0.45, 0.5, true, Font.ChaletLondon, UIColor.WHITE)); creditsPopup.add(new UITextElement("Venez nombreux !", 0.5, 0.525, 1, true, Font.HouseScript, UIColor.WHITE)); creditsPopup.add(new UITextElement("Entrée pour fermer", 0.5, 0.9, 0.6, true, Font.HouseScript, UIColor.WHITE)); creditsPopup.OnPopupClose += () => { GUIManager.Instance.popupManager.remove(creditsPopup); AudioManager.Instance.stopAll(); AudioManager.Instance.FilesSubFolder = ""; }; Script.Wait(100); creditsPopup.show(); }; successPopup.show(); }; newMission.OnEnded += (sender) => { DemagoScript.currentMission = null; if (!Globals.debug) { GUIManager.Instance.menu.getMenuPool().show("Outils"); GUIManager.Instance.menu.getMenuPool().show("Modèles"); GUIManager.Instance.menu.getMenuPool().show("Véhicules"); } }; missions.Add(newMission); } } }
private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { string fileName = RegistryStrings.InstallDir + "\\HD-RunApp.exe"; GenericNotificationItem notificationItem = GenericNotificationManager.Instance.GetNotificationItem(this.Id); JsonParser jsonParser = new JsonParser(this.ParentWindow.mVmName); if (this.ParentWindow != null && this.ParentWindow.mGuestBootCompleted) { if (notificationItem == null) { return; } ClientStats.SendMiscellaneousStatsAsync("NotificationDrawerItemClicked", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, notificationItem.Id, notificationItem.Title, JsonConvert.SerializeObject((object)notificationItem.ExtraPayload), notificationItem.ExtraPayload.ContainsKey("campaign_id") ? notificationItem.ExtraPayload["campaign_id"] : "", (string)null, (string)null, "Android"); GenericNotificationManager.MarkNotification((IEnumerable <string>) new List <string>() { notificationItem.Id }, (System.Action <GenericNotificationItem>)(x => x.IsRead = true)); this.ChangeToReadBackground(); this.ParentWindow.mTopBar.RefreshNotificationCentreButton(); if (notificationItem.ExtraPayload.Keys.Count > 0) { this.ParentWindow.Utils.HandleGenericActionFromDictionary((Dictionary <string, string>)notificationItem.ExtraPayload, "notification_drawer", notificationItem.NotificationMenuImageName); } else { try { if (string.Compare(notificationItem.Title, "Successfully copied files:", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(notificationItem.Title, "Cannot copy files:", StringComparison.OrdinalIgnoreCase) == 0) { NotificationPopup.LaunchExplorer(notificationItem.Message); } else { Logger.Info("launching " + notificationItem.Title); AppInfo infoFromPackageName = jsonParser.GetAppInfoFromPackageName(this.PackageName); if (infoFromPackageName != null) { string str = "-json \"" + new JObject() { { "app_icon_url", (JToken)"" }, { "app_name", (JToken)infoFromPackageName.Name }, { "app_url", (JToken)"" }, { "app_pkg", (JToken)this.PackageName } }.ToString(Formatting.None).Replace("\"", "\\\"") + "\""; Process.Start(fileName, string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} -vmname {1}", (object)str, (object)this.ParentWindow.mVmName)); } else { this.ParentWindow.Utils.HandleGenericActionFromDictionary(new Dictionary <string, string>() { { "click_generic_action", GenericAction.InstallPlay.ToString() }, { "click_action_packagename", notificationItem.Package } }, "notification_drawer", ""); } } } catch (Exception ex) { Logger.Error(ex.ToString()); } finally { this.ParentWindow.mTopBar.mNotificationCentrePopup.IsOpen = false; } } } else { if (notificationItem == null) { return; } this.ParentWindow.mPostBootNotificationAction = this.PackageName; this.ParentWindow.mTopBar.mNotificationCentrePopup.IsOpen = false; } }