const OC_RV_WRAPPER_CLASS = "ATRewardedVideoWrapper"; import ATiOSJS from "./ATiOSJS"; interface ATiOSRewardedVideoJSInterface { loadRewardedVideo(placementId: string, extra: string): void; setAdListener(listener: string): void; hasAdReady(placementId: string): boolean; checkAdStatus(placementId: string): boolean; setUserData(placementId: string, userId: string, userData: any): void; // Adjust type of userData if needed showAd(placementId: string): void; showAdInScenario(placementId: string, scenario: string): void; } const ATiOSRewardedVideoJS: ATiOSRewardedVideoJSInterface = { loadRewardedVideo(placementId: string, extra: string): void { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::loadRewardedVideo(${placementId}, ${extra})`); jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "loadRewardedVideoWithPlacementID:extra:", placementId, extra); }, setAdListener(listener: string): void { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::setAdListener(${listener})`); jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "setDelegates:", listener); }, hasAdReady(placementId: string): boolean { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::hasAdReady(${placementId})`); return jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "rewardedVideoReadyForPlacementID:", placementId); }, checkAdStatus(placementId: string): boolean { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::checkAdStatus(${placementId})`); return jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "checkAdStatus:", placementId); }, setUserData(placementId: string, userId: string, userData: any): void { cc.log("Android-setUserData"); // Implement functionality if needed }, showAd(placementId: string): void { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::showAd(${placementId})`); jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "showRewardedVideoWithPlacementID:scene:", placementId, null); }, showAdInScenario(placementId: string, scenario: string): void { ATiOSJS.printJsLog(`ATiOSRewardedVideoJS::showAdInScenario(${placementId}, ${scenario})`); jsb.reflection.callStaticMethod(OC_RV_WRAPPER_CLASS, "showRewardedVideoWithPlacementID:scene:", placementId, scenario); } }; export default ATiOSRewardedVideoJS;