예제 #1
0
        protected HeroType(OmegaStream stream)
        {
            Type = (HeroTypes)stream.ReadByte();
            switch (Type)
            {
            case HeroTypes.Enum:
            case HeroTypes.Class:
            case HeroTypes.NodeRef:
                Id = new DefinitionId(stream.ReadULong());
                break;

            case HeroTypes.List:
                Values = new HeroType(stream);
                break;

            case HeroTypes.LookupList:
                Indexer = new HeroType(stream);
                Values  = new HeroType(stream);
                break;
            }
        }
예제 #2
0
        public void SetVariable <T>(DefinitionId field, T value) where T : HeroAnyValue
        {
            int      variableId;
            Variable variable;
            var      definition = field.Definition as HeroFieldDef;

            if ((definition != null) && (definition.FieldType.Type != value.Type.Type))
            {
                throw new Exception("Type mismatch exception");
            }
            dictIdToVariable.TryGetValue(field.Id, out variable);
            if (variable != null)
            {
                variableId     = variable.VariableId;
                variable.Value = value;
            }
            else
            {
                variableId = GetNextId();
                variable   = new Variable(field, variableId, value);
                dictIdToVariable[field.Id] = variable;
                base.Add(variable);
            }
        }
예제 #3
0
 public Variable(DefinitionId field, int variableId, HeroAnyValue value)
 {
     Field      = field;
     VariableId = variableId;
     Value      = value;
 }