public IEnumerator throwAwayThings() { childRB.gameObject.transform.SetParent(transform.parent); yield return(new WaitForSeconds(0.6f)); // waits 0.3 seconds HoldingSomething = false; socket.Emit(socketID, "gyroOff"); // tell phone-node that the fruit is alreay thrown away }
public void SendData(JSONObject obj) { print("<color=#32D51CFF>SEND :</color> " + obj.Print()); JSONObject newData = new JSONObject(); string tempstr = AESEncrypt(obj.Print(), ENCKEY, ENCIV); newData.AddField("data", tempstr); socket.Emit("req", newData); }
void Update() { // // Collect Data from the Car Dictionary <string, string> data = new Dictionary <string, string>(); data["image"] = Convert.ToBase64String(CameraHelper.CaptureFrame(FrontFacingCamera)); data["lane_line_image"] = Convert.ToBase64String(CameraHelper.CaptureFrame(FrontFacingCamera)); _socket.Emit("telemetry", new JSONObject(data)); }
/////////////////////////////////// // Methods Related to Any Player // /////////////////////////////////// // KILL: Emit kill message when any player is killed public static void Kill(string playerID, float xPosition, float zPosition) { var j = new JSONObject(); j.AddField("id", playerID); j.AddField("x_position", xPosition); j.AddField("z_position", zPosition); socket.Emit("kill_player", j); }
public void Join() { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("userNickname", GameManager.instance.UserNickname); JSONObject jSONObject = new JSONObject(data); socket.Emit("join", jSONObject); }
public void JoinMsg() { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("userName", GameManager.instance.GetUserName()); JSONObject jObject = new JSONObject(data); socket.Emit("join", jObject); }
public void SendBacteriaPos(Vector2 bacteriaPos, int bacteriaId) { Dictionary <string, string> enemyPosData = new Dictionary <string, string>(); enemyPosData["posx"] = bacteriaPos.x.ToString(); enemyPosData["posy"] = bacteriaPos.y.ToString(); enemyPosData["id"] = bacteriaId.ToString(); socket.Emit("BACTERIA_POS", new JSONObject(enemyPosData)); }
public void send() { JSONObject jSONObject = new JSONObject(JSONObject.Type.OBJECT); jSONObject.AddField("name", name.text); jSONObject.AddField("number", number.text); socket.Emit("msg.send", jSONObject); Debug.Log("send" + jSONObject); }
void OnCommandMove(Vector3 vec3) { Dictionary <string, string> data = new Dictionary <string, string>(); Vector3 position = new Vector3(vec3.x, vec3.y, vec3.z); data["position"] = position.x + "," + position.y + "," + position.z; socket.Emit("MOVE", new JSONObject(data)); Debug.Log("Get the message from server in OnCommandMove"); }
public static void FoodEaten(string playerId, string foodId) { var foodData = new JSONObject(); foodData.AddField("food_id", foodId); foodData.AddField("player_id", playerId); socket.Emit("eat", foodData); }
public void OnClickJoin(Button button) { button.interactable = false; JSONObject data = new JSONObject(); data.AddField("clientId", clientInfo.clientId); socket.Emit("req_joinroom", data); }
public void SendMeshToClients(Mesh mesh) { SerializedMesh smesh = new SerializedMesh(mesh); var json_mesh = JSONObject.Create(JsonUtility.ToJson(smesh)); socket.Emit("dm-update-mesh", json_mesh); meshes.meshes.Add(smesh); }
/// <summary> /// Login to the Chat. /// </summary> /// <param name="userName">User name.</param> public void Login(string userName) { Message msg = new Message(); msg.fromUser = userName; //Emite socket.Emit("login", msg.ToJson()); Debug.Log("Login request sent"); }
public void ChangeName(string playerName) { this.playerName = playerName; Dictionary <string, string> jsonData = new Dictionary <string, string> { { "playerName", playerName } }; sIO.Emit(EVENT_SETNAME, new JSONObject(jsonData)); }
public void DeleteGame() { ShowError(""); socket.Emit("game:delete"); foreach (GameObject instance in instantiatedGames) { Destroy(instance); } EmitGetGames(); }
public void LogInToServer(string name) { if (gameCTR.isPlaying == false) { JSONobject = new JSONObject(JSONObject.Type.OBJECT); JSONobject.AddField("playerName", name); socket.Emit("login", JSONobject); } }
public void OnLogin() { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("id", idText.text); data.Add("password", passwordField.text); JSONObject jSONObject = new JSONObject(data); socket.Emit("OnLogin", jSONObject); }
public IEnumerator Loadroom() { yield return(new WaitForSeconds(0.3f)); var data = JsonUtility.ToJson(playerCon.player); Debug.Log(data); socket.Emit("LOAD", new JSONObject(data)); Debug.Log("Sending"); }
public void LeaveEvenIfJoined() { Dictionary <string, string> pairs = new Dictionary <string, string>(); pairs.Add("code", myGameCode); pairs.Add("deviceId", SystemInfo.deviceUniqueIdentifier); GameManager.Inst.isNotYetJoin = false; socketIOComponent.Emit("leftGame", new JSONObject(pairs)); StartCoroutine(CloseConfirmPanelAnimation(true)); //close confirm panel }
public void sendConnect() { JsonModel jm = new JsonModel(); jm.sendStr = "connect"; jm.result = uuid; JSONObject jo = new JSONObject(JsonUtility.ToJson(jm)); socket.Emit("send", jo); }
// send a "ping" message to NodeJS server public void SendPingToServer() { //create a data struct like <key,value> to storage data Dictionary <string, string> pack = new Dictionary <string, string> (); pack["message"] = "ping!!!"; //send to nodeJS server socket.Emit("PING", new JSONObject(pack)); }
public void Update() { if (Input.GetKey("space")) { data = new Dictionary <string, string> (); data ["msg"] = "noen"; socket.Emit("fromclient", new JSONObject(data)); login = false; } }
public void Join() { print("NetworkManager.Join()"); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("userName", GameManager.instance.userName); JSONObject jObject = new JSONObject(data); socket.Emit("join", jObject); }
// 새로운 메시지 이벤트 송신 public void SendNewMsg(string msg) { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("msg", msg); data.Add("userName", GameManager.instance.GetUserName()); JSONObject jObject = new JSONObject(data); socket.Emit("newMsg", jObject); }
public void ClickSend() { Debug.Log("Sended"); JSONObject jSONObject = new JSONObject(JSONObject.Type.OBJECT); jSONObject.AddField("name", inputName.text); jSONObject.AddField("number", inputNumber.text); socketIO.Emit("message", jSONObject); }
IEnumerator ConnectToServer() { socket.Emit("connect"); yield return(new WaitForSeconds(0.5f)); socket.Emit("add user", JSONObject.CreateStringObject("MyName")); yield return(new WaitForSeconds(0.5f)); socket.Emit("new message", JSONObject.CreateStringObject("MyMessage")); }
// public variables public void Login(string username, string password) { Debug.Log("Logging in"); Dictionary <string, string> data = new Dictionary <string, string> (); data ["username"] = username; data ["password"] = password; socket.Emit("login", new JSONObject(data)); }
// /** socket open될때 connect 소켓 보냄 */ // public void sendConnect() { // JsonModel jm = new JsonModel(); // jm.sendStr = "connect"; // jm.result = uuid; // JSONObject jo = new JSONObject(JsonUtility.ToJson(jm) ); // socket.Emit("send", jo ); // } // public void sendSuccess() { // JsonModel jm = new JsonModel(); // jm.sendStr = "success"; // JSONObject jo = new JSONObject(JsonUtility.ToJson(jm) ); // socket.Emit("send", jo ); // } public void sendDrawing(Vector2 v2) { JsonModel jm = new JsonModel(); jm.sendStr = "drawing"; jm.result = v2.ToString(); JSONObject jo = new JSONObject(JsonUtility.ToJson(jm)); socket.Emit("send", jo); }
public void LoadData() { if (socket == null) { Connect(); } Debug.Log("Loading Data"); socket.Emit("loadData"); }
public void setgame(SocketIOEvent obj) { i++; Debug.Log(i); correctTxt.gameObject.SetActive(false); wrongTxt.gameObject.SetActive(false); Debug.Log("Game Set" + obj.data); QuestionModel question = JsonUtility.FromJson <QuestionModel>(obj.data.ToString()); Debug.Log(question.question); qnumbertxt.text = "Question " + i; questiontxt.text = question.question; Debug.Log(question.answer); List <QuestionModel.Choices> choices = new List <QuestionModel.Choices>(); choices = question.choices; RemoveChoicesButton(); foreach (var item in choices) { GameObject choicesController = answerButtonObjectPool.GetObject(); choicesController.transform.SetParent(choicesPanel); choicesList.Add(choicesController); ChoicesController choice = choicesController.GetComponent <ChoicesController>(); choice.Setup(item); timeLeft = maxTime; choice.Isclick = false; Button ans = choice.GetComponent <Button>(); ans.onClick.AddListener(() => { if (choice.Isclick == false) { Debug.Log("Onclick" + choice.choices.text); if (choice.choices.value == true) { Debug.Log("Correct"); choice.Isclick = true; correctTxt.gameObject.SetActive(true); var data = JsonUtility.ToJson(playerCon.player); socket.Emit("Answer", new JSONObject(data)); Debug.Log("Sending"); } else { Debug.Log("Wrong"); choice.Isclick = true; wrongTxt.gameObject.SetActive(true); } } else { Debug.Log("Cannot ans again!!"); } }); } }