项目作者: MrZak-dev

项目描述 :
Facebook Audience Network Ad module for godot
高级语言: Java
项目地址: git://github.com/MrZak-dev/GodotFAN.git
创建时间: 2019-04-12T15:35:41Z
项目社区:https://github.com/MrZak-dev/GodotFAN

开源协议:Other

下载


Facebook Audience Network GODOT Plugin compatible with godot >= 3.2.1 new plugin system

Using the plugin

clone or download the repo to your and place GodotFAN folder to your_godot_project/android folder , after installing Android Build Template

the new Godot plugin system doesn’t require compiling the source code

demo

Initialize the module

in your project.godot add

  1. [android]
  2. modules="org/godotengine/godot/GodotFAN"

or From Project Setting >> Compression > Android

API

  1. var facebookAds
  2. func _ready()-> void:
  3. facebookAds = Engine.get_singleton("GodotFAN")
  4. facebookAds.FacebookAdsInit(get_instance_id(),"YOUR_INTERSTITIAL_PLACEMENT_id","YOUR_REWARDED_VIDEO_PLACEMENT_id" , "YOUR_BANNER_PLACEMENT_id")

Calling the interstitial and rewarded video ads

  1. facebookAds.showInterstitial() #Calls an interstitial ad
  2. facebookAds.loadRewardedVideo() # Loads a rewardedVideo ad
  3. facebookAds.showRewardedVideo() #Calls a rewarded video ad (remmember to call loadRewardedVideo() before showing a rewarded video)
  4. facebookAds.loadBanner(isTop : bool) #Loads a banner AdView , it takes a bool parameter , true for banner in the TOP , false for a banner in the BOTTOM
  5. facebookAds.showBanner() #show a banner ad if it is hidden , the banner ad is by visible by default
  6. facebookAds.hideBanner() #hide a banner ad , the banner ad is by visible by default

CallBacks

  1. #Interstitial Ad CallBacs
  2. func onInterstitialReady() -> void:
  3. #Called When a interstitial Ad is loaded and Ready
  4. pass
  5. func onInterstitialClosed() -> void:
  6. #Called When a interstitial Ad is closed
  7. pass
  8. ##Rewarded Video Ad CallBacs
  9. func onRewardedReady() -> void:
  10. #Called When a Rewarded video Ad is loaded and ready
  11. pass
  12. func onRewardedClosed() -> void:
  13. #Called When a Rewarded video Ad is closed (completed or not , this only detects the close action)
  14. pass
  15. func onRewardedCompleted() -> void:
  16. #Called When An Rewarded video Ad is completed
  17. #Call Reward Function here
  18. pass

Debugging

adb -d logcat GodotFan:V FAN:V godot:V *:S

Tested with godot 3.2.2