-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added HitScoreVisualizer integration
- Loading branch information
1 parent
cbe9961
commit 36973a5
Showing
4 changed files
with
140 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TMPro; | ||
using UnityEngine; | ||
|
||
namespace PerfectionDisplay | ||
{ | ||
class DisplaySection : MonoBehaviour | ||
{ | ||
TextMeshPro scoreMesh; | ||
public string title; | ||
public string color; | ||
|
||
void Awake() | ||
{ | ||
scoreMesh = this.gameObject.AddComponent<TextMeshPro>(); | ||
scoreMesh.text = ""; | ||
scoreMesh.fontSize = 3; | ||
scoreMesh.lineSpacing = -25f; | ||
scoreMesh.lineSpacingAdjustment = -25f; | ||
scoreMesh.enableAutoSizing = false; | ||
scoreMesh.paragraphSpacing = -25f; | ||
scoreMesh.color = Color.white; | ||
scoreMesh.font = Resources.Load<TMP_FontAsset>("Teko-Medium SDF No Glow"); | ||
scoreMesh.alignment = TextAlignmentOptions.Center; | ||
} | ||
public void UpdateText(int score, string percent) | ||
{ | ||
string text = "<color=" + color + ">" + title+"\n"; | ||
if (PerfectDisplay.showNumbers) text += score + "\n"; | ||
if (PerfectDisplay.showPercent) text += percent + "%\n"; | ||
scoreMesh.text = text; | ||
scoreMesh.ForceMeshUpdate(); | ||
} | ||
public void UpdatePosition(float x) | ||
{ | ||
transform.localPosition = PerfectDisplay.displayPosition+new Vector3(x,0,0); | ||
} | ||
|
||
public float GetWidth() | ||
{ | ||
return scoreMesh.GetRenderedValues().x+0.1f; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters