add mehtod for UnitySendMessage

This commit is contained in:
CounterFire2023 2024-02-20 14:02:09 +08:00
parent b22d7565c5
commit 640311163a
3 changed files with 30 additions and 22 deletions

View File

@ -65,36 +65,32 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data
android:host="www.cebg.games"
android:pathPrefix="/client" />
<data android:host="www.cebg.games"/>
<data android:pathPrefix="/client"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data
android:host="www.cebg.games"
android:pathPrefix="/client" />
<data android:host="www.cebg.games"/>
<data android:pathPrefix="/client"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data
android:host="www.counterfire.games"
android:pathPrefix="/client" />
<data android:host="www.counterfire.games"/>
<data android:pathPrefix="/client"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data
android:host="www.counterfire.games"
android:pathPrefix="/client" />
<data android:host="www.counterfire.games"/>
<data android:pathPrefix="/client"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
@ -157,18 +153,16 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data
android:host="oauth-svr.cebggame.com"
android:pathPrefix="/google" />
<data android:host="oauth-svr.cebggame.com"/>
<data android:pathPrefix="/google"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data
android:host="oauth-svr.cebggame.com"
android:pathPrefix="/google" />
<data android:host="oauth-svr.cebggame.com"/>
<data android:pathPrefix="/google"/>
</intent-filter>
</activity>
<activity

View File

@ -56,10 +56,6 @@ import com.jc.jcfw.util.JsonUtils;
import com.unity3d.player.UnityPlayerActivity;
import net.openid.appauth.AuthState;
import net.openid.appauth.AuthorizationRequest;
import net.openid.appauth.AuthorizationService;
import net.openid.appauth.AuthorizationServiceConfiguration;
import net.openid.appauth.ResponseTypeValues;
import org.cocos2dx.lib.Cocos2dxHelper;
import org.cocos2dx.lib.CocosJSHelper;

View File

@ -17,6 +17,7 @@ import com.google.common.base.Strings;
import com.jc.jcfw.google.PayClient;
import com.jc.jcfw.util.ThreadUtils;
import com.jc.jcfw.util.UIUtils;
import com.unity3d.player.UnityPlayer;
import org.cocos2dx.lib.CocosJSHelper;
import org.greenrobot.eventbus.EventBus;
@ -233,4 +234,21 @@ public class JcSDK {
public static void nativeCb(NativeResult result) {
nativeCb(result.getFunid(), result.getError(), result.getDataStr());
}
public static void toUnity(String funId, String error, String dataStr) {
JSONObject result = new JSONObject();
try {
result.put("funid", funId);
if (Strings.isNullOrEmpty(error)) {
result.put("errcode", 0);
result.put("data", dataStr);
} else {
result.put("errcode", 1);
result.put("errmessage", error);
}
} catch (JSONException e) {
Log.e(TAG, "JSONException: " + e.getMessage());
}
UnityPlayer.UnitySendMessage("WalletPanel1", "onNativeCallback", result.toString());
}
}