当前位置: 首页>>代码示例>>C#>>正文


C# IEvent.SetProperty方法代码示例

本文整理汇总了C#中IEvent.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IEvent.SetProperty方法的具体用法?C# IEvent.SetProperty怎么用?C# IEvent.SetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEvent的用法示例。


在下文中一共展示了IEvent.SetProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryParse

        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 4)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }

            float posX, posY, posZ;
            if( !float.TryParse(eventParams[1], out posX) ||
                !float.TryParse(eventParams[2], out posY) ||
                !float.TryParse(eventParams[3], out posZ) )
            {
                return false;
            }

            if (!target.HasProperty("EntityName") || !target.HasProperty("Target"))
            {
                return false;
            }

            UnityEngine.Vector3 targetPosition = new UnityEngine.Vector3();
            targetPosition.x = posX;
            targetPosition.y = posY;
            targetPosition.z = posZ;

            target.SetProperty("EntityName", eventParams[0]);
            target.SetProperty("Target", targetPosition);
            return true;
        }
开发者ID:haleox,项目名称:mortar,代码行数:40,代码来源:EntityNameVector3Parser.cs

示例2: TryParse

        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 2)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }

            float duration;
            if (!float.TryParse(eventParams[1], out duration))
            {
                return false;
            }

            if(!target.HasProperty("Name") || !target.HasProperty("Duration"))
            {
                return false;
            }

            target.SetProperty("Name", eventParams[0]);
            target.SetProperty("Duration", duration);
            return true;
        }
开发者ID:haleox,项目名称:mortar,代码行数:33,代码来源:TimerNameDurationParser.cs

示例3: TryParse

        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 2)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]) || string.IsNullOrEmpty(eventParams[1]))
            {
                return false;
            }
            if (!target.HasProperty("EntityName") || !target.HasProperty("ComponentName"))
            {
                return false;
            }

            target.SetProperty("EntityName", eventParams[0]);
            target.SetProperty("ComponentName", eventParams[1]);
            return true;
        }
开发者ID:haleox,项目名称:mortar,代码行数:26,代码来源:EntityNameComponentNameParser.cs

示例4: TryParse

        /// <summary>
        /// Tries to parse the given data to the target <see cref="IEvent"/>.
        /// </summary>
        /// <param name="eventParams">List of string-parameters to parse.</param>
        /// <param name="target">Target instance to parse the data to.</param>
        /// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
        public bool TryParse(List<string> eventParams, IEvent target)
        {
            if (eventParams.Count < 1)
            {
                return false;
            }

            if (string.IsNullOrEmpty(eventParams[0]))
            {
                return false;
            }
            if (!target.HasProperty("SceneName"))
            {
                return false;
            }

            target.SetProperty("SceneName", eventParams[0]);
            return true;
        }
开发者ID:haleox,项目名称:mortar,代码行数:25,代码来源:SceneNameParser.cs


注:本文中的IEvent.SetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。