Example #1
0
 void Start()
 {
     instance = this;
     backgroundClickContainer.SetActive(false);
     backgroundClickContainer.GetComponent <Button>().onClick.AddListener(() => HideAdjuster());
     lineUpButton.onClick.AddListener(() => ShiftLineUp(currentLine));
     lineDownButton.onClick.AddListener(() => ShiftLineDown(currentLine));
     lineDeleteButton.onClick.AddListener(() => PromptDeleteCurrentCodeLine());
     instance.confirmDialogObj.AddConfirmListener(() => DeleteCurrentCodeLine());
 }
Example #2
0
    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);
    }