Removed NetworkTransformPreview because no one uses it and it had random errors (#60)

This commit is contained in:
vis2k 2018-10-13 14:11:21 +02:00
parent a2796c98c6
commit 3e751b3da5
2 changed files with 0 additions and 81 deletions

View File

@ -62,7 +62,6 @@
<Compile Include="NetworkManagerPreview.cs" />
<Compile Include="NetworkTransformChildEditor.cs" />
<Compile Include="NetworkTransformEditor.cs" />
<Compile Include="NetworkTransformPreview.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NetworkManagerHUDEditor.cs" />
<Compile Include="NetworkBehaviourInspector.cs" />

View File

@ -1,80 +0,0 @@
using System;
using UnityEditor;
using UnityEngine;
using UnityObject = UnityEngine.Object;
namespace Mirror
{
[CustomPreview(typeof(GameObject))]
class NetworkTransformPreview : ObjectPreview
{
NetworkTransform m_Transform;
Rigidbody m_Rigidbody3D;
Rigidbody2D m_Rigidbody2D;
GUIContent m_Title;
public override void Initialize(UnityObject[] targets)
{
base.Initialize(targets);
GetNetworkInformation(target as GameObject);
}
public override GUIContent GetPreviewTitle()
{
m_Title = m_Title ?? new GUIContent("Network Transform");
return m_Title;
}
public override bool HasPreviewGUI()
{
return m_Transform != null;
}
public override void OnPreviewGUI(Rect r, GUIStyle background)
{
if (Event.current.type != EventType.Repaint)
return;
if (m_Transform == null)
return;
const int padding = 4;
int posY = 4;
float posDiff = (m_Transform.transform.position - m_Transform.targetSyncPosition).magnitude;
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Position: " + m_Transform.transform.position + " Target: " + m_Transform.targetSyncPosition + " Diff: " + posDiff);
posY += 20;
if (m_Rigidbody3D != null)
{
float angleDiff3D = Quaternion.Angle(m_Transform.rigidbody3D.rotation, m_Transform.targetSyncRotation3D);
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Angle: " + m_Transform.rigidbody3D.rotation + " Target: " + m_Transform.targetSyncRotation3D + " Diff: " + angleDiff3D);
posY += 20;
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Velocity: " + m_Transform.rigidbody3D.velocity + " Target: " + m_Transform.targetSyncVelocity);
posY += 20;
}
if (m_Rigidbody2D != null)
{
float angleDiff2D = m_Transform.rigidbody2D.rotation - m_Transform.targetSyncRotation2D;
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Angle: " + m_Transform.rigidbody2D.rotation + " Target: " + m_Transform.targetSyncRotation2D + " Diff: " + angleDiff2D);
posY += 20;
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 600, 20), "Velocity: " + m_Transform.rigidbody2D.velocity + " Target: " + m_Transform.targetSyncVelocity);
posY += 20;
}
GUI.Label(new Rect(r.xMin + padding, r.y + posY, 200, 20), "Last SyncTime: " + (Time.time - m_Transform.lastSyncTime));
}
void GetNetworkInformation(GameObject gameObject)
{
m_Transform = gameObject.GetComponent<NetworkTransform>();
m_Rigidbody3D = gameObject.GetComponent<Rigidbody>();
m_Rigidbody2D = gameObject.GetComponent<Rigidbody2D>();
}
}
}