Example #1
0
    public void SubmitSelection()
    {
        string selection = dropdown.options[dropdown.value].text;

        EffectData        data    = EffectData.GetEffectDataByName(selection);
        EffectBuilderItem newNode = data != null
            ? new EffectBuilderItem(data)
            : null;

        // handling for enums
        if (currentCompilerNode != null)
        {
            string typeString = currentFieldData.returnType.ToString();
            if (typeString.StartsWith("ENUM"))
            {
                EnumRepesentation enumRepesentation            = EnumRepesentation.EnumLookup(typeString);
                Instruction       enumInstruction              = enumRepesentation.getInstruction();
                EffectData        effectDataForEnumInstruction = EffectData.GetEffectDataByInstruction(enumInstruction);
                EffectBuilderItem compilerNode = new EffectBuilderItem(effectDataForEnumInstruction);
                currentCompilerNode.Add(compilerNode);
                byte enumValue = (byte)enumRepesentation.getIndex(selection);
                compilerNode.Add(new EffectBuilderItem(new List <byte> {
                    enumValue
                }));
                Next();
                return;
            }
            else if (newNode != null)
            {
                currentCompilerNode.Add(newNode);
            }
        }

        if (newNode != null)
        {
            currentCompilerNode = newNode;
        }
        Next();
    }