Пример #1
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(PaperUiKey.Key);
     _userInterface.OnReceiveMessage += OnUiReceiveMessage;
     _content = "";
     _mode    = PaperAction.Read;
     UpdateUserInterface();
 }
Пример #2
0
 public bool UseEntity(UseEntityEventArgs eventArgs)
 {
     if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
     {
         return(false);
     }
     _mode = PaperAction.Read;
     UpdateUserInterface();
     _userInterface.Open(actor.playerSession);
     return(true);
 }
Пример #3
0
        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);
        }
Пример #4
0
        protected override void Initialize()
        {
            base.Initialize();

            if (UserInterface != null)
            {
                UserInterface.OnReceiveMessage += OnUiReceiveMessage;
            }

            _mode = PaperAction.Read;
            UpdateUserInterface();
        }
Пример #5
0
        void IActivate.Activate(ActivateEventArgs eventArgs)
        {
            if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
            {
                return;
            }

            _mode = PaperAction.Read;
            UpdateUserInterface();
            UserInterface?.Toggle(actor.PlayerSession);
            return;
        }
Пример #6
0
        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);
        }
Пример #7
0
        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;
 }