public string To_XML() { var ret = "<interface type='network'>"; ret += "<source network='" + network + "'/>"; ret += "<model type='" + Model_Type.ToString() + "' />"; ret += "</interface>"; return(ret); }
public bool removeModelByName(Model_Type modelID) { bool bExist = allModel.ContainsKey(modelID); if (bExist) { GameObject.DestroyImmediate(allModel[modelID].gameObject); allModel.Remove(modelID); return(true); } return(false); }
/// <summary> /// 通过名字获取数据模型 /// </summary> /// <returns> /// The model by name. /// </returns> /// <param name='modelName'> /// Model_Type name. /// </param> public BaseModel GetModelByName(Model_Type modelID) { bool bExist = allModel.ContainsKey(modelID); if (bExist) { BaseModel tmpmodel = null; bool b = allModel.TryGetValue(modelID, out tmpmodel); if (b == false) { return(null); } return(tmpmodel); } return(null); }
public BaseModel AddModel <T>(Model_Type type) where T : BaseModel { if (!allModel.ContainsKey(type)) { GameObject obj = new GameObject(typeof(T).Name); BaseModel com = obj.AddComponent <T>(); com.ModelID = type; obj.transform.parent = gameObject.transform; allModel.Add(type, com); return(com); } else { return(allModel[type]); } }
/// <summary> /// View 对应的数据是否存在 /// </summary> /// <returns> /// The model by name. /// </returns> /// <param name='modelName'> /// If set to <c>true</c> model name. /// </param> public bool CheckModelByName(Model_Type modelID) { return(allModel.ContainsKey(modelID)); }