public override void HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.AlterBuildQueue); command.RelatedEntityType = this.Item.TypeToBuild; command.RelatedMagnitude = 1; if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Subtractive)) { command.RelatedMagnitude = -command.RelatedMagnitude; } Engine_AIW2.Instance.DoForSelected(delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } }
public override void HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.CreateNewControlGroup); command.RelatedSide = World_AIW2.Instance.GetLocalSide(); World_AIW2.Instance.QueueGameCommand(command); }
public override MouseHandlingResult HandleClick() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return(MouseHandlingResult.PlayClickDeniedSound); } GameEntity launcher = localSide.Entities.GetFirstMatching(EntityRollupType.KingUnits); if (launcher == null) { return(MouseHandlingResult.PlayClickDeniedSound); } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); if (planet == null || planet != launcher.Combat.Planet) { return(MouseHandlingResult.PlayClickDeniedSound); } GameCommand command = GameCommand.Create(GameCommandType.LaunchWarhead); command.RelatedEntityType = this.Type; command.RelatedEntityIDs.Add(launcher.PrimaryKeyID); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.Debug_GiveHacking); World_AIW2.Instance.QueueGameCommand(command, true); return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { if (iCampaignName.Instance.CampaignName.Trim().Length <= 0) { iCampaignName.Instance.CampaignName = World_AIW2.Instance.Setup.MapType.InternalName + "." + World_AIW2.Instance.Setup.Seed; } Window_SaveGameMenu.Instance.OverallCampaignName = iCampaignName.Instance.CampaignName; GameCommand command = GameCommand.Create(GameCommandType.SaveGame); //generate the saveGame entry from the name and state of the game DateTime dt = DateTime.Now; //Generate a SaveGameData from the saveGame and campaignName boxes, //along with game metadata SaveGameData data = new SaveGameData(iSaveGameName.Instance.SaveName, World_AIW2.Instance.Setup.Seed, World_AIW2.Instance.GameSecond, iCampaignName.Instance.CampaignName, dt, World_AIW2.Instance.Setup.MasterAIType.Name, World_AIW2.Instance.Setup.Difficulty.Name); data.setShortMapType(World_AIW2.Instance.Setup.MapType.InternalName); command.RelatedString = data.ToString(); World_AIW2.Instance.QueueGameCommand(command, true); if (World_AIW2.Instance.IsPaused) { //unpause on leaving save game menu. Note that the player //can unpause the game deliberately while in the save game menu (with a hotkey) //so make sure we only unpause if the game is currently paused command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } Window_SaveGameMenu.Instance.Close(); return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.CreateNewControlGroup); command.RelatedSide = World_AIW2.Instance.GetLocalPlayerSide(); World_AIW2.Instance.QueueGameCommand(command, true); return(MouseHandlingResult.None); }
public override void HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.SaveGame); command.RelatedString = this.SaveName; World_AIW2.Instance.QueueGameCommand(command); Window_SaveGameMenu.Instance.Close(); }
public override void OnOpen() { ArcenSettingTable.Instance.CopyCurrentValuesToTemp(); if (World.Instance.IsLoaded && !World_AIW2.Instance.IsPaused) { GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } }
public static void Helper_SendThreatOnRaid(List <GameEntity> threatShipsNotAssignedElsewhere, WorldSide worldSide, Galaxy galaxy, Planet planet, ArcenLongTermPlanningContext Context) { List <Planet> potentialAttackTargets = new List <Planet>(); List <Planet> planetsToCheckInFlood = new List <Planet>(); planetsToCheckInFlood.Add(planet); planet.AIPlanning_CheapestRaidPathToHereComesFrom = planet; for (int k = 0; k < planetsToCheckInFlood.Count; k++) { Planet floodPlanet = planetsToCheckInFlood[k]; floodPlanet.DoForLinkedNeighbors(delegate(Planet neighbor) { FInt totalCostFromOriginToNeighbor = floodPlanet.AIPlanning_CheapestRaidPathToHereCost + 1; if (!potentialAttackTargets.Contains(neighbor)) { potentialAttackTargets.Add(neighbor); } if (neighbor.AIPlanning_CheapestRaidPathToHereComesFrom != null && neighbor.AIPlanning_CheapestRaidPathToHereCost <= totalCostFromOriginToNeighbor) { return(DelReturn.Continue); } neighbor.AIPlanning_CheapestRaidPathToHereComesFrom = floodPlanet; neighbor.AIPlanning_CheapestRaidPathToHereCost = totalCostFromOriginToNeighbor; planetsToCheckInFlood.Add(neighbor); return(DelReturn.Continue); }); } if (potentialAttackTargets.Count <= 0) { return; } Planet threatTarget = potentialAttackTargets[Context.QualityRandom.Next(0, potentialAttackTargets.Count)]; List <Planet> path = new List <Planet>(); Planet workingPlanet = threatTarget; while (workingPlanet != planet) { path.Insert(0, workingPlanet); workingPlanet = workingPlanet.AIPlanning_CheapestRaidPathToHereComesFrom; } if (path.Count > 0) { GameCommand command = GameCommand.Create(GameCommandType.SetWormholePath); for (int k = 0; k < threatShipsNotAssignedElsewhere.Count; k++) { command.RelatedEntityIDs.Add(threatShipsNotAssignedElsewhere[k].PrimaryKeyID); } for (int k = 0; k < path.Count; k++) { command.RelatedPlanetIndices.Add(path[k].PlanetIndex); } Context.QueueCommandForSendingAtEndOfContext(command); } }
public override void HandleClick() { if (this.Item.EntityDataOrNull != null) { if (this.Item.EntityDataOrNull.MetalFlows[MetalFlowPurpose.SelfConstruction] != null) { Engine_AIW2.Instance.PlacingEntityType = this.Item.EntityDataOrNull; } else { GameCommand command = GameCommand.Create(GameCommandType.AlterBuildQueue); command.RelatedEntityType = this.Item.EntityDataOrNull; command.RelatedMagnitude = 1; if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Subtractive)) { command.RelatedMagnitude = -command.RelatedMagnitude; } Engine_AIW2.Instance.DoForSelected(delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } } } else { GameCommand command = GameCommand.Create(GameCommandType.InvokeBuildPattern); command.RelatedMagnitude = this.ItemMenuIndex; command.RelatedPoint.X = this.ItemColumnIndex; command.RelatedPoint.Y = this.ItemIndex; Engine_AIW2.Instance.DoForSelected(delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } } }
public static void Helper_SendMoveCommand(GameEntity entity, ArcenPoint Destination, bool isQueuedCommand) { GameCommand command = GameCommand.Create(GameCommandType.Move); command.ToBeQueued = isQueuedCommand; command.RelatedPoint = Destination; command.RelatedEntityIDs.Add(entity.PrimaryKeyID); World_AIW2.Instance.QueueGameCommand(command, true); }
public override MouseHandlingResult HandleClick() { if (this.TypeToBuild == null) { return(MouseHandlingResult.PlayClickDeniedSound); } else { if (Window_InGameTechTypeIconMenu.Instance.IsOpen) { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide.GetCanResearch(this.TypeToBuild.TechPrereq, false, false) != ArcenRejectionReason.Unknown) { return(MouseHandlingResult.PlayClickDeniedSound); } GameCommand command = GameCommand.Create(GameCommandType.UnlockTech); command.RelatedSide = World_AIW2.Instance.GetLocalPlayerSide(); command.RelatedTech = this.TypeToBuild.TechPrereq; World_AIW2.Instance.QueueGameCommand(command, true); return(MouseHandlingResult.None); } else { if (this.TypeToBuild.MetalFlows[MetalFlowPurpose.SelfConstruction] != null) { Engine_AIW2.Instance.PlacingEntityType = this.TypeToBuild; } else { GameCommand command = GameCommand.Create(GameCommandType.AlterBuildQueue); command.RelatedEntityType = this.TypeToBuild; command.RelatedMagnitude = 1; if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Subtractive)) { command.RelatedMagnitude = -command.RelatedMagnitude; } Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } } } } return(MouseHandlingResult.None); }
public override void HandleClick() { WorldSetup setupToSend = new WorldSetup(); World_AIW2.Instance.Setup.CopyTo(setupToSend); setupToSend.Seed = Engine_Universal.PermanentQualityRandom.Next(1, 999999999); GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup); command.RelatedSetup = setupToSend; World_AIW2.Instance.QueueGameCommand(command); }
public override MouseHandlingResult HandleClick() { if (World_AIW2.Instance.IsPaused) { //unpause on leaving save game menu. Note that the player //can unpause the game deliberately while in the save game menu (with a hotkey) //so make sure we only unpause if the game is currently paused GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } Instance.Close(); return(MouseHandlingResult.None); }
public override void HandleClick() { WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide.GetCanResearch(this.Item, false, false) != ArcenRejectionReason.Unknown) { return; } GameCommand command = GameCommand.Create(GameCommandType.UnlockTech); command.RelatedSide = World_AIW2.Instance.GetLocalSide(); command.RelatedTech = this.Item; World_AIW2.Instance.QueueGameCommand(command); }
public override MouseHandlingResult HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.RemoveFromControlGroupPopulation); Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { ControlGroup group = World_AIW2.Instance.GetControlGroupByID(World_AIW2.Instance.CurrentActiveSelectionControlGroupPrimaryKeyID); if (group == null) { return(MouseHandlingResult.PlayClickDeniedSound); } GameCommand command = GameCommand.Create(GameCommandType.SetGroupFormation); command.RelatedControlGroup = group; command.RelatedString = string.Empty; World_AIW2.Instance.QueueGameCommand(command, true); return(MouseHandlingResult.None); }
public override void HandleSelectionChanged(IArcenUI_Dropdown_Option Item) { if (Item == null) { return; } MapTypeData ItemAsType = (MapTypeData)Item.GetItem(); WorldSetup setupToSend = new WorldSetup(); World_AIW2.Instance.Setup.CopyTo(setupToSend); setupToSend.MapType = ItemAsType; GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup); command.RelatedSetup = setupToSend; World_AIW2.Instance.QueueGameCommand(command); }
public override void HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.SetHoldFireMode); command.RelatedBool = !currentState; Engine_AIW2.Instance.DoForSelected(delegate(GameEntity selected) { command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } }
public override void HandleClick() { string seedString = iSeed.Instance.CurrentValue; int seed; if (!Int32.TryParse(seedString, out seed)) { return; } WorldSetup setupToSend = new WorldSetup(); World_AIW2.Instance.Setup.CopyTo(setupToSend); setupToSend.Seed = seed; GameCommand command = GameCommand.Create(GameCommandType.SetupOnly_ChangeSetup); command.RelatedSetup = setupToSend; World_AIW2.Instance.QueueGameCommand(command); }
public override void OnOpen() { this.NeedsUpdate = true; iCampaignName.Instance.CampaignName = Window_SaveGameMenu.Instance.OverallCampaignName; if (debug) { ArcenDebugging.ArcenDebugLogSingleLine("Overall campaign is: " + Window_SaveGameMenu.Instance.OverallCampaignName, Verbosity.DoNotShow); } //pause the game once we enter the save game menu. I think this is a nice //quality of life improvement for the player. If the game is already paused, //do nothing if (!World_AIW2.Instance.IsPaused) { GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } }
public override MouseHandlingResult HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.SetRallyOrder); Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { if (selected.TypeData.MetalFlows[MetalFlowPurpose.BuildingShipsInternally] == null) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { //debug = true; if (iCampaignName.Instance.CampaignName.Trim().Length <= 0) { iCampaignName.Instance.CampaignName = World_AIW2.Instance.Setup.MapType.InternalName + "." + World_AIW2.Instance.Setup.Seed; } Window_SaveGameMenu.Instance.OverallCampaignName = iCampaignName.Instance.CampaignName; GameCommand command = GameCommand.Create(GameCommandType.SaveGame); //generate the saveGame entry from the name and state of the game DateTime dt = DateTime.Now; //Generate a SaveGameData from the saveGame and campaignName boxes, //along with game metadata SaveGameData data = new SaveGameData(iSaveGameName.Instance.SaveName, World_AIW2.Instance.Setup.Seed, World_AIW2.Instance.GameSecond, iCampaignName.Instance.CampaignName, dt, World_AIW2.Instance.Setup.MasterAIType.Name, World_AIW2.Instance.Setup.Difficulty.Name); data.setShortMapType(World_AIW2.Instance.Setup.MapType.InternalName); command.RelatedString = data.ToString(); command.RelatedBool = true; // tells it to quit after completing the save World_AIW2.Instance.QueueGameCommand(command, true); return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { WorldSide localSide = World_AIW2.Instance.GetLocalPlayerSide(); if (localSide == null) { return(MouseHandlingResult.PlayClickDeniedSound); } GameEntity hacker = localSide.Entities.GetFirstMatching(EntityRollupType.KingUnits); if (hacker == null) { return(MouseHandlingResult.PlayClickDeniedSound); } if (hacker.Combat != this.Target.Combat) { return(MouseHandlingResult.PlayClickDeniedSound); } if (!this.Type.Implementation.GetCanBeHacked(this.Target, hacker)) { return(MouseHandlingResult.PlayClickDeniedSound); } if (localSide.StoredHacking < this.Type.Implementation.GetCostToHack(this.Target, hacker)) { return(MouseHandlingResult.PlayClickDeniedSound); } GameCommand command = GameCommand.Create(GameCommandType.SetActiveHack); command.RelatedHack = this.Type; command.RelatedEntityIDs.Add(hacker.PrimaryKeyID); command.TargetEntityIDs.Add(this.Target.PrimaryKeyID); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } return(MouseHandlingResult.None); }
public override MouseHandlingResult HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.InvokeBuildPattern); command.RelatedMagnitude = this.ItemMenuIndex; command.RelatedPoint.X = this.ItemTypeIndex; command.RelatedPoint.Y = this.ItemIndex; Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { if (selected.TypeData != this.TypeDoingTheBuilding) { return(DelReturn.Continue); } command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command, true); } return(MouseHandlingResult.None); }
public override void HandleClick() { GameCommand command = GameCommand.Create(GameCommandType.Debug_GiveHacking); World_AIW2.Instance.QueueGameCommand(command); }
public static void HandleInner(Int32 Int1, string InputActionInternalName) { if (ArcenUI.Instance.ShowingConsole) { return; } switch (InputActionInternalName) { #region Development Tools case "DebugGenerateMap": if (World.Instance.IsLoaded) { return; } ArcenSocket.Instance.Shutdown(); Engine_AIW2.Instance.InnerDoStartNewWorldOKLogic(); break; case "DebugSendNextWave": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.Debug_SendNextWave); World_AIW2.Instance.QueueGameCommand(command); } break; case "DebugIncreaseAIP": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.Debug_IncreaseAIP); World_AIW2.Instance.QueueGameCommand(command); } break; case "DebugGiveSomeMetal": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.Debug_GiveMetal); World_AIW2.Instance.QueueGameCommand(command); } break; case "DebugGiveScience": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.Debug_GiveScience); World_AIW2.Instance.QueueGameCommand(command); } break; case "DebugConnectToLocalServer": ArcenSocket.Instance.OpenAsClient(Window_MainMenu.Instance.TargetIP, (ushort)GameSettings.Current.NetworkPort); break; case "ReloadExternalDefinitions": Engine_Universal.OnReloadAllExternalDefinitions(); break; case "ReloadExternalConstantsAndLanguageOnly": Engine_Universal.OnReloadExternalConstantsAndLanguageOnly(); break; #endregion case "ToggleGalaxyMap": if (Engine_Universal.RunStatus == RunStatus.GameStart) { return; } switch (Engine_AIW2.Instance.CurrentGameViewMode) { case GameViewMode.MainGameView: Engine_AIW2.Instance.PresentationLayer.ReactToLeavingPlanetView(Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed()); Engine_AIW2.Instance.SetCurrentGameViewMode(GameViewMode.GalaxyMapView); break; case GameViewMode.GalaxyMapView: Engine_AIW2.Instance.SetCurrentGameViewMode(GameViewMode.MainGameView); Engine_AIW2.Instance.PresentationLayer.ReactToEnteringPlanetView(Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed()); break; } break; case "TogglePause": { if (Engine_Universal.RunStatus == RunStatus.GameStart) { return; } GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command); } break; case "ScoutAll": { if (Engine_Universal.RunStatus == RunStatus.GameStart) { return; } GameCommand command = GameCommand.Create(GameCommandType.Debug_RevealAll); World_AIW2.Instance.QueueGameCommand(command); } break; case "ScrapUnits": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.ScrapUnits); Engine_AIW2.Instance.DoForSelected(delegate(GameEntity ship) { command.RelatedEntityIDs.Add(ship.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } } break; case "ToggleFRD": { if (!World.Instance.IsLoaded) { return; } GameCommand command = GameCommand.Create(GameCommandType.SetBehavior); command.SentWithToggleSet_SetOrdersForProducedUnits = Engine_AIW2.Instance.SettingOrdersForProducedUnits; bool foundSomeOff = false; Engine_AIW2.Instance.DoForSelected(delegate(GameEntity selected) { if (selected.EntitySpecificOrders.Behavior != EntityBehaviorType.Attacker) { foundSomeOff = true; } return(DelReturn.Continue); }); EntityBehaviorType targetType = EntityBehaviorType.Stationary; if (foundSomeOff) { targetType = EntityBehaviorType.Attacker; } command.RelatedMagnitude = (int)targetType; Engine_AIW2.Instance.DoForSelected(delegate(GameEntity ship) { command.RelatedEntityIDs.Add(ship.PrimaryKeyID); return(DelReturn.Continue); }); if (command.RelatedEntityIDs.Count > 0) { World_AIW2.Instance.QueueGameCommand(command); } } break; case "ToggleSettingOrdersForProducedUnits": Engine_AIW2.Instance.SettingOrdersForProducedUnits = !Engine_AIW2.Instance.SettingOrdersForProducedUnits; break; case "ToggleCombatSideBooleanFlag": { Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); CombatSide side = planet.Combat.GetSideForWorldSide(World_AIW2.Instance.GetLocalSide()); GameCommand command = GameCommand.Create(GameCommandType.ChangeCombatSideBooleanFlag); command.RelatedSide = side.WorldSide; command.RelatedPlanetIndex = planet.PlanetIndex; command.RelatedCombatSideBooleanFlag = (CombatSideBooleanFlag)Int1; command.RelatedBool = !side.BooleanFlags[command.RelatedCombatSideBooleanFlag]; World_AIW2.Instance.QueueGameCommand(command); } break; case "SelectAllMobileMilitary": case "SelectController": case "SelectSpaceDock": { if (!World.Instance.IsLoaded) { return; } WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); if (planet == null) { return; } EntityRollupType rollup = EntityRollupType.None; MetalFlowPurpose flowType = MetalFlowPurpose.None; switch (InputActionInternalName) { case "SelectAllMobileMilitary": rollup = EntityRollupType.MobileCombatants; break; case "SelectController": rollup = EntityRollupType.Controllers; break; case "SelectSpaceDock": rollup = EntityRollupType.HasAnyMetalFlows; flowType = MetalFlowPurpose.BuildingShipsInternally; break; default: return; } bool unselectingInstead = false; if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Additive)) { } else if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Subtractive)) { unselectingInstead = true; } else { Engine_AIW2.Instance.ClearSelection(); } for (int i = 0; i < planet.Combat.Sides.Count; i++) { CombatSide side = planet.Combat.Sides[i]; if (!side.WorldSide.ControlledByPlayerAccounts.Contains(PlayerAccount.Local.PlayerPrimaryKeyID)) { continue; } side.Entities.DoForEntities(rollup, delegate(GameEntity entity) { if (flowType != MetalFlowPurpose.None && entity.TypeData.MetalFlows[flowType] == null) { return(DelReturn.Continue); } if (unselectingInstead) { entity.Unselect(); } else { entity.Select(); } return(DelReturn.Continue); }); } } break; case "IncreaseFrameSize": case "DecreaseFrameSize": { GameCommand command = GameCommand.Create(GameCommandType.ChangeFrameSize); command.RelatedMagnitude = 1; if (InputActionInternalName == "DecreaseFrameSize") { command.RelatedMagnitude = -command.RelatedMagnitude; } World_AIW2.Instance.QueueGameCommand(command); } break; case "IncreaseFrameFrequency": case "DecreaseFrameFrequency": { GameCommand command = GameCommand.Create(GameCommandType.ChangeFrameFrequency); command.RelatedMagnitude = 1; if (InputActionInternalName == "DecreaseFrameFrequency") { command.RelatedMagnitude = -command.RelatedMagnitude; } World_AIW2.Instance.QueueGameCommand(command); } break; case "ShowShipRanges_Selected": ArcenInput_AIW2.ShouldShowShipRanges_Selected = true; break; case "ShowShipRanges_Hovered": ArcenInput_AIW2.ShouldShowShipRanges_Hovered = true; break; case "ShowShipRanges_All": ArcenInput_AIW2.ShouldShowShipRanges_All = true; break; case "ShowShipOrders": ArcenInput_AIW2.ShouldShowShipOrders = true; break; case "SelectBuilder": { if (!World.Instance.IsLoaded) { return; } WorldSide localSide = World_AIW2.Instance.GetLocalSide(); if (localSide == null) { return; } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); if (planet == null) { return; } GameEntity currentBuilder = null; if (Engine_AIW2.Instance.GetHasSelection()) { currentBuilder = Window_InGameBuildMenu.GetEntityToUseForBuildMenu(); if (currentBuilder == null) { Engine_AIW2.Instance.ClearSelection(); } } CombatSide side = planet.Combat.GetSideForWorldSide(localSide); bool foundCurrent = false; GameEntity newBuilder = null; GameEntity firstBuilder = null; side.Entities.DoForEntities(GameEntityCategory.Ship, delegate(GameEntity entity) { if (entity.TypeData.BuildMenus == null || entity.TypeData.BuildMenus.Count <= 0) { return(DelReturn.Continue); } if (firstBuilder == null) { firstBuilder = entity; } if (entity == currentBuilder) { foundCurrent = true; } else if (foundCurrent) { newBuilder = entity; return(DelReturn.Break); } return(DelReturn.Continue); }); if (newBuilder == null && firstBuilder != null) { newBuilder = firstBuilder; } if (newBuilder != null) { newBuilder.Select(); if (!Window_InGameBuildMenu.Instance.IsOpen) { Window_InGameCommandsMenu.bToggleBuildMenu.Instance.HandleClick(); } } } break; case "OpenTechMenu": case "OpenSystemMenu": case "ClearMenus": if (!World.Instance.IsLoaded) { return; } ToggleableWindowController window; switch (InputActionInternalName) { case "OpenTechMenu": window = Window_InGameTechMenu.Instance; break; case "OpenSystemMenu": window = Window_InGameEscapeMenu.Instance; break; case "ClearMenus": window = null; break; default: return; } bool closing = window == null || window.IsOpen; Engine_AIW2.Instance.ClearSelection(); Window_InGameBottomMenu.Instance.CloseAllExpansions(); if (!closing) { Window_InGameBottomMenu.bToggleMasterMenu.Instance.HandleClick(); switch (InputActionInternalName) { case "OpenTechMenu": Window_InGameMasterMenu.bToggleTechMenu.Instance.HandleClick(); break; case "OpenSystemMenu": Window_InGameMasterMenu.bToggleEscapeMenu.Instance.HandleClick(); break; default: return; } } break; } }
public override MouseHandlingResult HandleClick() { bool clearSelectionFirst = false; bool unselectingInstead = false; if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Additive)) { } else if (Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.Subtractive)) { unselectingInstead = true; } else { clearSelectionFirst = true; } bool isAssigningToGroup = Engine_AIW2.Instance.PresentationLayer.GetAreInputFlagsActive(ArcenInputFlags.ModifyingControlGroup); if (this.ControlGroup == null) { return(MouseHandlingResult.PlayClickDeniedSound); } Planet planet = Engine_AIW2.Instance.NonSim_GetPlanetBeingCurrentlyViewed(); bool foundOne = false; if (isAssigningToGroup) { GameCommandType commandType = GameCommandType.SetControlGroupPopulation; if (unselectingInstead) { commandType = GameCommandType.RemoveFromControlGroupPopulation; } else if (!clearSelectionFirst) { commandType = GameCommandType.AddToControlGroupPopulation; } else { commandType = GameCommandType.SetControlGroupPopulation; } GameCommand command = GameCommand.Create(commandType); command.SentWithToggleSet_SetOrdersForProducedUnits = Engine_AIW2.Instance.SettingOrdersForProducedUnits; command.RelatedControlGroup = this.ControlGroup; Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { command.RelatedEntityIDs.Add(selected.PrimaryKeyID); return(DelReturn.Continue); }); World_AIW2.Instance.QueueGameCommand(command, true); } else { this.ControlGroup.DoForEntities(delegate(GameEntity entity) { if (entity.Combat.Planet != planet) { return(DelReturn.Continue); } if (!foundOne) { foundOne = true; if (clearSelectionFirst) { if (entity.GetIsSelected()) { Engine_AIW2.Instance.PresentationLayer.CenterPlanetViewOnEntity(entity, false); } Engine_AIW2.Instance.ClearSelection(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy); } } if (unselectingInstead) { entity.Unselect(); } else { entity.Select(); } return(DelReturn.Continue); }); if (!foundOne && clearSelectionFirst) { Engine_AIW2.Instance.ClearSelection(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy); this.ControlGroup.DoForEntities(delegate(GameEntity entity) { if (!foundOne) { foundOne = true; Engine_AIW2.Instance.PresentationLayer.ReactToLeavingPlanetView(planet); planet = entity.Combat.Planet; World_AIW2.Instance.SwitchViewToPlanet(planet); Engine_AIW2.Instance.PresentationLayer.CenterPlanetViewOnEntity(entity, true); Engine_AIW2.Instance.PresentationLayer.ReactToEnteringPlanetView(planet); } if (entity.Combat.Planet != planet) { return(DelReturn.Continue); } entity.Select(); return(DelReturn.Continue); }); } Window_InGameBottomMenu.Instance.CloseAllExpansions(); } return(MouseHandlingResult.None); }
public static void HandleInner(Int32 Int1, string InputActionInternalName) { if (ArcenUI.CurrentlyShownWindowsWith_PreventsNormalInputHandlers.Count > 0) { return; } switch (InputActionInternalName) { case "Debug_ToggleConsole": ArcenUI.Instance.ShowingConsole = !ArcenUI.Instance.ShowingConsole; ArcenUI.Instance.UnitermConsoleCanvasObject.SetActive(ArcenUI.Instance.ShowingConsole); if (ArcenUI.Instance.ShowingConsole) { ArcenUI.Instance.UnitermTextbox.ActivateInputField(); } break; case "Debug_ConsoleAutocomplete": if (ArcenUI.Instance.ShowingConsole) { Engine_AIW2.Instance.FrontEnd.Uniterm_AcceptAutocomplete(); } break; } if (ArcenUI.Instance.ShowingConsole) { return; } switch (InputActionInternalName) { case "Debug_StartTestChamber": { Engine_AIW2.Instance.QuitGameAndGoBackToMainMenu(); TestChamberTable.Instance.Initialize(true); GameSettings_AIW2.Current.LastSetup.MapType = MapTypeDataTable.Instance.GetRowByName("TestChamber", false, null); Engine_AIW2.Instance.InnerDoStartNewWorldOKLogic(); while (Engine_Universal.WorkThreadIsRunning) { Thread.Sleep(10); } GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } break; case "Debug_InstantStopSim": Engine_Universal.DebugTimeMode = DebugTimeMode.StopSim; break; case "Debug_InstantStopSimAndVisualUpdates": Engine_Universal.DebugTimeMode = DebugTimeMode.StopSimAndVisualUpdates; break; case "Debug_ResumeFromInstantStop": Engine_Universal.DebugTimeMode = DebugTimeMode.Normal; break; case "Debug_RunExactlyNMoreSimSteps": Engine_Universal.DebugSimStepsToRun = 1; Engine_Universal.DebugTimeMode = DebugTimeMode.Normal; break; case "Debug_RunNMoreVisualUpdateSeconds": Engine_Universal.DebugVisualUpdateSecondsToRun = GameSettings.Current.DebugVisualUpdateSecondsIntervalLength; switch (Engine_Universal.DebugTimeMode) { case DebugTimeMode.StopSimAndVisualUpdates: Engine_Universal.DebugTimeMode = DebugTimeMode.StopSim; break; } break; case "Debug_BarfSquadData": { if (!World_AIW2.Instance.IsPaused) { GameCommand command = GameCommand.Create(GameCommandType.TogglePause); World_AIW2.Instance.QueueGameCommand(command, true); } ArcenCharacterBuffer buffer = new ArcenCharacterBuffer(); int count = 0; Engine_AIW2.Instance.DoForSelected(SelectionCommandScope.CurrentPlanet_UnlessViewingGalaxy, delegate(GameEntity selected) { count++; selected.VisualObj.WriteDebugDataTo(buffer); return(DelReturn.Continue); }); ArcenDebugging.ArcenDebugLogSingleLine("Squad Data Dump from " + count + " entities:" + buffer.ToString(), Verbosity.DoNotShow); } break; } }