Ejemplo n.º 1
0
 public static void Read(this ViIStream IS, out LogicAuraValueArray value)
 {
     IS.Read(out value.Element0);
     IS.Read(out value.Element1);
     IS.Read(out value.Element2);
     IS.Read(out value.Element3);
 }
Ejemplo n.º 2
0
 public static void Read(this ViIStream IS, out LogicAuraProperty value)
 {
     IS.Read(out value.SpellID);
     IS.Read(out value.EffectIdx);
     IS.Read(out value.EndTime);
     IS.Read(out value.CastorValue);
     IS.Read(out value.Value);
 }
Ejemplo n.º 3
0
    public void OnGameStart(ViIStream IS)
    {
        Int64 time1970       = 0;
        Int64 timeAccumulate = 0;

        IS.Read(out time1970);
        IS.Read(out timeAccumulate);
        OnGameStartExecer(time1970, timeAccumulate);
    }
Ejemplo n.º 4
0
    public void OnEntityMessage(ViIStream IS)
    {
        UInt16 msgID = 0;

        IS.Read(out msgID);
        UInt64 types = 0;

        IS.Read(out types);
        OnSelfMessageExecer(msgID, types, IS);
    }
Ejemplo n.º 5
0
    public static void Read(this ViIStream IS, out List <LogicAuraValueArray> list)
    {
        ViArrayIdx size;

        IS.Read(out size);
        list = new List <LogicAuraValueArray>((int)size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            LogicAuraValueArray value;
            IS.Read(out value);
            list.Add(value);
        }
    }
Ejemplo n.º 6
0
    public static void Read(this ViIStream IS, out List <UInt16> list)
    {
        ViArrayIdx size;

        IS.Read(out size);
        list = new List <UInt16>((int)size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            UInt16 value;
            IS.Read(out value);
            list.Add(value);
        }
    }
Ejemplo n.º 7
0
    public static void Read(this ViIStream IS, out List <VisualAuraProperty> list)
    {
        ViArrayIdx size;

        IS.Read(out size);
        list = new List <VisualAuraProperty>((int)size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            VisualAuraProperty value;
            IS.Read(out value);
            list.Add(value);
        }
    }
Ejemplo n.º 8
0
    public void OnExecACK(ViIStream IS)
    {
        ViEntityID entityID;
        UInt16     funcID;

        IS.Read(out entityID);
        IS.Read(out funcID);
        ViRPCExecer execer;

        if (_execerList.TryGetValue(entityID, out execer))
        {
            execer.Entity.RPC.ACK.Ack(funcID);
        }
    }
Ejemplo n.º 9
0
    public void OnGameTime(ViIStream IS)
    {
        Int64 timeAccumulate = 0;

        IS.Read(out timeAccumulate);
        OnGameTimeExecer(timeAccumulate);
    }
Ejemplo n.º 10
0
 public new void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
 {
     if (MatchChannel(channelMask))
     {
         IS.Read(out _value);
     }
 }
Ejemplo n.º 11
0
    public void OnEntityEmerge(ViIStream IS)
    {
        if (!OtherEntityShow)
        {
            return;
        }
        ViEntityID entityID;

        IS.Read(out entityID);
        ViEntityTypeID typeID = ViEntityType.Type(entityID);
        ViEntityType   type;

        if (ViEntityCreator.List.TryGetValue(typeID, out type))
        {
            ViRPCExecer execer = type.Create();
            _execerList[entityID] = execer;
            UInt16 channelMask = OTHER_PROPERTY_MASK;
            execer.Start(entityID, EntityManager, channelMask, IS);
            execer.Entity.RPC.Net = _net;
            if (OnEntityEnterExecer != null)
            {
                OnEntityEnterExecer(execer);
            }
        }
    }
Ejemplo n.º 12
0
    public new void OnPropertyUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
    {
        UInt16 slot;

        IS.Read(out slot);
        OnUpdate(slot, channel, IS, entity);
    }
Ejemplo n.º 13
0
    public static void Read(this ViIStream IS, out ViEntity value)
    {
        ViEntityID ID;

        IS.Read(out ID);
        value = EntityNameger.GetEntity(ID);
    }
Ejemplo n.º 14
0
    public static void Read <TEntity>(ViIStream IS, out TEntity value) where TEntity : ViEntity
    {
        ViEntityID ID;

        IS.Read(out ID);
        value = EntityNameger.GetEntity <TEntity>(ID);
    }
Ejemplo n.º 15
0
 public override void OnUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
 {
     if (MatchChannel(channel))
     {
         double oldValue = _value;
         IS.Read(out _value);
         OnUpdateInvoke(oldValue);
     }
 }
Ejemplo n.º 16
0
    public void _OnLoginResult(ViIStream IS)
    {
        UInt8 result;

        IS.Read(out result);
        if (OnLoginResult != null)
        {
            OnLoginResult(result);
        }
    }
Ejemplo n.º 17
0
    //
    public override void OnUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
    {
        if (!MatchChannel(channel))
        {
            return;
        }
        ViOperatorIdx op;

        IS.Read(out op);
        switch ((ViDataArrayOperator)op)
        {
        case ViDataArrayOperator.INSERT:
        {
            TReceiveKey key = new TReceiveKey();
            key.Read(IS);
            ViDebuger.AssertWarning(!_array.ContainsKey(key));
            //
            ViReceiveDataSetNode <TReceiveKey> newNode = new ViReceiveDataSetNode <TReceiveKey>();
            AttachWatcher(key, newNode, entity);
            _array[key] = newNode;
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.INSERT, key);
        }
        break;

        case ViDataArrayOperator.DEL:
        {
            TReceiveKey key = new TReceiveKey();
            key.Read(IS);
            ViDebuger.AssertWarning(_array.ContainsKey(key));
            //
            ViReceiveDataSetNode <TReceiveKey> node = _array[key];
            _array.Remove(key);
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.DEL, key);
            DetachWatcher(key, node, entity);
        }
        break;

        case ViDataArrayOperator.CLEAR:
            foreach (KeyValuePair <TReceiveKey, ViReceiveDataSetNode <TReceiveKey> > pair in _array)
            {
                ViReceiveDataSetNode <TReceiveKey> node = pair.Value;
                DetachWatcher(pair.Key, node, entity);
            }
            _array.Clear();
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.CLEAR, default(TReceiveKey));
            break;

        default:
            break;
        }
    }
Ejemplo n.º 18
0
    public static bool Read <T>(this ViIStream iStream, out ViRPCCallback <T> callback)
    {
        callback = new ViRPCCallback <T>();
        UInt32 CBID;

        if (!iStream.Read(out CBID))
        {
            return(false);
        }
        callback.ID = CBID;
        return(true);
    }
Ejemplo n.º 19
0
    public static void Read <TEntity>(ViIStream IS, out List <TEntity> list) where TEntity : ViEntity
    {
        ViArrayIdx size;

        IS.Read(out size);
        list = new List <TEntity>();
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            TEntity value;
            Read(IS, out value);
            list.Add(value);
        }
    }
Ejemplo n.º 20
0
    static bool ReadArray(ViIStream IS, FieldInfo field, ref object data)
    {
        object fieldObject = field.GetValue(data);
        int    len         = ViArrayParser.Length(fieldObject);

        for (int idx = 0; idx < len; ++idx)
        {
            object elementObject = ViArrayParser.Object(fieldObject, idx);
            if (elementObject.GetType().Equals(typeof(Int32)))
            {
                Int32 value;
                if (IS.Read(out value) == false)
                {
                    return(false);
                }
                ViArrayParser.SetObject(fieldObject, idx, value);
            }
            else if (elementObject.GetType().Equals(typeof(String)))
            {
                string value;
                if (IS.Read(out value) == false)
                {
                    return(false);
                }
                ViArrayParser.SetObject(fieldObject, idx, elementObject);
            }
            else
            {
                if (Read(IS, elementObject) == false)
                {
                    return(false);
                }
                ViArrayParser.SetObject(fieldObject, idx, elementObject);
            }
        }
        field.SetValue(data, fieldObject);
        return(true);
    }
Ejemplo n.º 21
0
    static bool ReadInt32Field(ViIStream IS, FieldInfo field, ref object data)
    {
        Int32 value;

        if (IS.Read(out value))
        {
            field.SetValue(data, value);
            return(true);
        }
        else
        {
            return(false);
        }
    }
Ejemplo n.º 22
0
    public void OnEntityPropertyUpdate(UInt8 channel, ViIStream IS)
    {
        ViEntityID entityID;

        IS.Read(out entityID);
        ViRPCExecer execer;

        if (_execerList.TryGetValue(entityID, out execer))
        {
            execer.OnPropertyUpdateStart(channel);
            while (IS.RemainLength > 0)
            {
                execer.OnPropertyUpdate(channel, IS);
            }
            execer.OnPropertyUpdateEnd(channel);
        }
    }
Ejemplo n.º 23
0
    public new void Start(UInt8 channel, ViIStream IS, ViEntity entity)
    {
        if (!MatchChannel(channel))
        {
            return;
        }
        ViArrayIdx size;

        IS.Read(out size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            TReceiveKey key = new TReceiveKey();
            key.Read(IS);
            ViReceiveDataSetNode <TReceiveKey> newNode = new ViReceiveDataSetNode <TReceiveKey>();
            AttachWatcher(key, newNode, entity);
            _array[key] = newNode;
        }
    }
Ejemplo n.º 24
0
    public void OnSelfEntity(UInt16 funcID, ViIStream IS)
    {
        ViEntityID entityID;

        IS.Read(out entityID);
        ViEntityTypeID typeID = ViEntityType.Type(entityID);
        ViEntityType   type;

        if (ViEntityCreator.List.TryGetValue(typeID, out type))
        {
            ViRPCExecer execer = type.Create();
            _execerList[entityID] = execer;
            UInt16 channelMask = SELF_PROPERTY_MASK;
            execer.Start(entityID, EntityManager, channelMask, IS);
            execer.Entity.RPC.Net = _net;
            ViDebuger.AssertError(OnSelfCreatedExecer != null);
            OnSelfCreatedExecer(execer);
        }
    }
Ejemplo n.º 25
0
    static bool ReadStructInt32Field(ViIStream 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);
        }
    }
Ejemplo n.º 26
0
    public void OnEntityVanish(ViIStream IS)
    {
        if (!OtherEntityShow)
        {
            return;
        }
        ViEntityID entityID;

        IS.Read(out entityID);
        ViRPCExecer execer;

        if (_execerList.TryGetValue(entityID, out execer))
        {
            if (OnEntityLeaveExecer != null)
            {
                OnEntityLeaveExecer(execer);
            }
            execer.End(EntityManager);
            _execerList.Remove(entityID);
        }
    }
Ejemplo n.º 27
0
    public new void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
    {
        if (!MatchChannel(channelMask))
        {
            return;
        }
        ViArrayIdx size;

        IS.Read(out size);
        _array.Capacity = (int)size;
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            TReceiveData property = new TReceiveData();
            property.StartByArray();
            property.Start(channelMask, IS, entity);
            property.Parent = this;
            ViReceiveDataArrayNode <TReceiveData> newNode = new ViReceiveDataArrayNode <TReceiveData>();
            newNode.Property = property;
            AttachWatcher(newNode, entity);
            _array.Add(newNode);
        }
    }
Ejemplo n.º 28
0
    public new void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
    {
        if (!MatchChannel(channelMask))
        {
            return;
        }
        ViArrayIdx size;

        IS.Read(out size);
        for (ViArrayIdx idx = 0; idx < size; ++idx)
        {
            TReceiveKey key = new TReceiveKey();
            key.Read(IS);
            TReceiveData property = new TReceiveData();
            property.StartByArray();
            property.Start(channelMask, IS, entity);
            property.Parent = this;
            ViReceiveDataDictionaryNode <TReceiveKey, TReceiveData> newNode = new ViReceiveDataDictionaryNode <TReceiveKey, TReceiveData>();
            newNode.Property = property;
            AttachWatcher(key, newNode, entity);
            _array[key] = newNode;
        }
    }
Ejemplo n.º 29
0
 public static void Read(this ViIStream IS, out ViVector3 value)
 {
     IS.Read(out value.x);
     IS.Read(out value.y);
     IS.Read(out value.z);
 }
Ejemplo n.º 30
0
    //
    public override void OnUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
    {
        if (!MatchChannel(channel))
        {
            return;
        }
        ViOperatorIdx op;

        IS.Read(out op);
        switch ((ViDataArrayOperator)op)
        {
        case ViDataArrayOperator.ADD_BACK:
        {
            TReceiveData property = new TReceiveData();
            property.StartByArray();
            property.Start(channel, IS, entity);
            property.Parent = this;
            ViReceiveDataArrayNode <TReceiveData> newNode = new ViReceiveDataArrayNode <TReceiveData>();
            newNode.Property = property;
            AttachWatcher(newNode, entity);
            _array.Add(newNode);
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.ADD_BACK, property);
        }
        break;

        case ViDataArrayOperator.ADD_FRONT:
        {
            TReceiveData property = new TReceiveData();
            property.StartByArray();
            property.Start(channel, IS, entity);
            property.Parent = this;
            ViReceiveDataArrayNode <TReceiveData> newNode = new ViReceiveDataArrayNode <TReceiveData>();
            newNode.Property = property;
            AttachWatcher(newNode, entity);
            _array.Insert(0, newNode);
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.ADD_FRONT, property);
        }
        break;

        case ViDataArrayOperator.INSERT:
        {
            ViArrayIdx idx;
            IS.Read(out idx);
            ViDebuger.AssertWarning(idx <= _array.Count);
            if (idx <= _array.Count)
            {
                TReceiveData property = new TReceiveData();
                property.StartByArray();
                property.Start(channel, IS, entity);
                property.Parent = this;
                ViReceiveDataArrayNode <TReceiveData> newNode = new ViReceiveDataArrayNode <TReceiveData>();
                newNode.Property = property;
                AttachWatcher(newNode, entity);
                _array.Insert(idx, newNode);
                OnUpdateInvoke(null);
                _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.INSERT, property);
            }
        }
        break;

        case ViDataArrayOperator.DEL:
        {
            ViArrayIdx idx;
            IS.Read(out idx);
            ViDebuger.AssertWarning(idx < _array.Count);
            if (idx < _array.Count)
            {
                ViReceiveDataArrayNode <TReceiveData> node = _array[idx];
                _array.RemoveAt(idx);
                OnUpdateInvoke(node.Property);
                _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.DEL, node.Property);
                DetachWatcher(node, entity);
                node.Property.End(entity);
                node.Property.Clear();
            }
        }
        break;

        case ViDataArrayOperator.MOD:
        {
            ViArrayIdx idx;
            IS.Read(out idx);
            ViDebuger.AssertWarning(idx < _array.Count);
            if (idx < _array.Count)
            {
                ViReceiveDataArrayNode <TReceiveData> node = _array[idx];
                UInt16 slot;
                while (IS.Read(out slot) && slot != END_SLOT)
                {
                    node.Property.OnUpdate(slot, channel, IS, entity);
                }
                _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.MOD, node.Property);
                if (node.Watcher != null)
                {
                    node.Watcher.OnUpdate(node.Property, entity);
                }
            }
        }
        break;

        case ViDataArrayOperator.CLEAR:
            foreach (ViReceiveDataArrayNode <TReceiveData> node in _array)
            {
                DetachWatcher(node, entity);
                node.Property.End(entity);
                node.Property.Clear();
            }
            _array.Clear();
            OnUpdateInvoke(null);
            _updateArrayCallbackList.Invoke((UInt32)ViDataArrayOperator.CLEAR, null);
            break;

        default:
            break;
        }
    }