-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
68 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using CountersPlus.Counters; | ||
using TMPro; | ||
using UnityEngine; | ||
|
||
namespace CountersPlus.Custom | ||
{ | ||
public abstract class CustomCounterTemplate : Counter<CustomConfigModel> | ||
{ | ||
public abstract string DisplayName { get; } | ||
public abstract string FormattedText { get; } | ||
|
||
private TMP_Text label; | ||
private TMP_Text counter; | ||
|
||
internal override void Init(CountersData data) | ||
{ | ||
Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance); | ||
|
||
TextHelper.CreateText(out counter, position - new Vector3(0, 0.4f, 0)); | ||
counter.text = "Data"; | ||
counter.fontSize = 4; | ||
counter.color = Color.white; | ||
counter.alignment = TextAlignmentOptions.Center; | ||
|
||
TextHelper.CreateText(out label, position); | ||
label.text = $"{settings.CustomCounter.Name}"; | ||
label.fontSize = 3; | ||
label.color = Color.white; | ||
label.alignment = TextAlignmentOptions.Center; | ||
|
||
RefreshCounter(); | ||
} | ||
|
||
public void RefreshCounter() | ||
{ | ||
label.text = DisplayName; | ||
counter.text = FormattedText; | ||
} | ||
} | ||
} |
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
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