|
@@ -2,6 +2,7 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using Blue;
|
|
|
+using LitJson;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using UnityEngine;
|
|
@@ -259,9 +260,19 @@ public class UIEditorPanel : AbstractController, EventObserver
|
|
|
for (int k = 0;k< spoit.material[j].materialList.Count; k++)
|
|
|
{
|
|
|
spoit.material[j].select = true;
|
|
|
- spoit.material[j].materialList[k].ObjectTransform.nowPos = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localPosition;
|
|
|
- spoit.material[j].materialList[k].ObjectTransform.nowRot = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localEulerAngles;
|
|
|
- spoit.material[j].materialList[k].ObjectTransform.nowScale = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localScale;
|
|
|
+ if (GameManager.Instance.ObjsParent.childCount > i)
|
|
|
+ {
|
|
|
+ if (GameManager.Instance.ObjsParent.GetChild(i).childCount > j)
|
|
|
+ {
|
|
|
+ if (GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).childCount > k)
|
|
|
+ {
|
|
|
+ Debug.LogError("HJJ materialList " + GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).name +"_" + GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localPosition);
|
|
|
+ spoit.material[j].materialList[k].ObjectTransform.nowPos = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localPosition;
|
|
|
+ spoit.material[j].materialList[k].ObjectTransform.nowRot = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localEulerAngles;
|
|
|
+ spoit.material[j].materialList[k].ObjectTransform.nowScale = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localScale;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
SplitSpoitData(spoit,count-1);
|
|
@@ -273,72 +284,125 @@ public class UIEditorPanel : AbstractController, EventObserver
|
|
|
{
|
|
|
countSplit++;
|
|
|
SendSaveData data = new SendSaveData();
|
|
|
- data.id = spoit.id;
|
|
|
- data.name = spoit.name;
|
|
|
+ data.id = GameManager.Instance.SpoitsValueDetail[spoit.id].id;
|
|
|
+ data.name = GameManager.Instance.SpoitsValueDetail[spoit.id].name;
|
|
|
data.projectId = DataManager.Instance.ProjectID;
|
|
|
data.material = spoit.material;
|
|
|
- data.spoittf = spoit.spoitTf;
|
|
|
+ data.spoittf = GameManager.Instance.SpoitsValueDetail[spoit.id].spoitTf;
|
|
|
+ data.position = GameManager.Instance.SpoitsValueDetail[spoit.id].position;
|
|
|
+ data.triggerImageId = GameManager.Instance.SpoitsValueDetail[spoit.id].triggerImageId;
|
|
|
+ data.triggerRange = GameManager.Instance.SpoitsValueDetail[spoit.id].triggerRange;
|
|
|
+
|
|
|
saveData.Add(data);
|
|
|
|
|
|
- string sendData = JsonConvert.SerializeObject(saveData);
|
|
|
- Debug.LogError(countSplit+"=="+spoitCount);
|
|
|
- if(countSplit==spoitCount)
|
|
|
- HttpTool.Instance.PostTest("/viewpoint/update", sendData, SaveCallBack);
|
|
|
+
|
|
|
+ if (countSplit==spoitCount)
|
|
|
+ {
|
|
|
+
|
|
|
+ string sendData = JsonConvert.SerializeObject(saveData);
|
|
|
+ JsonData jsdata = JsonMapper.ToObject(sendData);
|
|
|
+
|
|
|
+ for (int i = 0; i < jsdata.Count; i++)
|
|
|
+ {
|
|
|
+ if(jsdata[i].Keys.Contains("material")&&jsdata[i]["material"].IsArray)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < jsdata[i]["material"].Count; j++)
|
|
|
+ {
|
|
|
+ if (jsdata[i]["material"][j].Keys.Contains("materialList") && jsdata[i]["material"][j]["materialList"].IsArray)
|
|
|
+ {
|
|
|
+ for (int k = 0; k < jsdata[i]["material"][j]["materialList"].Count; k++)
|
|
|
+ {
|
|
|
+ jsdata[i]["material"][j]["materialList"][k]["textBJ"] = jsdata[i]["material"][j]["materialList"][k]["TextBJ"];
|
|
|
+ jsdata[i]["material"][j]["materialList"][k]["downloadPath"] = jsdata[i]["material"][j]["materialList"][k]["DownloadPath"];
|
|
|
+ jsdata[i]["material"][j]["materialList"][k]["objectTransform"] = jsdata[i]["material"][j]["materialList"][k]["ObjectTransform"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Debug.LogError(countSplit + "==" + spoitCount);
|
|
|
+ Debug.LogError("sendDatasendDatasendData====>" + jsdata.ToJson());
|
|
|
+ HttpTool.Instance.PostTest("/viewpoint/update", jsdata.ToJson(), SaveCallBack);
|
|
|
+ }
|
|
|
}
|
|
|
private int countSplit =0;
|
|
|
|
|
|
private void SaveCallBack(string message)
|
|
|
{
|
|
|
- if (message == "UnityWebRequest Error")
|
|
|
+ try
|
|
|
{
|
|
|
- InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
- InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
- InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
- CommandSystem.Instance.Send(ErrorCommand);
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
- JObject jObject = JObject.Parse(message);
|
|
|
- string str = jObject["message"].ToString();
|
|
|
- if (str != "更新成功")
|
|
|
+ JsonData jd = JsonMapper.ToObject(message);
|
|
|
+ if (jd.Keys.Contains("message"))
|
|
|
+ {
|
|
|
+ if (jd["message"].ToString() == "success")
|
|
|
+ {
|
|
|
+ Debug.Log("更新成功");
|
|
|
+ UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.SaveSpoitDataEnd);
|
|
|
+ ((LoadingPanel)UIManager.Instance.GetUI(UINameConfig.LoadingPanel)).TextStr = "更新成功";
|
|
|
+
|
|
|
+ InstantiateCommand Command = new InstantiateCommand(
|
|
|
+ InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
+ InstantiateSystem.Instance.BlueObject.SuccessText);
|
|
|
+ CommandSystem.Instance.Send(Command);
|
|
|
+
|
|
|
+ PosRotScale.PosRotScalePatchList.Clear();
|
|
|
+ for (int i = 0; i < GameManager.Instance.ObjsParent.childCount; i++)
|
|
|
+ {
|
|
|
+ if (i != 0)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < GameManager.Instance.ObjsParent.GetChild(i).childCount; j++)
|
|
|
+ {
|
|
|
+ for (int k = 0; k < GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).childCount; k++)
|
|
|
+ {
|
|
|
+ PosRotScalePatch PosRotScalePatch = new PosRotScalePatch();
|
|
|
+ PosRotScalePatch.PosPatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localPosition;
|
|
|
+ PosRotScalePatch.RotPatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localEulerAngles;
|
|
|
+ PosRotScalePatch.ScalePatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localScale;
|
|
|
+ PosRotScale.PosRotScalePatchList.Add(PosRotScalePatch);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
+ InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
+ InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
+ CommandSystem.Instance.Send(ErrorCommand);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
+ InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
+ InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
+ CommandSystem.Instance.Send(ErrorCommand);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch
|
|
|
{
|
|
|
InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
CommandSystem.Instance.Send(ErrorCommand);
|
|
|
- Debug.LogError("执行协程数:" + countSplit);
|
|
|
-
|
|
|
+
|
|
|
return;
|
|
|
- }
|
|
|
- Debug.Log("更新成功");
|
|
|
- UIManager.Instance.ShowUI(UINameConfig.LoadingPanel, typeof(LoadingPanel), (int)ELoadState.SaveSpoitDataEnd);
|
|
|
- ((LoadingPanel)UIManager.Instance.GetUI(UINameConfig.LoadingPanel)).TextStr = str;
|
|
|
|
|
|
- InstantiateCommand Command = new InstantiateCommand(
|
|
|
- InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
- InstantiateSystem.Instance.BlueObject.SuccessText);
|
|
|
- CommandSystem.Instance.Send(Command);
|
|
|
-
|
|
|
- PosRotScale.PosRotScalePatchList.Clear();
|
|
|
- for (int i = 0; i < GameManager.Instance.ObjsParent.childCount;i++)
|
|
|
- {
|
|
|
- if (i != 0)
|
|
|
- {
|
|
|
- for (int j = 0; j < GameManager.Instance.ObjsParent.GetChild(i).childCount; j++)
|
|
|
- {
|
|
|
- for (int k = 0; k < GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).childCount; k++)
|
|
|
- {
|
|
|
- PosRotScalePatch PosRotScalePatch = new PosRotScalePatch();
|
|
|
- PosRotScalePatch.PosPatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localPosition;
|
|
|
- PosRotScalePatch.RotPatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localEulerAngles;
|
|
|
- PosRotScalePatch.ScalePatch = GameManager.Instance.ObjsParent.GetChild(i).GetChild(j).GetChild(k).localScale;
|
|
|
- PosRotScale.PosRotScalePatchList.Add(PosRotScalePatch);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|