This commit is contained in:
guoqing.zhu 2022-05-31 19:50:57 +08:00
parent 248a17fdfe
commit 8d7039b033
7 changed files with 137 additions and 19 deletions

View File

@ -47,8 +47,8 @@
},
"_scale": {
"__type__": "cc.Vec3",
"x": 0.9920991955598369,
"y": 0.9920991955598369,
"x": 0.805834949016571,
"y": 0.805834949016571,
"z": 1
},
"_quat": {
@ -13797,7 +13797,7 @@
"__id__": 411
}
],
"_active": true,
"_active": false,
"_level": 2,
"_components": [
{

View File

@ -27,14 +27,14 @@
"_level": 1,
"_components": [
{
"__id__": 24
"__id__": 26
},
{
"__id__": 25
"__id__": 27
}
],
"_prefab": {
"__id__": 26
"__id__": 28
},
"_opacity": 255,
"_color": {
@ -246,11 +246,11 @@
"_level": 3,
"_components": [
{
"__id__": 22
"__id__": 24
}
],
"_prefab": {
"__id__": 23
"__id__": 25
},
"_opacity": 255,
"_color": {
@ -582,10 +582,13 @@
"_components": [
{
"__id__": 20
},
{
"__id__": 21
}
],
"_prefab": {
"__id__": 21
"__id__": 23
},
"_opacity": 255,
"_color": {
@ -759,6 +762,86 @@
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 22
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": ""
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "898d0t9wgdL+r0KgbgiHLTO",
"handler": "onClickOK",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {

View File

@ -12,6 +12,8 @@ const { GIFCache } = require('./gif/GIF');
const { showLoading } = require('./gif/Loading');
const { operation, OperationType } = require('./Operation/Operation');
const jcgamelog = require('./jcfw/service/jcgamelog');
const { uimanger } = require('./UI/UIManger');
const { default: ChainErrTip } = require('./tips/ChainErrTip');
window.connectOK = (account) => {
jcgamelog.addOperation(
@ -29,7 +31,8 @@ window.connectOK = (account) => {
};
window.chainErr = ()=>{
console.log("chain err")
console.log("打开提示框")
cc.Notifier.emit("chainerr");
};
window.signApp = (sign) => {
@ -130,7 +133,7 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.allCountry = ['Japan', 'Singapore', 'Turkey', 'USA'];
this.cpa_icon = [];
@ -144,6 +147,9 @@ cc.Class({
cc.Notifier.on('autologinsuccess', this, this.loadMain.bind(this));
cc.Notifier.on("chainerr",this,this.showchainErrTip.bind(this));
cc.debug.setDisplayStats(false);
// if (baseconfig.mainConfig.isoffical == false) {
@ -165,6 +171,11 @@ cc.Class({
}
},
showchainErrTip(){
console.log("链id错误")
uimanger.showUI(ChainErrTip.prefabPath);
},
loadMain() {
showLoading();
cc.director.loadScene('MainScene');
@ -190,6 +201,7 @@ cc.Class({
cc.Notifier.off('sdkloginfail', this);
cc.Notifier.off('sdkLoginSuccess', this);
cc.Notifier.off('autologinsuccess', this);
cc.Notifier.off("chainerr",this,this.showchainErrTip.bind(this));
cc.loader.onProgress = null;
SDKManage.logEvent('login_success', 'loginmain');
},

View File

@ -32,9 +32,12 @@ export default class ChainErrTip extends UIBase {
JSON.stringify(chainInfo)
);
}
this.node.destroy()
}
onClose() {
// this.node.destroy();
this.node.destroy();
}
}

View File

@ -16,7 +16,7 @@ android {
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 3
versionName "1.0.2"
multiDexEnabled true
ndk{
abiFilters 'armeabi-v7a','arm64-v8a'
}
@ -145,7 +145,7 @@ dependencies {
implementation project(':libcocos2dx')
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
implementation "org.java-websocket:Java-WebSocket:1.4.0"
implementation "org.java-websocket:Java-WebSocket:1.4.0"
implementation "com.github.komputing:khex:1.0.0-RC6"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
@ -159,7 +159,13 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
implementation 'com.github.WalletConnect:kotlin-walletconnect-lib:0.9.6'
implementation 'com.google.android.play:core:1.10.2'
implementation ('com.github.WalletConnect:kotlin-walletconnect-lib:0.9.6') {
exclude group: 'org.bouncycastle', module: '*'
}
implementation "org.bouncycastle:bcprov-jdk15to18:1.68"
}

View File

@ -286,7 +286,16 @@ public class AppActivity extends Cocos2dxActivity implements YouMeCallBackInterf
String signStr = Objects.requireNonNull(resp.getResult()).toString();
Log.i(TAG, signStr);
signStr = signStr.substring(2);
Cocos2dxJavascriptJavaBridge.evalString("window.signApp(\"" + signStr + "\")");
final String finalSignStr = signStr;
appActivity.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxJavascriptJavaBridge.evalString("window.signApp(\"" + finalSignStr + "\")");
}
});
} else {
Log.i(TAG, "sign is empty");
}
@ -372,6 +381,7 @@ public class AppActivity extends Cocos2dxActivity implements YouMeCallBackInterf
return;
}
if (chainId != 321L) {
System.out.println("链错误");
appActivity.runOnGLThread(new Runnable() {
@Override
public void run() {

View File

@ -1,10 +1,13 @@
package org.cocos2dx.javascript;
import android.util.Log
import androidx.multidex.MultiDexApplication
import com.squareup.moshi.Moshi
import io.walletconnect.example.server.BridgeServer
import okhttp3.OkHttpClient
import org.cocos2dx.javascript.wc.JMoshiPayloadAdapter
import org.cocos2dx.javascript.wc.JWCSession
import org.komputing.khex.extensions.toNoPrefixHexString
import org.walletconnect.Session
import org.walletconnect.impls.*
@ -63,7 +66,8 @@ class ExampleApplication : MultiDexApplication() {
}
fun handleResponse(resp: Session.MethodCall.Response) {
signRes = resp.result as String;
signRes = resp.result as String
Log.i("Application", signRes)
}
@ -71,8 +75,8 @@ class ExampleApplication : MultiDexApplication() {
nullOnThrow { session }?.clearCallbacks()
val key = ByteArray(32).also { Random().nextBytes(it) }.toNoPrefixHexString()
config = Session.Config(UUID.randomUUID().toString(), "https://bridge.walletconnect.org", key)
session = WCSession(config,
MoshiPayloadAdapter(moshi),
session = JWCSession(config,
JMoshiPayloadAdapter(moshi),
storage,
OkHttpTransport.Builder(client, moshi),
Session.PeerMeta(name = "CEBG",url = "https://www.cebg.games/",description = "CEBG")