Skip to content

Commit

Permalink
feat: Content View removed from Page class
Browse files Browse the repository at this point in the history
Model is now called ViewModel
  • Loading branch information
Vatsal Ambastha committed May 28, 2020
1 parent 9754ab8 commit a0328ab
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions Assets/Adrenak.UPF/Runtime/$Core/BindableBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public NotifyPropertyChangedInvocatorAttribute(string parameterName) {
public string ParameterName { get; private set; }
}

[Serializable]
public class Bindable : INotifyPropertyChanged, INotifyPropertyChanging {
readonly ConcurrentDictionary<string, object> _properties = new ConcurrentDictionary<string, object>();

Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/$Core/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

namespace Adrenak.UPF {
[Serializable]
public abstract class Model : Bindable { }
public abstract class ViewModel : Bindable { }
}
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/$Core/ModelGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections.Specialized;

namespace Adrenak.UPF {
public class ModelGroup<T> where T : Model {
public class ModelGroup<T> where T : ViewModel {
public ObservableCollection<T> Models { get; } = new ObservableCollection<T>();
public Action<T>[] Subscriber { get; set; }
public Action<T>[] Unsubscriber { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/$Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Adrenak.UPF {
[Serializable]
public abstract class View<T> : View where T : Model {
public abstract class View<T> : View where T : ViewModel {
[SerializeField] bool refreshOnStart;

[SerializeField] T _model;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Adrenak.UPF {
[Serializable]
public class ViewGroup<TModel, TView> where TModel : Model where TView : View<TModel> {
public class ViewGroup<TModel, TView> where TModel : ViewModel where TView : View<TModel> {
public Transform Container { get; private set; }
public TView ViewTemplate { get; private set; }
public ModelGroup<TModel> ModelGroup { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;

namespace Adrenak.UPF {
public class ViewGroupBehaviour<TModel, TView> : MonoBehaviour where TModel : Model where TView : View<TModel> {
public class ViewGroupObject<TModel, TView> : MonoBehaviour where TModel : ViewModel where TView : View<TModel> {
public ViewGroup<TModel, TView> InnerViewGroup { get; private set; }

[SerializeField] Transform container;
Expand Down
3 changes: 0 additions & 3 deletions Assets/Adrenak.UPF/Runtime/Pages/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public class Page : BindableBehaviour {

[ReadOnly] [SerializeField] bool isOpen;
public bool IsOpen => isOpen;

[SerializeField] protected View content;
public View Content => content;
#pragma warning restore 0649

void Start() {
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/Pages/PageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Adrenak.UPF.Examples.Unigram {
[System.Serializable]
public class PageModel : Model {
public class PageModel : ViewModel {
[SerializeField] string title = string.Empty;
public string Title {
get => title;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/Views/FormModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Adrenak.UPF {
[Serializable]
public abstract class FormModel : Model {
public abstract class FormModel : ViewModel {
public event EventHandler OnSubmitForm;
public event EventHandler OnCancelForm;

Expand Down
2 changes: 1 addition & 1 deletion Assets/Adrenak.UPF/Runtime/Views/ThumbView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using UnityEngine.UI;

namespace Adrenak.UPF {
public class ThumbView : View<ThumbModel> {
public class ThumbView : View<ThumbViewModel> {
#pragma warning disable 0649
[SerializeField] Text text;
[SerializeField] Image image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Adrenak.UPF {
[Serializable]
public class ThumbModel : Model {
public class ThumbViewModel : ViewModel {
public event EventHandler OnClick;
public void Click() {
OnClick?.Invoke(this, null);
Expand Down

0 comments on commit a0328ab

Please sign in to comment.