public override void Initialize() { base.Initialize(); _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>() .GetBoundUserInterface(PaperUiKey.Key); _userInterface.OnReceiveMessage += OnUiReceiveMessage; _content = ""; _mode = PaperAction.Read; UpdateUserInterface(); }
public bool UseEntity(UseEntityEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) { return(false); } _mode = PaperAction.Read; UpdateUserInterface(); _userInterface.Open(actor.playerSession); return(true); }
bool IUse.UseEntity(UseEntityEventArgs eventArgs) { if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return(false); } _mode = PaperAction.Read; UpdateUserInterface(); UserInterface?.Toggle(actor.PlayerSession); return(true); }
protected override void Initialize() { base.Initialize(); if (UserInterface != null) { UserInterface.OnReceiveMessage += OnUiReceiveMessage; } _mode = PaperAction.Read; UpdateUserInterface(); }
void IActivate.Activate(ActivateEventArgs eventArgs) { if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } _mode = PaperAction.Read; UpdateUserInterface(); UserInterface?.Toggle(actor.PlayerSession); return; }
public bool InteractUsing(InteractUsingEventArgs eventArgs) { if (!eventArgs.Using.HasComponent <WriteComponent>()) { return(false); } if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) { return(false); } _mode = PaperAction.Write; UpdateUserInterface(); _userInterface.Open(actor.playerSession); return(true); }
async Task <bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { if (!eventArgs.Using.HasTag("Write")) { return(false); } if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return(false); } _mode = PaperAction.Write; UpdateUserInterface(); UserInterface?.Open(actor.PlayerSession); return(true); }
public PaperActionMessage(PaperAction action) { Action = action; }
public PaperBoundUserInterfaceState(string text, PaperAction mode = PaperAction.Read) { Text = text; Mode = mode; }