Beispiel #1
0
    public IEnumerator DoStep(string actionId)
    {
        Debug.Log("DoStep " + actionId);
        BodyAction action = actions.actions.First(a => a.id == actionId);

        if (action == null)
        {
            Debug.Log("action is null!");
            yield return(null);
        }
        foreach (BodySubAction sa in action.subActions)
        {
            Debug.Log("BodyController SubAction=" + sa.id);
            yield return(StartCoroutine(SetRootJoint(sa.rootJoint)));

            foreach (JointMove move in sa.moves)
            {
                string jointName = move.joint.ToString() + "Joint";
                Debug.Log("BodyController move=" + jointName);
                if (joints.ContainsKey(jointName))
                {
                    joints [jointName].DoStep(move, sa.time);
                }
            }
            yield return(new WaitForSeconds(sa.time));
        }
    }
Beispiel #2
0
        /// <summary>
        /// Generate a Card
        /// </summary>
        /// <param name="entityName">Entity Logical Name</param>
        /// <param name="entityId">Entity Id</param>
        /// <param name="appId">App Id</param>
        /// <param name="attributes">Attributes</param>
        /// <returns></returns>
        public string ConvertToCard(string entityName, Guid entityId, Guid appId, string[] attributes)
        {
            //Retrieve Entity Record
            var entity = this.RetrieveRecord(entityName, entityId, attributes);

            //Retrieve Attributes Metadata
            var attributesMetadata = this.RetrieveAttributes(entityName, attributes);

            //Card
            var adaptativeCard = new AdaptativeCard();
            {
                //Button
                var bodyAction = new BodyAction();
                {
                    var action = new Models.Action("Open Record", this.DefineRecordUrl(appId, entity));
                    bodyAction.actions.Add(action);
                }
                adaptativeCard.body.Add(bodyAction);
            }

            //Facts
            var bodyFact = new BodyFact();
            {
                #region Facts
                for (int i = 0; i < attributes.Length; i++)
                {
                    object value = null;
                    if (entity.Contains(attributes[i]))
                    {
                        value = entity.Attributes[attributes[i]];
                    }
                    else
                    {
                        value = string.Empty;
                    }

                    //Fact
                    var match = attributesMetadata.Where(w => w.LogicalName == attributes[i]).FirstOrDefault();
                    if (match != null)
                    {
                        bodyFact.facts.Add(new Fact(match, value));
                    }
                }
                #endregion
            }
            adaptativeCard.body.Add(bodyFact);

            return(adaptativeCard.CardToJson());
        }
Beispiel #3
0
 internal Body Concept(string conceptName, BodyAction action)
 {
     _currentConcept = new Concept(conceptName, action);
     _concepts.Add(_currentConcept);
     return(this);
 }
Beispiel #4
0
 public Concept(string name, BodyAction action)
 {
     Name   = name;
     Action = action;
 }