コード例 #1
0
        internal void PacketizeEmitterState(IMyCubeBlock block, ProtoEmitterState state)
        {
            var data  = new DataEmitterState(MyAPIGateway.Multiplayer.MyId, block.EntityId, state);
            var bytes = MyAPIGateway.Utilities.SerializeToBinary(data);

            EmitterStateToClients(block.CubeGrid.GetPosition(), bytes, data.Sender);
        }
コード例 #2
0
 public DataEmitterState(ulong sender, long entityId, PacketType action)
 {
     Type     = action;
     Sender   = sender;
     EntityId = entityId;
     State    = null;
 }
コード例 #3
0
        public bool LoadState()
        {
            if (Emitter.Storage == null)
            {
                return(false);
            }

            string rawData;
            bool   loadedSomething = false;

            if (Emitter.Storage.TryGetValue(Session.Instance.EmitterStateGuid, out rawData))
            {
                ProtoEmitterState loadedState = null;
                var base64 = Convert.FromBase64String(rawData);
                loadedState = MyAPIGateway.Utilities.SerializeFromBinary <ProtoEmitterState>(base64);

                if (loadedState != null)
                {
                    State           = loadedState;
                    loadedSomething = true;
                }
                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Loaded - EmitterId [{Emitter.EntityId}]:");
                }
            }
            return(loadedSomething);
        }
コード例 #4
0
        }                             // empty ctor is required for deserialization

        public DataEmitterState(ulong sender, long entityId, ProtoEmitterState state)
        {
            Type     = PacketType.Emitterstate;
            Sender   = sender;
            EntityId = entityId;
            State    = state;
        }
コード例 #5
0
ファイル: Emitters.cs プロジェクト: jeffvella/DefenseShields
 internal void UpdateState(ProtoEmitterState newState)
 {
     EmiState.State = newState;
     if (Session.Enforced.Debug <= 3)
     {
         Log.Line($"UpdateState - EmitterId [{Emitter.EntityId}]:\n{EmiState.State}");
     }
 }