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

View File

@ -27,14 +27,14 @@
"_level": 1, "_level": 1,
"_components": [ "_components": [
{ {
"__id__": 24 "__id__": 26
}, },
{ {
"__id__": 25 "__id__": 27
} }
], ],
"_prefab": { "_prefab": {
"__id__": 26 "__id__": 28
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
@ -246,11 +246,11 @@
"_level": 3, "_level": 3,
"_components": [ "_components": [
{ {
"__id__": 22 "__id__": 24
} }
], ],
"_prefab": { "_prefab": {
"__id__": 23 "__id__": 25
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
@ -582,10 +582,13 @@
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 20
},
{
"__id__": 21
} }
], ],
"_prefab": { "_prefab": {
"__id__": 21 "__id__": 23
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
@ -759,6 +762,86 @@
"_atlas": null, "_atlas": null,
"_id": "" "_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", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

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

View File

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

View File

@ -16,7 +16,7 @@ android {
targetSdkVersion PROP_TARGET_SDK_VERSION targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 3 versionCode 3
versionName "1.0.2" versionName "1.0.2"
multiDexEnabled true
ndk{ ndk{
abiFilters 'armeabi-v7a','arm64-v8a' abiFilters 'armeabi-v7a','arm64-v8a'
} }
@ -145,7 +145,7 @@ dependencies {
implementation project(':libcocos2dx') implementation project(':libcocos2dx')
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: []) 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 "com.github.komputing:khex:1.0.0-RC6"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" 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-core:1.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android: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(); String signStr = Objects.requireNonNull(resp.getResult()).toString();
Log.i(TAG, signStr); Log.i(TAG, signStr);
signStr = signStr.substring(2); 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 { } else {
Log.i(TAG, "sign is empty"); Log.i(TAG, "sign is empty");
} }
@ -372,6 +381,7 @@ public class AppActivity extends Cocos2dxActivity implements YouMeCallBackInterf
return; return;
} }
if (chainId != 321L) { if (chainId != 321L) {
System.out.println("链错误");
appActivity.runOnGLThread(new Runnable() { appActivity.runOnGLThread(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

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