|
@@ -2,9 +2,11 @@
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using Blue;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
using UnityEngine;
|
|
|
+using UnityEngine.Assertions.Must;
|
|
|
using UnityEngine.UI;
|
|
|
-
|
|
|
public class UIEditorPanel : AbstractController, EventObserver
|
|
|
{
|
|
|
|
|
@@ -228,6 +230,7 @@ public class UIEditorPanel : AbstractController, EventObserver
|
|
|
|
|
|
SaveBtn.onClick.AddListener(() =>
|
|
|
{
|
|
|
+
|
|
|
if (MaterialObj == null)
|
|
|
{
|
|
|
InstantiateCommand Command = new InstantiateCommand(
|
|
@@ -238,10 +241,95 @@ public class UIEditorPanel : AbstractController, EventObserver
|
|
|
return;
|
|
|
}
|
|
|
GameManager.Instance.SaveSpoitObjs();
|
|
|
-
|
|
|
+ */
|
|
|
+ SetSpoitInfo();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public void SetSpoitInfo()
|
|
|
+ {
|
|
|
+ countCo =0;
|
|
|
+ int count = GameManager.Instance.ObjsParent.childCount;
|
|
|
+ for (int i = 1; i <= count-1;i++)
|
|
|
+ {
|
|
|
+ var spoit = GameManager.Instance.SpoitValues[i-1];
|
|
|
+
|
|
|
+ for (int j = 0; j < spoit.material.Count; j++)
|
|
|
+ {
|
|
|
+ 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(0).GetChild(k).localPosition;
|
|
|
+ spoit.material[j].materialList[k].ObjectTransform.nowRot = GameManager.Instance.ObjsParent.GetChild(i).GetChild(0).GetChild(k).localEulerAngles;
|
|
|
+ spoit.material[j].materialList[k].ObjectTransform.nowScale = GameManager.Instance.ObjsParent.GetChild(i).GetChild(0).GetChild(k).localScale;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StartCoroutine(SelectTrans(spoit));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private int countCo =0;
|
|
|
+ private IEnumerator SelectTrans(SpoitValue spoit)
|
|
|
+ {
|
|
|
+ yield return null;
|
|
|
+ List<SendSaveData> saveData = new List<SendSaveData>();
|
|
|
+ SendSaveData data = new SendSaveData();
|
|
|
+ data.id = spoit.id;
|
|
|
+ data.name = spoit.name;
|
|
|
+ data.projectId = DataManager.Instance.ProjectID;
|
|
|
+ data.material = spoit.material;
|
|
|
+ data.spoittf = spoit.spoitTf;
|
|
|
+ saveData.Add(data);
|
|
|
+
|
|
|
+ string sendData = JsonConvert.SerializeObject(saveData);
|
|
|
+ HttpTool.Instance.PostTest("/viewpoint/update", sendData, SaveCallBack);
|
|
|
+ }
|
|
|
+ private void SaveCallBack(string message)
|
|
|
+ {
|
|
|
+ countCo++;
|
|
|
+ if (message == "UnityWebRequest Error")
|
|
|
+ {
|
|
|
+ InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
+ InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
+ InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
+ CommandSystem.Instance.Send(ErrorCommand);
|
|
|
+ Debug.LogError("执行协程数:" + countCo);
|
|
|
+ StopAllCoroutines();
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JObject jObject = JObject.Parse(message);
|
|
|
+ string str = jObject["message"].ToString();
|
|
|
+ if (str != "更新成功")
|
|
|
+ {
|
|
|
+ InstantiateCommand ErrorCommand = new InstantiateCommand(
|
|
|
+ InstantiateSystem.Instance.BlueObject.WarningPopUp,
|
|
|
+ InstantiateSystem.Instance.BlueObject.NetErrorText);
|
|
|
+ CommandSystem.Instance.Send(ErrorCommand);
|
|
|
+ Debug.LogError("执行协程数:" + countCo);
|
|
|
+ StopAllCoroutines();
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.Log("更新成功");
|
|
|
+ }
|
|
|
+ if (countCo != GameManager.Instance.ObjsParent.childCount-1)
|
|
|
+ {
|
|
|
+ Debug.Log("执行协程数:" + countCo);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Debug.Log("执行协程数:" + countCo);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -249,6 +337,7 @@ public class UIEditorPanel : AbstractController, EventObserver
|
|
|
|
|
|
public void SelectMaterial(Transform MaterialObj)
|
|
|
{
|
|
|
+ Debug.LogError("MaterialObjName:"+MaterialObj.name);
|
|
|
this.MaterialObj = MaterialObj;
|
|
|
listAlter.Clear();
|
|
|
listAlter = new List<objectData>();
|