Example #1
0
        void StartServer()
        {
            if (client == null)
            {
                client = new NetworkClient();
                client.RegisterHandler(MsgType.Connect, OnConnect);
                client.RegisterHandler(MsgType.Disconnect, OnDisconnect);
                client.RegisterHandler(AlgorithmMessage.GetCustomMsgType(), OnAlgorithm);
                client.RegisterHandler(AlgorithmRespectMessage.GetCustomMsgType(), OnAlgorithmRespect);
                client.RegisterHandler(PlayerInformationMessage.GetCustomMsgType(), OnPlayerInformation);
                client.RegisterHandler(PlayerPaintTileMessage.GetCustomMsgType(), OnPlayerPaintTile);
                client.RegisterHandler(PaintingColorMessage.GetCustomMsgType(), OnPaintingColor);
                client.RegisterHandler(PlayerPositionMessage.GetCustomMsgType(), OnPlayerPosition);
                client.RegisterHandler(PlayerReachedTheEndMessage.GetCustomMsgType(), OnPlayerReachedTheEnd);
                client.RegisterHandler(PlayerRotationMessage.GetCustomMsgType(), OnPlayerRotation);
                client.RegisterHandler(PlayerTilesToPaintMessage.GetCustomMsgType(), OnPlayerTilesToPaint);

                client.RegisterHandler(ForwardDirecMessage.GetCustomMsgType(), OnForwardDirReceive);


                client.RegisterHandler(ScannedDistanceMessage.GetCustomMsgType(), OnScannedDistance);
                client.RegisterHandler(CompassRotationMessage.GetCustomMsgType(), OnCompassRotation);

                //client.RegisterHandler(ReturnToDivergencePointAnswerMessage.GetCustomMsgType(), OnReturnToDivergencePointAnswer);

                client.Connect(pairedIpAdress.Value, serverPort);
            }
            else
            {
                Client.Instance.State.Value = ClientGameState.Ready;
            }
        }
Example #2
0
        // TODO remove unused
        // Tools
        // For both scanners
        public void SendCompassRotation(Quaternion rotation)
        {
            CompassRotationMessage msg = new CompassRotationMessage();

            msg.rot = rotation; // Client.Instance.Labyrinth.Value.GetTilesToPaint();

            clientConnection.Send(msg.GetMsgType(), msg);
        }
Example #3
0
        private void OnCompassRotation(NetworkMessage netMsg)
        {
            CompassRotationMessage msg = netMsg.ReadMessage <CompassRotationMessage>();

            tabletTools.CompassRotation.Value = msg.rot;
        }