Exemplo n.º 1
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            var samplerField = new MutableField <T> {
                AbsoluteKey = FieldKey.GetFirstValue(payload.Data)
            };

            if (!samplerField.CouldResolve(payload.Data))
            {
                Debug.Log("Couldn't resolve assignment switch " + samplerField.AbsoluteKey + ".  Using default value.");
                AssignmentTarget.SetValue(GetDefaultValue(), payload.Data);
            }
            else
            {
                try
                {
                    foreach (var entry in AssignmentTarget.GetEntries(payload.Data))
                    {
                        AssignmentTarget.SetValue(samplerField.GetValue(entry), entry);
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError("Assignment switch invalid! Probably can't target " + AssignmentTarget.AbsoluteKey + " from theoretical field " + samplerField.AbsoluteKey + "!  Exception: " + e);
                    throw e;
                }
            }

            var iterator = Router.TransmitAll(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }