• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DwarfCorp.DwarfTime类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Update

        public override void Update(DwarfTime time)
        {
            base.Update(time);
            Animation.Update(time);

            Image = new ImageFrame(Animation.SpriteSheet.GetTexture(), Animation.GetCurrentFrameRect());
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:7,代码来源:IndicatorManager.cs


示例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);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:25,代码来源:Label.cs


示例3: Update

        public virtual void Update(DwarfTime t)
        {
            Time.Update(t);

            if(IsDone())
            {
                OnComplete.Invoke();
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:9,代码来源:MotionAnimation.cs


示例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);
 }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:10,代码来源:AnimatedImagePanel.cs


示例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);
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:12,代码来源:Box.cs


示例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);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:14,代码来源:GroupBox.cs


示例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);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:16,代码来源:ColorPanel.cs


示例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;
                    }
                }
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:30,代码来源:WaterManager.cs


示例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);
            }
        }
开发者ID:maroussil,项目名称:dwarfcorp,代码行数:27,代码来源:Diplomacy.cs


示例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);
 }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:12,代码来源:Dialog.cs


示例11: Render

        public override void Render(DwarfTime time, SpriteBatch batch)
        {
            if(!IsVisible)
            {
                return;
            }

            base.Render(time, batch);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:9,代码来源:Dialog.cs


示例12: Render

        public override void Render(DwarfTime time)
        {
            if (Voxel != null)
            {

            }
            base.Render(time);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:8,代码来源:BuildVoxelTask.cs


示例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;
                }
            }
        }
开发者ID:maroussil,项目名称:dwarfcorp,代码行数:20,代码来源:Animation.cs


示例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);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:12,代码来源:Sprite.cs


示例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);
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:12,代码来源:Label.cs


示例16: Update

        public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera)
        {
            if (ShouldDie)
            {
                DeathTimer.Update(gameTime);

                if (DeathTimer.HasTriggered)
                {
                    Die();
                }
            }
            base.Update(gameTime, chunks, camera);
        }
开发者ID:maroussil,项目名称:dwarfcorp,代码行数:13,代码来源:BearTrap.cs


示例17: Update

 public void Update(MouseState mouseState, KeyboardState keyState, DwarfGame game, DwarfTime time)
 {
     PlayState.GUI.IsMouseVisible = true;
 }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:4,代码来源:RoomBuilder.cs


示例18: Render

        public void Render(DwarfTime game, GraphicsDevice graphics)
        {
            foreach(Room room in DesignatedRooms)
            {
                if(room.IsBuilt)
                    Drawer3D.DrawBox(room.GetBoundingBox(), Color.White, 0.1f, true);
            }

            foreach(BuildRoomOrder roomDesignation in BuildDesignations)
            {
                BoundingBox roomBox = roomDesignation.GetBoundingBox();
                roomBox.Max = new Vector3(roomBox.Max.X, roomBox.Max.Y + 0.1f, roomBox.Max.Z);

                Drawer3D.DrawBox(roomBox, Color.White, 0.1f, true);
                List<BuildVoxelOrder> removals = new List<BuildVoxelOrder>();
                foreach(BuildVoxelOrder des in roomDesignation.VoxelOrders)
                {
                    Drawer3D.DrawBox(des.Voxel.GetBoundingBox(), Color.LightBlue, 0.05f, true);
                    BoundingBox centerBox = des.Voxel.GetBoundingBox();
                    centerBox.Min += new Vector3(0.7f, 1.1f, 0.7f);
                    centerBox.Max += new Vector3(-0.7f, 0.2f, -0.7f);
                    Drawer3D.DrawBox(centerBox, Color.LightBlue, 0.01f, true);

                    if (des.Voxel.IsEmpty)
                    {
                        removals.Add(des);
                    }
                }

                foreach(BuildVoxelOrder des in removals)
                {
                    roomDesignation.VoxelOrders.Remove(des);
                }

                Vector3 textLocation = (roomBox.Max - roomBox.Min) / 2.0f + roomBox.Min + new Vector3(0, 2.0f, 0);
                Drawer2D.DrawTextBox(roomDesignation.GetTextDisplay(), textLocation);
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:38,代码来源:RoomBuilder.cs


示例19: Update

        public bool Update(DwarfTime t)
        {
            if(null == t)
            {
                return false;
            }

            float seconds = (float)(Mode == TimerMode.Game ? t.TotalGameTime.TotalSeconds : t.TotalRealTime.TotalSeconds);

            if(!TriggerOnce && HasTriggered)
            {
                HasTriggered = false;
                CurrentTimeSeconds = 0.0f;
                StartTimeSeconds = -1;
            }

            if (HasTriggered && TriggerOnce)
            {
                return true;
            }

            if(StartTimeSeconds < 0)
            {
                StartTimeSeconds = seconds;
            }

            CurrentTimeSeconds = seconds - StartTimeSeconds;

            if(CurrentTimeSeconds > TargetTimeSeconds)
            {
                HasTriggered = true;
                CurrentTimeSeconds = TargetTimeSeconds;
                return true;
            }

            return false;
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:37,代码来源:Timer.cs


示例20: Splash

        public void Splash(DwarfTime time)
        {
            while(Splashes.Count > 0)
            {
                SplashType splash;

                if(!Splashes.TryDequeue(out splash))
                {
                    break;
                }

                PlayState.ParticleManager.Trigger(splash.name, splash.position + new Vector3(0.5f, 0.5f, 0.5f), Color.White, splash.numSplashes);

                if(splashNoiseLimiter[splash.name].HasTriggered)
                {
                    SoundManager.PlaySound(splash.sound, splash.position + new Vector3(0.5f, 0.5f, 0.5f), true);
                }
            }

            foreach(Timer t in splashNoiseLimiter.Values)
            {
                t.Update(time);
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:24,代码来源:WaterManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DwarfCorp.Voxel类代码示例发布时间:2022-05-24
下一篇:
C# Messages.DicomMessage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap