색 적용
This commit is contained in:
@@ -716,7 +716,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!223 &978445652
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1165,11 +1165,11 @@ RectTransform:
|
||||
- {fileID: 1623115969}
|
||||
m_Father: {fileID: 978445653}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 578, y: 400}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -180, y: -40}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!1 &1483225868
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1440,11 +1440,11 @@ RectTransform:
|
||||
- {fileID: 1899526669}
|
||||
m_Father: {fileID: 978445653}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 709, y: 400}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -40, y: -40}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!1 &1623115968
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1963,11 +1963,11 @@ RectTransform:
|
||||
- {fileID: 1172632111}
|
||||
m_Father: {fileID: 978445653}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 447, y: 400}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -320, y: -40}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -25,6 +25,7 @@ public abstract class MeasureGroup : MonoBehaviour
|
||||
protected List<Vector3> points = new List<Vector3>();
|
||||
|
||||
public virtual void Init(
|
||||
LineRenderer line,
|
||||
GameObject labelPrefab,
|
||||
GameObject deleteButtonPrefab,
|
||||
GameObject lineinfoPopupPrefab,
|
||||
@@ -35,6 +36,7 @@ public abstract class MeasureGroup : MonoBehaviour
|
||||
float lineWidth,
|
||||
Material lineMaterial)
|
||||
{
|
||||
this.line = line;
|
||||
this.labelPrefab = labelPrefab;
|
||||
this.deleteButtonPrefab = deleteButtonPrefab;
|
||||
this.lineInfoPopupPrefab = lineinfoPopupPrefab;
|
||||
@@ -44,13 +46,6 @@ public abstract class MeasureGroup : MonoBehaviour
|
||||
this.lineScaleMultiplier = lineScaleMultiplier;
|
||||
this.lineWidth = lineWidth;
|
||||
|
||||
|
||||
line = gameObject.AddComponent<LineRenderer>();
|
||||
line.material = lineMaterial;
|
||||
line.widthMultiplier = lineWidth;
|
||||
line.positionCount = 0;
|
||||
line.useWorldSpace = true;
|
||||
|
||||
cesiumGeoreference = FindAnyObjectByType<CesiumGeoreference>();
|
||||
cam = Camera.main;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public enum MeasureMode
|
||||
{
|
||||
None,
|
||||
Line,
|
||||
Rectangle,
|
||||
Polygon
|
||||
@@ -31,7 +33,7 @@ public class MeasureManager : MonoBehaviour
|
||||
private float lineWidth = 0.02f;
|
||||
public bool isMeasuring = false;
|
||||
|
||||
public MeasureMode currentMeasureMode = MeasureMode.Line;
|
||||
public MeasureMode currentMeasureMode = MeasureMode.None;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -40,7 +42,6 @@ public class MeasureManager : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if (Input.GetMouseButtonDown(0) && TryGetClickPosition(out Vector3 hitPos))
|
||||
{
|
||||
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
|
||||
@@ -83,21 +84,34 @@ public class MeasureManager : MonoBehaviour
|
||||
private void CreateMeasureGroup()
|
||||
{
|
||||
MeasureGroup group = null;
|
||||
Debug.Log("currentMeasureMode " + currentMeasureMode);
|
||||
Color color = Color.white;
|
||||
|
||||
switch (currentMeasureMode)
|
||||
{
|
||||
case MeasureMode.Line:
|
||||
group = new GameObject("LineMeasureGroup").AddComponent<LineMeasureGroup>();
|
||||
color = Color.white;
|
||||
break;
|
||||
case MeasureMode.Rectangle:
|
||||
group = new GameObject("RectangleMeasureGroup").AddComponent<RectangleMeasureGroup>();
|
||||
color = Color.red;
|
||||
break;
|
||||
case MeasureMode.Polygon:
|
||||
group = new GameObject("PolygonMeasureGroup").AddComponent<PolygonMeasureGroup>();
|
||||
color = Color.yellow;
|
||||
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(
|
||||
line,
|
||||
distanceLabelPrefab,
|
||||
deleteButtonPrefab,
|
||||
lineInfoPrefab,
|
||||
|
||||
@@ -52,20 +52,9 @@ public class RectangleMeasureGroup : MeasureGroup
|
||||
|
||||
private void AddThirdPoint(Vector3 pos)
|
||||
{
|
||||
Vector3 a = points[0];
|
||||
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 = Instantiate(deleteButtonPrefab, points[0], Quaternion.identity, infoPopupRoot);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ public class ModeChangeUI : MonoBehaviour
|
||||
|
||||
Toggle_Line.onValueChanged.AddListener(OnClickLine);
|
||||
Toggle_Rect.onValueChanged.AddListener(OnClickRect);
|
||||
Toggle_Poly.onValueChanged.AddListener(OnClickPoly);
|
||||
Toggle_Poly.onValueChanged.AddListener(OnClickPoly);
|
||||
|
||||
Toggle_Line.isOn = true;
|
||||
}
|
||||
|
||||
public void OnClickLine(bool isOn)
|
||||
|
||||
Reference in New Issue
Block a user