document.write("<canvas width="+width+" height="+height+" id="+id+"></canvas>"); // пиздец, конечно, ну да ладно =)
using UnityEngine;
using System.Collections;
using SocketIO;
using System.Text.RegularExpressions;
public class Network : MonoBehaviour {
static SocketIOComponent socket;
public GameObject playerPrefab;
void Start(){
socket = GetComponent<SocketIOComponent>();
socket.On("open", onConnected);
socket.On("spawn", onSpawn);
}
void onConnected(SocketIOEvent e){
}
void onSpawn(SocketIOEvent e){
JsonToString(e.data.GetField("xCoords"));
}
public string JsonToString<Network>(string target){
return JsonUtility.FromJson<Network>(target);
}
void Update(){
if(Input.GetKeyDown(KeyCode.R)){
socket.Emit("pressedR");
}
if(Input.GetKeyDown(KeyCode.E)){
socket.Emit("clearChat");
}
if(Input.GetKeyDown(KeyCode.E)){
socket.Emit("clearChat");
}
}
}