Skip to content

Commit

Permalink
Optimize the code
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuguohua committed Mar 7, 2025
1 parent d07e484 commit d2cec2f
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ static int addOnCompleteListener(int taskId, int listenerId) {
Log.e(TAG, "Called task id does not exist");
return -1;
}
Task<?> newTask = _taskMap.get(taskId).addOnCompleteListener((var)->{
Task<?> newTask = _taskMap.get(taskId).addOnCompleteListener((task)->{
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
int nextTaskId = putTask(var);
int nextTaskId = putTask(task);
onTaskCompleteNative(taskId, listenerId, nextTaskId);
}
});
Expand All @@ -141,13 +141,13 @@ static int addOnFailureListener(int taskId, int listenerId) {
Log.e(TAG, "Called task id does not exist");
return -1;
}
Task<?> newTask = _taskMap.get(taskId).addOnFailureListener((var)->{
Task<?> newTask = _taskMap.get(taskId).addOnFailureListener((e)->{
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
int nextExceptionId = ++_nextExceptionId;
_exceptionsMap.put(nextExceptionId, var);
onTaskFailureNative(taskId, listenerId, var, nextExceptionId);
_exceptionsMap.put(nextExceptionId, e);
onTaskFailureNative(taskId, listenerId, e, nextExceptionId);
}
});
});
Expand All @@ -158,11 +158,11 @@ static int addOnSuccessListener(int taskId, int listenerId) {
Log.e(TAG, "Called task id does not exist");
return -1;
}
Task<?> newTask = _taskMap.get(taskId).addOnSuccessListener((var)->{
Task<?> newTask = _taskMap.get(taskId).addOnSuccessListener((result)->{
CocosHelper.runOnGameThread(new Runnable() {
@Override
public void run() {
onTaskSuccessNative(taskId, listenerId, var);
onTaskSuccessNative(taskId, listenerId, result);
}
});
});
Expand Down

0 comments on commit d2cec2f

Please sign in to comment.