public void VoxelsSelected(List <Voxel> refs, InputManager.MouseButton button) { if (CurrentRoomData == null) { return; } if (displayObjects != null) { foreach (var thing in displayObjects) { thing.Delete(); } } if (button == InputManager.MouseButton.Left) { if (Faction.FilterMinionsWithCapability(Faction.SelectedMinions, GameMaster.ToolMode.Build).Count == 0) { World.ShowToolPopup("None of the selected units can build rooms."); } else if (CurrentRoomData.Verify(refs, Faction, World)) { BuildNewVoxels(refs); } } else { DeleteVoxels(refs); } }
public void VoxelsSelected(List <VoxelHandle> refs, InputManager.MouseButton button) { foreach (BuildRoomOrder order in BuildDesignations) { order.SetTint(Color.White); } foreach (Room room in Faction.GetRooms()) { room.SetTint(Color.White); } if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { if (CurrentRoomData.Verify(refs, Faction, World)) { BuildNewVoxels(refs); } } }
public void OnVoxelsDragged(List <VoxelHandle> refs, InputManager.MouseButton button) { World.Master.VoxSelector.SelectionColor = Color.White; if (Faction == null) { Faction = World.PlayerFaction; } foreach (BuildRoomOrder order in BuildDesignations) { order.SetTint(Color.White); } foreach (Room room in Faction.GetRooms()) { room.SetTint(Color.White); } if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { World.Tutorial("build " + CurrentRoomData.Name); if (CurrentRoomData.Verify(refs, Faction, World)) { List <Quantitiy <Resource.ResourceTags> > requirements = CurrentRoomData.GetRequiredResources(refs.Count, Faction); string tip = "Needs "; if (requirements.Count == 0) { tip = ""; } int i = 0; foreach (var requirement in requirements) { i++; tip += requirement.NumResources.ToString(); tip += " "; tip += requirement.ResourceType; tip += "\n"; } World.ShowTooltip("Release to build here."); } else { World.Master.VoxSelector.SelectionColor = GameSettings.Default.Colors.GetColor("Negative", Color.Red); } } }
public void OnVoxelsDragged(List <Voxel> refs, InputManager.MouseButton button) { if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { if (Faction.FilterMinionsWithCapability(Faction.SelectedMinions, GameMaster.ToolMode.Build).Count == 0) { PlayState.GUI.ToolTipManager.ToolTip = Drawer2D.WrapColor("None of the selected units can build rooms.", Color.Red); } else if (CurrentRoomData.Verify(refs, Faction)) { List <Quantitiy <Resource.ResourceTags> > requirements = CurrentRoomData.GetRequiredResources(refs.Count, Faction); string tip = "Needs "; if (requirements.Count == 0) { tip = ""; } int i = 0; foreach (var requirement in requirements) { i++; tip += requirement.NumResources.ToString(); tip += " "; tip += requirement.ResourceType; tip += "\n"; } PlayState.GUI.ToolTipManager.Popup(Drawer2D.WrapColor(tip + "Release to build here.", Color.Green)); } } }
public void VoxelsSelected(List <Voxel> refs, InputManager.MouseButton button) { if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { if (Faction.FilterMinionsWithCapability(Faction.SelectedMinions, GameMaster.ToolMode.Build).Count == 0) { PlayState.GUI.ToolTipManager.Popup("None of the selected units can build rooms."); } else if (CurrentRoomData.Verify(refs, Faction)) { BuildNewVoxels(refs); } } else { DeleteVoxels(refs); } }
public void OnVoxelsDragged(List <Voxel> refs, InputManager.MouseButton button) { if (Faction == null) { Faction = World.PlayerFaction; } if (displayObjects != null) { foreach (var thing in displayObjects) { thing.Delete(); } } if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { if (Faction.FilterMinionsWithCapability(Faction.SelectedMinions, GameMaster.ToolMode.Build).Count == 0) { World.ShowToolPopup("None of the selected units can build rooms."); } else if (CurrentRoomData.Verify(refs, Faction, World)) { List <Quantitiy <Resource.ResourceTags> > requirements = CurrentRoomData.GetRequiredResources(refs.Count, Faction); string tip = "Needs "; if (requirements.Count == 0) { tip = ""; } int i = 0; foreach (var requirement in requirements) { i++; tip += requirement.NumResources.ToString(); tip += " "; tip += requirement.ResourceType; tip += "\n"; } World.ShowToolPopup("Release to build here."); displayObjects = RoomLibrary.GenerateRoomComponentsTemplate(CurrentRoomData, refs, Faction.Components, World.ChunkManager.Content, World.ChunkManager.Graphics); foreach (Body thing in displayObjects) { thing.SetActiveRecursive(false); SetDisplayColor(thing, Color.Green); } } } }
public void OnVoxelsDragged(List <VoxelHandle> refs, InputManager.MouseButton button) { if (Faction == null) { Faction = World.PlayerFaction; } if (displayObjects != null) { foreach (var thing in displayObjects) { thing.Delete(); } } foreach (BuildRoomOrder order in BuildDesignations) { order.SetTint(Color.White); } foreach (Room room in Faction.GetRooms()) { room.SetTint(Color.White); } if (CurrentRoomData == null) { return; } if (button == InputManager.MouseButton.Left) { World.Tutorial("build " + CurrentRoomData.Name); if (CurrentRoomData.Verify(refs, Faction, World)) { List <Quantitiy <Resource.ResourceTags> > requirements = CurrentRoomData.GetRequiredResources(refs.Count, Faction); string tip = "Needs "; if (requirements.Count == 0) { tip = ""; } int i = 0; foreach (var requirement in requirements) { i++; tip += requirement.NumResources.ToString(); tip += " "; tip += requirement.ResourceType; tip += "\n"; } World.ShowToolPopup("Release to build here."); displayObjects = RoomLibrary.GenerateRoomComponentsTemplate(CurrentRoomData, refs, World.ComponentManager, World.ChunkManager.Content, World.ChunkManager.Graphics); foreach (Body thing in displayObjects) { thing.SetFlagRecursive(GameComponent.Flag.Active, false); SetDisplayColor(thing, Color.Green); } } } else { foreach (var v in refs.Where(v => v.IsValid && !v.IsEmpty)) { if (IsBuildDesignation(v)) { var order = GetBuildDesignation(v); if (order == null || order.Order == null) { // TODO(mklingen): Don't know how this could happen, but we got a crash here... continue; } if (!order.Order.IsBuilt) { order.Order.SetTint(Color.Red); } else { order.ToBuild.SetTint(Color.Red); } break; } else if (IsInRoom(v)) { Room existingRoom = GetMostLikelyRoom(v); if (existingRoom == null) { continue; } existingRoom.SetTint(Color.Red); break; } } } }