/// <summary> /// 从场景中找到已经存在的元素 /// </summary> protected void UpdateElementPool() { List <string> elementKeys = new List <string>(); for (int i = 0; i < itemList.Count; i++) { var elementName = itemList[i]; if (!elementKeys.Contains(elementName)) { elementKeys.Add(elementName); var elements = elementCtrl.GetElements <T>(elementName, false); if (elements != null) { foreach (var item in elements) { if (elementPool.Contains(item)) { if (onUpdateElement != null) { onUpdateElement.Invoke(item); } } else { elementPool.ScureAdd(item); } } } else { Debug.Log("have no element name:" + elementName); } } } }
/// <summary> /// 注册可点击元素 /// </summary> /// <param name="arg0"></param> protected void OnRegistElement(ISupportElement arg0) { if (SupportType(arg0.GetType()) && itemList.Contains(arg0.Name)) { if (!elementPool.Contains(arg0)) { elementPool.ScureAdd(arg0); } } }
protected void OnRegistElement(ISupportElement arg0) { if (arg0.GetType() == type && arg0 is ActionItem && arg0.Name == elementName) { var element = arg0 as ActionItem; if (!elementPool.Contains(element)) { elementPool.ScureAdd(element); } } }
/// <summary> /// 外部添加Element /// </summary> public void RegistElement(params ISupportElement[] items) { foreach (var item in items) { if (!elementList.Contains(item)) { elementList.ScureAdd(item); if (onRegistElememt != null) { onRegistElememt.Invoke(item); } } } }
internal void RemoveRunTimeElements(IList <RunTimePrefabItem> elements) { foreach (var item in elements) { if (item == null && item.prefab) { continue; } var element = item.prefab.GetComponent <ISupportElement>(); if (element != null && runTimeElementPrefabs.Contains(element)) { runTimeElementPrefabs.ScureRemove(element); } } }
/// <summary> /// 外部添加Element /// </summary> public void RegistElement(params ISupportElement[] items) { foreach (var item in items) { if (!elementList.Contains(item)) { elementList.ScureAdd(item); if (onRegistElememt != null) { onRegistElememt.Invoke(item); } if (log) { Debug.Log("regist:" + item.Name); } } } }
/// <summary> /// 注册 /// </summary> /// <param name="arg0"></param> protected override void OnRegistElement(ISupportElement arg0) { if (arg0 is PlaceElement) { if (arg0.Name == Name) { var placeItem = arg0 as PlaceElement; if (!elementPool.Contains(placeItem)) { elementPool.ScureAdd(placeItem); if (Started && !Completed) { placeItem.StepActive(); } } } } }
/// <summary> /// 注册 /// </summary> /// <param name="arg0"></param> protected override void OnRegistElement(ISupportElement arg0) { if (arg0 is LinkItem) { if (linkItems.Contains(arg0.Name)) { var linkItem = arg0 as LinkItem; if (!linkPool.Contains(linkItem)) { linkPool.ScureAdd(linkItem); if (Started) { linkItem.StepActive(); } } } } }