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


C# Animation.PlayFetchIndex方法代码示例

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


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

示例1: ProductionPaletteWidget

        public ProductionPaletteWidget([ObjectCreator.Param] World world,
		                               [ObjectCreator.Param] WorldRenderer worldRenderer)
        {
            this.world = world;
            this.worldRenderer = worldRenderer;
            tooltipContainer = new Lazy<TooltipContainerWidget>(() =>
                Widget.RootWidget.GetWidget<TooltipContainerWidget>(TooltipContainer));

            cantBuild = new Animation("clock");
            cantBuild.PlayFetchIndex("idle", () => 0);
            clock = new Animation("clock");

            iconSprites = Rules.Info.Values
                .Where(u => u.Traits.Contains<BuildableInfo>() && u.Name[0] != '^')
                .ToDictionary(
                    u => u.Name,
                    u => Game.modData.SpriteLoader.LoadAllSprites(
                        u.Traits.Get<TooltipInfo>().Icon ?? (u.Name + "icon"))[0]);

            overlayFont = Game.Renderer.Fonts["TinyBold"];
            holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2;
            readyOffset = new float2(32,24) - overlayFont.Measure("Ready") / 2;
            timeOffset = new float2(32,24) - overlayFont.Measure(WidgetUtils.FormatTime(0)) / 2;
            queuedOffset = new float2(4,2);
        }
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:25,代码来源:ProductionPaletteWidget.cs

示例2: RenderUnitTurreted

        public RenderUnitTurreted(Actor self)
            : base(self)
        {
            var facing = self.Trait<IFacing>();
            var turreted = self.Trait<Turreted>();
            var attack = self.TraitOrDefault<AttackBase>();
            var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();

            var turretAnim = new Animation(GetImage(self), () => turreted.turretFacing );
            turretAnim.Play( "turret" );

            for( var i = 0; i < attack.Turrets.Count; i++ )
            {
                var turret = attack.Turrets[i];
                anims.Add( "turret_{0}".F(i),
                    new AnimationWithOffset( turretAnim,
                        () => Combat.GetTurretPosition( self, facing, turret ),
                        null));

                if (attackInfo.MuzzleFlash)
                {
                    var muzzleFlash = new Animation(GetImage(self), () => turreted.turretFacing);
                    muzzleFlash.PlayFetchIndex("muzzle",
                        () => (int)(turret.Recoil * 5.9f)); /* hack: dumb crap */
                    anims.Add("muzzle_flash_{0}".F(i),
                        new AnimationWithOffset(muzzleFlash,
                            () => Combat.GetTurretPosition(self, facing, turret),
                            () => turret.Recoil <= 0));
                }
            }
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:31,代码来源:RenderUnitTurreted.cs

示例3: RenderPreviewSprites

        public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
        {
            // Show a static frame instead of animating all of the fullness states
            var anim = new Animation(init.World, image, () => 0);
            anim.PlayFetchIndex(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence), () => 0);

            yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:8,代码来源:RenderBuildingSilo.cs

示例4: DrawControlGroup

        void DrawControlGroup(WorldRenderer wr, Actor self, float2 basePosition)
        {
            var group = self.World.Selection.GetControlGroupForActor(self);
            if (group == null) return;

            var pipImages = new Animation("pips");
            pipImages.PlayFetchIndex("groups", () => (int)group);
            pipImages.Tick();
            pipImages.Image.DrawAt(basePosition + new float2(-8, 1), wr.Palette("chrome"));
        }
开发者ID:TiriliPiitPiit,项目名称:OpenRA,代码行数:10,代码来源:SelectionDecorations.cs

示例5: Rank

        public Rank(Actor self, string paletteName)
        {
            this.self = self;
            this.paletteName = paletteName;

            var xp = self.Trait<GainsExperience>();
            anim = new Animation(self.World, "rank");
            anim.PlayRepeating("rank");
            anim.PlayFetchIndex("rank", () => xp.Level == 0 ? 0 : xp.Level - 1);
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:10,代码来源:Rank.cs

示例6: ProductionPaletteWidget

        public ProductionPaletteWidget(World world, WorldRenderer worldRenderer)
        {
            this.World = world;
            this.worldRenderer = worldRenderer;
            tooltipContainer = Lazy.New(() =>
                Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

            cantBuild = new Animation("clock");
            cantBuild.PlayFetchIndex("idle", () => 0);
            clock = new Animation("clock");
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:11,代码来源:ProductionPaletteWidget.cs

示例7: BuildPaletteWidget

        public BuildPaletteWidget(World world, WorldRenderer worldRenderer)
        {
            this.world = world;
            this.worldRenderer = worldRenderer;

            cantBuild = new Animation("clock");
            cantBuild.PlayFetchIndex("idle", () => 0);
            clock = new Animation("clock");
            VisibleQueues = new List<ProductionQueue>();
            CurrentQueue = null;
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:11,代码来源:BuildPaletteWidget.cs

示例8: Parachute

        public Parachute(Player owner, float2 location, int altitude, Actor cargo)
        {
            this.location = location;
            this.altitude = altitude;
            this.cargo = cargo;

            var rs = cargo.Trait<RenderSimple>();
            var image = rs.anim.Name;
            palette = rs.Palette(owner);

            anim = new Animation(image);
            if (anim.HasSequence("idle"))
                anim.PlayFetchIndex("idle", () => 0);
            else
                anim.PlayFetchIndex("stand", () => 0);
            anim.Tick();

            paraAnim = new Animation("parach");
            paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));
        }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:20,代码来源:Parachute.cs

示例9: ProductionPaletteWidget

        public ProductionPaletteWidget(OrderManager orderManager, World world, WorldRenderer worldRenderer)
        {
            this.orderManager = orderManager;
            this.World = world;
            this.worldRenderer = worldRenderer;
            tooltipContainer = Exts.Lazy(() =>
                Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

            cantBuild = new Animation(world, "clock");
            cantBuild.PlayFetchIndex("idle", () => 0);
            clock = new Animation(world, "clock");
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:12,代码来源:ProductionPaletteWidget.cs

示例10: DrawControlGroup

        void DrawControlGroup(WorldRenderer wr, Actor self, int2 basePosition)
        {
            var group = self.World.Selection.GetControlGroupForActor(self);
            if (group == null) return;

            var pipImages = new Animation("pips");
            pipImages.PlayFetchIndex("groups", () => (int)group);
            pipImages.Tick();

            var pos = wr.Viewport.WorldToViewPx(basePosition) - (0.5f * pipImages.Image.size).ToInt2() + new int2(9, 5);
            Game.Renderer.SpriteRenderer.DrawSprite(pipImages.Image, pos, wr.Palette("chrome"));
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:12,代码来源:SelectionDecorations.cs

示例11: DrawControlGroup

        IEnumerable<IRenderable> DrawControlGroup(WorldRenderer wr, Actor self, int2 basePosition)
        {
            var group = self.World.Selection.GetControlGroupForActor(self);
            if (group == null)
                yield break;

            var pipImages = new Animation(self.World, "pips");
            var pal = wr.Palette(Info.Palette);
            pipImages.PlayFetchIndex("groups", () => (int)group);
            pipImages.Tick();

            var pos = basePosition - (0.5f * pipImages.Image.Size).ToInt2() + new int2(9, 5);
            yield return new UISpriteRenderable(pipImages.Image, pos, 0, pal, 1f);
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:14,代码来源:SelectionDecorations.cs

示例12: RenderUnitMuzzleFlash

        public RenderUnitMuzzleFlash(Actor self)
            : base(self)
        {
            var unit = self.traits.Get<Unit>();
            var attack = self.traits.Get<AttackBase>();
            var attackInfo = self.Info.Traits.Get<AttackBaseInfo>();

            var muzzleFlash = new Animation(GetImage(self), ()=>unit.Facing);
            muzzleFlash.PlayFetchIndex("muzzle",
                () => (int)(attack.primaryRecoil * 5.9f));
            anims.Add( "muzzle", new AnimationWithOffset(
                muzzleFlash,
                () => attackInfo.PrimaryOffset.AbsOffset(),
                () => attack.primaryRecoil <= 0 ) );
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:15,代码来源:RenderUnitMuzzleFlash.cs

示例13: RenderBuildingRefinery

        public RenderBuildingRefinery(ActorInitializer init, RenderBuildingInfo info)
            : base(init, info)
        {
            playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();

            lights = new Animation(GetImage(init.self));
            lights.PlayFetchIndex("lights",
                () => playerResources.OreCapacity != 0
                    ? (59 * playerResources.Ore) / (10 * playerResources.OreCapacity)
                    : 0);

            var offset = new float2(-32,-21);
            anims.Add("lights", new AnimationWithOffset( lights, wr => offset, () => !buildComplete )
                { ZOffset = 24 });
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:15,代码来源:RenderBuildingRefinery.cs

示例14: Parachute

        public Parachute(Player owner, PPos location, int altitude, Actor cargo)
        {
            this.location = location;
            this.altitude = altitude;
            this.cargo = cargo;

            var rs = cargo.Trait<RenderSimple>();
            var image = rs.anim.Name;
            palette = rs.Palette(owner);

            anim = new Animation(image);
            if (anim.HasSequence("idle"))
                anim.PlayFetchIndex("idle", () => 0);
            else
                anim.PlayFetchIndex("stand", () => 0);
            anim.Tick();

            var pai = cargo.Info.Traits.GetOrDefault<ParachuteAttachmentInfo>();

            paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach");
            paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));

            if (pai != null) offset = pai.Offset;
        }
开发者ID:JamesDunne,项目名称:OpenRA,代码行数:24,代码来源:Parachute.cs

示例15: Initialize

		public override void Initialize(WidgetArgs args)
		{
			base.Initialize(args);

			if (Unit != null && Sequence != null)
			{
				var anim = new Animation(worldRenderer.world, Unit, () => Facing);
				anim.PlayFetchIndex(Sequence, () => Frame);
				GetAnimation = () => anim;
			}

			GetSprite = () =>
			{
				var anim = GetAnimation();
				return anim != null ? anim.Image : null;
			};
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:17,代码来源:SpriteSequenceWidget.cs


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