Oprava spawnování monster, optimalizace v CommandProcessor a EventProcessor. Přesunutí některých tříd do vlastních namespaců, pročištění kódu, úpravy formátování, odstranění nepoužívaných souborů a zakomentovaného kódu
This commit is contained in:
parent
e5d746d597
commit
243f071a43
62 changed files with 873 additions and 1217 deletions
|
|
@ -1,30 +1,25 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using GlobalClassLib;
|
||||
using ONDClient.GUI;
|
||||
using PacketLib;
|
||||
using ONDClient.Net;
|
||||
|
||||
namespace ONDClient.Map;
|
||||
|
||||
public class ClientMapManager {
|
||||
public static class ClientMapManager {
|
||||
private static MapTileProjection[,] map = new MapTileProjection[5, 5];
|
||||
public static MapTileProjection Get((int x, int y) coords) => map[coords.x, coords.y];
|
||||
public static MapTileProjection Get(int tileId) => Get(IdToCoords(tileId));
|
||||
|
||||
private static bool inverted;
|
||||
|
||||
public static void InitMap(int[] connectors, int[] yourTiles, int[] opponentTiles, int[] litTiles, bool upsideDown ) {
|
||||
|
||||
(int id1, int id2, ConnectorType type, ClientPlayer? owner)[] connectorsData = new (int, int , ConnectorType, ClientPlayer?)[connectors.Length / 4];
|
||||
for (int i = 0; i < connectors.Length / 4; i++){
|
||||
connectorsData[i] = (connectors[i * 4], connectors[i * 4 + 1], (ConnectorType)connectors[i * 4 + 2], connectors[i * 4 + 3] == -1 ? null : Client.GetPlayer(connectors[i * 4 + 3]));
|
||||
}
|
||||
// ClientMapManager.InitMap(upsideDown);
|
||||
|
||||
inverted = upsideDown;
|
||||
|
||||
|
||||
IdToCoords = upsideDown ? _IdToCoordsInverse : _IdToCoords;
|
||||
CoordsToId = upsideDown ? _CoordsToIdInverse : _CoordsToId;
|
||||
|
||||
|
|
@ -62,13 +57,11 @@ public class ClientMapManager {
|
|||
|
||||
public static void InitConnectors(TileConnectorProjection[] connectors) {
|
||||
foreach (var con in connectors){
|
||||
// (int x, int y) coords1 = MapTileProjection.IdToCoords(con.Tiles.tile1.Id);
|
||||
// (int x, int y) coords2 = MapTileProjection.IdToCoords(con.Tiles.tile2.Id);
|
||||
map[con.Tiles.tile1.GridPosition.x, con.Tiles.tile1.GridPosition.y].AddConnector(con);
|
||||
}
|
||||
}
|
||||
|
||||
public static TileConnectorProjection GetConnector((int, int) id) => Get(id.Item1).GetConnector(id.Item2);
|
||||
public static TileConnectorProjection? GetConnector((int, int) id) => Get(id.Item1).GetConnector(id.Item2);
|
||||
|
||||
public static TileConnectorProjection[] GetConnectors(int tileId) => Get(IdToCoords(tileId)).GetAllConnectors();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue