Exemplo n.º 1
0
        private void IconClicked(EditorPartIcon icon, EditorIconEvents.EditorIconClickEvent evt)
        {
            Log.Info("IconClicked");
            if (!ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.primary) && !ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.secondary))
            {
                return;
            }

            Log.Info("Icon was clicked for " + icon.partInfo.name + " (" + icon.partInfo.title + "), icon.name: " + icon.name);

            _icon = icon;
            ShowPruneMenu();

            evt.Veto(); // prevent part from being spawned
        }
Exemplo n.º 2
0
            private void Start()
            {
                _button = GetComponent <Button>();
                _originalClickHandler = GetComponent <PointerClickHandler>();
                _icon = GetComponent <EditorPartIcon>();


                if (_button == null || _originalClickHandler == null || _icon == null)
                {
                    Log.Error("Couldn't find an expected component");
                    Destroy(this);
                    return;
                }

                _originalClickHandler.enabled = false; // we'll be managing these events instead

                // unhook EditorPartIcon's listener from the button
                // this will allow us to veto any clicks
                _button.onClick.RemoveListener(_icon.MouseInput_SpawnPart);
            }
Exemplo n.º 3
0
        private void IconHover(EditorPartIcon icon, bool hover)
        {
            Log.Info("IconHover,  ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.primary): " + ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.primary).ToString());
            if (HighLogic.CurrentGame.Parameters.CustomParams <JanitorsClosetSettings>().showMod ||
                ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.primary) || ExtendedInput.GetKey(GameSettings.MODIFIER_KEY.secondary))
            {
                string mod = ModFilterWindow.FindPartMod(icon.partInfo);

                drawTooltip = true;
                if (hover)
                {
                    tooltip = mod;
                }
                else
                {
                    tooltip = "";
                }
            }
            else
            {
                tooltip = "";
            }
        }
Exemplo n.º 4
0
 void Start()
 {
     GetComponent <UIButton>().AddInputDelegate(new EZInputDelegate(OnInput));
     editorPaction = GetComponent <EditorPartIcon>();
 }
Exemplo n.º 5
0
 private static void InstallReplacementHandler(EditorPartIcon icon)
 {
     icon.gameObject.AddComponent <ReplacementClickHandler>();
 }
Exemplo n.º 6
0
 void Start()
 {
     GetComponent<UIButton>().AddInputDelegate(new EZInputDelegate(OnInput));
     editorPaction = GetComponent<EditorPartIcon>();
 }
Exemplo n.º 7
0
 /// <summary>Registers click handlers on the editor's category icon.</summary>
 void Start()
 {
     // Getting components is not a cheap operation so, cache anything we can.
       partIcon = GetComponent<EditorPartIcon>();
 }