private void OnHandleMonoEvent(IEventMessage msg) { if(msg is TestEventMsg) { TestEventMsg temp = msg as TestEventMsg; Debug.Log($"这里是Hotfix层 {temp.Value}"); } }
private void OnHandleEventMsg(IEventMessage msg) { if (msg is TestEventMsg) { TestEventMsg temp = msg as TestEventMsg; Debug.Log($"这里是MONO层: {temp.Value}"); // 再给Hotfix层回复一条相同的测试消息 TestEventMsg newMsg = new TestEventMsg() { Value = $"test event from mono {Time.frameCount}", }; EventManager.Instance.Send(EventMessageTag.HotfixTag.ToString(), newMsg); } }
private void OnClickLogin() { // 播放点击音效 AudioManager.Instance.PlaySound("click"); // 替换按钮图片 if (_loginSprite.SpriteName == "button_1") _loginSprite.SpriteName = "button_2"; else _loginSprite.SpriteName = "button_1"; // 连接到ET5.0服务器 if (NetManager.Instance.State == MotionEngine.Net.ENetworkState.Disconnect) NetManager.Instance.ConnectServer("127.0.0.1", 10002, typeof(NetProtoPackageParser)); // 向Mono层发送测试事件 TestEventMsg eventMsg = new TestEventMsg() { Value = $"test event from hotfix {Time.frameCount}", }; EventManager.Instance.Send(EventMessageTag.TestTag.ToString(), eventMsg); }