Patch to compression tests. Transform Surrogate is not implemented

Added DragCorrector and PPIViewer utilities

--HG--
branch : develop_5.3
pull/413/head
Simon (darkside) Jackson 2016-06-03 17:36:55 +01:00
parent 841d8dbd92
commit 58b7a26f1a
6 changed files with 83 additions and 1 deletions

View File

@ -146,7 +146,6 @@ public class CompressionTests {
{
public Vector3 myPosition;
public Vector3[] myPositionHistory;
public Transform mytransform;
public string[] myChatHistory;
}

View File

@ -0,0 +1,31 @@
/// Credit FireOApache
/// sourced from: http://answers.unity3d.com/questions/1149417/ui-button-onclick-sensitivity-for-high-dpi-devices.html#answer-1197307
/*USAGE:
Simply place the script on the EventSystem in the scene to correct the drag thresholds*/
using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(EventSystem))]
[AddComponentMenu("UI/Extensions/DragCorrector")]
public class DragCorrector : MonoBehaviour
{
public int baseTH = 6;
public int basePPI = 210;
public int dragTH = 0;
void Start()
{
dragTH = baseTH * (int)Screen.dpi / basePPI;
EventSystem es = GetComponent<EventSystem>();
if (es)
{
es.pixelDragThreshold = dragTH;
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: af1c809ef037025409983d19f9b0baac
timeCreated: 1464969622
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
/// Credit FireOApache
/// sourced from: http://answers.unity3d.com/questions/1149417/ui-button-onclick-sensitivity-for-high-dpi-devices.html#answer-1197307
/*USAGE:
Simply place the script on A Text control in the scene to display the current PPI / DPI of the sceen*/
namespace UnityEngine.UI.Extensions
{
[RequireComponent(typeof(Text))]
[AddComponentMenu("UI/Extensions/PPIViewer")]
public class PPIViewer : MonoBehaviour
{
private Text label;
void Awake()
{
label = GetComponent<Text>();
}
void Start()
{
if (label != null)
{
label.text = "PPI: " + Screen.dpi.ToString();
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b0f2698294b9b524bb75cb394378eb6e
timeCreated: 1464969622
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.