mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
提交
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
using System.Collections.Generic;
|
||||
using DotRecast.Core.Collections;
|
||||
using JNGame.Math;
|
||||
using JNGame.Sync.State.Tile;
|
||||
using UnityEngine;
|
||||
|
||||
namespace JNGame.Sync.Debuger
|
||||
{
|
||||
public class JNTileServerDebuger : SingletonScene<JNTileServerDebuger>
|
||||
{
|
||||
|
||||
private List<JNSSTileServerService> _services = new List<JNSSTileServerService>();
|
||||
|
||||
public void Add(JNSSTileServerService service)
|
||||
{
|
||||
_services.Add(service);
|
||||
}
|
||||
|
||||
public void Remove(JNSSTileServerService service)
|
||||
{
|
||||
_services.Remove(service);
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
|
||||
_services.ForEach(DebugService);
|
||||
|
||||
}
|
||||
|
||||
private void DebugService(JNSSTileServerService service)
|
||||
{
|
||||
|
||||
if (!(service.IsStart)) return;
|
||||
|
||||
//绘制权限区块
|
||||
DrawContains(service.MaxContains,service.MinContains,Color.red);
|
||||
|
||||
//绘制连接区域
|
||||
service.GetLinkTiles().ForEach(index =>
|
||||
{
|
||||
(LVector2 max, LVector2 min) = service.GetTileContains(index);
|
||||
DrawContains(max,min,Color.cyan);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制区域
|
||||
/// </summary>
|
||||
/// <param name="MaxContains"></param>
|
||||
/// <param name="MinContains"></param>
|
||||
private void DrawContains(LVector2 MaxContains,LVector2 MinContains,Color color)
|
||||
{
|
||||
// 绘制正方形
|
||||
// 计算正方形的四个角点
|
||||
Vector3 topLeft = new Vector3(MaxContains.x,0, MaxContains.y);
|
||||
Vector3 topRight = new Vector3(MinContains.x,0, MaxContains.y);
|
||||
Vector3 bottomLeft = new Vector3(MaxContains.x,0, MinContains.y);
|
||||
Vector3 bottomRight = new Vector3(MinContains.x,0, MinContains.y);
|
||||
|
||||
// 使用Gizmos.DrawLine来绘制正方形的四条边
|
||||
Gizmos.color = color; // 设置Gizmos的颜色
|
||||
|
||||
// 顶部边
|
||||
Gizmos.DrawLine(topLeft, topRight);
|
||||
// 底部边
|
||||
Gizmos.DrawLine(bottomLeft, bottomRight);
|
||||
// 左侧边
|
||||
Gizmos.DrawLine(topLeft, bottomLeft);
|
||||
// 右侧边
|
||||
Gizmos.DrawLine(topRight, bottomRight);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3af567e286384e418dc55e261f8e31c8
|
||||
timeCreated: 1723694204
|
Reference in New Issue
Block a user