mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
61 lines
1.4 KiB
C#
61 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Cysharp.Threading.Tasks;
|
|
using JNGame.Math;
|
|
|
|
namespace JNGame.Sync.State.Tile
|
|
{
|
|
/// <summary>
|
|
/// 瓦片状态同步客户端
|
|
/// </summary>
|
|
public abstract class JNSSTileClientService : JNSStateClientService
|
|
{
|
|
|
|
/// <summary>
|
|
/// 当前显示的Tile
|
|
/// </summary>
|
|
protected List<int> TileShow = new ();
|
|
|
|
/// <summary>
|
|
/// 区块索引组
|
|
/// </summary>
|
|
protected abstract int[][] Tiles { get; }
|
|
|
|
/// <summary>
|
|
/// 区块大小
|
|
/// </summary>
|
|
protected abstract int TileSize { get; }
|
|
|
|
public int GetTileIndex(LVector3 pos)
|
|
{
|
|
return JNSSTileTool.GetTileIndex(Tiles, TileSize, pos);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取九宫格Index
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<int> 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);
|
|
}
|
|
}
|
|
|
|
}
|
|
} |