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

            case HeroTypes.String:
                break;

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

            case HeroTypes.LookupList:
                this.Indexer = new HeroType(stream);
                this.Values  = new HeroType(stream);
                break;

            default:
                return;
            }
        }
예제 #2
0
        public void SetVariable <T>(DefinitionId field, T value) where T : HeroAnyValue
        {
            int          variableId;
            Variable     variable;
            HeroFieldDef definition = field.Definition as HeroFieldDef;

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