Exemplo n.º 1
0
        public IEnumerator RecreateFamilyInstance(FamilyController behaviour, FamilyInstance oldData)
        {
            FamilyInstance fam = behaviour.GetInstanceData();

            Debug.LogError($"UPDATING HOST ID TO {fam.HostId}");
            behaviour.UpdateInstanceData(oldData);

            yield break;
        }
Exemplo n.º 2
0
        public IEnumerator UpdateFamilyInstance(FamilyController behaviour, FamilyInstance oldData)
        {
            FamilyInstance fam = behaviour.GetInstanceData();

            Debug.Log($"Saving {fam.Id} {fam.Name}");
            Debug.Log($"Saving {fam.Id} {fam.Name}");

            CoroutineWithData <Message> cd = new CoroutineWithData <Message>(
                behaviour,
                this.ServerRequestCoroutine(new Message
            {
                Type = "SET",
                Data = JsonConvert.SerializeObject(fam)
            })
                );

            yield return(cd.coroutine);

            Message response = cd.result;

            if (response == null)
            {
                Debug.LogError("FAILED TO UPDATE FAMILY INSTANCE");
                behaviour.UpdateInstanceData(oldData);
                yield break;
            }

            FamilyInstance newFamily = JObject.Parse(response.Data).ToObject <FamilyInstance>();

            Debug.Log(JsonConvert.SerializeObject(response));

            behaviour.UpdateInstanceData(newFamily);

            if (fam.HostId != null)
            {
                yield return(UpdateHostGeometry(behaviour, fam.HostId));
            }

            foreach (string subComponent in fam.SubComponents)
            {
                behaviour.StartCoroutine(UpdateSubFamilies(behaviour, subComponent));
            }
        }