This commit is contained in:
cebgcontract 2022-09-16 11:45:53 +08:00
parent 8bf9e7b965
commit 406cf75d9c
3 changed files with 8 additions and 3 deletions

View File

@ -13,6 +13,7 @@ public class WalletPanel : MonoBehaviour
private float update = 0.0f;
private float tickRate = 1/30;
private static bool walletInited = false;
private static bool reqBegin = false;
// 用于保存调用js方法的callback
private static readonly Dictionary<string, Action<string>>
@ -45,7 +46,7 @@ public class WalletPanel : MonoBehaviour
// Update is called once per frame
void FixedUpdate(){
//Time.deltaTime
if (walletInited) {
if (walletInited && reqBegin) {
tick(Time.deltaTime);
}
// update += Time.deltaTime;
@ -103,8 +104,11 @@ public class WalletPanel : MonoBehaviour
string[] paramList,
WalletCallback callback
){
if (methodName == "initWallet") {
reqBegin = true;
}
string funId = System.Guid.NewGuid().ToString();
logger.Log(TAG, "wallet method id: " + funId);
logger.Log(TAG, "wallet method : " + methodName + " ID: " + funId);
requestCallback[funId] = (data) =>{
callback (data);
};

View File

@ -51,7 +51,7 @@ public class WalletTestPanel : MonoBehaviour
public void testSignLogin(){
WalletPanel.callWalletMethod("loginSign",
new [] { "login request", "123455" },
new [] { "123455", "login request" },
delegate (string jsonStr){
logger.Log(TAG, "loginSign result: " + jsonStr);
writeTxt("loginSign result: " + jsonStr);

View File

@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}