|
@@ -1,3 +1,4 @@
|
|
|
|
+using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Collections;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
@@ -5,10 +6,12 @@ using UnityEngine;
|
|
|
|
|
|
public class ModelManager : Singleton<ModelManager>
|
|
public class ModelManager : Singleton<ModelManager>
|
|
{
|
|
{
|
|
- public Dictionary<string, ModelItem> modellist = new Dictionary<string, ModelItem>();
|
|
+
|
|
|
|
+ public Dictionary<int, ModelList> modellist = new Dictionary<int, ModelList>();
|
|
|
|
+ public GameObject materialLibrary;
|
|
public void init(string message)
|
|
public void init(string message)
|
|
{
|
|
{
|
|
- GameManager.Instance.text.text = " »ñÈ¡ËØ²ÄÁбí";
|
|
+ GameManager.Instance.text.text = " 获å�–ç´ æ��列表";
|
|
JObject jObject = JObject.Parse(message);
|
|
JObject jObject = JObject.Parse(message);
|
|
string data = jObject["data"].ToString();
|
|
string data = jObject["data"].ToString();
|
|
|
|
|
|
@@ -18,6 +21,44 @@ public class ModelManager : Singleton<ModelManager>
|
|
string library = dataObject["library"].ToString();
|
|
string library = dataObject["library"].ToString();
|
|
string combination = dataObject["combination"].ToString();
|
|
string combination = dataObject["combination"].ToString();
|
|
|
|
|
|
|
|
+ materialLibrary = new GameObject("MaterailLibrary");
|
|
|
|
+
|
|
|
|
+ AddDicModelList(single);
|
|
|
|
+ AddDicModelList(library);
|
|
|
|
+ AddDicModelList(combination);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void AddDicModelList(string message)
|
|
|
|
+ {
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(message))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ List<ModelList> ModelList = JsonConvert.DeserializeObject<List<ModelList>>(message);
|
|
|
|
+ Debug.Log(ModelList.Count + " AddDicModelList " + message);
|
|
|
|
+ for (int i = 0; i < ModelList.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ ModelList[i].materalLibrary = materialLibrary.transform;
|
|
|
|
+ modellist.Add(ModelList[i].id, ModelList[i]);
|
|
|
|
+ for (int j = 0; j < ModelList[i].materialList.Count; j++)
|
|
|
|
+ {
|
|
|
|
+ ModelList[i].materialList[j].init( ModelList[i].Model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
+ private void DownLoadModel(ModelList list)
|
|
|
|
+ {
|
|
|
|
+ for (int i = 0; i < list.materialList.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ if (list.materialList[i].Model != null)
|
|
|
|
+ Debug.Log(" 检测下载 " + list.materialList[i].name);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|