本文整理汇总了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);
}
示例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));
}
}
}
示例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);
}
示例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"));
}
示例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);
}
示例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");
}
示例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;
}
示例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"));
}
示例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");
}
示例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"));
}
示例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);
}
示例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 ) );
}
示例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 });
}
示例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;
}
示例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;
};
}