本文整理汇总了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;
}
}
示例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;
}
}
示例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
};
}
}
示例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) },
};
}
示例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) },
};
}
示例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);
}
示例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 },
};
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
*/
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}