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


C# Troop.ControlAvail方法代码示例

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


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

示例1: DrawTroop

        internal void DrawTroop(SpriteBatch spriteBatch, Troop troop, bool playerControlling)
        {
            if (troop.Scenario.ScenarioMap.TileWidth >= 50)
            {
                Color white = Color.White;
                this.DisplayOffset = troop.Scenario.GameScreen.GetPointByPosition(troop.Position);
                this.DisplayOffset=new Point( this.DisplayOffset.X ,this.DisplayOffset.Y- 13);
                if (troop.BelongedFaction != null)
                {
                    white = troop.BelongedFaction.FactionColor;
                }
                Rectangle? sourceRectangle = null;
                spriteBatch.Draw(this.BackgroundTexture, new Rectangle(this.displayOffset.X, this.displayOffset.Y, this.BackgroundSize.X, this.BackgroundSize.Y), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.47f);
                spriteBatch.Draw(this.shiqicaotupian, new Rectangle(this.displayOffset.X + this.shiqicaoweizhi.X, this.displayOffset.Y + this.shiqicaoweizhi.Y, this.shiqicaoweizhi.Width , this.shiqicaoweizhi.Height ), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f);
                spriteBatch.Draw(this.shiqitiaotupian, new Rectangle(this.displayOffset.X + this.shiqitiaoweizhi.X, this.displayOffset.Y + this.shiqitiaoweizhi.Y, shiqitiaokuandu(troop), this.shiqitiaoweizhi.Height), sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.469f);

                sourceRectangle = null;
                spriteBatch.Draw(this.FactionTexture, new Rectangle(this.displayOffset.X + this.FactionPosition.X, this.displayOffset.Y + this.FactionPosition.Y, this.FactionPosition.Width, this.FactionPosition.Height), sourceRectangle, white, 0f, Vector2.Zero, SpriteEffects.None, 0.469f);
                this.NameText.Text = troop.Leader.Name;
                this.binglitext.Text=troop.Army.Quantity.ToString();
                this.NameText.Draw(spriteBatch, 0.47f);
                this.binglitext.Draw(spriteBatch, 0.47f);
                sourceRectangle = null;
                spriteBatch.Draw(troop.Leader.SmallPortrait, new Rectangle(this.displayOffset.X + this.PortraitPosition.X, this.displayOffset.Y + this.PortraitPosition.Y, this.PortraitPosition.Width, this.PortraitPosition.Height), null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4687f);

                if (playerControlling && (GlobalVariables.SkyEye || troop.Scenario.IsCurrentPlayer(troop.BelongedFaction)))
                {
                    if (!troop.ControlAvail())
                    {
                        sourceRectangle = null;
                        spriteBatch.Draw(this.NoControlTexture, this.NoControlIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                    }
                    else
                    {
                        switch (troop.ControlState)
                        {
                            case TroopControlState.Undone:
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ActionUndoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                                break;

                            case TroopControlState.Done:
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ActionDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                                break;

                            case TroopControlState.Auto:
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ActionAutoTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                                break;

                            case TroopControlState.AutoDone:
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ActionAutoDoneTexture, this.ActionIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                                break;
                        }
                    }
                    if (troop.Food < troop.FoodCostPerDay)
                    {
                        sourceRectangle = null;
                        spriteBatch.Draw(this.FoodShortageTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                    }
                    /*
                    else
                    {
                        sourceRectangle = null;
                        spriteBatch.Draw(this.FoodNormalTexture, this.FoodIconDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                    }
                    */

                }
                if (troop.CurrentStunt != null)
                {
                    spriteBatch.Draw(this.StuntTexture, this.StuntIconDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.4688f);
                }
            }
        }
开发者ID:simon217,项目名称:ZhongHuaSanGuoZhi,代码行数:77,代码来源:TroopTitle.cs


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