public void Add(YiObj human) { if (Members.Contains(human.UniqueId)) { return; } Members.Add(human.UniqueId); human.Guild = this; human.GuildRank = GuildRanks.Member; if (human is Player player) { player.Send(MsgSyndicateSpawn.Create(player)); Message.SendTo(player, $"{player.Name} has joined our guild!", MsgTextType.Guild); foreach (var guild in Allies) { player.Send(MsgSyndicate.Create(guild.UniqueId, GuildRequest.SetAlly)); } foreach (var guild in Enemies) { player.Send(MsgSyndicate.Create(guild.UniqueId, GuildRequest.SetEnemy)); } } ScreenSystem.Send(human, MsgSpawn.Create(human as Player), true); }
private static void TalkChat(Player player, ref MsgText packet) { foreach (var entity in ScreenSystem.GetEntities(player)) { entity.GetMessage(player.Name, packet.To(), packet.Message(), MsgTextType.Talk); } }
private static void Jump(Player player, ref MsgAction packet) { player.CurrentTarget = null; player.RemoveSpawnProtection(); //TODO Distance & Speed Checks if (GameWorld.Maps.ContainsKey(player.MapId)) { if (GameWorld.Maps[player.MapId].GroundValid((ushort)packet.Param, (ushort)(packet.Param >> 16))) { if (!ScreenSystem.SendJump(player, ref packet)) { ScreenSystem.Send(player, packet, false, true, packet.Size); } player.Direction = Position.GetDirection(player.Location.X, player.Location.Y, (ushort)packet.Param, (ushort)(packet.Param >> 16)); player.Location.X = (ushort)packet.Param; player.Location.Y = (ushort)(packet.Param >> 16); if (TeamSystem.Teams.ContainsKey(player.UniqueId)) { TeamSystem.Teams[player.UniqueId].UpdateLeaderPosition(player); } ScreenSystem.Update(player); //Message.SendTo(player, $"Loc: X={player.Location.X} Y={player.Location.Y}", MsgTextType.Action); return; } } else { player.GetMessage("SERVER", player.Name, "THIS DMAP IS NOT LOADED!" + player.MapId, MsgTextType.Center); } player.Teleport(player.Location.X, player.Location.Y, player.MapId); ScreenSystem.Update(player); }
void MainMenuSelect(object sender, EventArgs e) { MenuCancel(); ExitScreen(); ScreenSystem.AddScreen(new MainMenuScreen()); ScreenSystem.RemoveScreen(this); }
public void Leave(YiObj obj) { Entities.TryRemove(obj.UniqueId); switch (obj) { case Npc npc: //RemoveNpc(obj); break; case DynamicNpc npc: //RemoveNpc(obj); break; case Monster monster: RemoveMob(obj); break; case FloorItem item: RemoveItem(obj); break; } ScreenSystem.Send(obj, MsgAction.Create(obj, 0, MsgActionType.EntityRemove)); ScreenSystem.ClearFor(obj); }
protected override void UpdateScreen(GameTime gameTime) { seconds += (float)gameTime.ElapsedGameTime.TotalSeconds; if (curLevel != null) { if (!curLevel.IsLevelLoaded()) { curLevel.LoadContent(); } collisionManager.Update(gameTime); objectManager.Update(gameTime); curLevel.Update(gameTime); if (curLevel.LevelDone()) { curLevel.UnLoadContent(); curLevel = levelManager.NextLevel(); } else if (curLevel.GameOver()) { curLevel.UnLoadContent(); ExitScreen(); ScreenSystem.RemoveScreen(this); } } else { ExitScreen(); ScreenSystem.AddScreen(new MainMenuScreen()); ScreenSystem.RemoveScreen(this); } }
public void LoadInEntity(YiObj obj) { Entities.AddOrUpdate(obj.UniqueId, obj); switch (obj) { case Npc npc: AddNpc(obj); break; case DynamicNpc npc: AddNpc(obj); break; case Monster monster: AddMob(obj); break; case FloorItem item: AddItem(obj); break; } ScreenSystem.Create(obj); }
public static void Handle(Player player, byte[] buffer) { fixed(byte *p = buffer) { var packet = *(MsgNpcSpawn *)p; BufferPool.RecycleBuffer(buffer); var npc = new Npc { UniqueId = UniqueIdGenerator.GetNext(EntityType.DynamicNpc), MapId = player.MapId, Location = { X = packet.X, Y = packet.Y }, Look = packet.Look, Type = 2, Direction = (Direction)(packet.Look % 10) }; GameWorld.Maps[player.MapId].LoadInEntity(npc); ScreenSystem.Create(npc); ScreenSystem.SendSpawn(npc); Collections.Npcs.Add(npc.UniqueId, npc); } }
/// <summary> /// Constructor. Acquire all necessary BeatSaberUi elements. /// </summary> /// <param name="flowCoordinator"></param> public BeatSaberUIController(LevelSelectionFlowCoordinator flowCoordinator) { Logger.Debug("Collecting all BeatSaberUI Elements..."); LevelSelectionFlowCoordinator = flowCoordinator; // gather flow coordinator elements LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetField <LevelSelectionNavigationController, LevelSelectionFlowCoordinator>("levelSelectionNavigationController"); Logger.Debug("Acquired LevelSelectionNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID()); LevelFilteringNavigationController = LevelSelectionNavigationController.GetField <LevelFilteringNavigationController, LevelSelectionNavigationController>("_levelFilteringNavigationController"); Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID()); LevelCollectionNavigationController = LevelSelectionNavigationController.GetField <LevelCollectionNavigationController, LevelSelectionNavigationController>("_levelCollectionNavigationController"); Logger.Debug("Acquired LevelCollectionNavigationController [{0}]", LevelCollectionNavigationController.GetInstanceID()); LevelCollectionViewController = LevelCollectionNavigationController.GetField <LevelCollectionViewController, LevelCollectionNavigationController>("_levelCollectionViewController"); Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID()); LevelDetailViewController = LevelCollectionNavigationController.GetField <StandardLevelDetailViewController, LevelCollectionNavigationController>("_levelDetailViewController"); Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID()); LevelCollectionTableView = this.LevelCollectionViewController.GetField <LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView"); Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID()); StandardLevelDetailView = LevelDetailViewController.GetField <StandardLevelDetailView, StandardLevelDetailViewController>("_standardLevelDetailView"); Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID()); BeatmapCharacteristicSelectionViewController = StandardLevelDetailView.GetField <BeatmapCharacteristicSegmentedControlController, StandardLevelDetailView>("_beatmapCharacteristicSegmentedControlController"); Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID()); LevelDifficultyViewController = StandardLevelDetailView.GetField <BeatmapDifficultySegmentedControlController, StandardLevelDetailView>("_beatmapDifficultySegmentedControlController"); Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID()); LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform; Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID()); AnnotatedBeatmapLevelCollectionsViewController = LevelFilteringNavigationController.GetField <AnnotatedBeatmapLevelCollectionsViewController, LevelFilteringNavigationController>("_annotatedBeatmapLevelCollectionsViewController"); Logger.Debug("Acquired AnnotatedBeatmapLevelCollectionsViewController from LevelFilteringNavigationController [{0}]", AnnotatedBeatmapLevelCollectionsViewController.GetInstanceID()); TableView tableView = LevelCollectionTableView.GetField <TableView, LevelCollectionTableView>("_tableView"); ScrollView scrollView = tableView.GetField <ScrollView, TableView>("_scrollView"); TableViewPageUpButton = scrollView.GetField <Button, ScrollView>("_pageUpButton"); TableViewPageDownButton = scrollView.GetField <Button, ScrollView>("_pageDownButton"); Logger.Debug("Acquired Page Up and Down buttons..."); ActionButtons = StandardLevelDetailView.GetComponentsInChildren <RectTransform>().First(x => x.name == "ActionButtons"); Logger.Debug("Acquired ActionButtons [{0}]", ActionButtons.GetInstanceID()); ScreenSystem = Resources.FindObjectsOfTypeAll <ScreenSystem>().Last(); Logger.Debug("Acquired ScreenSystem [{0}]", ScreenSystem.GetInstanceID()); SimpleDialogPromptViewControllerPrefab = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().Last(); Logger.Debug("Acquired SimpleDialogPromptViewControllerPrefab [{0}]", SimpleDialogPromptViewControllerPrefab.GetInstanceID()); BeatmapLevelsModel = Resources.FindObjectsOfTypeAll <BeatmapLevelsModel>().Last(); Logger.Debug("Acquired BeatmapLevelsModel [{0}]", BeatmapLevelsModel); }
void session_HealthDecreased(object sender, EventArgs e) { if (session.health < 0) { ExitScreen(); ScreenSystem.AddScreen(new GameOverScreen(levelselect)); } }
public override void HandleInput() { if (input.NewActionPress("Pause")) { FreezeScreen(); ScreenSystem.AddScreen(new PauseScreen(this)); } }
public Screen(ScreenSystem screenSystem, ScreenType screenType) { _screenSystem = screenSystem; _spriteBatch = screenSystem.spriteBatch; _screenType = screenType; _transitions = new List <Transition>(); _transitionsToRemove = new List <Transition>(); }
private static void GhostChat(Player player, ref MsgText packet) { foreach (var entity in ScreenSystem.GetEntities(player)) { if (entity.Class > 139 && entity.Class < 150) { entity.GetMessage(player.Name, packet.To(), packet.Message(), MsgTextType.Ghost); } } }
public MusicPlayer(HierarchyManager hierarchyManager) { _screenSystem = hierarchyManager.GetField <ScreenSystem, HierarchyManager>("_screenSystem"); _floatingScreen = FloatingScreen.CreateFloatingScreen(new Vector2(120f, 35f), false, Vector3.zero, Quaternion.identity); _musicPlayerView = BeatSaberUI.CreateViewController <MusicPlayerView>(); _floatingScreen.SetRootViewController(_musicPlayerView, true); _floatingScreen.transform.SetParent(_screenSystem.transform, false); _floatingScreen.transform.localPosition = new Vector3(-2.08f, 2.8f, 1.45f); _floatingScreen.transform.localRotation = Quaternion.Euler(new Vector3(335f, 300f, 0f)); }
public override void Attack() { Owner.CurrentSkill = new Skill((ushort)Owner.MagicType, 0, 0); //Thunder ScreenSystem.Send(Owner, MsgInteract.Create(Owner, Owner.CurrentTarget, MsgInteractType.Magic, 133337)); ScreenSystem.Send(Owner, MsgMagicEffect.Create(Owner, Owner.CurrentTarget, 133337)); Owner.LastAttack = DateTime.UtcNow; Owner.CurrentTarget.GetHit(Owner, 133337); }
public ConfirmationScreen(ScreenSystem screenSystem, SpriteFont font, string text, Action onCancel, Action onOkay) : base(screenSystem, ScreenType.Confirmation) { _spriteBatch = screenSystem.spriteBatch; _font = font; _onCancel = onCancel; _onOkay = onOkay; Vector2 titleSize = _font.MeasureString(text); int padding = 16; _overlay = new Overlay(this, Color.Black); _pane = new StonePane( this, UIAlignment.MiddleCenter, 0, -padding, (int)titleSize.X + padding * 2, 100); _label = new Label( this, _font, UIAlignment.MiddleCenter, 0, -50, TextAlignment.Center, text, 2); _cancelButton = new TextureButton( this, _spriteBatch, UIAlignment.MiddleCenter, (int)(titleSize.X / 2f) - 285, 15, ResourceManager.getTexture("cancel_button_over"), ResourceManager.getTexture("cancel_button"), new Rectangle(0, 0, 152, 33), () => { _onCancel(); }); _okayButton = new TextureButton( this, _spriteBatch, UIAlignment.MiddleCenter, (int)(titleSize.X / 2f) - 125, 15, ResourceManager.getTexture("okay_button_over"), ResourceManager.getTexture("okay_button"), new Rectangle(0, 0, 152, 33), () => { _onOkay(); }); }
public override void Respawn() { FindRespawnLocation(); SpawnTime = DateTime.UtcNow; GameWorld.Maps[MapId].AddMob(this); StatusEffects = 0; CurrentHp = MaximumHp; ScreenSystem.Update(this); ScreenSystem.SendSpawn(this); YiScheduler.Instance.Do(Brain.ThinkInterval, Brain.ThinkJob); }
public ConfirmationScreen(ScreenSystem screenSystem, SpriteFont font, string text, Action onCancel, Action onOkay) : base(screenSystem, ScreenType.Confirmation) { _spriteBatch = screenSystem.spriteBatch; _font = font; _onCancel = onCancel; _onOkay = onOkay; Vector2 titleSize = _font.MeasureString(text); int padding = 16; _overlay = new Overlay(this, Color.Black); _pane = new StonePane( this, UIAlignment.MiddleCenter, 0, -padding, (int)titleSize.X + padding * 2, 100); _label = new Label( this, _font, UIAlignment.MiddleCenter, 0, -50, TextAlignment.Center, text, 2); _cancelButton = new TextureButton( this, _spriteBatch, UIAlignment.MiddleCenter, (int)(titleSize.X / 2f) - 285, 15, ResourceManager.getTexture("cancel_button_over"), ResourceManager.getTexture("cancel_button"), new Rectangle(0, 0, 152, 33), () => { _onCancel(); }); _okayButton = new TextureButton( this, _spriteBatch, UIAlignment.MiddleCenter, (int)(titleSize.X / 2f) - 125, 15, ResourceManager.getTexture("okay_button_over"), ResourceManager.getTexture("okay_button"), new Rectangle(0, 0, 152, 33), () => { _onOkay(); }); }
private static void AddItemToShop(Player player, ref MsgItem packet) { if (player.Inventory.TryGetItem(packet.UnqiueId, out var item)) { BoothSystem.Add(player, packet.UnqiueId, packet.Param); ScreenSystem.Send(player, packet, true); } else { Message.SendTo(player, "Invalid Item", MsgTextType.Action); } }
public TDGame() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; screenSystem = new ScreenSystem(this); Components.Add(screenSystem); VideoManager vm = new VideoManager(Content, "Video\\"); }
private static void ChangeFace(YiObj player, ref MsgAction packet) { player.Look = (uint)(player.Look - (int)(player.Look / 10000) * 10000 + packet.Param * 10000); if (TeamSystem.Teams.ContainsKey(player.UniqueId)) { foreach (var member in TeamSystem.Teams[player.UniqueId].Members) { (member.Value as Player)?.Send(MsgTeamUpdate.JoinLeave(player, MsgTeamMemberAction.AddMember)); } } ScreenSystem.Send(player, packet, true); }
public TowerDefenseGame() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; screenSystem = new ScreenSystem(this); Components.Add(screenSystem); VideoManager vm = new VideoManager(Content, "Video\\"); }
void session_MapFinished(object sender, EventArgs e) { if (session.health >= 0) { ExitScreen(); levelselect.ActivateScreen(); } else { ExitScreen(); ScreenSystem.AddScreen(new GameOverScreen(levelselect)); } }
protected override void UpdateScreen(GameTime gameTime) { if (session.IsPaused) { FreezeScreen(); ScreenSystem.AddScreen(new PauseScreen(this, session)); } if (InputMap.NewActionPress("Pause")) { session.Pause(); } session.Update(gameTime); }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { if (addedToHierarchy) { showBackButton = true; SetTitle("Counters+"); } screenSystem = IPA.Utilities.ReflectionUtil.GetField <ScreenSystem, FlowCoordinator>(this, "_screenSystem"); //screenSystem.backButtonWasPressedEvent += HandleBackButtonWasPressed; ProvideInitialViewControllers(mainScreenNavigation, credits, null, settingsSelection); RefreshAllMockCounters(); }
public static void ExecuteAttack(Player player, Vector2 targetLocation) { if (!CostCovered(player)) { return; } var targets = GetTargets(player, targetLocation, player.CurrentSkill.Info.Type).ToArray(); foreach (var kvp in targets) { switch (MagicTypeHelper.Convert(player.CurrentSkill.Info.Type)) { case UseType.Damage: kvp.Item1.GetHit(player, kvp.Item2); break; case UseType.Heal: kvp.Item1.GetHealed(player, kvp.Item2); break; case UseType.Buff: if (!ScriptEngine.Scripts.TryGetValue(ScriptType.SkillUsage, out var script)) { continue; } if (script.Execute(kvp.Item1, player.CurrentSkill)) { kvp.Item1.GetBuffed(player, 0); } else { Output.WriteLine($"Unknown Skill: {player.CurrentSkill.Id} | Lv: {player.CurrentSkill.Info.Level}"); } break; default: Message.SendTo(player, $"Magic Attack Fail: {player.CurrentSkill.Info.Type} -> {MagicTypeHelper.Convert(player.CurrentSkill.Info.Type)}", MsgTextType.Talk); break; } } foreach (var packet in MsgMagicEffect.Create(player, targets)) { ScreenSystem.Send(player, packet, true); } }
public unsafe bool Unequip(MsgItemPosition position) { if (_owner.Inventory.Count == 40) { return(false); } if (TryRemove(position, out var item)) { _owner.Inventory.AddOrUpdate(item.UniqueId, item); (_owner as Player)?.ForceSend(new MsgItemInformation(item, MsgItemPosition.Inventory), (ushort)sizeof(MsgItemInformation)); ScreenSystem.Send(_owner, MsgSpawn.Create(_owner as Player)); EntityLogic.Recalculate(_owner); } return(true); }
private static void PhysicalAttack(YiObj attacker, ref MsgInteract packet) { if (attacker.HasFlag(StatusEffect.Invisibility)) { attacker.RemoveStatusEffect(StatusEffect.Invisibility); } if (attacker.HasFlag(StatusEffect.SpawnProtection)) { attacker.RemoveStatusEffect(StatusEffect.SpawnProtection); } if (!GameWorld.Maps[attacker.MapId].Find(packet.TargetUniqueId, out YiObj currentTarget)) { return; } attacker.CurrentTarget = currentTarget; packet.Value = Physical.PhysicalAttack(attacker, packet.Type); attacker.Equipment.RemoveDura(MsgItemPosition.LeftWeapon); attacker.Equipment.RemoveDura(MsgItemPosition.RightWeapon); attacker.Equipment.RemoveDura(MsgItemPosition.Ring); attacker.AddWeaponProf(MsgItemPosition.LeftWeapon, (uint)packet.Value); attacker.AddWeaponProf(MsgItemPosition.RightWeapon, (uint)packet.Value); if (packet.Type == MsgInteractType.Archer) { packet.Value = packet.Value / 2; } if (packet.Value == -1) { return; } if (attacker.ActivatePassiveSkill(attacker, ref packet.Value, out var skill) && skill.HasValue) { attacker.CurrentSkill = skill.Value; Magic.ExecuteAttack((Player)attacker, attacker.Location); return; } ScreenSystem.Send(attacker, packet, true); currentTarget.GetHit(attacker, packet.Type == MsgInteractType.Archer? packet.Value * 2: packet.Value); }
public virtual void KilledFrom(YiObject attacker) { if (HasFlag(StatusEffect.SuperMan) || HasFlag(StatusEffect.Cyclone)) { (attacker as Player)?.Send(MsgInteract.Create(attacker, this, MsgInteractType.Death, 0xFFFF * attacker.XpKills)); } else { ScreenSystem.Send(this, MsgInteract.Die(attacker, this), true); } var human = attacker; if (human != null) { human.PkPoints++; } }
protected override bool FoundTarget() { foreach (var potentialTarget in ScreenSystem.GetEntities(Owner).OfType <Player>()) { if (!potentialTarget.HasFlag(StatusEffect.Flashing) && !potentialTarget.HasFlag(StatusEffect.BlackName)) { continue; } var distanceToPotentialTarget = Calculations.Position.GetDistance(Owner, potentialTarget); if (distanceToPotentialTarget > 12) { continue; } if (potentialTarget.HasFlag(StatusEffect.Flying) || potentialTarget.HasFlag(StatusEffect.Invisibility) || potentialTarget.HasFlag(StatusEffect.Die)) { continue; } Owner.CurrentTarget = potentialTarget; return(true); } foreach (var potentialTarget in ScreenSystem.GetEntities(Owner).OfType <Monster>()) { var distanceToPotentialTarget = Calculations.Position.GetDistance(Owner, potentialTarget); if (distanceToPotentialTarget > 11) { continue; } if (potentialTarget.HasFlag(StatusEffect.Flying) || potentialTarget.HasFlag(StatusEffect.Invisibility) || potentialTarget.HasFlag(StatusEffect.Die)) { continue; } Owner.CurrentTarget = potentialTarget; return(true); } return(false); }
private static void PetJump(Player player, ref MsgAction packet) { var r = Position.GetDirection(player.Location.X, player.Location.Y, (ushort)packet.Param, (ushort)(packet.Param >> 16)); var x = (ushort)packet.Param; var y = (ushort)(packet.Param >> 16); if (player.Pet != null) { player.Pet.Location.X = x; player.Pet.Location.Y = y; player.Pet.Direction = r; if (!ScreenSystem.SendJump(player, ref packet)) { ScreenSystem.Send(player, packet, false, true, packet.Size); } ScreenSystem.Update(player); } }
public static void Handle(Player player, byte[] buffer) { try { fixed(byte *p = buffer) { var packet = *(MsgWalk *)p; BufferPool.RecycleBuffer(buffer); if (player.UniqueId == packet.UniqueId) { player.CurrentTarget = null; player.RemoveSpawnProtection(); player.Direction = (Direction)((byte)packet.Direction % 8); player.Location.X += (ushort)Constants.DeltaX[(sbyte)player.Direction]; player.Location.Y += (ushort)Constants.DeltaY[(sbyte)player.Direction]; player.Emote = Emote.Stand; ScreenSystem.Send(player, packet, true, true, packet.Size); ScreenSystem.Update(player); if (TeamSystem.Teams.ContainsKey(player.UniqueId)) { TeamSystem.Teams[player.UniqueId].UpdateLeaderPosition(player); } } else if (packet.UniqueId == player.Pet?.UniqueId) { player.Pet.Direction = (Direction)((byte)packet.Direction % 8); player.Pet.Location.X += (ushort)Constants.DeltaX[(sbyte)player.Direction]; player.Pet.Location.Y += (ushort)Constants.DeltaY[(sbyte)player.Direction]; ScreenSystem.Send(player.Pet, packet, false, true, packet.Size); ScreenSystem.Update(player.Pet); } } } catch (Exception e) { Output.WriteLine(e); } }
public Bouncing() { clearColor = new Color(22,22,22); graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; screenSystem = new ScreenSystem(this); Components.Add(screenSystem); objectManager = new ObjectManager(this); collisionDetectionService = new CollisionDetectionCircleService(this); _input = new InputManager(this); Services.AddService(typeof(ObjectManager), objectManager); Services.AddService(typeof(IManageCollisionsService), collisionDetectionService); Services.AddService(typeof(IInputService), _input); }
void menuButton_Selected(object sender, ScreenSystem.Input.PlayerIndexEventArgs e) { ScreenManager.AddScreen(new Play()); }
public override void HandleInput(ScreenSystem.InputHelper input) { //We need to handle the Tap gesture, to identify whether its clicked inside and should we raise event or not. HandleInput(input.Gestures); //Handle inputs base.HandleInput(input); }
void backButton_Selected(object sender, ScreenSystem.Input.PlayerIndexEventArgs e) { ScreenManager.RemoveScreen(this); }
void toggleButton_Selected(object sender, ScreenSystem.Input.PlayerIndexEventArgs e) { ((MenuToggleButton)sender).UpdateBackgroundState(); }
public void HandleInput(ScreenSystem.ScreenSystem.InputHelper input, GameTime gameTime) { // Mouse or touch on a menu item int hoverIndex = GetMenuEntryAt(input.Cursor); if (hoverIndex >= 0) { selectedEntry = hoverIndex; //debugScreen.AddDebugItem("BUTTON HOVER", "Index " + hoverIndex, XnaSwarmsData.Debug.DebugFlagType.Important); } else { selectedEntry = -1; } // Accept or cancel the menu? if (input.IsMenuSelect() && selectedEntry != -1) { if (menuEntries[selectedEntry].IsStable()) { controlClient.CreateStableSwarm(); } else if (menuEntries[selectedEntry].IsMutationGame()) { controlClient.CreateMutationSwarm(); } else if (menuEntries[selectedEntry].IsZoomIn()) { controlClient.ZoomIn(); } else if (menuEntries[selectedEntry].IsZoomOut()) { controlClient.ZoomOut(); } else if (menuEntries[selectedEntry].IsDebugger()) { debugScreen.SetVisiblity(); } else if (menuEntries[selectedEntry].IsSave()) { SaveSwarm(controlClient.SaveWorld()); UpdateLikedItemsUI(); } else if (menuEntries[selectedEntry].IsRecall1()) { allLikedItems[0].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[0], false); } else if (menuEntries[selectedEntry].IsRecall2()) { allLikedItems[1].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[1], false); } else if (menuEntries[selectedEntry].IsRecall3()) { allLikedItems[2].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[2], false); } else if (menuEntries[selectedEntry].IsRecall4()) { allLikedItems[3].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[3], false); } else if (menuEntries[selectedEntry].IsRecall5()) { allLikedItems[4].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[4], false); } else if (menuEntries[selectedEntry].IsRecall6()) { allLikedItems[5].SaveWorldParameters = controlClient.SaveWorld(); controlClient.UpdatePopulation(allLikedItems[5], false); } else if (menuEntries[selectedEntry].IsAudioPlay()) { controlClient.StartSoundEngine(); } else if (menuEntries[selectedEntry].IsAudioPause()) { controlClient.StopSoundEngine(); } else if (menuEntries[selectedEntry].IsAnalyze()) { controlClient.ToggleAnalyze(); } #if NETFX_CORE else if (menuEntries[selectedEntry].IsImportLikes()) { ImportSwarmSaveData(); } else if (menuEntries[selectedEntry].IsExportLikes()) { ExportSwarmSaveData(); } #endif } }
void settingsButton_Selected(object sender, ScreenSystem.Input.PlayerIndexEventArgs e) { ScreenManager.AddScreen(new Settings()); }
protected override void Initialize() { Logger.log("LoderGame.Initialize method started."); _systemManager = new SystemManager(); _entityManager = new EntityManager(_systemManager); _scriptManager = new ScriptManager(_systemManager, _entityManager); _animationManager = new AnimationManager(this); base.Initialize(); _screenSystem = new ScreenSystem(_systemManager, _spriteBatch); _systemManager.add(_screenSystem, -1); _loadingScreen = new LoadingScreen(this); DataManager.initialize(this, _systemManager, _entityManager); DataManager.loadGameSettings(); applyDisplaySettings(); Logger.log("LoderGame.Initialize method finished."); }