コード例 #1
0
ファイル: AddEventListener.cs プロジェクト: tencentyun/TIMSDK
    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);
    }
コード例 #2
0
ファイル: AddEventListener.cs プロジェクト: tencentyun/TIMSDK
    void RemoveEventListenerSDK(string eventName)
    {
        switch (eventName)
        {
        case "AddRecvNewMsgCallback":
        {
            TencentIMSDK.RemoveRecvNewMsgCallback();
            break;
        }

        case "SetMsgReadedReceiptCallback":
        {
            TencentIMSDK.SetMsgReadedReceiptCallback();
            break;
        }

        case "SetMsgRevokeCallback":
        {
            TencentIMSDK.SetMsgRevokeCallback();
            break;
        }

        case "SetGroupTipsEventCallback":
        {
            TencentIMSDK.SetGroupTipsEventCallback();
            break;
        }

        case "SetMsgElemUploadProgressCallback":
        {
            TencentIMSDK.SetMsgElemUploadProgressCallback();
            break;
        }

        default:
        {
            print($"Unknown event {eventName}");
            break;
        }
        }
        EventListenerInfo.Info.Remove(eventName);
        Button btn = GameObject.Find(eventName).GetComponent <Button>();

        RenderButton(eventName, btn);
    }