-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using AsyncReactAwait.Bindable; | ||
using UnityMVVM.ViewModelCore; | ||
|
||
namespace CCG.MVVM.MainScreen.Subviews.TextView | ||
{ | ||
public interface ITextViewModel : IViewModel | ||
{ | ||
IBindable<string> Text { get; } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using TMPro; | ||
using UnityEngine; | ||
using UnityMVVM; | ||
|
||
namespace CCG.MVVM.MainScreen.Subviews.TextView | ||
{ | ||
public class TextView : ViewBehaviour<ITextViewModel> | ||
{ | ||
|
||
[SerializeField] | ||
protected TMP_Text _text; | ||
|
||
protected override void OnViewModelSet() | ||
{ | ||
base.OnViewModelSet(); | ||
SmartBind(ViewModel!.Text, x => _text.text = x); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AsyncReactAwait.Bindable; | ||
|
||
namespace CCG.MVVM.MainScreen.Subviews.TextView | ||
{ | ||
public class TextViewModel : UnityMVVM.ViewModelCore.ViewModel, ITextViewModel | ||
{ | ||
|
||
private readonly Mutable<string> _text = new(); | ||
|
||
public IBindable<string> Text => _text; | ||
|
||
public TextViewModel(TextViewPayload payload) | ||
{ | ||
_text.Value = payload.text; | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using UnityMVVM.ViewModelCore; | ||
|
||
namespace CCG.MVVM.MainScreen.Subviews.TextView | ||
{ | ||
public struct TextViewPayload : IPayload | ||
{ | ||
public readonly string text; | ||
|
||
public TextViewPayload(string text) | ||
{ | ||
this.text = text; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.