Example #1
0
        /// <summary>
        /// Handler for 'connect' message from Socket Gamepad Manager
        /// Generates an AppHandshakeMsg with Controller Payloads
        /// if any and sends it to the server, as well as the default controller name
        /// </summary>
        /// <param name="e"></param>
        protected void HandleConnectedToSGServer(SocketIOEvent e)
        {
            string Payload        = string.Empty;
            string ControllerPath = Fyo.DefaultPaths.Controllers + ControllerPayload;

            if (File.Exists(ControllerPath))
            {
                Debug.LogWarning("Payload File \"" + ControllerPath + "\"");
                byte[] data = File.ReadAllBytes(ControllerPath);
                Payload = Convert.ToBase64String(data);
                Debug.LogWarning("Payload Data\"" + Payload + "\"");
            }
            else
            {
                Debug.LogWarning("No Payload, Path: \"" + ControllerPath + "\"");
            }

            AppHandshakeMsg GameInfoMsg = new AppHandshakeMsg(AppIdString, Payload, DefaultController);

            OnConnected();

            //Identify App to Node Server
            Debug.Log("Handshake Accepted, sending Game Info: " + GameInfoMsg.ToString());
            socket.Emit("AppHandshakeMsg", GameInfoMsg);
        }
Example #2
0
        /// <summary>
        /// Handles AppHandshakeMsg response from server after AppHandshakeMsg is sent
        /// Acknowledgement of Handshake,
        /// TODO: otherwise a Disconnect message will be sent from the server?
        /// </summary>
        /// <param name="e"></param>
        protected void HandleAppHandshake(SocketIOEvent e)
        {
            AppHandshakeMsg handshakeMsg = new AppHandshakeMsg(e.data);

            OnHandshake(handshakeMsg);
            Debug.Log("Application Handshake Accepted");
        }
Example #3
0
 /// <summary>
 /// Called after the Socket Gamepad Manager accepts Handshake
 /// </summary>
 /// <param name="handshakeMsg">Data sent from server for handshake acknowledgement, handshakeMsg.BinaryData may be developer defined payload(s)</param>
 protected abstract void OnHandshake(AppHandshakeMsg handshakeMsg);