private void OnConnected(object sender, NetChannelArgs args)
        {
            // request base info about the server
            var msgInfo = _net.CreateNetMessage <MsgServerInfoReq>();

            _net.ClientSendMessage(msgInfo);
        }
        public void SelectCharacter(int slot)
        {
            var msg = _netManager.CreateNetMessage <MsgSelectCharacter>();

            msg.SelectedCharacterIndex = slot;
            _netManager.ClientSendMessage(msg);
        }
Exemple #3
0
#pragma warning restore 649

        /// <summary>
        /// Sends a message to the relevant system(s) server side.
        /// </summary>
        public void SendSystemNetworkMessage(EntitySystemMessage message)
        {
            var msg = _network.CreateNetMessage <MsgEntity>();

            msg.Type          = EntityMessageType.SystemMessage;
            msg.SystemMessage = message;
            _network.ClientSendMessage(msg);
        }
Exemple #4
0
        public void SelectCharacter(int slot)
        {
            Preferences = new PlayerPreferences(Preferences.Characters, slot, Preferences.AdminOOCColor);
            var msg = _netManager.CreateNetMessage <MsgSelectCharacter>();

            msg.SelectedCharacterIndex = slot;
            _netManager.ClientSendMessage(msg);
        }
Exemple #5
0
        public void StartSession()
        {
            if (!CanScript)
            {
                throw new InvalidOperationException("We do not have scripting permission.");
            }

            var msg = _netManager.CreateNetMessage <MsgScriptStart>();

            msg.ScriptSession = _nextSessionId++;
            _netManager.ClientSendMessage(msg);
        }
        public void HandleDeletion(IEntity entity)
        {
            if (!IsActive || !Eraser)
            {
                return;
            }

            NetOutgoingMessage message = NetworkManager.CreateMessage();

            message.Write((byte)NetMessages.RequestEntityDeletion);
            message.Write(entity.Uid);
            NetworkManager.ClientSendMessage(message, NetDeliveryMethod.ReliableUnordered);
        }
        public void HandleDeletion(IEntity entity)
        {
            if (!IsActive || !Eraser)
            {
                return;
            }

            var msg = NetworkManager.CreateNetMessage <MsgPlacement>();

            msg.PlaceType = PlacementManagerMessage.RequestEntRemove;
            msg.EntityUid = entity.Uid;
            NetworkManager.ClientSendMessage(msg);
        }
Exemple #8
0
        private void AckGameState(GameTick sequence)
        {
            var msg = _network.CreateNetMessage <MsgStateAck>();

            msg.Sequence = sequence;
            _network.ClientSendMessage(msg);
        }
Exemple #9
0
        private void AckGameState(uint sequence)
        {
            var msg = networkManager.CreateNetMessage <MsgStateAck>();

            msg.Sequence = sequence;
            networkManager.ClientSendMessage(msg);
        }
    public void SendGamePrototype(string prototype)
    {
        var msg = _netManager.CreateNetMessage <GamePrototypeLoadMessage>();

        msg.PrototypeData = prototype;
        _netManager.ClientSendMessage(msg);
    }
        private void AckGameState(uint sequence)
        {
            NetOutgoingMessage ack = networkManager.CreateMessage();

            ack.Write((byte)NetMessages.StateAck);
            ack.Write(sequence);
            networkManager.ClientSendMessage(ack, NetDeliveryMethod.ReliableUnordered);
        }
        /// <summary>
        /// Sends a message to the relevant system(s) serverside.
        /// </summary>
        public void SendSystemNetworkMessage(EntitySystemMessage message,
                                             NetDeliveryMethod method = NetDeliveryMethod.ReliableUnordered)
        {
            NetOutgoingMessage newMsg = CreateEntityMessage();

            newMsg.Write((byte)EntityMessage.SystemMessage);

            using (var stream = new MemoryStream())
            {
                serializer.Serialize(stream, message);
                newMsg.Write((int)stream.Length);
                newMsg.Write(stream.ToArray());
            }

            //Send the message
            _networkManager.ClientSendMessage(newMsg, method);
        }
Exemple #13
0
        protected void SendMessage(EuiMessageBase msg)
        {
            var netMsg = _netManager.CreateNetMessage <MsgEuiMessage>();

            netMsg.Id      = Id;
            netMsg.Message = msg;

            _netManager.ClientSendMessage(netMsg);
        }
        /// <summary>
        ///     Requests remote commands from server.
        /// </summary>
        public void SendServerCommandRequest()
        {
            if (_requestedCommands)
            {
                return;
            }

            if (!_network.IsConnected)
            {
                return;
            }

            var msg = _network.CreateNetMessage <MsgConCmdReg>();

            _network.ClientSendMessage(msg);

            _requestedCommands = true;
        }
Exemple #15
0
        /// <inheritdoc />
        public void Startup(INetChannel channel)
        {
            LocalPlayer = new LocalPlayer(_network, _config);

            var msgList = _network.CreateNetMessage <MsgPlayerListReq>();

            // message is empty
            _network.ClientSendMessage(msgList);
        }
        /// <summary>
        /// Verb sender
        /// If UID is 0, it means its a global verb.
        /// </summary>
        /// <param name="verb">the verb</param>
        /// <param name="uid">a target entity's Uid</param>
        public void SendVerb(string verb, int uid)
        {
            NetOutgoingMessage message = _networkManager.CreateMessage();

            message.Write((byte)NetMessages.PlayerSessionMessage);
            message.Write((byte)PlayerSessionMessage.Verb);
            message.Write(verb);
            message.Write(uid);
            _networkManager.ClientSendMessage(message, NetDeliveryMethod.ReliableOrdered);
        }
Exemple #17
0
        protected void FinishPrompt(DMValueType responseType, object value)
        {
            if (_responseSent)
            {
                return;
            }
            _responseSent = true;

            var msg = _netManager.CreateNetMessage <MsgPromptResponse>();

            msg.PromptId = _promptId;
            msg.Type     = responseType;
            msg.Value    = value;
            _netManager.ClientSendMessage(msg);
        }
Exemple #18
0
        protected void FinishPrompt(DMValueType responseType, object value)
        {
            if (_responseSent)
            {
                return;
            }
            _responseSent = true;

            var msg = new MsgPromptResponse()
            {
                PromptId = _promptId,
                Type     = responseType,
                Value    = value
            };

            _netManager.ClientSendMessage(msg);
        }
Exemple #19
0
        private void BeforeBrowseHandler(IBeforeBrowseContext context)
        {
            if (string.IsNullOrEmpty(_webView.Url))
            {
                return;
            }

            Uri oldUri = new Uri(_webView.Url);
            Uri newUri = new Uri(context.Url);

            if (newUri.Scheme == "byond" || (newUri.AbsolutePath == oldUri.AbsolutePath && newUri.Query != String.Empty))
            {
                context.DoCancel();

                var msg = _netManager.CreateNetMessage <MsgTopic>();
                msg.Query = newUri.Query;
                _netManager.ClientSendMessage(msg);
            }
        }
Exemple #20
0
 private void OnRespawnButtonOnOnPressed(BaseButton.ButtonEventArgs args)
 {
     _netManager.ClientSendMessage(_netManager.CreateNetMessage <MsgSandboxRespawn>());
 }