public static void AddListeners() { TencentIMSDK.AddRecvNewMsgCallback(RecvNewMsgCallback); // 接收消息事件 // TencentIMSDK.SetMsgReadedReceiptCallback(MsgReadedReceiptCallback); // 消息已读回调 // TencentIMSDK.SetMsgRevokeCallback(MsgRevokeCallback); // 消息撤回回调 // TencentIMSDK.SetMsgElemUploadProgressCallback(MsgElemUploadProgressCallback); // 多媒体消息发送进度回调 // TencentIMSDK.SetGroupTipsEventCallback(GroupTipsEventCallback); // 群tips回调 // TencentIMSDK.SetGroupAttributeChangedCallback(GroupAttributeChangedCallback); // 群属性改变 addStringDataToConsole("Listeners add success"); }
void AddEventListenerSDK(string eventName) { var eventInfo = new EventListenerInfo.EventInfo(); EventListenerInfo.Info.Add(eventName, eventInfo); switch (eventName) { case "AddRecvNewMsgCallback": { TencentIMSDK.AddRecvNewMsgCallback(null, Utils.RecvNewMsgCallback(GetResult, eventInfo)); break; } case "SetMsgReadedReceiptCallback": { TencentIMSDK.SetMsgReadedReceiptCallback(null, Utils.SetMsgReadedReceiptCallback(GetResult, eventInfo)); break; } case "SetMsgRevokeCallback": { TencentIMSDK.SetMsgRevokeCallback(null, Utils.SetMsgRevokeCallback(GetResult, eventInfo)); break; } case "SetGroupTipsEventCallback": { TencentIMSDK.SetGroupTipsEventCallback(null, Utils.SetGroupTipsEventCallback(GetResult, eventInfo)); break; } case "SetMsgElemUploadProgressCallback": { TencentIMSDK.SetMsgElemUploadProgressCallback(null, Utils.SetMsgElemUploadProgressCallback(GetResult, eventInfo)); break; } default: { print($"Unknown event {eventName}"); break; } } Button btn = GameObject.Find(eventName).GetComponent <Button>(); RenderButton(eventName, btn); }