本文整理汇总了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;
}
}
示例2: OnMessage
public void OnMessage(SocketIOEvent e)
{
Debug.Log("[SocketIO] OnMessage : " + e.name + " " + e.data);
Debug.Log("hello");
dataF = e.data.list[0].f;
}
示例3: CloseHandler
public void CloseHandler(SocketIOEvent e)
{
if(isServer){
Debug.Log("[SocketIO] Close received: " + e.name + " " + e.data);
// socketIOInputEvents.ServerDisconnect();
}
}
示例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>());
}
示例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;
}
示例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);
}
示例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")) {
}
}
}
示例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();
}
}
示例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 (),"\""));
}
示例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);
}
示例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('"'));
}
示例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;
}
}
示例13: loginSuccess
public void loginSuccess(SocketIOEvent e)
{
Debug.Log("Login Exitoso");
GameObject script = GameObject.Find("Cube");
Debug.Log(script);
Destroy(script);
Application.LoadLevel("Juego");
}
示例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())));
}
}
示例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"));
}