예제 #1
0
    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);
    }
예제 #2
0
    public void DeleteZoneClicked()
    {
        ShowDeleteInfo();
        SetCursorAndSpriteForZone(Loc.GetZoneController().RemoveSprite);

        CellClickOrder = cells => Loc.GetZoneController().ClearZonesFromCells(cells);
    }
예제 #3
0
    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);
        };
    }
예제 #4
0
        private ZoneBase FindZoneInCells(List <Cell> cells)
        {
            foreach (var cell in cells)
            {
                var zone = Loc.GetZoneController().GetZoneForCell(cell);
                if (zone != null)
                {
                    return(zone);
                }
            }

            return(null);
        }
예제 #5
0
 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(),
     });
 }
예제 #6
0
    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);
    }
예제 #7
0
    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);
                }
            }
        }
    }
예제 #8
0
 public void NameChanged()
 {
     Loc.GetGameController().Typing = true;
     CurrentZone.Name = Name.text;
     Loc.GetZoneController().Refresh(CurrentZone);
 }
예제 #9
0
 public void DeleteZone()
 {
     Loc.GetZoneController().Delete(CurrentZone);
     Destroy();
 }