Example #1
0
        //maybe this should be done in the SystemState?
        void On_entityChangeEvent(EntityChangeData.EntityChangeType changeType, BaseDataBlob db)
        {
            _changesNextFrame.Add(new EntityChangeData()
            {
                ChangeType = changeType, Datablob = db, Entity = Entity
            });
            switch (changeType)
            {
            case EntityChangeData.EntityChangeType.DBAdded:
                DataBlobs[db.GetType()] = db;
                break;

            case EntityChangeData.EntityChangeType.DBRemoved:
                DataBlobs.Remove(db.GetType());
                break;

            case EntityChangeData.EntityChangeType.EntityRemoved:
                DataBlobs.Clear();
                IsDestroyed = true;
                break;

            default:
                break;
            }
        }
Example #2
0
        NetOutgoingMessage DatablobDataMessage(NetOutgoingMessage msg, Entity entity, BaseDataBlob datablob)
        {
            var mStream = new MemoryStream();

            //int typeIndex = EntityManager.DataBlobTypes[datablobtype];
            //var datablob = entity.GetDataBlob<BaseDataBlob>(typeIndex);

            //Messages.Add("GetType().ToSTring(): " + datablob.GetType().ToString());
            //Messages.Add("GetType().Name: " + datablob.GetType().Name);
            //Messages.Add("GetType().AssemblyQualifiedName: " + datablob.GetType().AssemblyQualifiedName);
            //Messages.Add("GetType().FullName: " + datablob.GetType().FullName);
            //Messages.Add("pulsarTypeIndex: " + typeIndex);

            SerializationManager.Export(Game, mStream, datablob);
            byte[] systemByteArray = mStream.ToArray();
            int    len             = systemByteArray.Length;

            msg.Write(entity.Guid.ToByteArray());                       //entityGuid
            msg.Write(datablob.GetType().Name);                         //datablob name
            msg.Write(EntityManager.DataBlobTypes[datablob.GetType()]); //datablob typeIndex
            msg.Write(len);                                             //stream length
            msg.Write(systemByteArray);                                 //encoded data.
            mStream.Close();
            return(msg);
        }
Example #3
0
        void SendDatablob(NetConnection recipient, Entity entity, BaseDataBlob datablob)
        {
            Messages.Add("Sending " + datablob.GetType().Name);
            NetOutgoingMessage msg = NetPeerObject.CreateMessage();

            msg.Write((byte)ToClientMsgType.SendDatablob);      //message type
            NetServerObject.SendMessage(msg, recipient, NetDeliveryMethod.ReliableOrdered);
        }
Example #4
0
        static void DisplayDBSpecifics(BaseDataBlob db)
        {
            Type type = db.GetType();

            switch (db)
            {
            case SensorProfileDB dbtype:
                DebugDisplaySensorProfile.Display(dbtype);
                break;
            }
        }
Example #5
0
        public static void DBDisplay(BaseDataBlob dataBlob)
        {
            Type dbType = dataBlob.GetType();

            MemberInfo[] memberInfos = dbType.GetMembers();

            var _totalHeight = _numLines * _heightMultiplyer;

            _numLines = memberInfos.Length;
            var size = new Vector2(ImGui.GetContentRegionAvail().X, _totalHeight);

            ImGui.BeginChild("InnerColomns", size);

            ImGui.Columns(2);

            RecursiveReflection(dataBlob);


            ImGui.Columns(0);

            ImGui.EndChild();
            DisplayDBSpecifics(dataBlob);
        }