将js的事件循环改回由unity触发

This commit is contained in:
CounterFire2023 2023-10-24 16:32:19 +08:00
parent 2de4391966
commit f36a6e4c07
2 changed files with 14 additions and 14 deletions

View File

@ -222,22 +222,22 @@ extern "C"
} }
void tick(float dt) void tick(float dt)
{ {
// if (_isStarted) if (_isStarted)
// { {
// schedule_task_into_server_thread_task_queue(&gasync, [=]() schedule_task_into_server_thread_task_queue(&gasync, [=]()
// { JcWallet::getInstance()->tick(dt); }); { JcWallet::getInstance()->tick(dt); });
// JcWallet::getInstance()->tickRun(); JcWallet::getInstance()->tickRun();
// } }
} }
void tick2(float dt) void tick2(float dt)
{ {
if (_isStarted) // if (_isStarted)
{ // {
schedule_task_into_server_thread_task_queue(&gasync, [=]() // schedule_task_into_server_thread_task_queue(&gasync, [=]()
{ JcWallet::getInstance()->tick(dt); }); // { JcWallet::getInstance()->tick(dt); });
JcWallet::getInstance()->tickRun(); // JcWallet::getInstance()->tickRun();
} // }
} }
int runWalletMethod(const char *funId, const char *methodName, int paramCount, char **paramList) int runWalletMethod(const char *funId, const char *methodName, int paramCount, char **paramList)

View File

@ -146,8 +146,8 @@ public class MainActivity extends UnityPlayerActivity
PayClient payClient = PayClient.getInstance(); PayClient payClient = PayClient.getInstance();
payClient.init(this); payClient.init(this);
mWalletUtil = new WalletUtil(this); mWalletUtil = new WalletUtil(this);
JSTimers timer = new JSTimers(Looper.getMainLooper()); // JSTimers timer = new JSTimers(Looper.getMainLooper());
timer.sendEmptyMessage(JSTimers.JS_TICK); // timer.sendEmptyMessage(JSTimers.JS_TICK);
} }
@Override protected void onResume(){ @Override protected void onResume(){