Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Down-tuned pinch gesture to account for better tracking, feels better!
- Loading branch information
Nicholas Benson
committed
Feb 28, 2018
1 parent
2e6c8fc
commit 1bec2a3
Showing
16 changed files
with
1,680 additions
and
3,088 deletions.
There are no files selected for viewing
File renamed without changes.
68 changes: 68 additions & 0 deletions
68
Assets/AppModules/AssetTools/LemurUI/Drivers/LabelTextMeshDriver.cs
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,68 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using Leap.Unity.Animation; | ||
using System; | ||
|
||
namespace Leap.Unity.LemurUI { | ||
|
||
public class LabelTextMeshDriver : LabelDriver<TextMesh> { | ||
|
||
public Label label; | ||
public TextMesh textMesh; | ||
|
||
public LabelTextMeshDriver() { | ||
textMesh = driven.gameObject.GetComponent<TextMesh>(); | ||
|
||
Updater.instance.OnUpdate += onUpdate; | ||
} | ||
|
||
public override void Bind(Label label) { | ||
this.label = label; | ||
} | ||
|
||
private void onUpdate() { | ||
if (label == null) return; | ||
if (textMesh == null) return; | ||
|
||
textMesh.transform.localScale = Vector3.one * 0.01f; | ||
|
||
// UnwrapDo: Applies the label color style to the text mesh if it has one. | ||
label.textStyle.color.UnwrapDo( | ||
addArg1: textMesh, | ||
doIfValue: (color, textMesh) => { textMesh.color = color; } | ||
); | ||
|
||
textMesh.text = label.text; | ||
} | ||
|
||
} | ||
|
||
public static class NullableExtensions { | ||
|
||
/// <summary> | ||
/// TODO: Move to TodoUMWard and add more argument counts | ||
/// </summary> | ||
public static void UnwrapDo<UnwrapType, Arg1Type>( | ||
this UnwrapType? unwrappedArg0, | ||
Arg1Type addArg1, | ||
Action<UnwrapType, Arg1Type> doIfValue) | ||
where UnwrapType : struct { | ||
if (unwrappedArg0.HasValue) { | ||
doIfValue(unwrappedArg0.Value, addArg1); | ||
} | ||
} | ||
public static void UnwrapDo<UnwrapType, Arg1Type, | ||
Arg2Type>( | ||
this UnwrapType? unwrappedArg0, | ||
Arg1Type addArg1, | ||
Arg2Type addArg2, | ||
Action<UnwrapType, Arg1Type, Arg2Type> doIfValue) | ||
where UnwrapType : struct { | ||
if (unwrappedArg0.HasValue) { | ||
doIfValue(unwrappedArg0.Value, addArg1, addArg2); | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
File renamed without changes.
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
File renamed without changes.
31 changes: 0 additions & 31 deletions
31
Assets/AppModules/AssetTools/LemurUI/Labels/LabelTextMeshDriver.cs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.