Skip to content

Commit

Permalink
WIP6 v0.604
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonexo3 committed Aug 3, 2018
1 parent c745cd6 commit 2959bcf
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 62 deletions.
106 changes: 53 additions & 53 deletions Assets/MapEditor.unity
Original file line number Diff line number Diff line change
Expand Up @@ -9820,7 +9820,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -190.01}
m_AnchoredPosition: {x: 0, y: -188.01}
m_SizeDelta: {x: 282.80005, y: 24}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &139810021
Expand Down Expand Up @@ -18643,8 +18643,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 141.40002, y: -231.06}
m_SizeDelta: {x: 282.80005, y: 302.01}
m_AnchoredPosition: {x: 141.40002, y: -182}
m_SizeDelta: {x: 282.80005, y: 354.01}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &230397650
MonoBehaviour:
Expand Down Expand Up @@ -19600,7 +19600,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -216.01}
m_AnchoredPosition: {x: 0, y: -214.01}
m_SizeDelta: {x: 282.80005, y: 24}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &247567236
Expand Down Expand Up @@ -43409,7 +43409,7 @@ Camera:
serializedVersion: 2
m_Bits: 2560
m_RenderingPath: 1
m_TargetTexture: {fileID: 1422367691}
m_TargetTexture: {fileID: 1952646852}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
Expand Down Expand Up @@ -44469,8 +44469,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 830445812}
m_HandleRect: {fileID: 830445810}
m_Direction: 2
m_Value: 0
m_Size: 1
m_Value: 1
m_Size: 0.8243036
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -52576,7 +52576,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -291.01}
m_AnchoredPosition: {x: 0, y: -315.01}
m_SizeDelta: {x: 282.80005, y: 22}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &672304486
Expand Down Expand Up @@ -64685,7 +64685,7 @@ RectTransform:
m_Father: {fileID: 2055952249}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 0.17569637}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
Expand Down Expand Up @@ -91416,7 +91416,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -56}
m_AnchoredPosition: {x: 0, y: -55}
m_SizeDelta: {x: 282.80005, y: 22}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &1168544506
Expand Down Expand Up @@ -96011,7 +96011,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -242.01004}
m_AnchoredPosition: {x: 0, y: -266.01}
m_SizeDelta: {x: 282.80005, y: 24}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &1212221947
Expand Down Expand Up @@ -101987,7 +101987,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -165.01}
m_AnchoredPosition: {x: 0, y: -163.01}
m_SizeDelta: {x: 282.80005, y: 22}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &1293125327
Expand Down Expand Up @@ -102821,7 +102821,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: View camera
m_Text: View through Camera Marker
--- !u!222 &1308546327
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -106899,7 +106899,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -83}
m_AnchoredPosition: {x: 0, y: -341.01}
m_SizeDelta: {x: 282.80005, y: 26}
m_Pivot: {x: 0, y: 0.5}
--- !u!1001 &1358671229
Expand Down Expand Up @@ -110786,7 +110786,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Create from current view
m_Text: Create from Viewport
--- !u!222 &1402853806
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -112017,37 +112017,6 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1418610925}
m_CullTransparentMesh: 0
--- !u!84 &1422367691
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 256
m_Height: 256
m_AntiAliasing: 1
m_DepthFormat: 1
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1 &1422377916
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -114482,7 +114451,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -83}
m_AnchoredPosition: {x: 0, y: -81}
m_SizeDelta: {x: 282.80005, y: 26}
m_Pivot: {x: 0, y: 0.5}
--- !u!1001 &1460699391
Expand Down Expand Up @@ -115047,7 +115016,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -267.01}
m_AnchoredPosition: {x: 0, y: -291.01}
m_SizeDelta: {x: 282.80005, y: 22}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &1463167047
Expand Down Expand Up @@ -117378,7 +117347,7 @@ MonoBehaviour:
m_Image: {fileID: 0}
- m_Text: Cybran
m_Image: {fileID: 0}
- m_Text: Seraphin
- m_Text: Seraphim
m_Image: {fileID: 0}
- m_Text: Others
m_Image: {fileID: 0}
Expand Down Expand Up @@ -143436,7 +143405,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -242.01}
m_AnchoredPosition: {x: 0, y: -240.01}
m_SizeDelta: {x: 282.80005, y: 24}
m_Pivot: {x: 0, y: 0.5}
--- !u!224 &1856852672 stripped
Expand Down Expand Up @@ -150815,6 +150784,37 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1949818971}
m_CullTransparentMesh: 0
--- !u!84 &1952646852
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 256
m_Height: 256
m_AntiAliasing: 1
m_DepthFormat: 1
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1 &1955277115
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -155388,7 +155388,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -125.005}
m_AnchoredPosition: {x: 0, y: -123.005}
m_SizeDelta: {x: 282.80005, y: 54.01}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &2020632930
Expand Down Expand Up @@ -160953,7 +160953,7 @@ Prefab:
- target: {fileID: 224052174994677230, guid: bcb2fa58fbfb75647babb8e9e84a09d1,
type: 2}
propertyPath: m_AnchorMin.y
value: 0.000000059604645
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114699022864908892, guid: bcb2fa58fbfb75647babb8e9e84a09d1,
type: 2}
Expand Down Expand Up @@ -164760,7 +164760,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Aligh to the current view
m_Text: Set Camera Marker from Viewport
--- !u!222 &2146578678
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down
6 changes: 3 additions & 3 deletions Assets/Scripts/Camera/CameraControler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void CheckScreenChange()
}
}

public static void FocusCamera(Transform Pivot, float Zoom = 30)
public static void FocusCamera(Vector3 pos, Quaternion rot, float Zoom = 30)
{
float ZoomValue = Zoom - CameraMinOffset;
ZoomValue /= Current.MapSize / 7f;
Expand All @@ -110,10 +110,10 @@ public static void FocusCamera(Transform Pivot, float Zoom = 30)
Current.LastLocalCamPos = Current.transform.localPosition;
Current.TargetLocalCamPos = Current.transform.localPosition;

Current.Rot = Pivot.eulerAngles;
Current.Rot = rot.eulerAngles;
Current.Pivot.localRotation = Quaternion.Euler(Current.Rot);

Current.Pos = Pivot.position;
Current.Pos = pos;
Current.Pivot.localPosition = Current.Pos;
}

Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Ozone SCMAP Code/Lua/SaveLua_Marker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public Marker(Marker CopyMarker, string NewName = "")


position = ScmapEditor.WorldPosToScmap(CopyMarker.MarkerObj.transform.position);
orientation = UnitInstance.ScmapRotationFromRotation(CopyMarker.MarkerObj.Tr.localRotation);
orientation = Markers.MarkerObject.MarkerRotToScmapRot(CopyMarker.MarkerObj.Tr.localRotation, CopyMarker.MarkerType);
prop = "/env/common/props/markers/M_Blank_prop.bp";

MarkerType = CopyMarker.MarkerType;
Expand Down Expand Up @@ -653,7 +653,7 @@ public void SaveMarkerValues(LuaParser.Creator LuaFile)
position = ScmapEditor.WorldPosToScmap(MarkerObj.transform.position);
if (MarkerType != MarkerTypes.CameraInfo)
MarkerObj.transform.localRotation = Quaternion.identity;
orientation = UnitInstance.ScmapRotationFromRotation(MarkerObj.transform.localRotation);
orientation = Markers.MarkerObject.MarkerRotToScmapRot(MarkerObj.transform.localRotation, MarkerObj.Owner.MarkerType);
}

ForceDefaultValues();
Expand Down
37 changes: 37 additions & 0 deletions Assets/Scripts/UI/Marker/MarkerObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,42 @@ namespace Markers
public class MarkerObject : SelectionObject
{
public SaveLua.Marker Owner;


public static Quaternion ScmapRotToMarkerRot(Vector3 rot, SaveLua.Marker.MarkerTypes Type)
{
if (Type == SaveLua.Marker.MarkerTypes.CameraInfo)
{
rot = new Vector3(rot.y, -rot.x, 0) * Mathf.Rad2Deg;
Debug.Log(rot);
return Quaternion.Euler(rot);
}
else
{
return Quaternion.Euler(rot * Mathf.Rad2Deg);
}
}

public static Vector3 MarkerRotToScmapRot(Quaternion Rot, SaveLua.Marker.MarkerTypes Type)
{
if (Type == SaveLua.Marker.MarkerTypes.CameraInfo)
{
Vector3 Euler = Rot.eulerAngles;
Euler.z = 0;

while (Euler.x < 0)
Euler.x += 360;

Euler = new Vector3(-Euler.y, Euler.x, 0);
Debug.Log(Euler);
return Euler * Mathf.Deg2Rad;
}
else
{
Vector3 Euler = Rot.eulerAngles;
Euler.z = 0;
return Euler * Mathf.Deg2Rad;
}
}
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/Marker/MarkersControler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static void CreateMarker(SaveLua.Marker Owner, int mc)
NewObj.Bc.center = PropGraphic.SharedMesh.bounds.center;

NewObj.Tr.localPosition = ScmapEditor.ScmapPosToWorld(Owner.position);
NewObj.Tr.localRotation = UnitInstance.RotationFromScmapRotation(Owner.orientation);
NewObj.Tr.localRotation = MarkerObject.ScmapRotToMarkerRot(Owner.orientation, Owner.MarkerType);

NewMarker.SetActive(Current.MarkerLayersSettings.ActiveByType(Owner.MarkerType));
}
Expand Down
10 changes: 8 additions & 2 deletions Assets/Scripts/UI/Tools/Markers/MarkerSelectionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,10 @@ public void ToggleCameraSync()

public void FocusCameraMarker()
{
CameraControler.FocusCamera(SelectedGameObjects[0].transform, SelectedGameObjects[0].GetComponent<MarkerObject>().Owner.zoom * 0.1f);
Vector3 FocusPos = SelectedGameObjects[0].transform.position;
Quaternion FocusRot = Quaternion.Euler(Vector3.up * -180) * SelectedGameObjects[0].transform.rotation * Quaternion.Euler(Vector3.right * -90);

CameraControler.FocusCamera(FocusPos, FocusRot, SelectedGameObjects[0].GetComponent<MarkerObject>().Owner.zoom * 0.1f);
}

public void AlighCameraMarker()
Expand All @@ -489,9 +492,12 @@ public void AlighCameraMarker()
Undo.RegisterUndo(new UndoHistory.HistoryMarkersChange(), new UndoHistory.HistoryMarkersChange.MarkersChangeHistoryParameter(AllMarkers));

SelectedGameObjects[0].GetComponent<MarkerObject>().Tr.position = CameraControler.Current.Pivot.localPosition;
SelectedGameObjects[0].GetComponent<MarkerObject>().Tr.rotation = CameraControler.Current.Pivot.localRotation;
SelectedGameObjects[0].GetComponent<MarkerObject>().Owner.zoom = CameraControler.GetCurrentZoom();

Quaternion rot = Quaternion.Euler(Vector3.up * 180) * CameraControler.Current.Pivot.localRotation * Quaternion.Euler(Vector3.right * 90);

SelectedGameObjects[0].GetComponent<MarkerObject>().Tr.rotation = rot;

SelectionManager.Current.FinishSelectionChange();
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/Tools/Markers/NewMarkersInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void Place(Vector3[] Positions, Quaternion[] Rotations, Vector3[] Scales)

NewMarker.position = ScmapEditor.WorldPosToScmap(Positions[i]);
if (CreationId == CREATE_CAM)
NewMarker.orientation = UnitInstance.ScmapRotationFromRotation( Rotations[i]);
NewMarker.orientation = MarkerObject.MarkerRotToScmapRot( Rotations[i], MapLua.SaveLua.Marker.MarkerTypes.CameraInfo);
else
NewMarker.orientation = Vector3.zero;
MarkersControler.CreateMarker(NewMarker, mc);
Expand Down
Loading

0 comments on commit 2959bcf

Please sign in to comment.