/// <summary> /// 添加一个模型的加载数据 /// 在结束解析的时候,开始加载 /// </summary> /// <param name="model"></param> /// <param name="structure"></param> /// <param name="motion"></param> /// <param name="direction"></param> /// <param name="resourceType"></param> /// <param name="resourceAssistType"></param> protected void Load(uint model, EModelStructure structure, CSMotion motion, CSDirection direction, EResourceType resourceType, EResourceAssistType resourceAssistType) { //加载的模型不存在 if (model == 0) { //如果要加载身体模型不存在,那么要注意清理其他的组件 if (structure == EModelStructure.Body) { } return; } long key = GetKey((int)model, (int)motion, (int)direction, (int)structure); ModelComponentLoadData data = null; if (!ModelComponentLoadedCacheDic.TryGetValue(key, out data)) { data = new T(); ModelComponentLoadedCacheDic[key] = data; } data.Model = model; data.Key = key; data.Structure = structure; data.ResourceType = resourceType; data.ResourceAssistType = resourceAssistType; WaitLoadComponentKey.Add(data); }
/// <summary> /// 从自身字典中清理下载完成的组件(组装完成后就清理掉) /// </summary> /// <param name="structure"></param> public void RemoveWaitModelComponent(EModelStructure structure) { int key = (int)structure; if (SleftModelComponentLoadedDic.ContainsKey(key)) { SleftModelComponentLoadedDic.Remove(key); } }
/// <summary> /// 得到已经下载完成的组件 /// </summary> /// <param name="structure"></param> /// <returns></returns> public ModelComponentLoadData GetWaitModelComponent(EModelStructure structure) { ModelComponentLoadData data = null; if (SleftModelComponentLoadedDic.TryGetValue((int)structure, out data)) { return(data); } return(data); }