예제 #1
0
        private void OnObjectMultiUseHandlerUse(Vector3Int _, Core.Appearances.ObjectInstance @object, int __)
        {
            _activeActionPanel.toggleComponent.isOn = true;

            Core.Game.ObjectMultiUseHandler.onUse = null;
            if (!@object)
            {
                Open();
                return;
            }

            var objectId = @object.Id;

            if (objectId < 100)
            {
                return;
            }

            var  objectAction = GetHotkeyActionForPanel <HotkeyObjectAction>(_activeActionPanel);
            bool firstAdd     = objectAction == null;

            if (firstAdd)
            {
                objectAction = new HotkeyObjectAction(@object.Type, UseActionTarget.CrossHair);
                SetHotketActionForPanel(_activeActionPanel, objectAction);

                _useWithCrosshairsToggle.toggle.isOn = true;
                _hotkeyTextInputField.interactable   = false;
                _autoSendCheckboxWrapper.DisableComponent();
            }
            else
            {
                objectAction.AppearanceType = @object.Type;
                if (@object.Type.IsMultiUse && objectAction.ActionTarget == UseActionTarget.Auto)
                {
                    objectAction.ActionTarget = UseActionTarget.CrossHair;
                }
                else if ([email protected] && objectAction.ActionTarget != UseActionTarget.Auto)
                {
                    objectAction.ActionTarget = UseActionTarget.Auto;
                }
            }

            if (objectAction.ActionTarget != UseActionTarget.Auto)
            {
                EnableObjectToggles();
            }
            else
            {
                DisableObjectToggles();
            }

            UpdateHotkeyPanelWithAction(_activeActionPanel, objectAction);
            if (!_objectInstance || _objectInstance.Id != objectAction.AppearanceType.Id)
            {
                _objectInstance = new Core.Appearances.ObjectInstance(objectAction.AppearanceType.Id, objectAction.AppearanceType, 0);
            }

            Open();
        }
예제 #2
0
        private void OnObjectMultiUseHandlerUse(Vector3Int _, Core.Appearances.ObjectInstance @object, int __)
        {
            Core.Game.ObjectMultiUseHandler.onUse = null;
            if (!@object)
            {
                OpenWindow();
                return;
            }

            var objectID = @object.ID;

            if (objectID < 100)
            {
                return;
            }

            var objectAction = GetHotkeyActionForPanel <HotkeyObjectAction>(m_ActiveActionPanel);

            if (objectAction == null)
            {
                objectAction = new HotkeyObjectAction(@object.Type, UseActionTarget.CrossHair);
                SetHotketActionForPanel(m_ActiveActionPanel, objectAction);

                EnableObjectToggles();

                m_ActiveActionPanel.textComponent.text = string.Format(TextUseWithCrosshairs, m_ActiveActionPanel.BaseText);
                m_UseWithCrosshairsToggle.toggle.isOn  = true;

                m_HotkeyTextInputField.interactable = false;
                m_AutoSendCheckboxWrapper.DisableComponent();
            }
            else
            {
                objectAction.AppearanceType = @object.Type;
            }

            if (!m_ObjectInstance || m_ObjectInstance.ID != objectAction.AppearanceType.ID)
            {
                m_ObjectInstance = new Core.Appearances.ObjectInstance(objectAction.AppearanceType.ID, objectAction.AppearanceType, 0);
            }

            OpenWindow();
        }