Exemplo n.º 1
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(LatheUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _powerDevice = Owner.GetComponent <PowerDeviceComponent>();
 }
Exemplo n.º 2
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(MagicMirrorUiKey.Key);
     _userInterface.OnReceiveMessage += OnUiReceiveMessage;
 }
Exemplo n.º 3
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(GasAnalyzerUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
 }
Exemplo n.º 4
0
        /// <summary>
        ///     Verify that the subscribed clients are still in range of the interface.
        /// </summary>
        private void CheckRange(BoundUserInterface ui)
        {
            // We have to cache the set of sessions because Unsubscribe modifies the original.
            _sessionCache.Clear();
            _sessionCache.AddRange(ui.SubscribedSessions);

            var transform = ui.Owner.Owner.Transform;

            var uiPos = transform.WorldPosition;
            var uiMap = transform.MapID;

            foreach (var session in _sessionCache)
            {
                var attachedEntity = session.AttachedEntity;

                // The component manages the set of sessions, so this invalid session should be removed soon.
                if (attachedEntity == null || !attachedEntity.IsValid())
                {
                    continue;
                }

                if (uiMap != attachedEntity.Transform.MapID)
                {
                    ui.Close(session);
                    continue;
                }

                var distanceSquared = (uiPos - attachedEntity.Transform.WorldPosition).LengthSquared;
                if (distanceSquared > MaxWindowRangeSquared)
                {
                    ui.Close(session);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Check whether the PDA has an uplink, and ensure that the only person that can see the PDA UI has an
        ///     uplink account.
        /// </summary>
        public bool ShouldShowUplink(EntityUid uid, BoundUserInterface ui, EntityUid?user = null)
        {
            // TODO UPLINK RINGTONES/SECRETS This is just a janky placeholder way of hiding uplinks from non syndicate
            // players. This should really use a sort of key-code entry system that selects an account which is not directly tied to
            // a player entity.

            if (!HasComp <UplinkComponent>(uid))
            {
                return(false);
            }

            // If a user is trying to open the UI, make sure that they have an uplink account before showing the UI.
            if (user != null && !_uplinkAccounts.HasAccount(user.Value))
            {
                return(false);
            }

            // If other users currently have the UI open, check that they too should be allowed to see the button..
            foreach (var session in ui.SubscribedSessions)
            {
                if (session.AttachedEntity != null && !_uplinkAccounts.HasAccount(session.AttachedEntity.Value))
                    return(false);
            }

            // everyone has an uplink account, show the button.
            return(true);
        }
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ResearchConsoleUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _client = Owner.GetComponent <ResearchClientComponent>();
 }
Exemplo n.º 7
0
 public override void Initialize()
 {
     base.Initialize();
     _appearance    = Owner.GetComponent <AppearanceComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(MedicalScannerUiKey.Key);
     _bodyContainer = ContainerManagerComponent.Ensure <ContainerSlot>($"{Name}-bodyContainer", Owner);
     UpdateUserInterface();
 }
        public override void Initialize()
        {
            base.Initialize();

            _userInterface = Owner.GetComponent<ServerUserInterfaceComponent>().GetBoundUserInterface(SolarControlConsoleUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
            _powerReceiver = Owner.GetComponent<PowerReceiverComponent>();
            _powerSolarSystem = _entitySystemManager.GetEntitySystem<PowerSolarSystem>();
        }
Exemplo n.º 9
0
#pragma warning restore 649

        public override void Initialize()
        {
            base.Initialize();
            Battery        = Owner.GetComponent <BatteryComponent>();
            _appearance    = Owner.GetComponent <AppearanceComponent>();
            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ApcUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
            Update();
        }
 public override void Initialize()
 {
     base.Initialize();
     Storage        = Owner.GetComponent <PowerStorageComponent>();
     Appearance     = Owner.GetComponent <AppearanceComponent>();
     _provider      = Owner.GetComponent <PowerProviderComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ApcUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
 }
Exemplo n.º 11
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(PaperUiKey.Key);
     _userInterface.OnReceiveMessage += OnUiReceiveMessage;
     _content = "";
     _mode    = PaperAction.Read;
     UpdateUserInterface();
 }
 public override void Initialize()
 {
     base.Initialize();
     Market         = Owner.GetComponent <GalacticMarketComponent>();
     Orders         = Owner.GetComponent <CargoOrderDatabaseComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(CargoConsoleUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _galacticBankManager.AddComponent(this);
     BankId = 0;
 }
 public override void Initialize()
 {
     base.Initialize();
     _appearance    = Owner.GetComponent <AppearanceComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(VendingMachineUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _powerDevice = Owner.GetComponent <PowerDeviceComponent>();
     _powerDevice.OnPowerStateChanged += UpdatePower;
     InitializeFromPrototype();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Called once per instance of this component. Gets references to any other components needed
        /// by this component and initializes it's UI and other data.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ReagentDispenserUiKey.Key);
            _userInterface.OnReceiveMessage += OnUiReceiveMessage;

            _beakerContainer = ContainerManagerComponent.Ensure <ContainerSlot>($"{Name}-reagentContainerContainer", Owner);

            InitializeFromPrototype();
            UpdateUserInterface();
        }
 public override void Initialize()
 {
     base.Initialize();
     _appearance    = Owner.GetComponent <AppearanceComponent>();
     _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                      .GetBoundUserInterface(VendingMachineUiKey.Key);
     _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
     _powerReceiver = Owner.GetComponent <PowerReceiverComponent>();
     _powerReceiver.OnPowerStateChanged += UpdatePower;
     TrySetVisualState(_powerReceiver.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off);
     InitializeFromPrototype();
 }
        public override void Initialize()
        {
            base.Initialize();

            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(CommunicationsConsoleUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
            _powerDevice = Owner.GetComponent <PowerDeviceComponent>();

            RoundEndSystem.OnRoundEndCountdownStarted   += UpdateBoundInterface;
            RoundEndSystem.OnRoundEndCountdownCancelled += UpdateBoundInterface;
            RoundEndSystem.OnRoundEndCountdownFinished  += UpdateBoundInterface;
        }
        public override void Initialize()
        {
            base.Initialize();
            // For now it just registers on the first server it can find.
            var servers = _entitySystemManager.GetEntitySystem <ResearchSystem>().Servers;

            if (servers.Count > 0)
            {
                RegisterServer(servers[0]);
            }
            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(ResearchClientUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
        }
Exemplo n.º 18
0
        public override void Initialize()
        {
            base.Initialize();

            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                             .GetBoundUserInterface(GravityGeneratorUiKey.Key);
            _userInterface.OnReceiveMessage += HandleUIMessage;
            _powerReceiver = Owner.GetComponent <PowerReceiverComponent>();
            _sprite        = Owner.GetComponent <SpriteComponent>();
            _switchedOn    = true;
            _intact        = true;
            _status        = GravityGeneratorStatus.On;
            UpdateState();
        }
Exemplo n.º 19
0
        public override void Initialize()
        {
            base.Initialize();

            _privilegedIdContainer = ContainerManagerComponent.Ensure <ContainerSlot>($"{Name}-privilegedId", Owner);
            _targetIdContainer     = ContainerManagerComponent.Ensure <ContainerSlot>($"{Name}-targetId", Owner);

            _accessReader = Owner.GetComponent <AccessReader>();

            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                             .GetBoundUserInterface(IdCardConsoleUiKey.Key);
            _userInterface.OnReceiveMessage += OnUiReceiveMessage;
            UpdateUserInterface();
        }
Exemplo n.º 20
0
        public override void Initialize()
        {
            base.Initialize();
            _solution ??= Owner.TryGetComponent(out SolutionComponent solutionComponent)
                ? solutionComponent
                : Owner.AddComponent <SolutionComponent>();

            _storage       = ContainerManagerComponent.Ensure <Container>("microwave_entity_container", Owner, out var existed);
            _appearance    = Owner.GetComponent <AppearanceComponent>();
            _powerDevice   = Owner.GetComponent <PowerDeviceComponent>();
            _audioSystem   = _entitySystemManager.GetEntitySystem <AudioSystem>();
            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                             .GetBoundUserInterface(MicrowaveUiKey.Key);
            _userInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
        }
Exemplo n.º 21
0
        public override void Initialize()
        {
            base.Initialize();
            _idSlot     = ContainerManagerComponent.Ensure <Container>("pda_entity_container", Owner, out var existed);
            _pdaLight   = Owner.GetComponent <PointLightComponent>();
            _appearance = Owner.GetComponent <AppearanceComponent>();
            _interface  = Owner.GetComponent <ServerUserInterfaceComponent>()
                          .GetBoundUserInterface(PDAUiKey.Key);
            _interface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
            var idCard          = _entityManager.SpawnEntity(_startingIdCard, Owner.Transform.GridPosition);
            var idCardComponent = idCard.GetComponent <IdCardComponent>();

            InsertIdCard(idCardComponent);
            UpdatePDAAppearance();
        }
        /// <summary>
        /// Called once per instance of this component. Gets references to any other components needed
        /// by this component and initializes it's UI and other data.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            _userInterface = Owner.GetComponent <ServerUserInterfaceComponent>()
                             .GetBoundUserInterface(ChemMasterUiKey.Key);
            _userInterface.OnReceiveMessage += OnUiReceiveMessage;

            _beakerContainer =
                ContainerManagerComponent.Ensure <ContainerSlot>($"{Name}-reagentContainerContainer", Owner);
            _powerReceiver = Owner.GetComponent <PowerReceiverComponent>();

            //BufferSolution = Owner.BufferSolution
            BufferSolution.Solution  = new Solution();
            BufferSolution.MaxVolume = ReagentUnit.New(1000);

            UpdateUserInterface();
        }
Exemplo n.º 23
0
 internal void DeactivateInterface(BoundUserInterface userInterface)
 {
     _activeInterfaces.Remove(userInterface);
 }
Exemplo n.º 24
0
 public override void Initialize()
 {
     base.Initialize();
     _userInterface           = Owner.GetComponent <ServerUserInterfaceComponent>().GetBoundUserInterface(InstrumentUiKey.Key);
     _userInterface.OnClosed += UserInterfaceOnClosed;
 }
Exemplo n.º 25
0
 internal void ActivateInterface(BoundUserInterface userInterface)
 {
     _activeInterfaces.Add(userInterface);
 }