当前位置: 首页>>代码示例>>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;未经允许,请勿转载。