导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - UnityCommunicationBridge.java 源代码

正在查看: RummyCircle v11000.89 应用的 UnityCommunicationBridge.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.games24x7.dynamicrc.unitymodule.comm.bridge;

import android.content.Context;
import android.util.Log;
import com.games24x7.coregame.KrakenApplication;
import com.games24x7.coregame.common.CommonConfig;
import com.games24x7.coregame.common.communication.nativecomm.NativeCommunicationInterface;
import com.games24x7.dynamicrc.unitymodule.comm.unitycomm.NativeUnityCommController;
import com.games24x7.pgeventbus.event.PGEvent;
import com.google.gson.d;
import com.unity3d.player.UnityPlayer;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;

@Metadata
public class UnityCommunicationBridge implements NativeCommunicationInterface.Bridge {

    @NotNull
    public static final Companion Companion = new Companion(null);

    @NotNull
    private static final String TAG = "UNITY_BRIDGE";

    @NotNull
    private final NativeCommunicationInterface.Controller communicationController;

    @NotNull
    private final Context context;

    @Metadata
    public static final class Companion {
        public Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        private Companion() {
        }
    }

    public UnityCommunicationBridge(@NotNull Context context) {
        Intrinsics.checkNotNullParameter(context, "context");
        this.context = context;
        this.communicationController = new NativeUnityCommController(this, KrakenApplication.Companion.getApplicationContext(), new CommonConfig("https://www.google.com"));
    }

    private final void sendMessageToUnity(String str, String str2, String str3) {
        try {
            UnityPlayer.UnitySendMessage(str, str2, str3);
        } catch (Exception e) {
            e.printStackTrace();
            Log.d("SendMessageToUnityProxy", "Exception handling : \nInterfaceName =  " + str + "  : \nMethodName =  " + str2 + " \n " + Unit.a);
        }
    }

    @NotNull
    public final Context getContext() {
        return this.context;
    }

    public void onCallbackFromNative(@NotNull PGEvent pGEvent) {
        Intrinsics.checkNotNullParameter(pGEvent, "pgEvent");
        Log.e(TAG, new d().s(pGEvent));
        sendMessageToUnity("NativeCommunicator", "InitiateNativeCallback", new d().s(pGEvent));
    }

    public final void requestNative(@NotNull String str, @NotNull String str2, @NotNull String str3) {
        Intrinsics.checkNotNullParameter(str, "eventInfo");
        Intrinsics.checkNotNullParameter(str2, "payload");
        Intrinsics.checkNotNullParameter(str3, "callbackInfo");
        Log.e(TAG, "requestNative :: Requested for native :: payload is :: " + str2);
        this.communicationController.requestNative(str, str2, str3);
    }

    public final void unregisterEventBus() {
        this.communicationController.unregisterEventBus();
    }
}