1using System.Collections.Generic;
2using System.Runtime.Serialization;
3using CreativeSpore.SuperTilemapEditor;
122 public string idMap =>
"map_ntyris";
132 for (
int i = 0; i <
h; i++)
134 for (
int j = 0; j <
w; j++)
151 for (
int i = 0; i <
h; i++)
153 for (
int j = 0; j <
w; j++)
182 for (
int i = 0; i <
h; i++)
184 for (
int j = 0; j <
w; j++)
198 Debug.Log(
"cell is null:" + x +
"/" + y);
203 cell.obj = zone.
icon;
206 for (
int k = 0; k <
h; k++)
208 for (
int l = 0; l <
w; l++)
217 if (cell2.
zone !=
null)
231 objmap.UpdateMeshImmediate();
234 public void SetZone(
int gx,
int gy,
Zone z,
bool updateMesh =
false)
239 Debug.Log(
"cell is null:" + gx +
"/" + gy);
241 else if (z ==
null || cell.
obj != z.
icon)
243 cell.obj = z?.
icon ?? 0;
244 if (z !=
null && z.
source.tag.Contains(
"iconFlag"))
267 objmap.UpdateMeshImmediate();
290 group.Tilemaps.ForeachReverse(delegate(STETilemap m)
292 if (!(m ==
fogmap || skip))
294 int tileIdFromTileData = Tileset.GetTileIdFromTileData(m.GetTileData(gx, gy));
295 TileData tileData =
new TileData(m.GetTileData(gx, gy));
296 int tileId = tileData.tileId;
297 if (tileId >= 22 && tileId <= 25)
299 bool flipHorizontal = tileData.flipHorizontal;
300 bool flipVertical = tileData.flipVertical;
301 bool rot = tileData.rot90;
302 int num = (flipHorizontal ? 1 : 0) + (flipVertical ? 1 : 0) * 2 + (rot ? 1 : 0) * 4;
304 t.roadLeft = tileId == 23 || (tileId == 24 && (num == 4 || num == 0)) || (tileId == 25 && num != 6);
305 t.roadRight = tileId == 23 || (tileId == 24 && (num == 6 || num == 1)) || (tileId == 25 && num != 4);
306 t.roadUp = tileId == 22 || (tileId == 24 && (num == 4 || num == 6)) || (tileId == 25 && num != 0);
307 t.roadDown = tileId == 22 || (tileId == 24 && (num == 0 || num == 1)) || (tileId == 25 && num != 2);
344 foreach (STETilemap tilemap
in group.Tilemaps)
348 int tileIdFromTileData = Tileset.GetTileIdFromTileData(tilemap.GetTileData(gx, gy));
362 for (
int i = gy - radius; i < gy + radius + 1; i++)
364 for (
int j = gx - radius; j < gx + radius + 1; j++)
375 if (cell ==
null || cell.
zone !=
null ||
cloudmap.GetTileData(gx, gy) != uint.MaxValue)
403 if (row ==
null || !row.
tag.Contains(
"site"))
458 if (child.
x == gx && child.
y == gy && (child as
Zone)?.instance ==
null && (zone ==
null || zone is
Zone_Field))
460 zone = child as
Zone;
472 for (
int i = 0; i < 100; i++)
474 for (
int j = gy - i; j < gy + i + 1; j++)
476 for (
int k = gx - i; k < gx + i + 1; k++)
478 if (j == gy - i || j == gy + i || k == gx - i || k == gx + i)
481 if (((tileData != uint.MaxValue) ? ((tileData & 0xFFF0000) >> 16) : 0) == 3)
485 tileData =
seaMap.GetTileData(k, j);
486 if (((tileData != uint.MaxValue) ? ((tileData & 0xFFF0000) >> 16) : 0) == 3)
497 public void AddLight(
int gx,
int gy,
string id =
"elolight")
507 spriteRenderer.transform.position = TilemapUtils.GetGridWorldPos(
fogmap, gx, gy);
514 if (light.
gx == gx && light.
gy == gy)
516 Object.DestroyImmediate(light.
sr.gameObject);
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
static SourceManager sources
void Initialize(EloMap _elomap)
List< EloMapLight > lights
SourceGlobalTile.Row source
void OnDeserialized(StreamingContext context)
void SetZone(int gx, int gy, Zone z, bool updateMesh=false)
void RemoveLight(int gx, int gy)
bool IsSnow(int gx, int gy)
void AddLight(int gx, int gy, string id="elolight")
Cell GetCell(int gx, int gy)
void OnSerializing(StreamingContext context)
bool CanBuildSite(int gx, int gy, int radius=0, ElomapSiteType type=ElomapSiteType.Nefia)
void Init(EloMapActor _actor)
int GetRoadDist(int gx, int gy)
bool IsWater(int gx, int gy)
List< SourceGlobalTile.Row > GetSources(int gx, int gy)
TileInfo GetTileInfo(int gx, int gy)
Zone GetZone(int gx, int gy)
Dictionary< int, Row > tileAlias
SourceGlobalTile globalTiles