public void AddNetEntity(NetCreatableInfo info, INetEntity entity)
        {
            NetEntitySnapshot    snapshot = entity.CreateSnapshot(info, snapshotSystem);
            DynamicSnapshotField field    = AddNestedField(info.Id, snapshot);

            snapshotFields.Add(info.Id, field);
        }
예제 #2
0
 public CommandPostEntitySnapshot(INetEntity entity, NetCreatableInfo info, SnapshotSystem snapshotSystem)
     : base(entity, info, snapshotSystem)
 {
     x = AddPrimitiveField <float>();
     y = AddPrimitiveField <float>();
     z = AddPrimitiveField <float>();
 }
예제 #3
0
        public GeoNetEntityAssist(CollectionsModel model)
        {
            this.m_Model = model;
            this.m_SiteCol = model.SiteColl;
            this.m_TranceiverCol = model.TranceiverColl;
            this.m_RepCol = model.RepeaterColl;
            this.m_GeoMsgChange = model.GisINetEntity;
            this.m_antennas = model.Antennas;
            this.m_TpCol = model.TplCellCollection;
            this.m_RNCol = model.RNColl;
            this.m_SiteCol.SiteAddEvent += new EventHandler<NESiteEventArgs>(this.SiteCol_SiteAddEvent);
            this.m_SiteCol.SiteDeleteEvent += new EventHandler<NESiteEventArgs>(this.SiteCol_SiteDeleteEvent);
            this.m_SiteCol.SiteModifyEvent += new EventHandler<NESiteEventArgs>(this.SiteCol_SiteModifyEvent);
            this.m_TranceiverCol.AddEvent += new EventHandler<NETranceiverEventArgs>(this.CellCol_CellAddEvent);
            this.m_TranceiverCol.DeleteEvent += new EventHandler<NETranceiverEventArgs>(this.CellCol_CellDeleteEvent);
            this.m_TranceiverCol.ModifyEvent += new EventHandler<NETranceiverEventArgs>(this.CellCol_CellModifyEvent);
            this.m_RepCol.RepeaterAddEvent += new EventHandler<NERepeaterEventArgs>(this.RepCol_RepeaterAddEvent);
            this.m_RepCol.RepeaterDeleteEvent += new EventHandler<NERepeaterEventArgs>(this.RepCol_RepeaterDeleteEvent);
            this.m_RepCol.RepeaterModifyEvent += new EventHandler<NERepeaterEventArgs>(this.RepCol_RepeaterModifyEvent);
            this.m_antennas.ResponseEvent += new RetrunUserInfoDelegate(this.m_antennas_ResponseEvent);
            this.m_RNCol.RNAddEvent += new EventHandler<NERelayNodeEventArgs>(this.RNCol_AddEvent);
            this.m_RNCol.RNDeleteEvent += new EventHandler<NERelayNodeEventArgs>(this.RNCol_DeleteEvent);
            this.m_RNCol.RNModifyEvent += new EventHandler<NERelayNodeEventArgs>(this.RNCol_ModifyEvent);

        }
예제 #4
0
 public FiledDisplayForm(CollectionsModel model, NetWorkType network)
 {
     this.m_DisplayControl = new DisplayControl(model, network);
     this.m_DisplayControl.EnableApplyEvent += new EventHandler<EventArgs>(this.DisplayControl_EnableApplyEvent);
     this.InitializeComponent();
     this.m_NetEntityEvent = model.GisINetEntity;
     this.m_Editor = new FiledDisplayFormEditor(model, network);
     this.BulidSiteNode();
     this.LoadData(new Huawei.UNet.NE.Model.GisDisPlay());
     this.button_Apply.Enabled = false;
 }
예제 #5
0
 private void SnapshotComponent_OnWorldSnapshotInbound(object sender, WorldSnapshot e)
 {
     foreach (NetCreatableInfo info in netObjects.Entities.Values)
     {
         NetEntitySnapshot snapshot;
         if (snapshotComponent.WorldSnapshot.NetEntityListSnapshot.TryGetEntitySnapshot(info.Id, out snapshot))
         {
             INetEntity entity = info.Creatable as INetEntity;
             entity.OnClientInbound(snapshot);
         }
     }
 }
        public NetEntitySnapshot(INetEntity entity, NetCreatableInfo info, SnapshotSystem snapshotSystem)
            : base(snapshotSystem, info.Owner, !info.IsAppOwner)
        {
            Entity     = entity;
            EntityInfo = info;

            if (entity != info.Creatable)
            {
                throw new Exception("Failed to create NetEntitySnapshot, entity does not match the creatable info!");
            }

            EnableDeltaCompression(10);
        }
예제 #7
0
 private void SnapshotComponent_OnWorldSnapshotOutbound(object sender, WorldSnapshot e)
 {
     foreach (NetCreatableInfo info in netObjects.Entities.Values)
     {
         foreach (NetConnectionSnapshotState clientState in snapshotComponent.ConnectionStates.Values)
         {
             INetEntity        entity = (INetEntity)info.Creatable;
             NetEntitySnapshot snapshot;
             if (clientState.WorldSnapshot.NetEntityListSnapshot.TryGetEntitySnapshot(info.Id, out snapshot))
             {
                 entity.OnServerOutbound(snapshot);
             }
         }
     }
 }
예제 #8
0
        void HandleInstantiationPacket(NetInboundPacket packet)
        {
            string eventName = packet.ReadString();
            ushort id        = packet.ReadUInt16();
            bool   isOwner   = packet.ReadBool();

            NetInstantiationCallback callback;

            if (instCallbacks.TryGetValue(eventName, out callback))
            {
                if (netObjects.Creatables.ContainsKey(id))
                {
                    DashCMD.WriteError("[ObjectNC] Creatable with id {0} is already instantiated!", id);
                    return;
                }

                //DashCMD.WriteLine("[ObjectNC] Instantiating creatable with id {0}...", id);

                INetCreatable    creatable = callback(id, isOwner, packet);
                NetCreatableInfo info      = new NetCreatableInfo(packet.Sender, creatable, id, isOwner);
                netObjects.Add(id, info);

                INetEntity entity = creatable as INetEntity;
                if (entity != null && snapshotComponent.WorldSnapshot != null)
                {
                    NetEntityListSnapshot entList = snapshotComponent.WorldSnapshot.NetEntityListSnapshot;
                    entList.AddNetEntity(info, entity);
                }

                creatable.OnNetworkInstantiated(info);

                if (OnCreatableInstantiated != null)
                {
                    OnCreatableInstantiated(this, info);
                }
            }
            else
            {
                DashCMD.WriteError("[ObjectNC] Received instantiation for unknown type: {0}", eventName);
            }
        }
예제 #9
0
        public void NetworkInstantiate(INetCreatable creatable, string instEventName,
                                       NetConnection clientOwner, params object[] args)
        {
            ushort netId = lastNetEntId++;

            if (netId == 0)
            {
                netId++;
            }

            NetCreatableInfo info = new NetCreatableInfo(clientOwner, creatable, netId, true);

            INetEntity entity = creatable as INetEntity;

            if (entity != null)
            {
                foreach (NetConnectionSnapshotState state in snapshotComponent.ConnectionStates.Values)
                {
                    state.WorldSnapshot.NetEntityListSnapshot.AddNetEntity(info, entity);
                }
            }

            creatable.OnNetworkInstantiated(info);

            if (OnCreatableInstantiated != null)
            {
                OnCreatableInstantiated(this, info);
            }

            netObjects.Add(netId, info);

            foreach (NetConnection conn in server.Connections.Values)
            {
                NetOutboundPacket packet = new NetOutboundPacket(NetDeliveryMethod.Reliable);
                packet.Write((byte)CustomPacketType.Instantiate);
                packet.Write(instEventName);
                packet.Write(netId);
                packet.Write(conn == clientOwner);

                for (int i = 0; i < args.Length; i++)
                {
                    packet.WriteDynamic(args[i]);
                }

                conn.SendPacket(packet);
            }

            NetOutboundPacket epacket = new NetOutboundPacket(NetDeliveryMethod.Reliable);

            epacket.Write((byte)CustomPacketType.Instantiate);
            epacket.Write(instEventName);
            epacket.Write(netId);
            epacket.Write(false);

            for (int i = 0; i < args.Length; i++)
            {
                epacket.WriteDynamic(args[i]);
            }

            instPackets.Add(netId, epacket);
        }