private ZoneLabel DrawZone(ZoneBase newZone) { var sprite = Loc.GetZoneController().ZoneSprite; var room = false; if (newZone is RoomZone) { sprite = Loc.GetZoneController().RoomSprite; room = true; } else if (newZone is StorageZone) { sprite = Loc.GetZoneController().StorageSprite; } foreach (var cell in newZone.ZoneCells.GetCells()) { SetZoneCellTile(newZone, sprite, cell); if (room) { Loc.GetStructureController().CreateRoof(cell); } } var label = Instantiate(ZoneLabelPrefab, transform); label.name = newZone.Name; label.Text.text = newZone.Name; MoveZoneLabel(newZone, label); return(label); }
public void DeleteZoneClicked() { ShowDeleteInfo(); SetCursorAndSpriteForZone(Loc.GetZoneController().RemoveSprite); CellClickOrder = cells => Loc.GetZoneController().ClearZonesFromCells(cells); }
public void AddStoreClicked() { ShowStorageInfo(); SetCursorAndSpriteForZone(Loc.GetZoneController().StorageSprite); CellClickOrder = cells => { var newZone = Loc.GetZoneController().CreateStore(FactionConstants.Player, cells.Where(c => CanAddCellToZone(c)).ToArray()); Loc.GetGameController().ShowZonePanel(newZone); }; }
private ZoneBase FindZoneInCells(List <Cell> cells) { foreach (var cell in cells) { var zone = Loc.GetZoneController().GetZoneForCell(cell); if (zone != null) { return(zone); } } return(null); }
public static Save MakeSave() { return(new Save { MapGenerationData = MapGenerationData.Instance, Factions = Loc.GetFactionController().Factions.Values.ToList(), Time = Loc.GetTimeManager().Data, Items = Loc.GetIdService().ItemIdLookup.Values.ToList(), CameraData = new CameraData(Loc.GetCamera()), Rooms = Loc.GetZoneController().RoomZones, Stores = Loc.GetZoneController().StorageZones, Areas = Loc.GetZoneController().AreaZones, Chunks = Loc.GetMap().Chunks.Values.Select(s => s.Data).ToList(), }); }
public string List(string type) { var list = ""; switch (type.ToLower()) { case "items": foreach (var item in Loc.GetIdService().ItemIdLookup) { list += $"{item.Key}: {item.Value.Name}\n"; } break; case "creatures": foreach (var creature in Loc.GetIdService().CreatureIdLookup) { list += $"{creature.Key}: {creature.Value.Name}\n"; } break; case "structures": foreach (var structure in Loc.GetIdService().StructureIdLookup) { list += $"{structure.Key}: {structure.Value.Name}\n"; } break; case "factions": foreach (var faction in Loc.GetFactionController().Factions) { list += $"{faction.Key}\n"; } break; case "zones": foreach (var zone in Loc.GetZoneController().Zones) { list += $"{zone.Key.Name}: {zone.Key.FactionName}\n"; } break; default: list = "Provide type of list:\n-items\n-creatures\n-structures\n-factions\n-zones"; break; } return(list); }
public void ClearZonesFromCells(IEnumerable <Cell> cells) { foreach (var cell in cells) { var current = Loc.GetZoneController().GetZoneForCell(cell); if (current != null) { current.ZoneCells.RemoveCell(cell); ClearZoneCellTile(cell); if (current.ZoneCells.GetCells().Count == 0) { Delete(current); } else { MoveZoneLabel(current); } } } }
public void NameChanged() { Loc.GetGameController().Typing = true; CurrentZone.Name = Name.text; Loc.GetZoneController().Refresh(CurrentZone); }
public void DeleteZone() { Loc.GetZoneController().Delete(CurrentZone); Destroy(); }