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


C# Component.SetProperty方法代码示例

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


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

示例1: Initialize

        public void Initialize()
        {
            BlankEntityFactory = () =>
            {
                var entity = new Entity();
                var transform = new Component(GetPlugin(typeof(TransformComponent)));
                transform.SetProperty("Width", new Value(48, true));
                transform.SetProperty("Height", new Value(48, true));
                entity.AddComponent(transform);
                return entity;
            };

            ImageEntityFactory = () =>
            {
                var entity = new Entity();
                entity.AddComponent(new Component(GetPlugin(typeof(ImageRenderComponent))));
                return entity;
            };

            ShapeEntityFactory = () =>
            {
                var entity = new Entity();
                var transform = new Component(GetPlugin(typeof(TransformComponent)));
                transform.SetProperty("Width", new Value(48, true));
                transform.SetProperty("Height", new Value(48, true));
                entity.AddComponent(transform);
                var render = new Component(GetPlugin(typeof(RenderComponent)));
                render.SetProperty("Shape", new Value("Rectangle", true));
                render.SetProperty("FillColor", new Value("Blue", true));
                entity.AddComponent(render);
                return entity;
            };

            TextEntityFactory = () =>
            {
                var entity = new Entity();
                var text = new Component(GetPlugin(typeof(TextRenderComponent)));
                text.SetProperty("FontSize", new Value(36, true));
                text.SetProperty("FontColor", new Value("Black", true));
                text.SetProperty("Value", new Value("Your Text Here", true));
                entity.AddComponent(text);
                return entity;
            };

            Statements.Add(new StatementFactory("If", StatementType.ConditionGroup, () => new ConditionGroup()));
            Statements.Add(new StatementFactory("While Loop", StatementType.WhileLoop, () => new WhileLoop()));
            Statements.Add(new StatementFactory("For Loop", StatementType.ForLoop, () => new ForLoop()));
            Statements.Add(new StatementFactory("Change a Value", StatementType.Assignment, () => new Assignment()));

            foreach (MethodInfo mi in typeof(Kinectitude.Core.Functions.Math).GetMethods().Where(mi => System.Attribute.IsDefined(mi, typeof(PluginAttribute))))
            {
                FunctionHolder.AddFunction(mi.Name, mi);
            }

            foreach (MethodInfo mi in typeof(Conversions).GetMethods().Where(mi => System.Attribute.IsDefined(mi, typeof(PluginAttribute))))
            {
                FunctionHolder.AddFunction(mi.Name, mi);
            }
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:59,代码来源:Workspace.cs


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