using Newtonsoft.Json; using NUnit.Framework.Constraints; using Simulator.Config; using Simulator.Data; using System; using System.Collections.Generic; using UnityEngine; using UVC.Network; [Serializable] public class Patches { public List patches=new List(); } [Serializable] public class Patch { public string path; public object value; } public class UpdateValueStack : MonoBehaviour { static Dictionary patches=new Dictionary(); public static void AddPatch(string path, object value) { if (patches.ContainsKey(path)) { patches[path] = value; } else { patches.Add(path, value); } } public static async void Save() { Patches change = new Patches(); foreach (var patch in patches) { Patch pa = new Patch(); pa.path = patch.Key; pa.value = patch.Value; change.patches.Add(pa); } var data=JsonConvert.SerializeObject(change); Debug.Log(data); var request = await HttpRequester.Request_($"{Constants.HTTP_DOMAIN}/simulation/logics/{SimulationConfig.logicId}/data", data, methodString:"patch", null,true); Debug.Log(request.code); patches.Clear(); } }