using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System; public class TaskPanelController : PanelController { protected override UIBaseManager FetchUiManager() // check if need return by ref { var uiManager = GameObject.FindObjectOfType(); // uiManager.SetPanelController(gameObject); - unnecessary return uiManager; } public override void BuildPanelContent(List elements) { base.BuildPanelContent(elements); for (int i = 0; i < elements.Count; i++) { this.AddTask(elements[i]); } } public void AddTask(Task _task) { // update TaskManager main list of task //TaskManager.Instance.AddTask(_task); // add task to local panel contant GameObject newTaskBox = SetupTaskBox(_task); // Set new Slot instance ChildBoxList.Add(newTaskBox); } protected GameObject SetupTaskBox(Task _task) { if (ChildBoxTemplate == null) throw new Exception("taskbox_template is empty"); GameObject _newTaskBox = MonoBehaviour.Instantiate(ChildBoxTemplate, _panelContent.transform.position, Quaternion.identity); //.GetComponent(); _newTaskBox.transform.SetParent(_panelContent.transform); _newTaskBox.transform.localScale = new Vector3(2.5f, 2.5f, 1.0f); _newTaskBox.GetComponent().SetTask(_task); return _newTaskBox; } // Ignored methods public override void BuildPanelSlots() { return; } public override GameObject BuildSlot(int key, GameObject _parent) { throw new NotImplementedException(); } public override void ClearSlots() { throw new NotImplementedException(); } }