void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("message", TestMessage); }
public void Start() { socket = gameObject.GetComponent<SocketIOComponent>(); socket.On("smarttouch-start", SmartTouch); socket.On("smarttouch-end", SmartTouch); checkJSON.readJson(); }
// Use this for initialization void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); transform.position = startPosition; socket.Emit("LoadMap"); }
void Start() { sc = GameObject.Find ("ServerConnect").GetComponent<ServerConnect> (); Socket = sc.Socket; tc = GameObject.Find ("TurnController").GetComponent<TurnController> (); }
// Use this for initialization void Start() { Debug.Log ("ConfigScreen start with ipAddr= "+ipAddr+":"+port); GameObject SocketIOobj = GameObject.Find ("SocketIO"); sockio = (SocketIOComponent)SocketIOobj.GetComponent("SocketIOComponent"); sockio.Close(); if (PlayerPrefs.HasKey("IPAddress")) { ipAddr = PlayerPrefs.GetString("IPAddress"); Debug.Log ("PlayerPrefs has IPAddress = "+ipAddr); } else { ipAddr = sockio.ipAddr; } if (PlayerPrefs.HasKey("Port")) { port = PlayerPrefs.GetString("Port"); Debug.Log ("PlayerPrefs has Port = "+port); } else { port = sockio.port; } connectStatus.text = sockio.IsConnected ? "Connected" : "Not Connected"; ipAddrInpField.text = ipAddr; portInpField.text = port; Debug.Log ("ConfigScreen start now ending with ipAddr= "+ipAddr+":"+port+" and connectStatus = "+connectStatus.text); //Text ipTextVal = ipAddrTextField.GetComponent<Text>(); //GameObject ipAddrTextFieldPlaceholder = GameObject.Find("IpAddr-Placeholder"); //Text placeholder = ipAddrTextFieldPlaceholder.GetComponent<Text>(); //ipTextVal.text = ipAddr; //placeholder.text = ipAddr; }
//GameManager gameManager; void Start() { //Makes this object stay throughout the entire scene if (dontDestroyOnLoad) { DontDestroyOnLoad (transform.gameObject); } network = FindObjectOfType<NetworkManager> (); //Find the Socket Component in the Game Scene GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); //Register what kind of messages the client receives socket.On ("ConnectionTest", NetTest); socket.On ("JoinRoom", NetLogin); //socket.On ("Response", NetResponse); socket.Connect (); //Start Connection Test if (socket.IsConnected) { //Debug.Log ("Connected to Server!"); StartCoroutine("ConnectionTest"); } else { Debug.Log ("Not Connected..."); } }
void Start () { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); myscript = go.GetComponent<ectScript>(); socket.On ("talk", ChatMessage); }
public void Initialize() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.Connect(); // Register callbacks socket.On("message", OnMessage); // Send first contact to server socket.Emit("connection"); // Log in Dictionary<string,string> login = new Dictionary<string,string>(); login["username"] = "******"; socket.Emit("login", new JSONObject(login)); /* client = new Client(url); client.Opened += OnSocketOpened; client.Message += SocketMessage; client.SocketConnectionClosed += SocketConnectionClosed; client.Error +=SocketError; client.Connect(); */ }
// Use this for initialization void Start() { rb = this.GetComponent<Rigidbody> (); gameManager = GameObject.Find ("GameManager").GetComponent<GameManager> (); GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("open", TestOpen); socket.On("gyro", (message) => { JSONObject json = message.data; JSONObject pitchJSON = json.GetField("beta"); pitchAxis = float.Parse(pitchJSON.ToString())/180; JSONObject rollJSON = json.GetField("gamma"); rollAxis = float.Parse(rollJSON.ToString())/180; JSONObject yawJSON = json.GetField("alpha"); //yawAxis = float.Parse(yawJSON.ToString()); //yawAxis = (yawAxis - 180) / 360; //Debug.Log("pitch: "+pitchAxis+" yaw: " +yawAxis +" Roll "+ rollAxis); }); socket.On("speed",(message) => { AmbientSpeed = float.Parse (message.data.GetField("speed").ToString()); }); socket.On("error", TestError); socket.On("close", TestClose); }
// Use this for initialization void Start() { rb = GetComponent<Rigidbody2D> (); sc = GameObject.Find ("ServerConnect").GetComponent<ServerConnect> (); tc = GameObject.Find ("TurnController").GetComponent<TurnController> (); Socket = sc.Socket; }
void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); //コントローラーの命令が入ってきたら処理する。(1、idを特定し、オブジェクトを特定 2、特定したオブジェクトのコンポーネントに命令) socket.On("move",CheckID); }
void Awake() { PlayFabSettings.TitleId = "9C78"; GameObject go = GameObject.Find("SocketIO"); socketIO = go.GetComponent<SocketIOComponent>(); DontDestroyOnLoad (socketIO); }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On ("rgb",changeBackgroundRGB); _guiText = guiText.GetComponent<Text> (); }
void Start () { DontDestroyOnLoad (gameObject); GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On ("connection", Connection); socket.On("loginconfirm", LoginConfirm); }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("open",Opend); socket.On("power",PowerReact); }
void Awake() { DontDestroyOnLoad(this); sc = GameObject.Find ("ServerConnect").GetComponent<ServerConnect> (); mc = GameObject.Find ("MenuController").GetComponent<MenuController> (); Socket = sc.Socket; }
void Start () { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); myscript = go.GetComponent<ectScript>(); socket.Emit("LoadMap"); socket.On("swapAllPlayer",swapAllPlayer); }
void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); pan = transform.position.x; pitch = transform.position.y; updatePosition("created"); }
private bool Init() { if (Instance != null) { Destroy(this); return(false); } Instance = this; return(true); }
// Use this for initialization void Start () { _gameboard = FindObjectOfType<Gameboard>(); GameObject go = GameObject.Find("SocketIO"); _socket = go.GetComponent<SocketIOComponent>(); _socket.On("login", connectCallback); _socket.On("move", moveCallback); Debug.Log("Connecting"); }
// Use this for initialization void Start() { //socket.io approach //retrieve socket component GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); nodeList = new Dictionary<string, Node>(); //create a new dictionary socket.On("result", NodeListUpdate); //event listener waiting for the results of the node queries }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("open", TestOpen); socket.On("message",OnMessage); socket.On("welcome",OnWelcome); socket.On("error", TestError); socket.On("close", TestClose); }
void Start () { Name = " "; DontDestroyOnLoad (gameObject); GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("error", ServerError); socket.On("close", ServerClose); transform.position = startPosition; rend = GetComponent<Renderer>(); }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); //新しくログインしてきたら、CreateNewを起動 socket.On("new_player",CreateNewPlayer); //誰かがページを離れたら、オブジェクトが消える。 socket.On("player_exit",RemovePlayer); }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("open", Open); socket.On("wait", Wait); socket.On("roomready", Roomready); socket.On("needwait", NeedWait); socket.On("error", Error); socket.On("close", Close); }
// Use this for initialization void Start() { InitUI (); //same old, same old GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); //register for events via coordinated string keys //there are some defaults, like connect, open, close socket.On("connect", ConnectedToServer); }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("open", TestOpen); socket.On("boop", TestBoop); socket.On("error", TestError); socket.On("close", TestClose); StartCoroutine("BeepBoop"); }
// Use this for initialization void Start () { //ws://localhost:4567/socket.io/?EIO=4&transport=websocket //GameObject go = GameObject.Find("SocketIO"); socket = GameObject.FindObjectOfType<SocketIOComponent>(); //socket.Connect (); socket.On("open", OnSocketOpen); socket.On("error", OnSocketError); socket.On("chat message", ChatMessage); //StartCoroutine(TestCoroutine()); }
void StartWebsocket() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); socket.On("acceleration", OnAcceleration); socket.On("steering", OnSteering); //socket.On("open", TestOpen); /*socket.On("error", TestError); socket.On("close", TestClose);*/ }
// Use this for initialization void Start () { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); Debug.Log ("Adding callbacks"); socket.On("connect", Connect); socket.On("updateBlob", UpdateUser); socket.On("newBlob", AddUser); socket.On ("removeBlob", DeleteUser); socket.Connect (); }
public void Start() { if (autoConnect) { Connect(); GameObject go = GameObject.Find("SocketIO"); SocketIOComponent sock = (SocketIOComponent)go.GetComponent(typeof(SocketIOComponent)); sock.On("move_forward_Utkarsh", (SocketIOEvent e) => { Debug.Log("Utkarsh move forward"); }); } }
public void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent<SocketIOComponent>(); txt = this.gameObject.GetComponent<Text>(); socket.On("sendname", OnSendName); socket.On("randomnumber",OnRandomNumber); socket.On("welcome",OnWelcome); socket.On("error", TestError); socket.On("close", TestClose); }
// Start is called before the first frame update void Start() { GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent <SocketIO.SocketIOComponent>(); socket.On("open", socketConnected); socket.On("do flight", doFlight); // transform.position = start.position; pos = transform.position; rot = transform.rotation; // Debug.Log("Position " + pos + " and the rotation " + rot); }
public void Awake() { if (singleton) { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); } encoder = new Encoder(); decoder = new Decoder(); parser = new Parser(); handlers = new Dictionary <string, List <Action <SocketIOEvent> > > (); ackList = new List <Ack> (); sid = null; packetId = 0; ws = new WebSocket(url); ws.OnOpen += OnOpen; ws.OnMessage += OnMessage; ws.OnError += OnError; ws.OnClose += OnClose; wsConnected = false; eventQueueLock = new object(); eventQueue = new Queue <SocketIOEvent> (); ackQueueLock = new object(); ackQueue = new Queue <Packet> (); connected = false; #if SOCKET_IO_DEBUG if (debugMethod == null) { debugMethod = Debug.Log; } ; #endif }
/// <summary> /// Handles the player join packet, it will spawn a player on the possition given by the server. /// </summary> /// <param name="e"></param> /// <param name="socket"></param> /// <param name="networkManager"></param> public PlayerJoin(SocketIO.SocketIOEvent e, SocketIO.SocketIOComponent socket, NetworkManager networkManager) : base(e, socket, networkManager) { this.clientId = data["socketId"]; this.x = PacketUtils.FromPacketString(data["spawnLocationX"]); this.y = PacketUtils.FromPacketString(data["spawnLocationY"]); this.z = PacketUtils.FromPacketString(data["spawnLocationZ"]); this.headRotationX = PacketUtils.FromPacketString(data["headRotationX"]); this.headRotationY = PacketUtils.FromPacketString(data["headRotationY"]); this.headRotationZ = PacketUtils.FromPacketString(data["headRotationZ"]); this.headRotationW = PacketUtils.FromPacketString(data["headRotationW"]); this.playerTypeId = int.Parse(data["playerType"]); this.isMain = networkManager.IsMain(this.clientId); HandlePacket(); }
// Use this for initialization void Start() { io = GameObject.Find("SocketIO").GetComponent <SocketIO.SocketIOComponent>(); test_script = GameObject.Find("ConnectServer").GetComponent <TestSocketIO>(); }
/// <summary> /// A pretty empty packet, it's just our clientId the server will do the rest. /// </summary> /// <param name="socket">The socket</param> /// <param name="networkManager">The network manager</param> public PlayerJoinBuilder(SocketIO.SocketIOComponent socket, NetworkManager networkManager) : base(socket, networkManager, "PlayerJoin") { Send(); }
void Start() { io = GetComponent <SocketIO.SocketIOComponent>(); dodgeballManager = transform.parent.GetComponentInChildren <dodgeballManager>(); io.On("joined-game", (SocketIO.SocketIOEvent e) => { JSONObject data = e.data; Debug.Log("Joined game " + data); }); io.On("player-position-update", (SocketIO.SocketIOEvent e) => { try { JSONObject data = e.data; string playerID = data.GetField("id").ToString(); JSONObject playerPos = data.GetField("position"); Vector3 newPos = new Vector3( float.Parse(playerPos.GetField("x").ToString()), float.Parse(playerPos.GetField("y").ToString()), float.Parse(playerPos.GetField("z").ToString()) ); JSONObject playerRot = data.GetField("rotation"); Quaternion newRot = new Quaternion( float.Parse(playerRot.GetField("x").ToString()), float.Parse(playerRot.GetField("y").ToString()), float.Parse(playerRot.GetField("z").ToString()), float.Parse(playerRot.GetField("w").ToString()) ); player p = getPlayer(playerID); if (p != null) { p.newPos = newPos; p.newRot = newRot; } } catch (Exception err) { Debug.LogError("player-position-update-exception: " + err); } }); io.On("dodgeball-thrown", (SocketIO.SocketIOEvent e) => { JSONObject data = e.data; JSONObject posObj = data.GetField("position"); JSONObject dirObj = data.GetField("direction"); int ID = int.Parse(data.GetField("ID").ToString()); string playerID = data.GetField("playerID").ToString(); Vector3 position = new Vector3( float.Parse(posObj.GetField("x").ToString()), float.Parse(posObj.GetField("y").ToString()), float.Parse(posObj.GetField("z").ToString()) ); Vector3 direction = new Vector3( float.Parse(dirObj.GetField("x").ToString()), float.Parse(dirObj.GetField("y").ToString()), float.Parse(dirObj.GetField("z").ToString()) ); dodgeballManager.onNetworkThrowBall(position, direction); getPlayer(playerID).network.onThrowDodgeball(); }); io.On("dodgeball-pickup", (SocketIO.SocketIOEvent e) => { JSONObject data = e.data; string playerID = data.GetField("playerID").ToString(); player foundPlayer = getPlayer(playerID); foundPlayer.network.onPickupDodgeball(); }); io.On("player-join", (SocketIO.SocketIOEvent e) => { Debug.Log("new player join"); JSONObject data = e.data; player newPlayer = new player(); newPlayer.id = data.GetField("playerID").ToString(); GameObject playerObj = GameObject.Instantiate(playerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity); newPlayer.transform = playerObj.transform; newPlayer.network = playerObj.GetComponent <networkPlayerController>(); otherPlayers.Add(newPlayer); }); io.On("player-disconnect", (SocketIO.SocketIOEvent e) => { JSONObject data = e.data; string id = data.GetField("id").ToString(); player p = otherPlayers.Find(x => x.id == id); GameObject.Destroy(p.transform.gameObject); otherPlayers.Remove(p); }); io.On("player-death", (SocketIO.SocketIOEvent e) => { Debug.Log("player death"); }); }
public UpdateSeeker(SocketIO.SocketIOEvent e, SocketIO.SocketIOComponent socket, NetworkManager networkManager) : base(e, socket, networkManager) { this.player = networkManager.GetPlayerFromClientId(data["clientId"]); this.HandlePacket(); }