搭建pause和结算的UI界面,未装功能
重置gameplay的界面。
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class Benchmark01 : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -54,13 +54,13 @@ namespace TMPro.Examples
|
||||
//m_textMeshPro.fontSharedMaterial.SetFloat("_OutlineWidth", 0.2f);
|
||||
//m_textMeshPro.fontSharedMaterial.EnableKeyword("UNDERLAY_ON");
|
||||
//m_textMeshPro.lineJustification = LineJustificationTypes.Center;
|
||||
m_textMeshPro.enableWordWrapping = false;
|
||||
//m_textMeshPro.lineLength = 60;
|
||||
m_textMeshPro.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
//m_textMeshPro.lineLength = 60;
|
||||
//m_textMeshPro.characterSpacing = 0.2f;
|
||||
//m_textMeshPro.fontColor = new Color32(255, 255, 255, 255);
|
||||
|
||||
m_material01 = m_textMeshPro.font.material;
|
||||
m_material02 = Resources.Load<Material>("Fonts & Materials/LiberationSans SDF - Drop Shadow"); // Make sure the LiberationSans SDF exists before calling this...
|
||||
m_material02 = Resources.Load<Material>("Fonts & Materials/LiberationSans SDF - Drop Shadow"); // Make sure the LiberationSans SDF exists before calling this...
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace TMPro.Examples
|
||||
|
||||
textMeshPro.alignment = TextAlignmentOptions.Bottom;
|
||||
textMeshPro.fontSize = 96;
|
||||
textMeshPro.enableKerning = false;
|
||||
textMeshPro.fontFeatures.Clear();
|
||||
|
||||
textMeshPro.color = new Color32(255, 255, 0, 255);
|
||||
textMeshPro.text = "!";
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class Benchmark04 : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace TMPro.Examples
|
||||
//textMeshPro.anchor = AnchorPositions.Left;
|
||||
textMeshPro.rectTransform.pivot = new Vector2(0, 0.5f);
|
||||
|
||||
textMeshPro.enableWordWrapping = false;
|
||||
textMeshPro.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
textMeshPro.extraPadding = true;
|
||||
textMeshPro.isOrthographic = true;
|
||||
textMeshPro.fontSize = i;
|
||||
@@ -65,7 +65,7 @@ namespace TMPro.Examples
|
||||
//if (lineHeight > orthoSize * 2 * 0.9f) return;
|
||||
|
||||
go.transform.position = m_Transform.position + new Vector3(ratio * -orthoSize * 0.975f, orthoSize * 0.975f - lineHeight, 1);
|
||||
|
||||
|
||||
TextMesh textMesh = go.AddComponent<TextMesh>();
|
||||
textMesh.font = Resources.Load("Fonts/ARIAL", typeof(Font)) as Font;
|
||||
textMesh.renderer.sharedMaterial = textMesh.font.material;
|
||||
|
||||
@@ -4,12 +4,15 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class ObjectSpin : MonoBehaviour
|
||||
{
|
||||
#pragma warning disable 0414
|
||||
public enum MotionType { Rotation, SearchLight, Translation };
|
||||
public MotionType Motion;
|
||||
|
||||
#pragma warning disable 0414
|
||||
|
||||
public Vector3 TranslationDistance = new Vector3(5, 0, 0);
|
||||
public float TranslationSpeed = 1.0f;
|
||||
public float SpinSpeed = 5;
|
||||
public int RotationRange = 15;
|
||||
private Transform m_transform;
|
||||
@@ -19,10 +22,6 @@ namespace TMPro.Examples
|
||||
private Vector3 m_initial_Rotation;
|
||||
private Vector3 m_initial_Position;
|
||||
private Color32 m_lightColor;
|
||||
private int frames = 0;
|
||||
|
||||
public enum MotionType { Rotation, BackAndForth, Translation };
|
||||
public MotionType Motion;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -38,31 +37,30 @@ namespace TMPro.Examples
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Motion == MotionType.Rotation)
|
||||
switch (Motion)
|
||||
{
|
||||
m_transform.Rotate(0, SpinSpeed * Time.deltaTime, 0);
|
||||
}
|
||||
else if (Motion == MotionType.BackAndForth)
|
||||
{
|
||||
m_time += SpinSpeed * Time.deltaTime;
|
||||
m_transform.rotation = Quaternion.Euler(m_initial_Rotation.x, Mathf.Sin(m_time) * RotationRange + m_initial_Rotation.y, m_initial_Rotation.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_time += SpinSpeed * Time.deltaTime;
|
||||
case MotionType.Rotation:
|
||||
m_transform.Rotate(0, SpinSpeed * Time.deltaTime, 0);
|
||||
break;
|
||||
case MotionType.SearchLight:
|
||||
m_time += SpinSpeed * Time.deltaTime;
|
||||
m_transform.rotation = Quaternion.Euler(m_initial_Rotation.x, Mathf.Sin(m_time) * RotationRange + m_initial_Rotation.y, m_initial_Rotation.z);
|
||||
break;
|
||||
case MotionType.Translation:
|
||||
m_time += TranslationSpeed * Time.deltaTime;
|
||||
|
||||
float x = 15 * Mathf.Cos(m_time * .95f);
|
||||
float y = 10; // *Mathf.Sin(m_time * 1f) * Mathf.Cos(m_time * 1f);
|
||||
float z = 0f; // *Mathf.Sin(m_time * .9f);
|
||||
float x = TranslationDistance.x * Mathf.Cos(m_time);
|
||||
float y = TranslationDistance.y * Mathf.Sin(m_time) * Mathf.Cos(m_time * 1f);
|
||||
float z = TranslationDistance.z * Mathf.Sin(m_time);
|
||||
|
||||
m_transform.position = m_initial_Position + new Vector3(x, z, y);
|
||||
m_transform.position = m_initial_Position + new Vector3(x, z, y);
|
||||
|
||||
// Drawing light patterns because they can be cool looking.
|
||||
//if (frames > 2)
|
||||
// Debug.DrawLine(m_transform.position, m_prevPOS, m_lightColor, 100f);
|
||||
// Drawing light patterns because they can be cool looking.
|
||||
//if (Time.frameCount > 1)
|
||||
// Debug.DrawLine(m_transform.position, m_prevPOS, m_lightColor, 100f);
|
||||
|
||||
m_prevPOS = m_transform.position;
|
||||
frames += 1;
|
||||
m_prevPOS = m_transform.position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class SimpleScript : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace TMPro.Examples
|
||||
// Assign Material to TextMesh Pro Component
|
||||
//m_textMeshPro.fontSharedMaterial = Resources.Load("Fonts & Materials/LiberationSans SDF - Bevel", typeof(Material)) as Material;
|
||||
//m_textMeshPro.fontSharedMaterial.EnableKeyword("BEVEL_ON");
|
||||
|
||||
|
||||
// Set various font settings.
|
||||
m_textMeshPro.fontSize = 48;
|
||||
|
||||
m_textMeshPro.alignment = TextAlignmentOptions.Center;
|
||||
|
||||
|
||||
//m_textMeshPro.anchorDampening = true; // Has been deprecated but under consideration for re-implementation.
|
||||
//m_textMeshPro.enableAutoSizing = true;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TMPro.Examples
|
||||
//m_textMeshPro.wordSpacing = 0.1f;
|
||||
|
||||
//m_textMeshPro.enableCulling = true;
|
||||
m_textMeshPro.enableWordWrapping = false;
|
||||
m_textMeshPro.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
|
||||
//textMeshPro.fontColor = new Color32(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class TMP_FrameRateCounter : MonoBehaviour
|
||||
{
|
||||
public float UpdateInterval = 5.0f;
|
||||
@@ -43,7 +43,7 @@ namespace TMPro.Examples
|
||||
m_frameCounter_transform.SetParent(m_camera.transform);
|
||||
m_frameCounter_transform.localRotation = Quaternion.identity;
|
||||
|
||||
m_TextMeshPro.enableWordWrapping = false;
|
||||
m_TextMeshPro.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
m_TextMeshPro.fontSize = 24;
|
||||
//m_TextMeshPro.FontColor = new Color32(255, 255, 255, 128);
|
||||
//m_TextMeshPro.edgeWidth = .15f;
|
||||
|
||||
@@ -124,6 +124,15 @@ namespace TMPro
|
||||
{
|
||||
if (TMP_TextUtilities.IsIntersectingRectTransform(m_TextComponent.rectTransform, Input.mousePosition, m_Camera))
|
||||
{
|
||||
#region Nearest Character
|
||||
/*int charIndex = TMP_TextUtilities.FindNearestCharacterOnLine(m_TextComponent, Input.mousePosition, 0, m_Camera, false);
|
||||
if (charIndex != -1 && charIndex != m_lastCharIndex)
|
||||
{
|
||||
m_lastCharIndex = charIndex;
|
||||
}*/
|
||||
#endregion
|
||||
|
||||
|
||||
#region Example of Character or Sprite Selection
|
||||
int charIndex = TMP_TextUtilities.FindIntersectingCharacter(m_TextComponent, Input.mousePosition, m_Camera, true);
|
||||
if (charIndex != -1 && charIndex != m_lastCharIndex)
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace TMPro.Examples
|
||||
// We do this to make sure this character is rendered last and over other characters.
|
||||
meshInfo.SwapVertexData(vertexIndex, lastVertexIndex);
|
||||
|
||||
// Need to update the appropriate
|
||||
// Need to update the appropriate
|
||||
m_TextMeshPro.UpdateVertexData(TMP_VertexDataUpdateFlags.All);
|
||||
}
|
||||
#endregion
|
||||
@@ -286,7 +286,7 @@ namespace TMPro.Examples
|
||||
m_lastIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -491,8 +491,8 @@ namespace TMPro.Examples
|
||||
|
||||
// Restore UV0S
|
||||
// UVS0
|
||||
Vector2[] src_uv0s = m_cachedMeshInfoVertexData[materialIndex].uvs0;
|
||||
Vector2[] dst_uv0s = m_TextMeshPro.textInfo.meshInfo[materialIndex].uvs0;
|
||||
Vector4[] src_uv0s = m_cachedMeshInfoVertexData[materialIndex].uvs0;
|
||||
Vector4[] dst_uv0s = m_TextMeshPro.textInfo.meshInfo[materialIndex].uvs0;
|
||||
dst_uv0s[vertexIndex + 0] = src_uv0s[vertexIndex + 0];
|
||||
dst_uv0s[vertexIndex + 1] = src_uv0s[vertexIndex + 1];
|
||||
dst_uv0s[vertexIndex + 2] = src_uv0s[vertexIndex + 2];
|
||||
@@ -540,7 +540,7 @@ namespace TMPro.Examples
|
||||
dst_uv2s[lastIndex + 2] = src_uv2s[lastIndex + 2];
|
||||
dst_uv2s[lastIndex + 3] = src_uv2s[lastIndex + 3];
|
||||
|
||||
// Need to update the appropriate
|
||||
// Need to update the appropriate
|
||||
m_TextMeshPro.UpdateVertexData(TMP_VertexDataUpdateFlags.All);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class TMP_UiFrameRateCounter : MonoBehaviour
|
||||
{
|
||||
public float UpdateInterval = 5.0f;
|
||||
@@ -39,7 +39,7 @@ namespace TMPro.Examples
|
||||
m_TextMeshPro.font = Resources.Load<TMP_FontAsset>("Fonts & Materials/LiberationSans SDF");
|
||||
m_TextMeshPro.fontSharedMaterial = Resources.Load<Material>("Fonts & Materials/LiberationSans SDF - Overlay");
|
||||
|
||||
m_TextMeshPro.enableWordWrapping = false;
|
||||
m_TextMeshPro.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
m_TextMeshPro.fontSize = 36;
|
||||
|
||||
m_TextMeshPro.isOverlay = true;
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections;
|
||||
|
||||
namespace TMPro.Examples
|
||||
{
|
||||
|
||||
|
||||
public class TeleType : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace TMPro.Examples
|
||||
// Get Reference to TextMeshPro Component
|
||||
m_textMeshPro = GetComponent<TMP_Text>();
|
||||
m_textMeshPro.text = label01;
|
||||
m_textMeshPro.enableWordWrapping = true;
|
||||
m_textMeshPro.textWrappingMode = TextWrappingModes.Normal;
|
||||
m_textMeshPro.alignment = TextAlignmentOptions.Top;
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace TMPro.Examples
|
||||
m_textMeshPro.fontSize = 24;
|
||||
//m_textMeshPro.enableExtraPadding = true;
|
||||
//m_textMeshPro.enableShadows = false;
|
||||
m_textMeshPro.enableKerning = false;
|
||||
m_textMeshPro.fontFeatures.Clear();
|
||||
m_textMeshPro.text = string.Empty;
|
||||
m_textMeshPro.isTextObjectScaleStatic = IsTextObjectScaleStatic;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace TMPro.Examples
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Allocate new vertices
|
||||
// Allocate new vertices
|
||||
if (hasTextChanged)
|
||||
{
|
||||
// Get updated vertex data
|
||||
@@ -130,7 +130,7 @@ namespace TMPro.Examples
|
||||
|
||||
// Determine the random scale change for each character.
|
||||
float randomScale = Random.Range(1f, 1.5f);
|
||||
|
||||
|
||||
// Add modified scale and index
|
||||
modifiedCharScale.Add(randomScale);
|
||||
scaleSortingOrder.Add(modifiedCharScale.Count - 1);
|
||||
@@ -150,8 +150,8 @@ namespace TMPro.Examples
|
||||
destinationVertices[vertexIndex + 3] += offset;
|
||||
|
||||
// Restore Source UVS which have been modified by the sorting
|
||||
Vector2[] sourceUVs0 = cachedMeshInfoVertexData[materialIndex].uvs0;
|
||||
Vector2[] destinationUVs0 = textInfo.meshInfo[materialIndex].uvs0;
|
||||
Vector4[] sourceUVs0 = cachedMeshInfoVertexData[materialIndex].uvs0;
|
||||
Vector4[] destinationUVs0 = textInfo.meshInfo[materialIndex].uvs0;
|
||||
|
||||
destinationUVs0[vertexIndex + 0] = sourceUVs0[vertexIndex + 0];
|
||||
destinationUVs0[vertexIndex + 1] = sourceUVs0[vertexIndex + 1];
|
||||
@@ -178,7 +178,7 @@ namespace TMPro.Examples
|
||||
|
||||
// Updated modified vertex attributes
|
||||
textInfo.meshInfo[i].mesh.vertices = textInfo.meshInfo[i].vertices;
|
||||
textInfo.meshInfo[i].mesh.uv = textInfo.meshInfo[i].uvs0;
|
||||
textInfo.meshInfo[i].mesh.SetUVs(0, textInfo.meshInfo[i].uvs0);
|
||||
textInfo.meshInfo[i].mesh.colors32 = textInfo.meshInfo[i].colors32;
|
||||
|
||||
m_TextComponent.UpdateGeometry(textInfo.meshInfo[i].mesh, i);
|
||||
|
||||
Reference in New Issue
Block a user