Exemple #1
0
    public static void DeregisterAsLabelSlot(Button lblSlot)
    {
        if (!instance.buttonToDelegateMap.ContainsKey(lblSlot))
        {
            return;
        }
        HighlightAsLabelSlot temp = instance.buttonToDelegateMap[lblSlot];

        if (temp != null)
        {
            instance.registerSlotHighlighter -= temp;
        }
    }
Exemple #2
0
    public static void RegisterAsLabelSlot(CodeLine line, Button labelSlot, Text labelText)
    {
        HighlightAsLabelSlot temp = (string label, Color c) =>
        {
            labelText.color = c;
            labelSlot.onClick.AddListener(() =>
            {
                line.SetLabel(label);
                LabelPanelManager.ClearLabelHighlighting();
            });
        };

        instance.buttonToDelegateMap.Add(labelSlot, temp);
        instance.registerSlotHighlighter += temp;
        instance.disableHighlighting     += (Color n) =>
        {
            labelSlot.onClick.RemoveAllListeners();
            labelText.color = n;
        };
    }
Exemple #3
0
    public static void RegisterAsLabelSlot(CodeLine line, Button labelSlot, Text labelText, int operandIndex)
    {
        HighlightAsLabelSlot temp = (string label, Color c) =>
        {
            labelText.color = c;
            labelSlot.onClick.AddListener(() =>
            {
                Label r = new Label(label);
                switch (operandIndex)
                {
                case 0:
                    line.setOperand1(r);
                    break;

                case 1:
                    line.setOperand2(r);
                    break;

                case 2:
                    line.setOperand3(r);
                    break;

                default:
                    break;
                }
                LabelPanelManager.ClearLabelHighlighting();
            });
        };

        instance.buttonToDelegateMap.Add(labelSlot, temp);
        instance.registerSlotHighlighter += temp;
        instance.disableHighlighting     += (Color n) =>
        {
            labelSlot.onClick.RemoveAllListeners();
            labelText.color = n;
        };
    }