색 적용

This commit is contained in:
geondo55
2025-09-15 21:54:32 +09:00
parent 5177788c18
commit 782174b3a3
5 changed files with 37 additions and 37 deletions

View File

@@ -716,7 +716,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96 m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96 m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1 m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1 m_PresetInfoIsWorld: 0
--- !u!223 &978445652 --- !u!223 &978445652
Canvas: Canvas:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1165,11 +1165,11 @@ RectTransform:
- {fileID: 1623115969} - {fileID: 1623115969}
m_Father: {fileID: 978445653} m_Father: {fileID: 978445653}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 578, y: 400} m_AnchoredPosition: {x: -180, y: -40}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 1, y: 1}
--- !u!1 &1483225868 --- !u!1 &1483225868
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1440,11 +1440,11 @@ RectTransform:
- {fileID: 1899526669} - {fileID: 1899526669}
m_Father: {fileID: 978445653} m_Father: {fileID: 978445653}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 709, y: 400} m_AnchoredPosition: {x: -40, y: -40}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 1, y: 1}
--- !u!1 &1623115968 --- !u!1 &1623115968
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1963,11 +1963,11 @@ RectTransform:
- {fileID: 1172632111} - {fileID: 1172632111}
m_Father: {fileID: 978445653} m_Father: {fileID: 978445653}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 447, y: 400} m_AnchoredPosition: {x: -320, y: -40}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 1, y: 1}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -25,6 +25,7 @@ public abstract class MeasureGroup : MonoBehaviour
protected List<Vector3> points = new List<Vector3>(); protected List<Vector3> points = new List<Vector3>();
public virtual void Init( public virtual void Init(
LineRenderer line,
GameObject labelPrefab, GameObject labelPrefab,
GameObject deleteButtonPrefab, GameObject deleteButtonPrefab,
GameObject lineinfoPopupPrefab, GameObject lineinfoPopupPrefab,
@@ -35,6 +36,7 @@ public abstract class MeasureGroup : MonoBehaviour
float lineWidth, float lineWidth,
Material lineMaterial) Material lineMaterial)
{ {
this.line = line;
this.labelPrefab = labelPrefab; this.labelPrefab = labelPrefab;
this.deleteButtonPrefab = deleteButtonPrefab; this.deleteButtonPrefab = deleteButtonPrefab;
this.lineInfoPopupPrefab = lineinfoPopupPrefab; this.lineInfoPopupPrefab = lineinfoPopupPrefab;
@@ -44,13 +46,6 @@ public abstract class MeasureGroup : MonoBehaviour
this.lineScaleMultiplier = lineScaleMultiplier; this.lineScaleMultiplier = lineScaleMultiplier;
this.lineWidth = lineWidth; this.lineWidth = lineWidth;
line = gameObject.AddComponent<LineRenderer>();
line.material = lineMaterial;
line.widthMultiplier = lineWidth;
line.positionCount = 0;
line.useWorldSpace = true;
cesiumGeoreference = FindAnyObjectByType<CesiumGeoreference>(); cesiumGeoreference = FindAnyObjectByType<CesiumGeoreference>();
cam = Camera.main; cam = Camera.main;
} }

View File

@@ -1,9 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
public enum MeasureMode public enum MeasureMode
{ {
None,
Line, Line,
Rectangle, Rectangle,
Polygon Polygon
@@ -31,7 +33,7 @@ public class MeasureManager : MonoBehaviour
private float lineWidth = 0.02f; private float lineWidth = 0.02f;
public bool isMeasuring = false; public bool isMeasuring = false;
public MeasureMode currentMeasureMode = MeasureMode.Line; public MeasureMode currentMeasureMode = MeasureMode.None;
private void Awake() private void Awake()
{ {
@@ -40,7 +42,6 @@ public class MeasureManager : MonoBehaviour
private void Update() private void Update()
{ {
if (Input.GetMouseButtonDown(0) && TryGetClickPosition(out Vector3 hitPos)) if (Input.GetMouseButtonDown(0) && TryGetClickPosition(out Vector3 hitPos))
{ {
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject()) if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
@@ -83,21 +84,34 @@ public class MeasureManager : MonoBehaviour
private void CreateMeasureGroup() private void CreateMeasureGroup()
{ {
MeasureGroup group = null; MeasureGroup group = null;
Debug.Log("currentMeasureMode " + currentMeasureMode); Color color = Color.white;
switch (currentMeasureMode) switch (currentMeasureMode)
{ {
case MeasureMode.Line: case MeasureMode.Line:
group = new GameObject("LineMeasureGroup").AddComponent<LineMeasureGroup>(); group = new GameObject("LineMeasureGroup").AddComponent<LineMeasureGroup>();
color = Color.white;
break; break;
case MeasureMode.Rectangle: case MeasureMode.Rectangle:
group = new GameObject("RectangleMeasureGroup").AddComponent<RectangleMeasureGroup>(); group = new GameObject("RectangleMeasureGroup").AddComponent<RectangleMeasureGroup>();
color = Color.red;
break; break;
case MeasureMode.Polygon: case MeasureMode.Polygon:
group = new GameObject("PolygonMeasureGroup").AddComponent<PolygonMeasureGroup>(); group = new GameObject("PolygonMeasureGroup").AddComponent<PolygonMeasureGroup>();
color = Color.yellow;
break; break;
} }
LineRenderer line = group.gameObject.AddComponent<LineRenderer>();
line.material = lineMaterial;
line.widthMultiplier = lineWidth;
line.positionCount = 0;
line.useWorldSpace = true;
line.startColor = color;
line.endColor = color;
group.Init( group.Init(
line,
distanceLabelPrefab, distanceLabelPrefab,
deleteButtonPrefab, deleteButtonPrefab,
lineInfoPrefab, lineInfoPrefab,

View File

@@ -52,20 +52,9 @@ public class RectangleMeasureGroup : MeasureGroup
private void AddThirdPoint(Vector3 pos) private void AddThirdPoint(Vector3 pos)
{ {
Vector3 a = points[0]; deleteButton = Instantiate(deleteButtonPrefab, points[0], Quaternion.identity, infoPopupRoot);
Vector3 b = points[1];
Vector3 ab = b - a;
Vector3 perp = new Vector3(-ab.z, 0, ab.x).normalized;
Vector3 ac = pos - a;
float length = Vector3.Dot(ac, perp);
Vector3 c = b + perp * length;
deleteButton = Instantiate(deleteButtonPrefab, c, Quaternion.identity, infoPopupRoot);
deleteButton.GetComponentInChildren<Button>().onClick.AddListener(() => DestroyAll()); deleteButton.GetComponentInChildren<Button>().onClick.AddListener(() => DestroyAll());
deleteButton.transform.position = c + new Vector3(-20, 0, 20); deleteButton.transform.position = points[0] + new Vector3(-20, 0, 20);
FindAnyObjectByType<MeasureManager>().isMeasuring = false; FindAnyObjectByType<MeasureManager>().isMeasuring = false;
} }

View File

@@ -16,7 +16,9 @@ public class ModeChangeUI : MonoBehaviour
Toggle_Line.onValueChanged.AddListener(OnClickLine); Toggle_Line.onValueChanged.AddListener(OnClickLine);
Toggle_Rect.onValueChanged.AddListener(OnClickRect); Toggle_Rect.onValueChanged.AddListener(OnClickRect);
Toggle_Poly.onValueChanged.AddListener(OnClickPoly); Toggle_Poly.onValueChanged.AddListener(OnClickPoly);
Toggle_Line.isOn = true;
} }
public void OnClickLine(bool isOn) public void OnClickLine(bool isOn)