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


C# Engine类代码示例

本文整理汇总了C#中Engine的典型用法代码示例。如果您正苦于以下问题:C# Engine类的具体用法?C# Engine怎么用?C# Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BgColorChangeMaterial

        public BgColorChangeMaterial(Engine engine, Material baseMaterial)
            : base(engine, baseMaterial)
        {
            Navin = BgColorChangeParameter.None;

            foreach (var param in baseMaterial.TextureParameters) {
                var tex = baseMaterial.TexturesFiles[param.TextureIndex];
                BgColorChangeParameter currentParam;
                if (!CharacterParameterMap.TryGetValue(param.ParameterId, out currentParam)) {
                    System.Diagnostics.Trace.WriteLine(string.Format("Unknown character parameter {0:X8} for texture '{1}' in material '{2}'.", param.ParameterId, tex.Path, baseMaterial.File.Path));
                    continue;
                }

                Navin |= currentParam;
                switch (currentParam) {
                    case BgColorChangeParameter.ColorMap0:
                        ColorMap0 = Engine.TextureFactory.GetResource(tex);
                        break;
                    case BgColorChangeParameter.SpecularMap0:
                        SpecularMap0 = Engine.TextureFactory.GetResource(tex);
                        break;
                    case BgColorChangeParameter.NormalMap0:
                        NormalMap0 = Engine.TextureFactory.GetResource(tex);
                        break;
                }
            }

            CurrentTechniqueName = "BgColorChange"; // TechniqueNames[Navin];
        }
开发者ID:KevinAllenWiegand,项目名称:SaintCoinach,代码行数:29,代码来源:BgColorChangeMaterial.cs

示例2: Main

 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Engine game = new Engine())
     {
         game.Run();
     }
 }
开发者ID:SFDStrandberg,项目名称:StarPunk,代码行数:10,代码来源:Program.cs

示例3: Transform

        public void Transform(Engine engine, Package package)
        {
            TemplatingLogger log = TemplatingLogger.GetLogger(GetType());
            RepositoryLocalObject context;
            if (package.GetByName(Package.PageName) != null)
            {

                context = (RepositoryLocalObject)engine.GetObject(package.GetByName(Package.PageName));
                log.Debug("Setting context to page with ID " + context.Id);
            }
            else
            {
                log.Info("This template building block should only run on a page. Exiting.");
                return;
            }

            if (!(context is Page)) return;

            Page page = (Page)context;

            package.PushItem(SiteEditPageContext, package.CreateStringItem(ContentType.Text, page.OwningRepository.Id));
            package.PushItem(SiteEditPublishContext, package.CreateStringItem(ContentType.Text, page.ContextRepository.Id));

            if (page.ComponentPresentations.Count <= 0) return;
            Component component = page.ComponentPresentations[0].Component;
            package.PushItem(SiteEditComponentContext, package.CreateStringItem(ContentType.Text, component.OwningRepository.Id));
        }
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:27,代码来源:SetSiteEditBlueprintContext.cs

示例4: TileData

        public TileData(Engine engine)
        {
            _instance = this;

            IConfigurationService configurationService = engine.Services.GetService<IConfigurationService>();
            string ultimaOnlineDirectory = configurationService.GetValue<string>(ConfigSections.UltimaOnline, ConfigKeys.UltimaOnlineDirectory);

            string filePath = Path.Combine(ultimaOnlineDirectory, "tiledata.mul");

            if (filePath != null)
            {
                using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(fs);

                    m_LandData = new LandData[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                        {
                            bin.ReadInt32(); // header
                        }

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        bin.ReadInt16(); // skip 2 bytes -- textureID

                        m_LandData[i] = new LandData(ReadNameString(bin), flags);
                    }

                    m_ItemData = new ItemData[0x4000];
                    m_HeightTable = new int[0x4000];

                    for (int i = 0; i < 0x4000; ++i)
                    {
                        if ((i & 0x1F) == 0)
                            bin.ReadInt32(); // header

                        TileFlag flags = (TileFlag)bin.ReadInt32();
                        int weight = bin.ReadByte();
                        int quality = bin.ReadByte();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int quantity = bin.ReadByte();
                        int anim = bin.ReadInt16();
                        bin.ReadInt16();
                        bin.ReadByte();
                        int value = bin.ReadByte();
                        int height = bin.ReadByte();

                        m_ItemData[i] = new ItemData(ReadNameString(bin), flags, weight, quality, quantity, value, height, anim);
                        m_HeightTable[i] = height;
                    }
                }
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:60,代码来源:TileData.cs

示例5: OrderByOrdersThenByInAscendingOrder

        public void OrderByOrdersThenByInAscendingOrder()
        {
            // Given
            List<string> content = new List<string>();
            Engine engine = new Engine();
            engine.CleanOutputFolderOnExecute = false;
            engine.Trace.AddListener(new TestTraceListener());
            CountModule count = new CountModule("A")
            {
                AdditionalOutputs = 4
            };
            CountModule count2 = new CountModule("B")
            {
                AdditionalOutputs = 1
            };
            OrderBy orderBy = new OrderBy((d, c) => d.Get<int>("A"))
                .ThenBy((d, c) => d.Get<int>("B"));
            Execute gatherData = new Execute((d, c) =>
            {
                content.Add(d.Content);
                return null;
            });
            engine.Pipelines.Add(count, count2, orderBy, gatherData);

            // When
            engine.Execute();

            // Then
            Assert.AreEqual(10, content.Count); // (4+1) * (21+1)
            CollectionAssert.AreEqual(new[] { "11", "12", "23", "24", "35", "36", "47", "48", "59", "510" }, content);
        }
开发者ID:Chandu,项目名称:Wyam,代码行数:31,代码来源:OrderByFixture.cs

示例6: ClrAccessDescriptor

 public ClrAccessDescriptor(Engine engine, Func<JsValue, JsValue> get, Action<JsValue, JsValue> set)
     : base(
         get: new GetterFunctionInstance(engine, get),
         set: set == null ? Native.Undefined.Instance : new SetterFunctionInstance(engine, set)
         )
 {
 }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:7,代码来源:ClrAccessDescriptor.cs

示例7: EngineTests

 public EngineTests()
 {
     _engine = new Engine()
         .SetValue("log", new Action<object>(Console.WriteLine))
         .SetValue("assert", new Action<bool>(Assert.True))
         ;
 }
开发者ID:BusinessActs,项目名称:jint,代码行数:7,代码来源:EngineTests.cs

示例8: RollingCircleEnemy

        public RollingCircleEnemy(Engine engine, Vector2 position)
            : base(engine, position)
        {
            animation = new Animation(engine, @"Characters\FlickeringCircle", 64, 64, 1, 2, 2, 15, Global.Animations.Repeat);
            animation.Play();

            enemyPhysicsComponent = new EnemyPhysicsComponent(Engine, position, Global.Shapes.Circle);
            enemyPhysicsComponent.MainFixture.Body.LinearDamping = 2.0f;
            enemyPhysicsComponent.MainFixture.CollisionFilter.CollisionCategories = (Category)Global.CollisionCategories.Enemy;
            enemyPhysicsComponent.MainFixture.OnCollision += EnemyOnCollision;

            deathAnimation = new Animation(engine, @"Miscellaneous\Explosion", 512, 512, 3, 4, 9, 20, Global.Animations.PlayOnce);
            deathAnimation.Scale = 0.3f;
            deathAnimation.DrawOrder = int.MaxValue - 1;

            enemySound = Engine.Audio.GetCue("EnterTheVoid");

            light = new Light(engine);
            light.Color = Color.White;
            light.Fov = MathHelper.TwoPi;
            light.Position = position;
            light.Range = 100;

            engine.AddComponent(this);
        }
开发者ID:PhoenixWright,项目名称:NePlus,代码行数:25,代码来源:RollingCircleEnemy.cs

示例9: PaginateSetsCorrectMetadata

        public void PaginateSetsCorrectMetadata()
        {
            // Given
            List<int> currentPage = new List<int>();
            List<int> totalPages = new List<int>();
            List<bool> hasNextPage = new List<bool>();
            List<bool> hasPreviousPage = new List<bool>();
            Engine engine = new Engine();
            engine.Trace.AddListener(new TestTraceListener());
            CountModule count = new CountModule("A")
            {
                AdditionalOutputs = 7
            };
            Paginate paginate = new Paginate(3, count);
            Execute gatherData = new Execute((d, c) =>
            {
                currentPage.Add(d.Get<int>(Keys.CurrentPage));
                totalPages.Add(d.Get<int>(Keys.TotalPages));
                hasNextPage.Add(d.Get<bool>(Keys.HasNextPage));
                hasPreviousPage.Add(d.Get<bool>(Keys.HasPreviousPage));
                return null;
            });
            engine.Pipelines.Add(paginate, gatherData);

            // When
            engine.Execute();

            // Then
            CollectionAssert.AreEqual(new[] { 1, 2, 3 }, currentPage);
            CollectionAssert.AreEqual(new[] { 3, 3, 3 }, totalPages);
            CollectionAssert.AreEqual(new[] { true, true, false }, hasNextPage);
            CollectionAssert.AreEqual(new[] { false, true, true }, hasPreviousPage);
        }
开发者ID:martinvobr,项目名称:Wyam,代码行数:33,代码来源:PaginateFixture.cs

示例10: Engine

 public void 助詞によって引数の順番を切り替える()
 {
     // 副作用を有り。
     var engine = new Engine();
     string[] codes = {
         "「A」が「B」を「C」にテストする。" ,
         "「A」が「C」に「B」をテストする。" ,
         "「B」を「A」が「C」にテストする。" ,
         "「B」を「C」に「A」がテストする。" ,
         "「C」に「A」が「B」をテストする。" ,
         "「C」に「B」を「A」がテストする。"};
     engine.Global.SetVariable("テスト", new SuffixFunc<Func<object, object, object, object>>(
         (a, b, c) => ((string)a == "A" && (string)b == "B" && (string)c == "C"),
         "が", "を", "に"));
     foreach (var code in codes) {
         Assert.IsTrue((bool)engine.Execute(code, Statics.TestName));
     }
     var defun =
         "以下の定義でAがBをCにテストする。" +
         "	[A,B,C]を文字列連結する。" +
         "以上。";
     engine.Execute(defun, Statics.TestName);
     foreach (var code in codes) {
         Assert.AreEqual("ABC", (string)engine.Execute(code, Statics.TestName));
     }
 }
开发者ID:irxground,项目名称:kurogane,代码行数:26,代码来源:Behavior.cs

示例11: Transform

        public void Transform(Engine engine, Package package)
        {
            if (package.GetByName(Package.PageName) == null) return;
            Page page = (Page)engine.GetObject(package.GetByName(Package.PageName));
            bool hasHeader = false;
            bool hasFooter = false;

            foreach (CP cp in page.ComponentPresentations)
            {
                if (cp.ComponentTemplate.Title.ToLower().Contains("header")) hasHeader = true;
                if (cp.ComponentTemplate.Title.ToLower().Contains("footer")) hasFooter = true;
            }
            if (!hasHeader)
            {
                ComponentTemplate headerCt = (ComponentTemplate)engine.GetObject(page.ContextRepository.RootFolder.WebDavUrl + HeaderComponentTemplateUrl);
                Component header = (Component)engine.GetObject(page.ContextRepository.RootFolder.WebDavUrl + HeaderComponentUrl);
                package.PushItem("headerCP", package.CreateStringItem(ContentType.Html, string.Format("<tcdl:ComponentPresentation type=\"Dynamic\" componentURI=\"{0}\" templateURI=\"{1}\" />", header.Id, headerCt.Id)));
            }
            if (!hasFooter)
            {
                ComponentTemplate footerCt = (ComponentTemplate)engine.GetObject(page.ContextRepository.RootFolder.WebDavUrl + FooterComponentTemplateUrl);
                Component footer = (Component)engine.GetObject(page.ContextRepository.RootFolder.WebDavUrl + FooterComponentUrl);
                package.PushItem("footerCP", package.CreateStringItem(ContentType.Html, string.Format("<tcdl:ComponentPresentation type=\"Dynamic\" componentURI=\"{0}\" templateURI=\"{1}\" />", footer.Id, footerCt.Id)));

            }
        }
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:26,代码来源:AddHeaderAndFooterToPage.cs

示例12: Camera3D

        public Camera3D(Engine engine)
            : base(engine)
        {
            ResetCamera();

              Engine.AddComponent(this);
        }
开发者ID:PhoenixWright,项目名称:Mystery,代码行数:7,代码来源:Camera3D.cs

示例13: BuildPage

        public static Dynamic.Page BuildPage(TCM.Page tcmPage, Engine engine, BuildManager manager, int linkLevels, bool resolveWidthAndHeight)
        {
            Dynamic.Page p = new Dynamic.Page();
            p.Title = tcmPage.Title;
            p.Id = tcmPage.Id.ToString();
            p.Filename = tcmPage.FileName;
            p.PageTemplate = manager.BuildPageTemplate(tcmPage.PageTemplate);
            p.Schema = manager.BuildSchema(tcmPage.MetadataSchema);
            p.Metadata = new Dynamic.SerializableDictionary<string, Dynamic.Field>();
            if (linkLevels > 0) {
                try {
                    if (tcmPage.Metadata != null) {
                        var tcmMetadataFields = new Tridion.ContentManager.ContentManagement.Fields.ItemFields(tcmPage.Metadata, tcmPage.MetadataSchema);
                        p.Metadata = manager.BuildFields(tcmMetadataFields, linkLevels, resolveWidthAndHeight);
                    }
                } catch (ItemDoesNotExistException) {
                    // fail silently if there is no metadata schema
                }
            }

            p.ComponentPresentations = new List<Dynamic.ComponentPresentation>();
            foreach (TCM.ComponentPresentation cp in tcmPage.ComponentPresentations) {
                Dynamic.ComponentPresentation dynCp = manager.BuildComponentPresentation(cp, engine, linkLevels - 1, resolveWidthAndHeight);
                p.ComponentPresentations.Add(dynCp);
            }
            p.StructureGroup = manager.BuildOrganizationalItem((TCM.StructureGroup)tcmPage.OrganizationalItem);
            p.Publication = manager.BuildPublication(tcmPage.ContextRepository);
            p.Categories = manager.BuildCategories(tcmPage);

            return p;
        }
开发者ID:rainmaker2k,项目名称:TridionMVCDotNet,代码行数:31,代码来源:PageBuilder.cs

示例14: Update

 public override void Update(Engine.GameTime gameTime)
 {
     if(AnimationSetRenderComponent.IsFinished())
     {
         AnimationSetRenderComponent.SetAnimation("Flying");
     }
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:7,代码来源:FlyingBugControllerComponent.cs

示例15: GameObject

 /// <summary>
 /// Constructor de la clase GameObject.
 /// </summary>
 /// <param name="effect">Effecto usado para dibujar.</param>
 /// <param name="engine">Clase principal del juego.</param>
 /// <param name="size">Tamaño del objeto.</param>
 /// <param name="position">Posicion x, y, z dada como Vector3.</param>
 /// <param name="color">Color del objeto.</param>
 public GameObject(Engine engine, Vector3 position, Color color, float size)
     : base(engine)
 {
     this.size = size;
     this.color = color;
     this.position = position;
 }
开发者ID:alejopelaez,项目名称:eshcerworld,代码行数:15,代码来源:GameObject.cs


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