コード例 #1
0
        void RaiseUseFailure(UseActionEnum actionEnum, UseActionResult actionResult, IMyControllableEntity usedBy)
        {
            var handler = UseFailed;

            if (handler != null)
            {
                handler(actionEnum, actionResult, usedBy);
            }
        }
コード例 #2
0
 void sync_UseFailed(UseActionEnum actionEnum, UseActionResult actionResult, IMyControllableEntity user)
 {
     if (user != null && user.ControllerInfo.IsLocallyHumanControlled())
     {
         if (actionResult == UseActionResult.UsedBySomeoneElse)
             MyHud.Notifications.Add(new MyHudNotification(MySpaceTexts.AlreadyUsedBySomebodyElse, 2500, MyFontEnum.Red));
         else if (actionResult == UseActionResult.AccessDenied)
             MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
         else if (actionResult == UseActionResult.Unpowered)
             MyHud.Notifications.Add(new MyHudNotification(MySpaceTexts.BlockIsNotPowered, 2500, MyFontEnum.Red));
         else if (actionResult == UseActionResult.CockpitDamaged)
             MyHud.Notifications.Add(new MyHudNotification(MySpaceTexts.Notification_CockpitIsDamaged, 2500, MyFontEnum.Red));
     }
 }
コード例 #3
0
ファイル: MyCockpit.cs プロジェクト: Rynchodon/SpaceEngineers
 public void AttachPilotEventFailed(UseActionResult actionResult)
 {
     if (actionResult == UseActionResult.UsedBySomeoneElse)
         MyHud.Notifications.Add(new MyHudNotification(MyCommonTexts.AlreadyUsedBySomebodyElse, 2500, MyFontEnum.Red));
     else if (actionResult == UseActionResult.AccessDenied)
         MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
     else if (actionResult == UseActionResult.Unpowered)
         MyHud.Notifications.Add(new MyHudNotification(MySpaceTexts.BlockIsNotPowered, 2500, MyFontEnum.Red));
     else if (actionResult == UseActionResult.CockpitDamaged)
         MyHud.Notifications.Add(new MyHudNotification(MySpaceTexts.Notification_CockpitIsDamaged, 2500, MyFontEnum.Red));
 }
コード例 #4
0
 void UseFailureCallback(UseActionEnum useAction, long usedById, UseActionResult useResult)
 {
     MyEntity controlledEntity;
     bool userFound = MyEntities.TryGetEntityById<MyEntity>(usedById, out controlledEntity);
     Debug.Assert(userFound);
     IMyControllableEntity controllableEntity = controlledEntity as IMyControllableEntity;
     Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");
     sync_UseFailed(useAction, useResult, controllableEntity);
 }
コード例 #5
0
        void UseSuccessCallback(UseActionEnum useAction, long usedById,UseActionResult useResult)
        {
            MyEntity controlledEntity;
            if (MyEntities.TryGetEntityById<MyEntity>(usedById, out controlledEntity))
            {
                var controllableEntity = controlledEntity as IMyControllableEntity;
                Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity");

                if (controllableEntity != null)
                {                  
                    VRage.Game.MyRelationsBetweenPlayerAndBlock relation = VRage.Game.MyRelationsBetweenPlayerAndBlock.NoOwnership;
                    var cubeBlock = this as MyCubeBlock;
                    if (cubeBlock != null && controllableEntity.ControllerInfo.Controller != null)
                    {
                        relation = cubeBlock.GetUserRelationToOwner(controllableEntity.ControllerInfo.Controller.Player.Identity.IdentityId);
                    }

                    if (relation.IsFriendly())
                    {                    
                        sync_UseSuccess(useAction, controllableEntity);
                    }
                    else
                    {
                        sync_UseFailed(useAction, useResult, controllableEntity);
                    }
                }
            }
        }
コード例 #6
0
 void RaiseUseFailure(UseActionEnum actionEnum, UseActionResult actionResult, IMyControllableEntity usedBy)
 {
     var handler = UseFailed;
     if (handler != null) 
         handler(actionEnum, actionResult, usedBy);
 }