コード例 #1
0
        public BGIValue(ITree treein)
        {
            baseTree = treein;
            tree     = treein.GetChild(0);
            switch (treein.Text)
            {
            case "TYPEINT":
                Type = BurikoValueType.Int;
                break;

            case "TYPEHEX":
                Type = BurikoValueType.Int;
                break;

            case "TYPESTRING":
                Type = BurikoValueType.String;
                break;

            case "TYPEBOOL":
                Type = BurikoValueType.Bool;
                break;

            case "TYPENULL":
                Type = BurikoValueType.Null;
                break;

            case "TYPEFUNCTION":
                Type = BurikoValueType.Operation;
                break;

            case "TYPEVARIABLE":
                Type     = BurikoValueType.Variable;
                baseTree = tree;
                tree     = baseTree.GetChild(0);
                break;

            case "TYPEUNARY":
                Type = BurikoValueType.Unary;
                break;

            case "VAR":
                Type = BurikoValueType.Variable;
                break;
            }
            if (Type == BurikoValueType.None && IsMath(treein.Text))
            {
                Type = BurikoValueType.Math;
            }
        }
コード例 #2
0
        public BurikoVariable(BinaryReader stream)
        {
            Type = (BurikoValueType)stream.ReadInt16();
            switch (Type)
            {
            case BurikoValueType.Null:
                valueInt = -1;
                break;

            case BurikoValueType.Bool:
                valueInt = stream.ReadByte();
                break;

            case BurikoValueType.Int:
                valueInt = stream.ReadInt32();
                break;

            case BurikoValueType.String:
                valueString = stream.ReadString();
                break;

            case BurikoValueType.Variable:
                stream.BaseStream.Seek(-2L, SeekOrigin.Current);
                valueReference = ReadReference(stream);
                break;

            case BurikoValueType.Math:
            {
                BurikoMathType type = (BurikoMathType)stream.ReadInt16();
                BurikoVariable a    = new BurikoVariable(stream);
                BurikoVariable b    = new BurikoVariable(stream);
                Type     = BurikoValueType.Int;
                valueInt = PerformMath(type, a, b);
                break;
            }

            case BurikoValueType.Operation:
                valueVariable = BurikoScriptSystem.Instance.GetCurrentScript().ExecuteOperation((BurikoOperations)stream.ReadInt16());
                break;

            default:
                throw new NotImplementedException("BurikoVariable: Unhandled BurikoValueType " + Type);
            }
        }
コード例 #3
0
 public BurikoVariable(BurikoReference reference, BurikoVariable variable)
 {
     Type           = BurikoValueType.Variable;
     valueReference = reference;
     valueVariable  = variable;
 }
コード例 #4
0
 public BurikoVariable(int i)
 {
     Type     = BurikoValueType.Int;
     valueInt = i;
 }
コード例 #5
0
 public BurikoVariable(string s)
 {
     Type        = BurikoValueType.String;
     valueString = s;
 }
コード例 #6
0
 public BurikoVariable()
 {
     Type = BurikoValueType.Null;
 }