feat: Add ID view on map

This commit is contained in:
2025-02-16 20:56:00 +08:00
parent cc57334ab2
commit 830d014bf0
4 changed files with 107 additions and 5 deletions

View File

@@ -15,6 +15,8 @@ namespace Cryville.EEW.Unity.Map {
static readonly HttpClient _httpClient = new() { Timeout = TimeSpan.FromSeconds(10) };
[SerializeField] Transform _idView;
public MapTileIndex Index { get; set; }
public bool IsEmpty { get; private set; }
@@ -39,7 +41,11 @@ namespace Cryville.EEW.Unity.Map {
_localFile = new(Path.Combine(cacheDir, $"map/{Index.Z}/{Index.NX}/{Index.NY}"));
float z = 1 << index.Z;
transform.localPosition = new(index.X / z, -(index.Y + 1) / z, -index.Z / 100f);
transform.localScale = new Vector3(1 / z, 1 / z);
transform.localScale = new Vector3(1 / z, 1 / z, 1);
_idView.gameObject.SetActive(true);
byte e = SharedSettings.Instance.IdBytes[((index.X << 2) + index.Y) & 0x1f];
int ex = e >> 4, ey = e & 0xf;
_idView.localPosition = new(ex / 16f, 1 - ey / 16f, -1 / 200f);
if (_localFile.Exists) {
_downloadDone = true;
}