Ejemplo n.º 1
0
        public void Send()
        {
            //Log.Trace("Sending Message Container", "Send");

            SourceType = SEGarden.GardenGateway.RunningOn;
            //Log.Trace("SourceType : " + SourceType, "Send");

            if (SourceType == RunLocation.Client || SourceType == RunLocation.Singleplayer)
            {
                SourceId = (ulong)MyAPIGateway.Session.Player.SteamUserId;
            }
            else
            {
                SourceId = 0;
            }

            //Log.Trace("SourceId : " + SourceId, "Send");

            byte[] buffer = ToBytes();

            if (DestinationId == 0)
            {
                DestinationType = MessageDestinationType.Server;
            }

            //Log.Trace("DestinationType : " + DestinationType, "Send");

            Log.Info("Sending packet of " + buffer.Length + " bytes", "SendMessage");

            switch (DestinationType)
            {
            case MessageDestinationType.Server:
                //Log.Info("Sending to server " + DestinationId, "SendMessage");
                MyAPIGateway.Multiplayer.SendMessageToServer(
                    DomainId, buffer, Reliable);
                break;

            case MessageDestinationType.Player:
                //Log.Info("Sending to player " + DestinationId, "SendMessage");
                MyAPIGateway.Multiplayer.SendMessageTo(
                    DomainId, buffer, DestinationId, Reliable);
                //Log.Info("Sent message to player " + DestinationId, "SendMessage");
                break;

            case MessageDestinationType.All:
                MyAPIGateway.Multiplayer.SendMessageToOthers(
                    DomainId, buffer, Reliable);
                break;
            }
        }
Ejemplo n.º 2
0
        /*
        private ushort DomainId; // { get; }
        private ushort TypeId; // { get; }

        public MessageBase(ushort domainId, ushort typeId) {
            DomainId = domainId;
            TypeId = typeId;

        }
        */
        public void Send(ulong destSteamId, MessageDestinationType destType)
        {
            Log.Trace("Sending message with domain " + _DomainId +
                " and type " + _TypeId, "Send");

            MessageContainer container = new MessageContainer() {
                Body = ToBytes(),
                DestinationId = destSteamId,
                DestinationType = destType,
                DomainId = _DomainId,
                TypeId = _TypeId,
                Reliable = _Reliable
            };

            container.Send();
        }
Ejemplo n.º 3
0
        /*
         * private ushort DomainId; // { get; }
         * private ushort TypeId; // { get; }
         *
         * public MessageBase(ushort domainId, ushort typeId) {
         *  DomainId = domainId;
         *  TypeId = typeId;
         *
         * }
         */


        public void Send(ulong destSteamId, MessageDestinationType destType)
        {
            Log.Trace("Sending message with domain " + _DomainId +
                      " and type " + _TypeId, "Send");

            MessageContainer container = new MessageContainer()
            {
                Body            = ToBytes(),
                DestinationId   = destSteamId,
                DestinationType = destType,
                DomainId        = _DomainId,
                TypeId          = _TypeId,
                Reliable        = _Reliable
            };

            container.Send();
        }
Ejemplo n.º 4
0
 public IMessagingSystemInfo CreateMessagingSystemInfo(string vendorName, string destinationName, MessageDestinationType destinationType, ChannelType channelType, string channelEndpoint)
 => dummyMessagingSystemInfo;
Ejemplo n.º 5
0
        public void Send()
        {
            //Log.Trace("Sending Message Container", "Send");

            SourceType = SEGarden.GardenGateway.RunningOn;
            //Log.Trace("SourceType : " + SourceType, "Send");

            if (SourceType == RunLocation.Client || SourceType == RunLocation.Singleplayer)
                SourceId = (ulong)MyAPIGateway.Session.Player.SteamUserId;
            else SourceId = 0;

            //Log.Trace("SourceId : " + SourceId, "Send");

            byte[] buffer = ToBytes();

            if (DestinationId == 0) DestinationType = MessageDestinationType.Server;

            //Log.Trace("DestinationType : " + DestinationType, "Send");

            Log.Info("Sending packet of " + buffer.Length + " bytes", "SendMessage");

            switch (DestinationType) {

                case MessageDestinationType.Server:
                    //Log.Info("Sending to server " + DestinationId, "SendMessage");
                    MyAPIGateway.Multiplayer.SendMessageToServer(
                        DomainId, buffer, Reliable);
                    break;

                case MessageDestinationType.Player:
                    //Log.Info("Sending to player " + DestinationId, "SendMessage");
                    MyAPIGateway.Multiplayer.SendMessageTo(
                        DomainId, buffer, DestinationId, Reliable);
                        //Log.Info("Sent message to player " + DestinationId, "SendMessage");
                    break;

                case MessageDestinationType.All:
                    MyAPIGateway.Multiplayer.SendMessageToOthers(
                        DomainId, buffer, Reliable);
                    break;
            }
        }