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


C# Layer.AddSprite方法代码示例

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


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

示例1: Initialize

        /// <summary>
        /// Sets the screen up (UI components, multimedia content, etc.)
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            Image iMountain = ResourceManager.CreateImage("mountain");
            Image iGround = ResourceManager.CreateImage("ground");
            Image icloud = ResourceManager.CreateImage("cloud");

            sCloud= new Sprite("cloud", icloud);

            sMountain1= new Sprite("mountain1", iMountain);
            sMountain1.Pivot=Vector2.UnitY;
            sMountain2 = new Sprite("mountain2", iMountain);
            sMountain2.Pivot = Vector2.UnitY;

            sGround1 = new Sprite("ground1", iGround);
            sGround1.Pivot= Vector2.UnitY;
            sGround2 = new Sprite("ground2", iGround);
            sGround2.Pivot = Vector2.UnitY;

            lcloud = new Layer();
            lcloud.AddSprite(sCloud);

            lmountain = new Layer();
            lmountain.AddSprite(sMountain1);
            lmountain.AddSprite(sMountain2);

            lground = new Layer();
            lground.AddSprite(sGround1);
            lground.AddSprite(sGround2);

            AddComponent(sCloud, 400, 10);

            AddComponent(sGround1, Preferences.ViewportManager.BottomLeftAnchor);
            AddComponent(sGround2, Preferences.ViewportManager.BottomRightAnchor);

            AddComponent(sMountain1, Preferences.ViewportManager.BottomLeftAnchor-Vector2.UnitY*sGround1.Size.Y*0.8f);
            AddComponent(sMountain2, Preferences.ViewportManager.BottomRightAnchor - Vector2.UnitY * sGround1.Size.Y * 0.8f);

            SendToFront(sGround1);
            SendToFront(sGround2);

            btnleft = new Button("Move Left");
            AddComponent(btnleft, Vector2.Zero);
            btnright = new Button("Move Right");
            btnright.Pivot = Vector2.UnitX;
            AddComponent(btnright, Preferences.ViewportManager.TopRightAnchor);
        }
开发者ID:Syderis,项目名称:CellSDK-Tutorials,代码行数:51,代码来源:MainScreen.cs


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