本文整理汇总了C#中DwarfCorp.DwarfTime类的典型用法代码示例。如果您正苦于以下问题:C# DwarfTime类的具体用法?C# DwarfTime怎么用?C# DwarfTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DwarfTime类属于DwarfCorp命名空间,在下文中一共展示了DwarfTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(DwarfTime time)
{
base.Update(time);
Animation.Update(time);
Image = new ImageFrame(Animation.SpriteSheet.GetTexture(), Animation.GetCurrentFrameRect());
}
示例2: Update
public override void Update(DwarfTime time)
{
if (ValueFn != null)
{
float value = ValueFn();
if (value.CompareTo(LastValue) != 0)
{
string operand = "-";
Color color = Color.Red;
if (value.CompareTo(LastValue) > 0)
{
operand = "+";
color = Color.Green;
}
IndicatorManager.DrawIndicator(operand + (value - LastValue).ToString(Format) + Postfix,
new Vector3(GlobalBounds.Center.X, GlobalBounds.Center.Y, 0), 1.0f, color, Indicator.IndicatorMode.Indicator2D);
LastValue = value;
Text = Prefix + value.ToString(Format) + Postfix;
}
}
base.Update(time);
}
示例3: Update
public virtual void Update(DwarfTime t)
{
Time.Update(t);
if(IsDone())
{
OnComplete.Invoke();
}
}
示例4: Update
public override void Update(DwarfTime time)
{
if (Animation != null)
{
Animation.Update(time, Timer.TimerMode.Real);
Image.Image = Animation.SpriteSheet.GetTexture();
Image.SourceRect = Animation.GetCurrentFrameRect();
}
base.Update(time);
}
示例5: Render
public override void Render(DwarfTime gameTime, ChunkManager chunks, Camera camera, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice, Effect effect, bool renderingForWater)
{
base.Render(gameTime, chunks, camera, spriteBatch, graphicsDevice, effect, renderingForWater);
effect.Parameters["xTexture"].SetValue(Texture);
effect.Parameters["xWorld"].SetValue(GlobalTransform);
foreach(EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
Primitive.Render(graphicsDevice);
}
}
示例6: Render
public override void Render(DwarfTime time, SpriteBatch batch)
{
if(!IsVisible)
{
return;
}
if(DrawBounds)
{
GUI.Skin.RenderGroup(GlobalBounds, batch);
}
Drawer2D.DrawAlignedText(batch, Title, GUI.DefaultFont, Color.Black, Drawer2D.Alignment.Top | Drawer2D.Alignment.Left, GlobalBounds);
base.Render(time, batch);
}
示例7: Render
public override void Render(DwarfTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
{
Drawer2D.FillRect(batch, GlobalBounds, CurrentColor);
if (BorderWidth > 0)
{
Drawer2D.DrawRect(batch, GlobalBounds, BorderColor, BorderWidth);
}
if (IsMouseOver)
{
Color highlightColor = new Color(255 - CurrentColor.R, 255 - CurrentColor.G, 255 - CurrentColor.B);
Drawer2D.DrawRect(batch, GlobalBounds, highlightColor, BorderWidth * 2 + 1);
}
base.Render(time, batch);
}
示例8: HandleTransfers
public void HandleTransfers(DwarfTime time)
{
Voxel atPos = new Voxel();
while(Transfers.Count > 0)
{
Transfer transfer;
if(!Transfers.TryDequeue(out transfer))
{
break;
}
if(transfer.cellFrom.Type == LiquidType.Lava && transfer.cellTo.Type == LiquidType.Water || (transfer.cellFrom.Type == LiquidType.Water && transfer.cellTo.Type == LiquidType.Lava))
{
bool success = Chunks.ChunkData.GetVoxel(transfer.worldLocation, ref atPos);
if(success)
{
Voxel v = atPos;
VoxelLibrary.PlaceType(VoxelLibrary.GetVoxelType("Stone"), v);
VoxelChunk chunk = Chunks.ChunkData.ChunkMap[v.ChunkID];
chunk.Data.Water[v.Index].Type = LiquidType.None;
chunk.Data.Water[v.Index].WaterLevel = 0;
chunk.ShouldRebuild = true;
chunk.ShouldRecalculateLighting = true;
}
}
}
}
示例9: Update
public void Update(DwarfTime time, DateTime currentDate)
{
foreach (var mypolitics in FactionPolitics)
{
Pair<Faction> pair = mypolitics.Key;
if (!pair.IsSelfPair() && pair.Contains(PlayState.PlayerFaction))
{
Faction otherFaction = null;
otherFaction = pair.First.Equals(PlayState.PlayerFaction) ? pair.Second : pair.First;
Race race = otherFaction.Race;
Politics relation = mypolitics.Value;
if (race.IsIntelligent && race.IsNative && !otherFaction.IsRaceFaction && !relation.HasMet && MathFunctions.RandEvent(1e-2f))
{
SendTradeEnvoy(otherFaction);
}
if (race.IsIntelligent && race.IsNative && !otherFaction.IsRaceFaction && relation.GetCurrentRelationship() == Relationship.Hates && MathFunctions.RandEvent(1e-7f))
{
SendWarParty(otherFaction);
}
}
mypolitics.Value.UpdateEvents(currentDate);
}
}
示例10: Update
public override void Update(DwarfTime time)
{
if(IsModal && !isClosed && IsVisible)
{
GUI.FocusComponent = this;
}
else if(GUI.FocusComponent == this)
{
GUI.FocusComponent = null;
}
base.Update(time);
}
示例11: Render
public override void Render(DwarfTime time, SpriteBatch batch)
{
if(!IsVisible)
{
return;
}
base.Render(time, batch);
}
示例12: Render
public override void Render(DwarfTime time)
{
if (Voxel != null)
{
}
base.Render(time);
}
示例13: Update
public virtual void Update(DwarfTime gameTime, Timer.TimerMode mode = Timer.TimerMode.Game)
{
if(IsPlaying)
{
float dt = mode == Timer.TimerMode.Game ? (float)gameTime.ElapsedGameTime.TotalSeconds : (float)gameTime.ElapsedRealTime.TotalSeconds;
FrameTimer += dt;
float time = FrameHZ;
if (Speeds.Count > 0)
{
time = Speeds[Math.Min(CurrentFrame, Speeds.Count - 1)];
}
if(FrameTimer * SpeedMultiplier >= 1.0f / time)
{
NextFrame();
FrameTimer = 0.0f;
}
}
}
示例14: Update
public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera)
{
if(IsActive)
{
if(CurrentAnimation != null)
{
CurrentAnimation.Update(gameTime);
}
}
base.Update(gameTime, chunks, camera);
}
示例15: Render
public override void Render(DwarfTime time, SpriteBatch batch)
{
string text = Text;
if(WordWrap)
{
text = DwarfGUI.WrapLines(Text, LocalBounds, TextFont);
}
Drawer2D.DrawAlignedStrokedText(batch, text, TextFont, TextColor, StrokeColor, Alignment, GlobalBounds);
base.Render(time, batch);
}