GodotTapsell:
Godot Tapsell plugin implemented based on Godot 3.2.2+ android plugin standards.
This plugin uses Tapsell sdk.
Tapsell "reward video" and "native banner" are supported in godotTapsell plugin.
prerequisite:
Install Custom builds for Android using official godot engine documention.
Installation:
Download latest release from release page and extract content to [your_project_path]/android/plugins folder.
Enable plugin on export dialog.
From "Project>Project settings" dialog do steps 1 and 2 as you see in below image:
In [your_project_path]/android/build/config.gradle file change kotlin version to kotlinVersion : '1.4.0' .
Note: You have to activate your VPN before build after this settings by now!
Note: This plugin just works on your build on device.
Connect to plugin in Godot:
Download tapsell.gd file and add it to your games common folder and add it to your Autoload.
1- How to implement "Reward Video":
#connecting events
func _ready():
if Engine.has_singleton(Tapsell.tapsell_plugin_name):
Tapsell.tapsellPlugin.connect("on_rewarded_done", self, "on_rewarded_done")
Tapsell.tapsellPlugin.connect("on_no_network", self, "on_no_network")
Tapsell.tapsellPlugin.connect("on_no_ad_available", self, "on_no_ad_available")
Tapsell.tapsellPlugin.connect("on_error", self, "on_error")
#request a reward video
func on_checknet_success():
#call this method with your ad zone_id
Tapsell.tapsellPlugin.requestAd("5sdf15s551f5a15sdf4465")
#runs after your reward video finished successful
func on_rewarded_done(result):
if str(result) == "true":
#give the reward to user
#runs if no video available that is reported from tapsell
func on_no_ad_available():
# run your decision if no video available from tapsell
1- How to implement "native banner":
#connecting events
func request_ad(zoneId):
if Engine.has_singleton(Tapsell.tapsell_plugin_name):
#connect to banner load event
Tapsell.tapsellPlugin.connect("native_ad_filled", self, "native_ad_filled")
#call for a native banner from tapsell
Tapsell.tapsellPlugin.getNativeAdd(zoneId)
# calls when your native banner is available
func native_ad_filled(adParams):
adFilled = adParams
#adParams filles with parts of your native banner.
adParams["iconUrl"], #iconUrl of native banner
adParams["callToActionText"] #call to action text
adParams["landscapeImageUrl"], #url of landscape image of banner
adParams["description"], #description of native banner
adParams["zoneId"],
adParams["adId"]
#you can use this function for loading images of native banner from tapsell
func load_image(imgUrl):
var http_error = $HTTPRequest.request(str(imgUrl))
#runs after image is loaded
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
var image = Image.new()
print_debug("response_code", body)
var image_error = image.load_jpg_from_buffer(body)
if image_error != OK:
image_error = image.load_png_from_buffer(body)
if image_error != OK:
print(image_error)
var texture = ImageTexture.new()
texture.create_from_image(image, 4)
# Assign to the child TextureRect node to display image
$TexImage.texture = texture