我正在为iOS游戏而团结。要解锁成就,我需要从我的C#代码中访问“ Achievement.mm”文件:
[DllImport("__Internal")]
private static extern void
GKAchievement(string achievementID, float progress, bool value);
Run Code Online (Sandbox Code Playgroud)
我从一个论坛获得了这段代码。但是,“ __ Internal”是什么意思?
@FunctionalInterface
public interface ServiceCaller {
void callService();
}
//common method to execute any service call
public void executeService(ServiceCaller serviceCaller) {
//do common things
//i want to access dbValidationRequest/apiValidationRequest here for logging purpose
try {
serviceCaller.callService();
} catch (Exception ex) {
//do common things
LogUtils.log(logger, ex);
}
//do common things
}
//my clients call this
public void validateFromDb(DbValidationRequest dbValidationRequest){
commonUtils.executeService(()-> dbValidationService.validate(dbValidationRequest));
}
//my clients call this
public void validateFromApi(ApiValidationRequest apiValidationRequest){
commonUtils.executeService(()-> apiValidationService.validate(apiValidationRequest));
}
Run Code Online (Sandbox Code Playgroud)
这是Java Spring应用程序的控制器。在executeService方法中,我传递了ServiceCaller接口的一个实例。我使用此方法从控制器调用所有服务。如果我使用 intelliJ IDEA …