Example #1
0
        public string To_XML()
        {
            var ret = "<interface type='network'>";

            ret += "<source network='" + network + "'/>";
            ret += "<model type='" + Model_Type.ToString() + "' />";
            ret += "</interface>";
            return(ret);
        }
Example #2
0
    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);
    }
Example #3
0
    /// <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);
    }
Example #4
0
    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]);
        }
    }
Example #5
0
 /// <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));
 }