當前位置: 首頁>>代碼示例>>C#>>正文


C# SocketIO.SocketIOEvent類代碼示例

本文整理匯總了C#中SocketIO.SocketIOEvent的典型用法代碼示例。如果您正苦於以下問題:C# SocketIOEvent類的具體用法?C# SocketIOEvent怎麽用?C# SocketIOEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SocketIOEvent類屬於SocketIO命名空間,在下文中一共展示了SocketIOEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: getAcceleration

    public void getAcceleration(SocketIOEvent e)
    {
        //Debug.Log("Acceleration X: " +  e.data["aX"].ToString());
        //Debug.Log("Acceleration Y: " +  e.data["aY"].ToString());
        //Debug.Log("Acceleration Z: " +  e.data["aZ"].ToString());

        currentAx = float.Parse((e.data["aX"]).ToString());
        currentAy = float.Parse((e.data["aY"]).ToString());;
        //Probably most important value
        currentAz = float.Parse((e.data["aZ"]).ToString());

        if (currentAx > 0.5 || currentAx < -0.5) {
            ogAx = currentAx;
        }
        else {
            ogAx = 0;
        }
        if (currentAy > 0.5 || currentAy < -0.5) {
            ogAy = currentAy;
        }
        else {
            ogAy = 0;
        }
        if (currentAz > 0.5 || currentAz < -0.5) {
            ogAz = currentAz;
        } else {
            ogAz = 0;
        }
    }
開發者ID:timotius02,項目名稱:VRGolf,代碼行數:29,代碼來源:swing.cs

示例2: OnMessage

    public void OnMessage(SocketIOEvent e)
    {
        Debug.Log("[SocketIO] OnMessage : " + e.name + " " + e.data);
        Debug.Log("hello");

        dataF = e.data.list[0].f;
    }
開發者ID:jasonrwalters,項目名稱:Unity_SocketIO,代碼行數:7,代碼來源:TestSocketIO.cs

示例3: CloseHandler

 public void CloseHandler(SocketIOEvent e)
 {
     if(isServer){
         Debug.Log("[SocketIO] Close received: " + e.name + " " + e.data);
         // socketIOInputEvents.ServerDisconnect();
     }
 }
開發者ID:MylesBell,項目名稱:Unity,代碼行數:7,代碼來源:SocketNetworkManager.cs

示例4: ackLeaveRoom

 public void ackLeaveRoom(SocketIOEvent e)
 {
     Debug.Log ("방 퇴장");
     //방을 퇴장하면 룸 채팅창을 깨끗히 비운다.
     GameObject.Find ("RoomChatField").GetComponent<Text> ().text = "";
     GameObject.Find ("Canvas").GetComponent<MenuManager> ().ShowMenu (GameObject.Find ("Lobby").GetComponent<Menu>());
 }
開發者ID:alciakng,項目名稱:WormsClient,代碼行數:7,代碼來源:MenuController.cs

示例5: OnPlayAvariable

    private void OnPlayAvariable(SocketIOEvent evt )
    {
        UserData player1 = CheckPlayer(evt.data.GetField("player1"));
        UserData player2 = CheckPlayer(evt.data.GetField("player2"));

        if( GameManager.Instance.userData.ID == player1.ID ){
            Debug.Log("Player1 Ready!!");
            GameManager.Instance.player = GameManager.Player.player1;

            JSONObject ready = new JSONObject();
            ready.AddField("id", player1.ID );
            NetworkManager.Instance.Socket.Emit("READY", ready);
        }else{
            if( GameManager.Instance.userData.ID == player2.ID ){
                Debug.Log("Player2 Ready!!");
                GameManager.Instance.player = GameManager.Player.player2;
                JSONObject ready = new JSONObject();
                ready.AddField("id", player1.ID );
                NetworkManager.Instance.Socket.Emit("READY", ready);
            }else{
                Debug.Log("JUST WATCH!!");
                GameManager.Instance.player = GameManager.Player.guest;
            }
        }

        oldText.text 		= player1.UserName;
        friendText.text 	= player2.UserName;
    }
開發者ID:shunlll999,項目名稱:pong-unity,代碼行數:28,代碼來源:GameController.cs

示例6: loginSuccess

	void loginSuccess(SocketIOEvent e)
	{
		PlayerName = myscript.jsontoString( e.data [0].ToString (),"\"");
		Player.Name = PlayerName;
		Player.ID = myscript.jsontoString(e.data [1].ToString (),"\"");
		Player.MyColor = myscript.jsontoString(e.data [3].ToString (),"\"");
		Debug.Log ("Your ID : " + PlayerName);
		Debug.Log ("Your Position : " + e.data [2].ToString ());

		if (myscript.jsontoString(e.data [2].ToString (),"\"") == "null") 
		{
			Player.startPosition = Vector3.zero;

		} else 
		{
			Player.startPosition = myscript.StringtoVector3(myscript.jsontoString(e.data [2].ToString (),"\""));
		}

		Player.gameObject.transform.position = Player.startPosition;

		Login = false;
		Application.LoadLevel(1);

                                     
	}
開發者ID:SuwalskiKarol,項目名稱:oor,代碼行數:25,代碼來源:NetworkManager.cs

示例7: playerEnter

	public void playerEnter(SocketIOEvent e)
	{
		string side = string.Format ("{0}", e.data ["side"]);
		string character = string.Format ("{0}", e.data ["character"]);
		string holdingItem = string.Format ("{0}", e.data ["holdingItem"]);

		if (holdingItem.Contains ("none")) {

			Debug.Log ("NOITEMCALLchar: " + character + "  tempSide: " + side);
			callingCharAnims.GetComponent<CallingCharAnimations> ().callAnimation (character, side);


		} else {
			Debug.Log ("char: " + character + "  tempSide: " + side + "  holdingItem :" + holdingItem);
			
			string tempItem = "chili";
			
			callingCharAnims.GetComponent<CallingCharAnimations> ().callAnimationWithItem (character, side, holdingItem);
			
			
			if (tempItem.Contains ("bramble")) {
				
			}

		}

	}
開發者ID:polygon-studios,項目名稱:house,代碼行數:27,代碼來源:SocketIOLogic.cs

示例8: moveCallback

    private void moveCallback(SocketIOEvent obj)
    {
        Debug.Log(string.Format("[name: {0}, data: {1}]", obj.name, obj.data));

        var playerId = obj.data["player"].str;
        var move = obj.data["move"];
        var distance = obj.data["distance"].n;
        var direction = int.Parse(move.str);

        _gameboard.SetActivePlayer(playerId);

        // -1 is a failed move
        if (distance < 0)
            _gameboard.HandlePlayerMove(playerId, direction, false);

        // 1 is a successful move
        if (distance > 0)
        {
            _gameboard.HandlePlayerMove(playerId, direction, true);
        }
        
        // 0 is game over
        if (distance == 0)
        {
            _gameboard.HandleGameOver();
        }
    }
開發者ID:dxhackers,項目名稱:cybermaze,代碼行數:27,代碼來源:SocketIoSetup.cs

示例9: PlayerMove

 public void PlayerMove(SocketIOEvent e)
 {
     Debug.Log("Player " + myscript.jsontoString (e.data [0].ToString (), "\"") + " : " + myscript.jsontoString (e.data [1].ToString (), "\"") );
     GameObject newObj = GameObject.Find (myscript.jsontoString (e.data [0].ToString (), "\""));
     Debug.Log(newObj);
     newObj.GetComponent<OtherPlayer>().currentPosition = myscript.StringtoVector3(myscript.jsontoString(e.data [1].ToString (),"\""));
 }
開發者ID:carl03q,項目名稱:salsipuedes,代碼行數:7,代碼來源:NetworkManager.cs

示例10: RemovePlayer

 public void RemovePlayer(SocketIOEvent e)
 {
     string id = "__"+e.data.GetField("id").str;
     //        Debug.Log("goodby "+id);
     GameObject obj = GameObject.Find(id);
     Destroy(obj);
 }
開發者ID:DialBird,項目名稱:kadai,代碼行數:7,代碼來源:newJoinScript.cs

示例11: ToClient

	public void ToClient(SocketIOEvent e){
		Debug.Log(string.Format("[name: {0}, data: {1}]", e.name, e.data));
		Debug.Log (e.data ["msg"].ToString().Trim());
		playercontrolobject = GameObject.Find ("__GameManager");
		_PlayerControl = playercontrolobject.GetComponent<PlayerControl> ();
		//_PlayerControl.TakeInput (e.data ["msg"].ToString().Trim('"'));
	}
開發者ID:EojinRho,項目名稱:WizardChess,代碼行數:7,代碼來源:Client.cs

示例12: CheckID

    void CheckID(SocketIOEvent e)
    {
        //socket情報抽出
        string id = "__"+e.data.GetField("id").str;
        string direction = e.data.GetField("direction").str;
        Debug.Log(id);
        Debug.Log(direction);

        //送られてきたIDの対象を特定
        GameObject target = GameObject.Find(id);
        plycon = target.GetComponent<PlayerController>();

        //対象のオブジェクトに、特定の方向に動かす命令
        switch(direction){
            case "up":
                plycon.MoveUp();
                break;
            case "left":
                plycon.MoveLeft();
                break;
            case "right":
                plycon.MoveRight();
                break;
            case "down":
                plycon.MoveDown();
                break;
        }
    }
開發者ID:DialBird,項目名稱:kadai,代碼行數:28,代碼來源:MoveControlScript.cs

示例13: loginSuccess

 public void loginSuccess(SocketIOEvent e)
 {
     Debug.Log("Login Exitoso");
     GameObject script = GameObject.Find("Cube");
     Debug.Log(script);
     Destroy(script);
     Application.LoadLevel("Juego");
 }
開發者ID:carl03q,項目名稱:salsipuedes,代碼行數:8,代碼來源:NetworkManager.cs

示例14: OnRecketEnemyMove

 private void OnRecketEnemyMove(SocketIOEvent evt )
 {
     if( GameManager.Instance.player == GameManager.Player.player1 ){
         racketPlayer2.FromBoradcastVelocity(Converter.JsonToVecter2(Converter.JsonToString(evt.data.GetField("position").ToString())));
     }else if( GameManager.Instance.player == GameManager.Player.player2 ){
         racketPlayer1.FromBoradcastVelocity(Converter.JsonToVecter2(Converter.JsonToString(evt.data.GetField("position").ToString())));
     }
 }
開發者ID:shunlll999,項目名稱:pong-unity,代碼行數:8,代碼來源:GameController.cs

示例15: OnAcceleration

 public void OnAcceleration(SocketIOEvent e)
 {
     Debug.Log(e.data);
     JSONNode node = JSON.Parse(e.data + "");
     acceleration = node["acceleration"].AsFloat;
     //Debug.Log(json.GetField("acceleration"));
      
 }
開發者ID:chrisfries,項目名稱:vrbike-unity,代碼行數:8,代碼來源:BikeMovement.cs


注:本文中的SocketIO.SocketIOEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。