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


C# UseActionEnum类代码示例

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


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

示例1: Use

        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var block = Entity as MyCubeBlock;

            if (block != null)
            {
                var relation = block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
                if (!relation.IsFriendly())
                {
                    if (user.ControllerInfo.IsLocallyHumanControlled())
                    {
                        MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                    }
                    return;
                }
            }

            switch (actionEnum)
            {
                case UseActionEnum.OpenInventory:
                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
                    break;
                default:
                    //MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Block);
                    break;
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:29,代码来源:MyUseObjectInventory.cs

示例2: Use

 public void Use(UseActionEnum actionEnum, Character.MyCharacter user)
 {
     switch(actionEnum)
     {
         case UseActionEnum.Manipulate:
             if (!m_buttonPanel.IsWorking)
                 return;
             if (!m_buttonPanel.AnyoneCanUse && !m_buttonPanel.HasLocalPlayerAccess())
             {
                 MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                 return;
             }
             m_buttonPanel.Toolbar.UpdateItem(m_index);
             m_buttonPanel.Toolbar.ActivateItemAtIndex(m_index);
             m_buttonPanel.PressButton(m_index);
             break;
         case UseActionEnum.OpenTerminal:
             if (!m_buttonPanel.HasLocalPlayerAccess())
                 return;
             MyToolbarComponent.CurrentToolbar = m_buttonPanel.Toolbar;
             MyGuiScreenBase screen = MyGuiScreenCubeBuilder.Static;
             if (screen == null)
                 screen = MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.ToolbarConfigScreen, 0, m_buttonPanel);
             MyToolbarComponent.AutoUpdate = false;
             screen.Closed += (source) => MyToolbarComponent.AutoUpdate = true;
             MyGuiSandbox.AddScreen(screen);
             break;
         default:
             break;
     }
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:31,代码来源:MyUseObjectPanelButton.cs

示例3: switch

        MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
        {
            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    return new MyActionDescription()
                    {
                        Text = MySpaceTexts.NotificationHintPressToRechargeInMedicalRoom,
                        FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE) },
                        IsTextControlHint = true,
                        JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
                    };

                case UseActionEnum.OpenTerminal:
                    return new MyActionDescription()
                    {
                        Text = MySpaceTexts.NotificationHintPressToOpenTerminal,
                        FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                        IsTextControlHint = true,
                        JoystickText = MySpaceTexts.NotificationHintJoystickPressToOpenTerminal,
                    };

                default:
                    Debug.Fail("Invalid branch reached.");
                    return new MyActionDescription()
                    {
                        Text = MySpaceTexts.NotificationHintPressToOpenTerminal,
                        FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL) },
                        IsTextControlHint = true
                    };
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:32,代码来源:MyUseObjectMedicalRoom.cs

示例4: MyActionDescription

 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToUseWardrobe,
         FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.USE) },
         IsTextControlHint = true,
         JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
     };
 }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:10,代码来源:MyUseObjectWardrobe.cs

示例5: MyActionDescription

 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToEnterCockpit,
         FormatParams = new object[] { MyGuiSandbox.GetKeyName(MyControlsSpace.USE) },
         IsTextControlHint = true,
         JoystickFormatParams = new object[] { MyControllerHelper.GetCodeForControl(MySpaceBindingCreator.CX_CHARACTER, MyControlsSpace.USE) },
     };
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:MyUseObjectCockpitDoor.cs

示例6: RequestUse

            public void RequestUse(UseActionEnum actionEnum, MyCharacter user)
            {
                var msg = new UseMsg();

                msg.EntityId = m_block.EntityId;
                msg.UsedByEntityId = user.EntityId;
                msg.ActionEnum = actionEnum;

                Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request);

            }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:11,代码来源:MyMedicalRoom.cs

示例7: MyActionDescription

 MyActionDescription IMyUseObject.GetActionInfo(UseActionEnum actionEnum)
 {
     return new MyActionDescription()
     {
         Text = MySpaceTexts.NotificationHintPressToOpenControlPanel,
         FormatParams = new object[] { MyInput.Static.GetGameControl(MyControlsSpace.TERMINAL), Block.DefinitionDisplayNameText },
         IsTextControlHint = true,
         JoystickText = MySpaceTexts.NotificationHintJoystickPressToOpenControlPanel,
         JoystickFormatParams = new object[] { Block.DefinitionDisplayNameText },
     };
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:11,代码来源:MyUseObjectTerminal.cs

示例8:

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            // How to distinct between server sending message?
            // - it's response...always

            // This is request
            // 1) use - server call
            // -- on server: take control of entity
            // -- -- on success, use it, broadcast
            // -- -- on failure, don't use it, report back

            // Something like:
            // -- extension method IControllableEntity.RequestUse(actionEnum, user, handler)
            if(Cockpit is MyCockpit)
                (Cockpit as MyCockpit).RequestUse(actionEnum, user);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:16,代码来源:MyUseObjectCockpitDoor.cs

示例9: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user));
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:19,代码来源:MyUseObjectWardrobe.cs

示例10: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (!relation.IsFriendly())
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user));
                    break;
            }
        }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:20,代码来源:MyUseObjectWardrobe.cs

示例11: Use

        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var block = Entity as MyCubeBlock;

            if (block != null)
            {
                var relation = block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
                if (!relation.IsFriendly())
                {
                    if (user.ControllerInfo.IsLocallyHumanControlled())
                    {
                        MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                    }
                    return;
                }
            }

            //by Gregory: on use action the button pressed should be checked because on use action we will always get only Inventory TODO: refactor somehow
            if (MyInput.Static.IsNewGameControlPressed(MyControlsSpace.TERMINAL))
                MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Entity);
            else
                MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
            
            /*
            switch (actionEnum)
            {
                case UseActionEnum.OpenInventory:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
                    break;
                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
                    break;
                default:
                    //MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
                    break;
            }
            */
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:39,代码来源:MyUseObjectInventory.cs

示例12: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Door.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    Door.SetOpenRequest(!Door.Open, user.ControllerInfo.ControllingIdentityId);
                    break;

                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Door);
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:23,代码来源:MyUseObjectDoorTerminal.cs

示例13: switch

        void IMyUseObject.Use(UseActionEnum actionEnum, MyCharacter user)
        {
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (relation != Common.MyRelationsBetweenPlayerAndBlock.Owner && relation != Common.MyRelationsBetweenPlayerAndBlock.FactionShare)
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Block);
                    break;
                case UseActionEnum.OpenInventory:
                    if (Block as IMyInventoryOwner != null)
                        MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Block);
                    break;
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:23,代码来源:MyUseObjectTerminal.cs

示例14: Use

        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var relation = Door.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (!relation.IsFriendly())
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    Door.ChangeOpenClose(!Door.Open);
                    break;

                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.ControlPanel, user, Door);
                    break;
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:24,代码来源:MyUseObjectAirtightDoors.cs

示例15: Use

        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var relation = Block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
            if (!relation.IsFriendly())
            {
                if (user.ControllerInfo.IsLocallyHumanControlled())
                {
                    MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                }
                return;
            }

            switch (actionEnum)
            {
                case UseActionEnum.Manipulate:
                    if (Block is MyMedicalRoom)
                    {
                        MyMedicalRoom medRoom = (MyMedicalRoom)Block;
                        if (!medRoom.SuitChangeAllowed)
                        {
                            MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                            break;
                        }

                        if (medRoom.CustomWardrobesEnabled)
                        {
                            MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user, medRoom.CustomWardrobeNames));
                            break;
                        }
                    }
 
                    MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = new MyGuiScreenWardrobe(user));
                    break;
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:36,代码来源:MyUseObjectWardrobe.cs


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