feat: Add ID view on map
This commit is contained in:
@@ -25,6 +25,8 @@ namespace Cryville.EEW.Unity {
|
||||
MapScriptToTypefaces = PlatformConfig.ScriptFontMap
|
||||
};
|
||||
TMPLocalizedText.DefaultShader = Resources.Load<Shader>(PlatformConfig.TextShader);
|
||||
|
||||
SharedSettings.Instance.Init();
|
||||
}
|
||||
|
||||
static readonly Encoding _encoding = new UTF8Encoding(false, true);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -5,7 +5,9 @@ using Cryville.EEW.Map;
|
||||
using Cryville.EEW.Report;
|
||||
using Cryville.EEW.TTS;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Security.Cryptography;
|
||||
using UnityEngine;
|
||||
using Color = System.Drawing.Color;
|
||||
|
||||
namespace Cryville.EEW.Unity {
|
||||
sealed class SharedSettings : IRVMGeneratorContext, IMapGeneratorContext, ITTSMessageGeneratorContext {
|
||||
@@ -20,5 +22,11 @@ namespace Cryville.EEW.Unity {
|
||||
public ISubColorScheme TextColorScheme => new DefaultTextColorScheme(Color.White, Color.Black);
|
||||
public ILocationConverter LocationConverter => new FERegionLongConverter();
|
||||
public TimeSpan NowcastWarningDelayTolerance => TimeSpan.MaxValue;
|
||||
|
||||
public byte[] IdBytes { get; } = new byte[32];
|
||||
public void Init() {
|
||||
using var hash = SHA256.Create();
|
||||
hash.ComputeHash(EEW.SharedSettings.Encoding.GetBytes(SystemInfo.deviceUniqueIdentifier)).CopyTo(IdBytes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,89 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5361934079370698033
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3505748630845561529}
|
||||
- component: {fileID: 3316179797384773187}
|
||||
m_Layer: 0
|
||||
m_Name: Id
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &3505748630845561529
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5361934079370698033}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -0.005}
|
||||
m_LocalScale: {x: 0.024999999, y: 0.024999999, z: 0.024999999}
|
||||
m_ConstrainProportionsScale: 1
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7683017549812261838}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3316179797384773187
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5361934079370698033}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 9073ff3c2a4d9a34b8ad0e21c02b50df, type: 3}
|
||||
m_Color: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0.1882353}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.28, y: 1.28}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &7683017549812261837
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -29,7 +113,8 @@ Transform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 3505748630845561529}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -74,12 +159,12 @@ SpriteRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 672c776247ebf734a8e575a63278a292, type: 3}
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 0.04, y: 0.04}
|
||||
m_Size: {x: 1.28, y: 1.28}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 0
|
||||
@@ -97,3 +182,4 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 772f71bcdaaa2504d9e9a469c3100593, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_idView: {fileID: 3505748630845561529}
|
||||
|
Reference in New Issue
Block a user