public GOPoolItemGroup CreateGroup(string categoryName, string groupName, ItemTemplateType itemType, GameObject itemTemplate) { GOPoolCategory category = GetCategory(categoryName); if (category == null) { return(null); } return(category.CreateGroup(groupName, itemType, itemTemplate)); }
internal GOPoolItemGroup( string categoryName, Transform transform, string groupName, ItemTemplateType templateType, GameObject templateGObj) { CategoryName = categoryName; categoryTransform = transform; GroupName = groupName; TemplateType = templateType; template = templateGObj; if (templateType != ItemTemplateType.Prefab) { template.SetActive(false); template.transform.SetParent(categoryTransform, false); } }
/// <summary> /// 使用给定的GameObject创建缓存池 /// </summary> /// <param name="itemName">资源唯一标签,一般使用资源路径</param> /// <param name="itemTemplate">模板GameObject</param> /// <returns></returns> public GOPoolItemGroup CreateGroup(string itemName, ItemTemplateType itemType, GameObject itemTemplate) { if (itemTemplate == null) { GOPoolUtil.LogError("Template is Null"); return(null); } if (!itemGroupDic.TryGetValue(itemName, out GOPoolItemGroup itemGroup)) { itemGroup = new GOPoolItemGroup(Name, categoryTransform, itemName, itemType, itemTemplate); itemGroupDic.Add(itemName, itemGroup); } else { GOPoolUtil.LogWarning("The pool has been created.uniqueName = " + itemName); } return(itemGroup); }
public SmallItemViewModel(string title, ItemTemplateType itemTemplate) { Title = title; ItemTemplate = itemTemplate; }