Exemple #1
0
    public void OnUpdate(Index slot, UInt8 channel, ViIStream IS, ViEntity entity)
    {
        ViDebuger.AssertError(slot < _updateSlots.Count);
        ViReceiveDataNode data = _updateSlots[slot];

        ViDebuger.AssertError(data);
        if (OnIndexPropertyUpdate != null)
        {
            Index idx = 0;
            if (_slotToIndex.TryGetValue(slot, out idx))
            {
                ViReceiveDataInt32 dataInt32 = data as ViReceiveDataInt32;
                Int32 oldValue = dataInt32.Value;
                data.OnUpdate(channel, IS, entity);
                OnIndexPropertyUpdate(idx, dataInt32, oldValue);
            }
            else
            {
                data.OnUpdate(channel, IS, entity);
            }
        }
        else
        {
            data.OnUpdate(channel, IS, entity);
        }
    }
Exemple #2
0
    public void OnGameTime(ViIStream IS)
    {
        Int64 timeAccumulate = 0;

        IS.Read(out timeAccumulate);
        OnGameTimeExecer(timeAccumulate);
    }
Exemple #3
0
    bool UpdateStream(out UInt16 flag, out ViIStream IS)
    {
        flag = 0;
        IS   = null;
        NetworkStream stream = _client.GetStream();

        if (_receiver.Size == 0)
        {
            if (_client.Available < RECEIVE_HEAD_SIZE)
            {
                return(false);
            }
            SetConnectState(true);
            int    bufferSize = stream.Read(_receiveHead, 0, RECEIVE_HEAD_SIZE);
            UInt16 flag_      = ViBitConverter.ToUInt16(_receiveHead, 0);
            UInt32 size       = ViBitConverter.ToUInt32(_receiveHead, RECEIVE_SIZE_OFFSET);
            _receiver.SetCompleteSize(flag_, size);
        }
        _receiver.Read(stream);
        if (_receiver.IsComplete == false)
        {
            return(false);
        }
        _IS.Init(_receiver.Data, _receiver.Size);
        _receiver.Clear();
        IS = _IS;
        return(true);
    }
Exemple #4
0
    public static void Read(this ViIStream IS, out ViEntity value)
    {
        ViEntityID ID;

        IS.Read(out ID);
        value = EntityNameger.GetEntity(ID);
    }
Exemple #5
0
    public new void OnPropertyUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
    {
        UInt16 slot;

        IS.Read(out slot);
        OnUpdate(slot, channel, IS, entity);
    }
Exemple #6
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);
    }
Exemple #7
0
 public new void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
 {
     if (MatchChannel(channelMask))
     {
         IS.Read(out _value);
     }
 }
Exemple #8
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);
            }
        }
    }
Exemple #9
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);
 }
Exemple #10
0
 public override void OnUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
 {
     if (MatchChannel(channel))
     {
         OnUpdateInvoke(null);
     }
 }
Exemple #11
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);
 }
Exemple #12
0
 public override void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
 {
     SpellID.Start(channelMask, IS, entity);
     SpellID.Parent = this;
     EffectIdx.Start(channelMask, IS, entity);
     EffectIdx.Parent = this;
     EndTime.Start(channelMask, IS, entity);
     EndTime.Parent = this;
 }
Exemple #13
0
 public new void StartProperty(UInt16 channelMask, ViIStream IS, ViEntity entity)
 {
     base.StartProperty(channelMask, IS, entity);
     ActionState.Start(channelMask, IS, entity);
     MoveState.Start(channelMask, IS, entity);
     AuraState.Start(channelMask, IS, entity);
     VisualAuraPropertyList.Start(channelMask, IS, entity);
     LogicAuraPropertyList.Start(channelMask, IS, entity);
 }
 public override void OnMessage(UInt16 funcIdx, ViIStream IS)
 {
     switch ((ViGameUnitClientMethod)funcIdx)
     {
     default:
         base.OnMessage(funcIdx, IS);
         break;
     }
 }
Exemple #15
0
 public override void OnUpdate(UInt8 channel, ViIStream IS, ViEntity entity)
 {
     if (MatchChannel(channel))
     {
         double oldValue = _value;
         IS.Read(out _value);
         OnUpdateInvoke(oldValue);
     }
 }
Exemple #16
0
    public void OnGameStart(ViIStream IS)
    {
        Int64 time1970       = 0;
        Int64 timeAccumulate = 0;

        IS.Read(out time1970);
        IS.Read(out timeAccumulate);
        OnGameStartExecer(time1970, timeAccumulate);
    }
Exemple #17
0
    public void OnEntityMessage(ViIStream IS)
    {
        UInt16 msgID = 0;

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

        IS.Read(out types);
        OnSelfMessageExecer(msgID, types, IS);
    }
Exemple #18
0
    public void _OnLoginResult(ViIStream IS)
    {
        UInt8 result;

        IS.Read(out result);
        if (OnLoginResult != null)
        {
            OnLoginResult(result);
        }
    }
Exemple #19
0
 public override void Start(UInt16 channelMask, ViIStream IS, ViEntity entity)
 {
     Element0.Start(channelMask, IS, entity);
     Element0.Parent = this;
     Element1.Start(channelMask, IS, entity);
     Element1.Parent = this;
     Element2.Start(channelMask, IS, entity);
     Element2.Parent = this;
     Element3.Start(channelMask, IS, entity);
     Element3.Parent = this;
 }
Exemple #20
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;
        }
    }
Exemple #21
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);
    }
Exemple #22
0
 static bool Read(ViIStream 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.IsGenericType)
             {
                 field.FieldType.GetGenericTypeDefinition();
                 if (field.FieldType.GetGenericTypeDefinition() == ViStaticArrayType)
                 {
                     if (ReadArray(IS, field, ref obj) == false)
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     if (ReadStructInt32Field(IS, field, ref obj) == false)
                     {
                         return(false);
                     }
                 }
             }
             else
             {
                 object fieldObject = field.GetValue(obj);
                 if (Read(IS, fieldObject) == false)
                 {
                     return(false);
                 }
                 field.SetValue(obj, fieldObject);
             }
         }
     }
     return(true);
 }
Exemple #23
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);
        }
    }
Exemple #24
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);
        }
    }
Exemple #25
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);
        }
    }
Exemple #26
0
 public override void Start(UInt8 channel, ViIStream IS, ViEntity entity)
 {
     SpellID.Start(channel, IS, entity);
     SpellID.Parent = this;
     EffectIdx.Start(channel, IS, entity);
     EffectIdx.Parent = this;
     EndTime.Start(channel, IS, entity);
     EndTime.Parent = this;
     CastorValue.Start(channel, IS, entity);
     CastorValue.Parent = this;
     Value.Start(channel, IS, entity);
     Value.Parent = this;
 }
Exemple #27
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);
        }
    }
Exemple #28
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);
        }
    }
Exemple #29
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);
        }
    }
Exemple #30
0
 public static void Load(ViIStream IS)
 {
     Clear();
     while (IS.RemainLength > 0)
     {
         T data;
         if (ViBinaryReader.ReadSealedData(IS, out data) == false)
         {
             break;
         }
         if (data.State == (Int32)ViSealDataState.ACTIVE)
         {
             AddData(data);
         }
     }
 }