Пример #1
0
 public static bool Read(this ViStringIStream IS, out LogicAuraProperty value)
 {
     value = default(LogicAuraProperty);
     if (IS.Read(out value.SpellID) == false)
     {
         return(false);
     }
     if (IS.Read(out value.EffectIdx) == false)
     {
         return(false);
     }
     if (IS.Read(out value.EndTime) == false)
     {
         return(false);
     }
     if (IS.Read(out value.CastorValue) == false)
     {
         return(false);
     }
     if (IS.Read(out value.Value) == false)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
    public static bool Read <TEntity>(ViStringIStream IS, out TEntity value) where TEntity : ViEntity
    {
        value = default(TEntity);
        ViEntityID ID;

        if (IS.Read(out ID) == false)
        {
            return(false);
        }
        value = EntityNameger.GetEntity <TEntity>(ID);
        return(true);
    }
Пример #3
0
    static bool ReadInt32Field(ViStringIStream IS, FieldInfo field, ref object data)
    {
        Int32 value;

        if (IS.Read(out value))
        {
            field.SetValue(data, value);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Пример #4
0
    public static bool Read(this ViStringIStream IS, out List <string> list)
    {
        ViArrayIdx size;

        IS.Read(out size);
        list = new List <string>((int)size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            string value;
            if (IS.Read(out value) == false)
            {
                return(false);
            }
            list.Add(value);
        }
        return(true);
    }
Пример #5
0
 public static bool Read(this ViStringIStream IS, out ViVector3 value)
 {
     value = ViVector3.ZERO;
     if (IS.Read(out value.x) == false)
     {
         return(false);
     }
     if (IS.Read(out value.y) == false)
     {
         return(false);
     }
     if (IS.Read(out value.z) == false)
     {
         return(false);
     }
     return(true);
 }
Пример #6
0
    static bool ReadStructInt32Field(ViStringIStream IS, FieldInfo field, ref object data)
    {
        object obj = field.GetValue(data);

        FieldInfo[] fieldList = obj.GetType().GetFields(BindingFlag);
        ViDebuger.AssertError(fieldList.Length == 1);
        Int32 value;

        if (IS.Read(out value))
        {
            fieldList[0].SetValue(obj, value);
            field.SetValue(data, obj);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Пример #7
0
    public static bool Read <TEntity>(ViStringIStream IS, out List <TEntity> list) where TEntity : ViEntity
    {
        list = null;
        ViArrayIdx size;

        if (IS.Read(out size) == false)
        {
            return(false);
        }
        list = new List <TEntity>();
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            TEntity value;
            if (Read(IS, out value))
            {
                return(false);
            }
            list.Add(value);
        }
        return(true);
    }
Пример #8
0
 public static bool Read(this ViStringIStream IS, out LogicAuraValueArray value)
 {
     value = default(LogicAuraValueArray);
     if (IS.Read(out value.Element0) == false)
     {
         return(false);
     }
     if (IS.Read(out value.Element1) == false)
     {
         return(false);
     }
     if (IS.Read(out value.Element2) == false)
     {
         return(false);
     }
     if (IS.Read(out value.Element3) == false)
     {
         return(false);
     }
     return(true);
 }
Пример #9
0
    public static bool Read(this ViStringIStream IS, out List <LogicAuraProperty> list)
    {
        list = null;
        ViArrayIdx size;

        if (IS.Read(out size) == false)
        {
            return(false);
        }
        list = new List <LogicAuraProperty>((int)size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            LogicAuraProperty value;
            if (IS.Read(out value) == false)
            {
                return(false);
            }
            list.Add(value);
        }
        return(true);
    }
Пример #10
0
 public static bool Read(this ViStringIStream IS, out List <ViGameUnit> list)
 {
     return(ViEntitySerialize.Read(IS, out list));
 }
Пример #11
0
 public static bool Read(this ViStringIStream IS, out ViGameUnit value)
 {
     return(ViEntitySerialize.Read(IS, out value));
 }
Пример #12
0
 public static bool Read <T>(this ViStringIStream iStream, out ViRPCCallback <T> callback)
 {
     ViDebuger.Warning("ViRPCCallback: not stringlize");
     callback = null;
     return(false);
 }
Пример #13
0
 public static bool Read <T>(ViStringIStream IS, out T obj)
     where T : class, new()
 {
     obj = new T();
     return(Read(IS, obj));
 }
Пример #14
0
 static bool Read(ViStringIStream IS, object obj)
 {
     FieldInfo[] fieldList = ViSealedDataAssisstant.GetFeilds(obj.GetType());
     foreach (FieldInfo field in fieldList)
     {
         if (field.FieldType.Equals(typeof(Int32)))
         {
             if (ReadInt32Field(IS, field, ref obj) == false)
             {
                 return(false);
             }
         }
         else if (field.FieldType.Equals(typeof(String)))
         {
             if (ReadStringField(IS, field, ref obj) == false)
             {
                 return(false);
             }
         }
         else if (field.FieldType.Name.StartsWith("ViMask32"))
         {
             if (ReadStructInt32Field(IS, field, ref obj) == false)
             {
                 return(false);
             }
         }
         else if (field.FieldType.Name.StartsWith("ViEnum32"))
         {
             if (ReadStructInt32Field(IS, field, ref obj) == false)
             {
                 return(false);
             }
         }
         else if (field.FieldType.Name.StartsWith("ViForeignKey32"))
         {
             if (ReadStructInt32Field(IS, field, ref obj) == false)
             {
                 return(false);
             }
         }
         else if (field.FieldType.Name.StartsWith("ViStaticArray"))
         {
             object fieldObject = field.GetValue(obj);
             int    len         = ViArrayParser.Length(fieldObject);
             for (int idx = 0; idx < len; ++idx)
             {
                 object elementObject = ViArrayParser.Object(fieldObject, idx);
                 if (Read(IS, elementObject) == false)
                 {
                     return(false);
                 }
                 field.SetValue(obj, fieldObject);
             }
         }
         else
         {
             object fieldObject = field.GetValue(obj);
             if (Read(IS, fieldObject) == false)
             {
                 return(false);
             }
             field.SetValue(obj, fieldObject);
         }
     }
     return(true);
 }