using System; using System.Collections.Generic; using System.Threading.Tasks; using Cysharp.Threading.Tasks; using JNGame.Math; namespace JNGame.Sync.State.Tile { /// /// 瓦片状态同步客户端 /// public abstract class JNSSTileClientService : JNSStateClientService { /// /// 当前显示的Tile /// protected List TileShow = new (); /// /// 区块索引组 /// protected abstract int[][] Tiles { get; } /// /// 区块大小 /// protected abstract int TileSize { get; } public int GetTileIndex(LVector3 pos) { return JNSSTileTool.GetTileIndex(Tiles, TileSize, pos); } /// /// 获取九宫格Index /// /// public List GetTileGridIndex(LVector3 pos) { return JNSSTileTool.GetTileGridIndex(Tiles, TileSize,pos); } public void AddTileShow(int index) { if (!(TileShow.Contains(index))) { TileShow.Add(index); } } public void RemoveTileShow(int index) { if (TileShow.Contains(index)) { TileShow.Remove(index); } } } }