Skip to content

Commit

Permalink
feat: Create ViewGroupBehaviour component
Browse files Browse the repository at this point in the history
  • Loading branch information
Vatsal Ambastha committed May 27, 2020
1 parent 8508d90 commit 111c9c2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using UnityEngine;
using System;
using UnityEngine;
using System.Collections.Generic;
using System.Collections.Specialized;
using Object = UnityEngine.Object;

namespace Adrenak.UPF {
[Serializable]
public class ViewGroup<TModel, TView> where TModel : Model where TView : View<TModel> {
public Transform Container { get; private set; }
public TView ViewTemplate { get; private set; }
Expand Down
16 changes: 16 additions & 0 deletions Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections.Generic;

namespace Adrenak.UPF {
public class ViewGroupBehaviour<TModel, TView> : MonoBehaviour where TModel : Model where TView : View<TModel> {
[SerializeField] ViewGroup<TModel, TView> group;
public ViewGroup<TModel, TView> Group => group;

[SerializeField] List<TModel> initialModels;

void Start() {
group.ModelGroup.Models.Clear();
group.ModelGroup.Models.AddRange(initialModels);
}
}
}
11 changes: 11 additions & 0 deletions Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 111c9c2

Please sign in to comment.