Exemplo n.º 1
0
 public void SetData(StateElement state, EntryNode destination, ITransition transition)
 {
     m_state = state;
     transform.SetParent(state.transform);
     transform.localPosition = Vector3.zero;
     m_transition            = transition;
     m_destination           = destination;
 }
Exemplo n.º 2
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Address;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (UseElement != null)
                {
                    dest.UseElement = (Code <Hl7.Fhir.Model.Address.AddressUse>)UseElement.DeepCopy();
                }
                if (TypeElement != null)
                {
                    dest.TypeElement = (Code <Hl7.Fhir.Model.Address.AddressType>)TypeElement.DeepCopy();
                }
                if (TextElement != null)
                {
                    dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopy();
                }
                if (LineElement != null)
                {
                    dest.LineElement = new List <Hl7.Fhir.Model.FhirString>(LineElement.DeepCopy());
                }
                if (CityElement != null)
                {
                    dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopy();
                }
                if (DistrictElement != null)
                {
                    dest.DistrictElement = (Hl7.Fhir.Model.FhirString)DistrictElement.DeepCopy();
                }
                if (StateElement != null)
                {
                    dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopy();
                }
                if (PostalCodeElement != null)
                {
                    dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)PostalCodeElement.DeepCopy();
                }
                if (CountryElement != null)
                {
                    dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopy();
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// The value of the specified dynamic state element
 /// </summary>
 public object Lookup(StateElement e)
 {
     if (Bindings.TryGetValue(e, out var result))
     {
         return(result);
     }
     if (e.HasDefault)
     {
         return(e.DefaultValue);
     }
     throw new KeyNotFoundException($"State contains no value for state element {e.Name}");
 }
Exemplo n.º 4
0
            public StateElement Clone(AIControllerBase aiController)
            {
                var instance = new StateElement();

                instance.stateName         = this.stateName;
                instance.state             = this.state.Clone(aiController);
                instance.nextStateElements = new NextStateElement[this.nextStateElements.Length];
                for (var i = 0; i < this.nextStateElements.Length; i++)
                {
                    instance.nextStateElements[i] = this.nextStateElements[i].Clone;
                }

                return(instance);
            }
Exemplo n.º 5
0
        public static SolaceLogState Create(string message, object[] args)
        {
            var elms  = new List <StateElement>(args.Length);
            var count = 0;

            foreach (var item in args)
            {
                var elm = new StateElement(count, item);
                elms.Add(elm);
                count++;
            }
            var state = new SolaceLogState(message, elms);

            return(state);
        }
Exemplo n.º 6
0
            /// <summary>
            /// Parses the specified value and converts it to an ItemIconState.
            /// </summary>
            /// <param name="value">The string to parse.</param>
            /// <returns>A new instance.</returns>
            internal static StateElement Parse(string value)
            {
                var instance = new StateElement();

                if (value != null)
                {
                    string[] tokens = value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string token in tokens)
                    {
                        ValueConverter.TryGetValue(typeof(ItemIconStates), token, out object state);
                        if (state != null)
                        {
                            instance.State |= (ItemIconStates)state;
                        }
                    }
                }

                return(instance);
            }
Exemplo n.º 7
0
    public void OnDrag(BaseEventData data)
    {
        var pointerData = data as PointerEventData;

        NextState = pointerData.pointerCurrentRaycast.gameObject.GetComponent <EntryNode>()?.State;
        if (NextState?.GUID == State.GUID)
        {
            NextState = null;
        }
        if (NextState)
        {
            m_tempTransition.SetColor(UiReferenceTracker.LevelInstance.Skin.GoodColor);
        }
        else
        {
            m_tempTransition.SetColor(UiReferenceTracker.LevelInstance.Skin.BadColor);
        }
        m_isDragging = true;
        m_tempTransition.SetLine(pointerData.position);
    }
Exemplo n.º 8
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (UseElement != null)
            {
                result.AddRange(UseElement.Validate());
            }
            if (TextElement != null)
            {
                result.AddRange(TextElement.Validate());
            }
            if (LineElement != null)
            {
                LineElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (CityElement != null)
            {
                result.AddRange(CityElement.Validate());
            }
            if (StateElement != null)
            {
                result.AddRange(StateElement.Validate());
            }
            if (ZipElement != null)
            {
                result.AddRange(ZipElement.Validate());
            }
            if (CountryElement != null)
            {
                result.AddRange(CountryElement.Validate());
            }
            if (Period != null)
            {
                result.AddRange(Period.Validate());
            }

            return(result);
        }
Exemplo n.º 9
0
    public void EndDrag(BaseEventData data)
    {
        m_isDragging = false;
        var pointerData = data as PointerEventData;
        var node        = pointerData.pointerCurrentRaycast.gameObject.GetComponent <EntryNode>();

        if (node == null)
        {
            NextState = null;
            Destroy(m_tempTransition.gameObject);
            m_tempTransition = null;
            return;
        }
        NextState = node.State;
        if (NextState.GUID == State.GUID)
        {
            NextState = null;
        }
        TransitionNodes.Add(m_tempTransition);
        m_tempTransition.SetData(State, node, UiManager.LevelInstance.CurrentFile.DefaultTransition());
        m_tempTransition = null;
    }
Exemplo n.º 10
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as CalibrationComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (TypeElement != null)
                {
                    dest.TypeElement = (Code <Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType>)TypeElement.DeepCopy();
                }
                if (StateElement != null)
                {
                    dest.StateElement = (Code <Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState>)StateElement.DeepCopy();
                }
                if (TimeElement != null)
                {
                    dest.TimeElement = (Hl7.Fhir.Model.Instant)TimeElement.DeepCopy();
                }
                return(dest);
            }
Exemplo n.º 11
0
 /// <summary>
 /// Set result to the value of e and return true, if e is bound, else return false
 /// </summary>
 public bool TryGetValue(StateElement e, out object result) => Bindings.TryGetValue(e, out result);
Exemplo n.º 12
0
 /// <summary>
 /// The value of the specified dynamic state element or the specified default value, if the state element
 /// has no value.
 /// </summary>
 public object LookupOrDefault(StateElement e, object defaultValue)
 => Bindings.TryGetValue(e, out var result) ? result : defaultValue;
Exemplo n.º 13
0
 /// <summary>
 /// The value of the specified dynamic state element
 /// </summary>
 public object this[StateElement e] => Lookup(e);
Exemplo n.º 14
0
 /// <summary>
 /// Binds the specified state element to the specified value
 /// </summary>
 /// <returns>New dynamic state</returns>
 public State Bind(StateElement e, object value) => new State(Bindings.SetItem(e, value));
Exemplo n.º 15
0
 public static string ToString(StateElement element, int progressionWidth) =>
 $"{element.Progression.ToString().PadRight(progressionWidth)} {ToString(element.FollowedBy)}";
Exemplo n.º 16
0
 public static string ToString(StateElement stateElement) =>
 $"{ToString(stateElement.Progression)} {ToString(stateElement.FollowedBy)}";