private void OnSendEventGroupNotify(MsSendEventGroupNotify tRsp) { string payload = tRsp.cpProto; JsonData data = JsonUtil.toObject(payload); string action = (string)data["action"]; if (action.Equals("enter")) { int id = (int)data["id"]; GameObject target = GetPlayerInfoByID(id).Target; target.GetComponent <CharacterMove>().OnEnter(); data = new JsonData(); data["action"] = "enterResponse"; data["id"] = GameManager.userID; string value = JsonUtil.toJson(data); GameManager.SendEventGroup(value, new string[] { "specialArea" }); Message("玩家" + id + "进入特殊区域"); } else if (action.Equals("exist")) { int id = (int)data["id"]; GameObject target = GetPlayerInfoByID(id).Target; target.GetComponent <CharacterMove>().OnExist(); Message("玩家" + id + "离开特殊区域"); } else if (action.Equals("enterResponse")) { int id = (int)data["id"]; GameObject target = GetPlayerInfoByID(id).Target; target.GetComponent <CharacterMove>().OnEnter(); } }
public override int sendEventGroupNotify(MsSendEventGroupNotify tRsp) { Debug.Log("sendEventGroupNotify: " + JsonUtil.toJson(tRsp)); Loom.QueueOnMainThread(() => { if (GameManager.Instance.sendEventGroupNotify != null) { GameManager.Instance.sendEventGroupNotify(tRsp); } }); return(0); }