From 111c9c2f7a5bc0413ce0a57c506ffb06c0d04369 Mon Sep 17 00:00:00 2001 From: Vatsal Ambastha Date: Thu, 28 May 2020 00:38:58 +0530 Subject: [PATCH] feat: Create ViewGroupBehaviour component --- Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs | 5 ++++- .../Runtime/$Core/ViewGroupBehaviour.cs | 16 ++++++++++++++++ .../Runtime/$Core/ViewGroupBehaviour.cs.meta | 11 +++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs create mode 100644 Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs.meta diff --git a/Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs index f3f25a9..ac5887e 100644 --- a/Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs +++ b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroup.cs @@ -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 where TModel : Model where TView : View { public Transform Container { get; private set; } public TView ViewTemplate { get; private set; } diff --git a/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs new file mode 100644 index 0000000..a67411b --- /dev/null +++ b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs @@ -0,0 +1,16 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace Adrenak.UPF { + public class ViewGroupBehaviour : MonoBehaviour where TModel : Model where TView : View { + [SerializeField] ViewGroup group; + public ViewGroup Group => group; + + [SerializeField] List initialModels; + + void Start() { + group.ModelGroup.Models.Clear(); + group.ModelGroup.Models.AddRange(initialModels); + } + } +} diff --git a/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs.meta b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs.meta new file mode 100644 index 0000000..5fce1a1 --- /dev/null +++ b/Assets/Adrenak.UPF/Runtime/$Core/ViewGroupBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 978386c573b46c0498825cf42d0e8203 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: