new void Start()
 {
     base.Start();
     instance            = this;
     panel               = GetComponentInChildren <GridLayoutGroup>();
     buttonToDelegateMap = new Dictionary <Button, HighlightAsImmediateSlot>();
     RefreshPanel();
 }
 public void cleanup()
 {
     for (int i = 0; i < 3; i++)
     {
         Button opBtn = getButtonForOperandIndex(i);
         RegisterPanelManager.DeregisterAsRegisterSlot(opBtn);
         LabelPanelManager.DeregisterAsLabelSlot(opBtn);
         ImmediatePanelManager.DeregisterAsImmediateSlot(opBtn);
     }
 }
    public CodeLine setupLine(OpcodeRepository.OPCODE code)
    {
        instr.code = code;
        if (instrText != null)
        {
            instrText.text = code.ToString();
        }
        lineAdjustButton.onClick.AddListener(() => LineAdjuster.ShowAdjusterForLine(this));

        //Register each of the operands to their appropriate listeners.
        for (int i = 0; i < 3; i++)
        {
            if (OpcodeRepository.indexUnused(code, i))
            {
                disableOperandText(i);
                continue;
            }
            if (OpcodeRepository.canPlaceRegister(code, i))
            {
                RegisterPanelManager.RegisterAsRegisterSlot(this, getButtonForOperandIndex(i), getTextForOperandIndex(i), i);
                getTextForOperandIndex(i).text = "register";
            }
            if (OpcodeRepository.canPlaceImmediate(code, i))
            {
                ImmediatePanelManager.RegisterAsRegisterSlot(this, getButtonForOperandIndex(i), getTextForOperandIndex(i), i);
                getTextForOperandIndex(i).text = "immediate";
            }
            if (OpcodeRepository.canPlaceLabel(code, i))
            {
                LabelPanelManager.RegisterAsLabelSlot(this, getButtonForOperandIndex(i), getTextForOperandIndex(i), i);
                getTextForOperandIndex(i).text = "label";
            }

            //TOOD add in the ability to place memory locations
        }
        LabelPanelManager.RegisterAsLabelSlot(this, labelButton, labelText);
        return(this);
    }