Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CentrED/Data/Languages/Czech.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,33 @@ STRENGTH=Síla
EDGE_FALLOFF=Útlum okrajů
FALLOFF_START=Začátek útlumu
FALLOFF_START_TOOLTIP=Procento poloměru, kde začíná útlum
WALL_TOOL=Zeď
WALL_SET=Sada zdí
DRAW_MODE=Režim kreslení
RECTANGLE=Obdélník
POLYGON=Polygon
Z_LEVEL=Úroveň Z
ERASING=Mazání...
PAINTING=Malování...
AREA_TILES_CTRL_DELETE=Oblast: {0} dlaždic - Ctrl + Táhnout pro smazání
PAINT_AREA_HINT=Namalujte oblast (Ctrl+táhnout pro mazání)
WALL_TILES=Dlaždice zdí
NORTH=Sever
SOUTH=Jih
LEFT=Levá
RIGHT=Pravá
LEFT_TILES_PERCENT=Levé dlaždice ({0}%)
RIGHT_TILES_PERCENT=Pravé dlaždice ({0}%)
OVER_100_PERCENT=Přes 100%!
DROP_TO_ADD=Přetáhněte sem
DRAWING=Kreslení...
READY_DRAG_ON_MAP=Připraveno - Táhněte na mapě
ADD_TILES_TO_BEGIN=Přidejte dlaždice pro začátek
RESET=Reset
OK=OK
DRAG_TILE_FROM_TILES_WINDOW=Přetáhněte dlaždici z okna Dlaždice
RIGHT_CLICK_TO_CLEAR=Pravým kliknutím vymažete
RIGHT_CLICK_TO_REMOVE=Pravým kliknutím odstraníte
OPTIONAL=(Volitelné)
OPTIONAL_DRAG_TILE=Volitelné - přetáhněte dlaždici pro střídající se zdi
WAITING_FOR_CONNECTION=Čekání na připojení...
30 changes: 30 additions & 0 deletions CentrED/Data/Languages/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,33 @@ STRENGTH=Strength
EDGE_FALLOFF=Edge falloff
FALLOFF_START=Falloff start
FALLOFF_START_TOOLTIP=Percentage of radius where falloff begins
WALL_TOOL=Wall
WALL_SET=Wall Set
DRAW_MODE=Draw Mode
RECTANGLE=Rectangle
POLYGON=Polygon
Z_LEVEL=Z Level
ERASING=Erasing...
PAINTING=Painting...
AREA_TILES_CTRL_DELETE=Area: {0} tiles - Ctrl+drag to erase
PAINT_AREA_HINT=Paint area (Ctrl+drag to erase)
WALL_TILES=Wall Tiles
NORTH=North
SOUTH=South
LEFT=Left
RIGHT=Right
LEFT_TILES_PERCENT=Left Tiles ({0}%)
RIGHT_TILES_PERCENT=Right Tiles ({0}%)
OVER_100_PERCENT=Over 100%!
DROP_TO_ADD=Drop to Add
DRAWING=Drawing...
READY_DRAG_ON_MAP=Ready - Drag on map
ADD_TILES_TO_BEGIN=Add tiles to begin
RESET=Reset
OK=OK
DRAG_TILE_FROM_TILES_WINDOW=Drag a tile from the Tiles window
RIGHT_CLICK_TO_CLEAR=Right-click to clear
RIGHT_CLICK_TO_REMOVE=Right-click to remove
OPTIONAL=(Optional)
OPTIONAL_DRAG_TILE=Optional - drag a tile for alternating walls
WAITING_FOR_CONNECTION=Waiting for connection...
30 changes: 30 additions & 0 deletions CentrED/Data/Languages/Polski.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,33 @@ STRENGTH=Siła
EDGE_FALLOFF=Zanikanie krawędzi
FALLOFF_START=Początek zanikania
FALLOFF_START_TOOLTIP=Procent promienia, od którego zaczyna się zanikanie
WALL_TOOL=Ściana
WALL_SET=Zestaw ścian
DRAW_MODE=Tryb rysowania
RECTANGLE=Prostokąt
POLYGON=Wielokąt
Z_LEVEL=Poziom Z
ERASING=Usuwanie...
PAINTING=Malowanie...
AREA_TILES_CTRL_DELETE=Obszar: {0} kafelków - Ctrl + Przeciągnij aby usunąć
PAINT_AREA_HINT=Namaluj obszar (Ctrl+przeciągnij aby usunąć)
WALL_TILES=Kafelki ścian
NORTH=Północ
SOUTH=Południe
LEFT=Lewa
RIGHT=Prawa
LEFT_TILES_PERCENT=Lewe kafelki ({0}%)
RIGHT_TILES_PERCENT=Prawe kafelki ({0}%)
OVER_100_PERCENT=Ponad 100%!
DROP_TO_ADD=Upuść tutaj
DRAWING=Rysowanie...
READY_DRAG_ON_MAP=Gotowe - Przeciągnij na mapie
ADD_TILES_TO_BEGIN=Dodaj kafelki aby rozpocząć
RESET=Reset
OK=OK
DRAG_TILE_FROM_TILES_WINDOW=Przeciągnij kafelek z okna Kafelki
RIGHT_CLICK_TO_CLEAR=Kliknij prawym aby wyczyścić
RIGHT_CLICK_TO_REMOVE=Kliknij prawym aby usunąć
OPTIONAL=(Opcjonalne)
OPTIONAL_DRAG_TILE=Opcjonalne - przeciągnij kafelek dla naprzemiennych ścian
WAITING_FOR_CONNECTION=Oczekiwanie na połączenie...
30 changes: 30 additions & 0 deletions CentrED/Data/Languages/Português.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,33 @@ STRENGTH=Intensidade
EDGE_FALLOFF=Atenuação de borda
FALLOFF_START=Início da atenuação
FALLOFF_START_TOOLTIP=Porcentagem do raio onde a atenuação começa
WALL_TOOL=Parede
WALL_SET=Conjunto de paredes
DRAW_MODE=Modo de desenho
RECTANGLE=Retângulo
POLYGON=Polígono
Z_LEVEL=Nível Z
ERASING=Apagando...
PAINTING=Pintando...
AREA_TILES_CTRL_DELETE=Área: {0} blocos - Ctrl + Arrastar para apagar
PAINT_AREA_HINT=Pinte a área (Ctrl+arrastar para apagar)
WALL_TILES=Blocos de parede
NORTH=Norte
SOUTH=Sul
LEFT=Esquerda
RIGHT=Direita
LEFT_TILES_PERCENT=Blocos esquerdos ({0}%)
RIGHT_TILES_PERCENT=Blocos direitos ({0}%)
OVER_100_PERCENT=Acima de 100%!
DROP_TO_ADD=Solte aqui
DRAWING=Desenhando...
READY_DRAG_ON_MAP=Pronto - Arraste no mapa
ADD_TILES_TO_BEGIN=Adicione blocos para começar
RESET=Resetar
OK=OK
DRAG_TILE_FROM_TILES_WINDOW=Arraste um bloco da janela Blocos
RIGHT_CLICK_TO_CLEAR=Clique direito para limpar
RIGHT_CLICK_TO_REMOVE=Clique direito para remover
OPTIONAL=(Opcional)
OPTIONAL_DRAG_TILE=Opcional - arraste um bloco para paredes alternadas
WAITING_FOR_CONNECTION=Aguardando conexão...
11 changes: 11 additions & 0 deletions CentrED/IO/Models/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

namespace CentrED.IO.Models;

public record WallTileChance(ushort TileId, int Chance);

public record WallSet(ushort North, ushort South, List<WallTileChance> LeftTiles, List<WallTileChance> RightTiles);

public class Profile
{
private const string PROFILE_FILE = "profile.json";
Expand All @@ -12,6 +16,7 @@ public class Profile
private const string HUE_SETS_FILE = "huesets.json";
private const string LAND_BRUSH_FILE = "landbrush.json";
private const string STATIC_FILTER_FILE = "staticfilter.json";
private const string WALL_SETS_FILE = "wallsets.json";

[JsonIgnore] public string Name { get; set; } = "";
public string Hostname { get; set; } = "127.0.0.1";
Expand All @@ -26,6 +31,7 @@ public class Profile
[JsonIgnore] public Dictionary<string, SortedSet<ushort>> HueSets { get; set; } = new();
[JsonIgnore] public Dictionary<string, LandBrush> LandBrush { get; set; } = new();
[JsonIgnore] public List<int> StaticFilter { get; set; } = new();
[JsonIgnore] public Dictionary<string, WallSet> WallSets { get; set; } = new();


public void Serialize(String path)
Expand All @@ -46,6 +52,7 @@ public void Serialize(String path)
File.WriteAllText(Path.Join(profileDir, HUE_SETS_FILE), JsonSerializer.Serialize(HueSets, options));
File.WriteAllText(Path.Join(profileDir, LAND_BRUSH_FILE), JsonSerializer.Serialize(LandBrush, Models.LandBrush.JsonOptions));
File.WriteAllText(Path.Join(profileDir, STATIC_FILTER_FILE), JsonSerializer.Serialize(StaticFilter, options));
File.WriteAllText(Path.Join(profileDir, WALL_SETS_FILE), JsonSerializer.Serialize(WallSets, options));
}

public static Profile? Deserialize(string profileDir)
Expand Down Expand Up @@ -83,6 +90,10 @@ public void Serialize(String path)
if (staticFilter != null)
profile.StaticFilter = staticFilter;

var wallSets = Deserialize<Dictionary<string, WallSet>>(Path.Join(profileDir, WALL_SETS_FILE));
if (wallSets != null)
profile.WallSets = wallSets;

return profile;
}

Expand Down
32 changes: 32 additions & 0 deletions CentrED/Languages/LangEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,36 @@ public enum LangEntry
EDGE_FALLOFF,
FALLOFF_START,
FALLOFF_START_TOOLTIP,

// Wall Tool
WALL_TOOL,
WALL_SET,
DRAW_MODE,
RECTANGLE,
POLYGON,
Z_LEVEL,
ERASING,
PAINTING,
AREA_TILES_CTRL_DELETE,
PAINT_AREA_HINT,
WALL_TILES,
NORTH,
SOUTH,
LEFT,
RIGHT,
LEFT_TILES_PERCENT,
RIGHT_TILES_PERCENT,
OVER_100_PERCENT,
DROP_TO_ADD,
DRAWING,
READY_DRAG_ON_MAP,
ADD_TILES_TO_BEGIN,
RESET,
OK,
DRAG_TILE_FROM_TILES_WINDOW,
RIGHT_CLICK_TO_CLEAR,
RIGHT_CLICK_TO_REMOVE,
OPTIONAL,
OPTIONAL_DRAG_TILE,
WAITING_FOR_CONNECTION,
}
8 changes: 6 additions & 2 deletions CentrED/Map/MapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ public MapManager(GraphicsDevice gd, GameWindow window, Keymap keymap)
Tools.Add(new MeshEditTool());
Tools.Add(new AltitudeGradientTool());
Tools.Add(new CoastlineTool());

Tools.Add(new WallTool());

Tools.ForEach(t => t.PostConstruct(this));

_activeTool = Tools[0];
Expand Down Expand Up @@ -655,7 +656,10 @@ public void Update(GameTime gameTime, bool isActive, bool processMouse, bool pro
}
else if (_keymap.IsKeyPressed(Keys.Z))
{
Client.Undo();
if (!ActiveTool.HandlesUndo)
{
Client.Undo();
}
}

if (_keymap.IsKeyPressed(Keys.R))
Expand Down
64 changes: 60 additions & 4 deletions CentrED/Tools/DrawTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class DrawTool : BaseTool
private readonly TilesWindow _tilesWindow;
private readonly BlueprintsWindow _blueprintsWindow;
private HueTool _hueTool;
private WallTool? _wallTool;

public DrawTool()
{
_tilesWindow = UIManager.GetWindow<TilesWindow>();
Expand All @@ -22,6 +24,7 @@ public DrawTool()
public override void PostConstruct(MapManager mapManager)
{
_hueTool = mapManager.Tools.OfType<HueTool>().First();
_wallTool = mapManager.Tools.OfType<WallTool>().FirstOrDefault();
}

public override string Name => LangManager.Get(DRAW_TOOL);
Expand All @@ -31,7 +34,8 @@ enum DrawSource
{
TILE,
TILE_SET,
BLUEPRINT
BLUEPRINT,
WALL_SET
}

enum DrawMode
Expand All @@ -53,9 +57,10 @@ enum DrawMode

private List<ushort> _tileSetValues => _tilesWindow.ActiveTileSetValues;

internal override void Draw()
public void DrawSourceSelection()
{
ImGui.Text(LangManager.Get(SOURCE));
var prevSource = _drawSource;
ImGui.RadioButton(LangManager.Get(TILES), ref _drawSource, (int)DrawSource.TILE);
ImGui.RadioButton(LangManager.Get(TILE_SET), ref _drawSource, (int)DrawSource.TILE_SET);
if (_tileSetValues.Count <= 0)
Expand All @@ -64,12 +69,32 @@ internal override void Draw()
ImGui.TextDisabled(LangManager.Get(EMPTY));
}
ImGui.RadioButton(LangManager.Get(BLUEPRINTS), ref _drawSource, (int)DrawSource.BLUEPRINT);

ImGui.RadioButton(LangManager.Get(WALL_SET), ref _drawSource, (int)DrawSource.WALL_SET);

if (_drawSource != prevSource)
{
if (_drawSource == (int)DrawSource.WALL_SET && _wallTool != null)
{
_wallTool.SetParentDrawTool(this);
MapManager.ActiveTool = _wallTool;
}
else if (prevSource == (int)DrawSource.WALL_SET)
{
_wallTool?.SetParentDrawTool(null);
MapManager.ActiveTool = this;
}
}
}

internal override void Draw()
{
DrawSourceSelection();

ImGui.Separator();
ImGui.Text(LangManager.Get(SOURCE_PARAMETERS));
if (_drawSource == (int)DrawSource.TILE_SET)
{

ImGuiEx.TwoWaySwitch(LangManager.Get(RANDOM), LangManager.Get(SEQUENTIAL), ref _tileSetSequential);
}
if (_drawSource == (int)DrawSource.BLUEPRINT)
Expand All @@ -78,6 +103,13 @@ internal override void Draw()
ImGui.Checkbox(LangManager.Get(SNAP_TO_TERRAIN), ref _snapToTerrain);
ImGui.EndDisabled();
}
if (_drawSource == (int)DrawSource.WALL_SET && _wallTool != null)
{
_wallTool.DrawConfiguration();
}

if (_drawSource == (int)DrawSource.WALL_SET)
return;

ImGui.Separator();
ImGui.Text(LangManager.Get(MODE));
Expand Down Expand Up @@ -122,6 +154,12 @@ internal override void Draw()

public override void OnActivated(TileObject? o)
{
if (_drawSource == (int)DrawSource.WALL_SET && _wallTool != null)
{
MapManager.ActiveTool = _wallTool;
return;
}

if (_drawMode == (int)DrawMode.FIXED_Z)
{
MapManager.UseVirtualLayer = true;
Expand All @@ -134,10 +172,22 @@ public override void OnDeactivated(TileObject? o)
base.OnDeactivated(o);
MapManager.UseVirtualLayer = false;
MapManager.ShowVirtualLayer = false;

if (_drawSource == (int)DrawSource.WALL_SET && _wallTool != null)
{
_wallTool.SetParentDrawTool(null);
if (MapManager.ActiveTool == _wallTool)
{
_wallTool.OnDeactivated(o);
}
}
}

protected override void GhostApply(TileObject? o)
{
if (_drawSource == (int)DrawSource.WALL_SET)
return;

o = TransformTarget(o);
if (o == null)
return;
Expand Down Expand Up @@ -216,6 +266,9 @@ protected override void GhostApply(TileObject? o)

protected override void GhostClear(TileObject? o)
{
if (_drawSource == (int)DrawSource.WALL_SET)
return;

o = TransformTarget(o);
if (o == null)
return;
Expand All @@ -230,6 +283,9 @@ protected override void GhostClear(TileObject? o)

protected override void InternalApply(TileObject? o)
{
if (_drawSource == (int)DrawSource.WALL_SET)
return;

o = TransformTarget(o);
if (o == null)
return;
Expand Down
Loading
Loading