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


C# MyEntity.GetCorrectDisplayName方法代码示例

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


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

示例1: GetEntityName

 protected StringBuilder GetEntityName(MyEntity entity)
 {
     if (!string.IsNullOrEmpty(entity.DisplayName))
     {
         return new StringBuilder(entity.GetCorrectDisplayName());
     }
     else
     {
         if(entity is MyPrefabLargeWeapon && (entity as MyPrefabLargeWeapon).GetGun() != null){
             MyLargeShipGunBase gun = (entity as MyPrefabLargeWeapon).GetGun();
             if (gun is MyLargeShipAutocannon)
             {
                 return MyTextsWrapper.Get(MyTextsWrapperEnum.Autocannon);
             }
             else if (gun is MyLargeShipCIWS)
             {
                 return MyTextsWrapper.Get(MyTextsWrapperEnum.CIWS);
             }
             else if (gun is MyLargeShipMachineGun)
             {
                 return MyTextsWrapper.Get(MyTextsWrapperEnum.MachineGun);
             }
             else if(gun is MyLargeShipMissileLauncherGun)
             {
                 return MyTextsWrapper.Get(MyTextsWrapperEnum.MissileLauncher);
             }
         }
         else if(entity is MyPrefabCamera){
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Camera);
         }
         else if(entity is MyPrefabAlarm){
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Alarm);
         }
         else if(entity is MyPrefabBankNode){
             return MyTextsWrapper.Get(MyTextsWrapperEnum.BankNode);
         }
         else if(entity is MyPrefabGenerator){
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Generator);
         }
         else if (entity is MyPrefabScanner)
         {
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Scanner);
         }
         else if (entity is MyPrefabContainer)
         {
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Alarm);
         }
         else if (entity is MyPrefabKinematic)
         {
             MyPrefabKinematic pk = (MyPrefabKinematic)entity;
             return MyTextsWrapper.Get(MyTextsWrapperEnum.Door);
         }
         return new StringBuilder();
     }
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:55,代码来源:MyGuiControlEntityUse.cs

示例2: DisplayDetectedEntityActionNotification

        /// <summary>
        /// Displays notification
        /// </summary>
        /// <param name="entity">Entity</param>        
        /// <param name="action">Action</param>
        private MyHudNotification.MyNotification DisplayDetectedEntityActionNotification(MyEntity entity, MySmallShipInteractionActionEnum action)
        {
            string entityName = entity.DisplayName;
            //// if we trade throught hangar, we want display prefab container's name, not hangar's name
            //if (entity is MyPrefabHangar)
            //{
            //    entityName = (entity as MyPrefabHangar).GetOwner().DisplayName;
            //}

            //else
            //{
            //    entityName = entity.DisplayName;
            //}


            //get localized entity name
            entityName = entity.GetCorrectDisplayName();

            if (String.IsNullOrWhiteSpace(entityName))
            {
                entityName = MyTextsWrapper.Get(MyTextsWrapperEnum.ThisObject).ToString();
            }

            bool isMissionNotification = MyMissions.IsMissionEntityNotification(entity, action);
            object[] args = new object[3];
            MyTextsWrapperEnum notificationText;
            MyGuiFont notificationFont;
            switch (action)
            {
                case MySmallShipInteractionActionEnum.TradeForFree:
                    notificationFont = MyHudConstants.FRIEND_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanTradeWith;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.TradeForMoney:
                    notificationFont = MyHudConstants.NEUTRAL_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanTradeWith;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Loot:
                    notificationFont = MyHudConstants.ENEMY_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanLoot;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Examine:
                    notificationFont = MyHudConstants.NEUTRAL_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanExamine;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY);
                    args[1] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE);
                    args[2] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.ExamineEmpty:
                    notificationFont = MyHudConstants.NEUTRAL_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanExamineEmpty;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.INVENTORY);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Blocked:
                    notificationFont = MyHudConstants.ENEMY_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCantExamine;
                    args[0] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Build:
                    notificationFont = MyHudConstants.NEUTRAL_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanBuild;
                    break;
                case MySmallShipInteractionActionEnum.Travel:
                    notificationFont = MyHudConstants.FRIEND_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanTravel;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.TRAVEL);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Use:
                    IMyUseableEntity useableEntity = entity as IMyUseableEntity;
                    Debug.Assert(useableEntity != null);
                    notificationFont = MyHudConstants.FRIEND_FONT;
                    if (useableEntity.UseProperties.UseText != null)
                    {
                        notificationText = useableEntity.UseProperties.UseText.Value;
                    }
                    else
                    {
                        notificationText = MyTextsWrapperEnum.NotificationYouCanUse;
                    }
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE);
                    args[1] = entityName;
                    break;
                case MySmallShipInteractionActionEnum.Hack:
                    notificationFont = MyHudConstants.NEUTRAL_FONT;
                    notificationText = MyTextsWrapperEnum.NotificationYouCanHack;
                    args[0] = MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.USE);
                    args[1] = entityName;
//.........这里部分代码省略.........
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:101,代码来源:MySmallShip.cs


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