Initial Void Bastion 0.20 prototype
This commit is contained in:
commit
7362ca0f02
251 files changed
+29688
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
uid://dssu2uimllcg6
|
||||
@@ -0,0 +1,374 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
const PLUGIN_NAME: String = "AdmobPlugin"
|
||||
const ANDROID_DEPENDENCIES: Array = [ "androidx.appcompat:appcompat:1.7.1", "androidx.lifecycle:lifecycle-process:2.8.3", "com.google.android.gms:play-services-ads:24.9.0" ]
|
||||
const IOS_PLATFORM_VERSION: String = "14.3"
|
||||
const IOS_FRAMEWORKS: Array = [ "Foundation.framework", "AppTrackingTransparency.framework" ]
|
||||
const IOS_EMBEDDED_FRAMEWORKS: Array = [ ]
|
||||
const IOS_LINKER_FLAGS: Array = [ "-ObjC" ]
|
||||
const IOS_BUNDLE_FILES: Array = [ ]
|
||||
const SPM_DEPENDENCIES: Array = [ {&"url": "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", &"version": "12.14.0", &"products": ["GoogleMobileAds"]} ]
|
||||
|
||||
var android_export_plugin: AndroidExportPlugin
|
||||
var ios_export_plugin: IosExportPlugin
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
android_export_plugin = AndroidExportPlugin.new()
|
||||
add_export_plugin(android_export_plugin)
|
||||
ios_export_plugin = IosExportPlugin.new()
|
||||
add_export_plugin(ios_export_plugin)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
remove_export_plugin(android_export_plugin)
|
||||
android_export_plugin = null
|
||||
remove_export_plugin(ios_export_plugin)
|
||||
ios_export_plugin = null
|
||||
|
||||
|
||||
class AndroidExportPlugin extends EditorExportPlugin:
|
||||
const APP_ID_META_TAG = """
|
||||
<meta-data
|
||||
tools:replace="android:value"
|
||||
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
||||
android:value="%s"/>
|
||||
"""
|
||||
|
||||
var _plugin_name = PLUGIN_NAME
|
||||
var _export_config: AdmobAndroidExportConfig
|
||||
|
||||
|
||||
func _supports_platform(platform: EditorExportPlatform) -> bool:
|
||||
return platform is EditorExportPlatformAndroid
|
||||
|
||||
|
||||
func _get_android_libraries(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
|
||||
if debug:
|
||||
return PackedStringArray(["%s/bin/debug/%s-debug.aar" % [_plugin_name, _plugin_name]])
|
||||
else:
|
||||
return PackedStringArray(["%s/bin/release/%s-release.aar" % [_plugin_name, _plugin_name]])
|
||||
|
||||
|
||||
func _get_name() -> String:
|
||||
return _plugin_name
|
||||
|
||||
|
||||
func _export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) -> void:
|
||||
if _supports_platform(get_export_platform()):
|
||||
_export_config = AdmobAndroidExportConfig.new()
|
||||
if not _export_config.export_config_file_exists() or _export_config.load_export_config_from_file() != OK:
|
||||
_export_config.load_export_config_from_node()
|
||||
|
||||
|
||||
func _get_android_dependencies(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
|
||||
var deps: PackedStringArray = PackedStringArray(ANDROID_DEPENDENCIES)
|
||||
if _export_config and _export_config.enabled_mediation_networks.size() > 0:
|
||||
for __network in _export_config.enabled_mediation_networks:
|
||||
for __dependency in __network.android_dependencies:
|
||||
deps.append(__dependency)
|
||||
|
||||
GmpLogger.log_info("Android dependencies: %s" % str(deps))
|
||||
|
||||
return deps
|
||||
|
||||
|
||||
func _get_android_dependencies_maven_repos(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
|
||||
var __custom_repos: PackedStringArray = []
|
||||
|
||||
if _export_config and _export_config.enabled_mediation_networks.size() > 0:
|
||||
for network in _export_config.enabled_mediation_networks:
|
||||
if network.android_custom_maven_repo and not network.android_custom_maven_repo.is_empty():
|
||||
__custom_repos.append(network.android_custom_maven_repo)
|
||||
GmpLogger.log_info(
|
||||
"Added custom Maven repo for %s mediation: %s" %
|
||||
[network.tag, network.android_custom_maven_repo],
|
||||
)
|
||||
|
||||
return __custom_repos
|
||||
|
||||
|
||||
func _get_android_manifest_application_element_contents(platform: EditorExportPlatform, debug: bool) -> String:
|
||||
var __contents: String
|
||||
|
||||
if _export_config:
|
||||
__contents = APP_ID_META_TAG % (_export_config.real_application_id if _export_config.is_real \
|
||||
else _export_config.debug_application_id )
|
||||
else:
|
||||
GmpLogger.log_warn("Export config not found for %s!" % _plugin_name)
|
||||
__contents = ""
|
||||
|
||||
return __contents
|
||||
|
||||
|
||||
class IosExportPlugin extends EditorExportPlugin:
|
||||
const NS_APP_TRANSPORT_SECURITY: String = """
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
||||
<true/>
|
||||
</dict>
|
||||
"""
|
||||
|
||||
var _plugin_name = PLUGIN_NAME
|
||||
var _spm_dependencies = []
|
||||
var _export_config: AdmobIosExportConfig
|
||||
var _export_path: String
|
||||
|
||||
|
||||
func _supports_platform(platform: EditorExportPlatform) -> bool:
|
||||
return platform is EditorExportPlatformIOS
|
||||
|
||||
|
||||
func _get_name() -> String:
|
||||
return _plugin_name
|
||||
|
||||
|
||||
func _export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) -> void:
|
||||
if _supports_platform(get_export_platform()):
|
||||
_export_path = path.simplify_path()
|
||||
_export_config = AdmobIosExportConfig.new()
|
||||
if not _export_config.export_config_file_exists() or _export_config.load_export_config_from_file() != OK:
|
||||
_export_config.load_export_config_from_node()
|
||||
|
||||
add_apple_embedded_platform_plist_content("<key>GADApplicationIdentifier</key>")
|
||||
add_apple_embedded_platform_plist_content(
|
||||
"\t<string>%s</string>" % (_export_config.real_application_id
|
||||
if _export_config.is_real else _export_config.debug_application_id ),
|
||||
)
|
||||
|
||||
if _export_config.att_enabled and _export_config.att_text and not _export_config.att_text.is_empty():
|
||||
add_apple_embedded_platform_plist_content("<key>NSUserTrackingUsageDescription</key>")
|
||||
add_apple_embedded_platform_plist_content("<string>%s</string>" % _export_config.att_text)
|
||||
|
||||
add_apple_embedded_platform_plist_content(
|
||||
MediationNetwork.generate_sk_ad_network_plist(
|
||||
_export_config.enabled_mediation_networks,
|
||||
),
|
||||
)
|
||||
|
||||
add_apple_embedded_platform_plist_content(NS_APP_TRANSPORT_SECURITY)
|
||||
|
||||
for __framework in IOS_FRAMEWORKS:
|
||||
add_apple_embedded_platform_framework(__framework)
|
||||
|
||||
for __framework in IOS_EMBEDDED_FRAMEWORKS:
|
||||
add_apple_embedded_platform_embedded_framework(__framework)
|
||||
|
||||
for __flag in IOS_LINKER_FLAGS:
|
||||
add_apple_embedded_platform_linker_flags(__flag)
|
||||
|
||||
for __bundle_file in IOS_BUNDLE_FILES:
|
||||
add_apple_embedded_platform_bundle_file(__bundle_file)
|
||||
|
||||
for __spm_dep in SPM_DEPENDENCIES:
|
||||
_spm_dependencies.append(SpmDependency.new(__spm_dep))
|
||||
|
||||
|
||||
func _end_generate_apple_embedded_project(path: String, will_build_archive: bool) -> void:
|
||||
GmpLogger.log_info("Apple export project generated at: %s. Will build archive: %s"
|
||||
% [path, str(will_build_archive)])
|
||||
|
||||
if _supports_platform(get_export_platform()):
|
||||
_spm_dependencies.append_array(_get_extra_dependencies())
|
||||
|
||||
if _spm_dependencies.is_empty():
|
||||
GmpLogger.log_info("No SPM dependencies to install. Skipping.")
|
||||
else:
|
||||
GmpLogger.log_info("Installing %d SPM dependencies." % _spm_dependencies.size())
|
||||
_install_dependencies(path.get_base_dir(), path.get_file().get_basename())
|
||||
|
||||
|
||||
func _get_extra_dependencies() -> Array[SpmDependency]:
|
||||
var __extra_dependencies:= [] as Array[SpmDependency]
|
||||
|
||||
__extra_dependencies.append_array(
|
||||
MediationNetwork.get_spm_dependencies(_export_config.enabled_mediation_networks))
|
||||
|
||||
return __extra_dependencies
|
||||
|
||||
|
||||
func _install_dependencies(a_base_dir: String, a_project_name: String) -> void:
|
||||
var __project_file_name:= "%s.xcodeproj" % a_project_name
|
||||
var __project_file_path:= a_base_dir.path_join(__project_file_name)
|
||||
if not DirAccess.dir_exists_absolute(__project_file_path):
|
||||
GmpLogger.log_error("Xcode project '%s' does not exist! Can't install SPM dependencies."
|
||||
% __project_file_path)
|
||||
return
|
||||
|
||||
var __script_name = "add_dependency.rb"
|
||||
var __add_dependency_script_path = a_base_dir.path_join(__script_name)
|
||||
var __result = _generate_add_dependency_script(__add_dependency_script_path)
|
||||
if __result != Error.OK:
|
||||
GmpLogger.log_error("Failed to generate '%s' script with error %d!" % [__script_name, __result])
|
||||
return
|
||||
|
||||
GmpLogger.log_info("Adding SPM dependencies to %s..." % __project_file_path)
|
||||
|
||||
for __spm_dep: SpmDependency in _spm_dependencies:
|
||||
for __spm_dep_product: String in __spm_dep.get_products():
|
||||
var exec_output: Array = []
|
||||
var exec_code = OS.execute("ruby", [
|
||||
__add_dependency_script_path,
|
||||
__project_file_path,
|
||||
__spm_dep.get_url(),
|
||||
__spm_dep.get_version(),
|
||||
__spm_dep_product,
|
||||
], exec_output, true, false)
|
||||
|
||||
if exec_code == 0:
|
||||
GmpLogger.log_info("Product %s for SPM dependency %s added successfully!"
|
||||
% [__spm_dep_product, __spm_dep.format_to_string()])
|
||||
for line in exec_output:
|
||||
GmpLogger.log_info("SPM: %s" % line)
|
||||
else:
|
||||
GmpLogger.log_info("Failed to add product %s for SPM dependency %s !"
|
||||
% [__spm_dep_product, __spm_dep.format_to_string()])
|
||||
for line in exec_output:
|
||||
GmpLogger.log_error("SPM: %s" % line)
|
||||
|
||||
GmpLogger.log_info("Resolving SPM dependencies...")
|
||||
|
||||
__script_name = "resolve_dependencies.sh"
|
||||
var __resolve_dependencies_script_path = a_base_dir.path_join(__script_name)
|
||||
__result = _generate_resolve_dependencies_script(__resolve_dependencies_script_path, a_base_dir, a_project_name)
|
||||
if __result != Error.OK:
|
||||
GmpLogger.log_error("Failed to generate '%s' script with error %d!" % [__script_name, __result])
|
||||
return
|
||||
|
||||
var exec_output: Array = []
|
||||
var exec_code = OS.execute(__resolve_dependencies_script_path, [], exec_output, true, false)
|
||||
|
||||
if exec_code == 0:
|
||||
for line in exec_output:
|
||||
GmpLogger.log_info("SPM: %s" % line)
|
||||
GmpLogger.log_info("Resolved dependencies successfully!")
|
||||
else:
|
||||
for line in exec_output:
|
||||
GmpLogger.log_error("SPM: %s" % line)
|
||||
GmpLogger.log_info("Failed to resolve dependencies! Try manually in Xcode.")
|
||||
|
||||
|
||||
const ADD_DEPENDENCY_RUBY_SCRIPT = """
|
||||
require 'xcodeproj'
|
||||
|
||||
project_path = ARGV[0]
|
||||
url = ARGV[1].strip
|
||||
version = ARGV[2].strip
|
||||
product_name = ARGV[3].strip
|
||||
|
||||
unless File.exist?(project_path)
|
||||
puts "Error: Xcode project not found at #{project_path}"
|
||||
exit 1
|
||||
end
|
||||
|
||||
if url.empty? || version.empty? || product_name.empty?
|
||||
puts "Error: url, version, and product_name must all be non-empty."
|
||||
exit 1
|
||||
end
|
||||
|
||||
begin
|
||||
project = Xcodeproj::Project.open(project_path)
|
||||
target = project.targets.first
|
||||
|
||||
if target.nil?
|
||||
puts "Error: No targets found in the Xcode project."
|
||||
exit 1
|
||||
end
|
||||
|
||||
existing_dep = target.package_product_dependencies.find do |dep|
|
||||
dep.product_name == product_name
|
||||
end
|
||||
|
||||
if existing_dep
|
||||
puts "Warning: Product dependency '#{product_name}' already exists in the project. Skipping add.\n\n"
|
||||
else
|
||||
# Reuse an existing package reference for the same URL, or create a new one
|
||||
pkg = project.root_object.package_references.find do |p|
|
||||
p.repositoryURL == url
|
||||
end
|
||||
|
||||
if pkg
|
||||
puts "Reusing existing package reference for '#{url}'."
|
||||
else
|
||||
pkg = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference)
|
||||
pkg.repositoryURL = url
|
||||
pkg.requirement = {
|
||||
'kind' => 'upToNextMajorVersion',
|
||||
'minimumVersion' => version
|
||||
}
|
||||
project.root_object.package_references << pkg
|
||||
end
|
||||
|
||||
# Create the product dependency and link it to the shared package reference
|
||||
ref = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
||||
ref.product_name = product_name
|
||||
ref.package = pkg
|
||||
target.package_product_dependencies << ref
|
||||
|
||||
puts "Successfully added SPM dependency '#{product_name}' " \
|
||||
"(#{url} @ #{version}) to #{File.basename(project_path)}\n\n"
|
||||
end
|
||||
|
||||
project.save
|
||||
|
||||
rescue => e
|
||||
puts "An error occurred: #{e.message}\n\n"
|
||||
exit 1
|
||||
end
|
||||
"""
|
||||
func _generate_add_dependency_script(a_script_path: String) -> Error:
|
||||
var __result = Error.OK
|
||||
|
||||
var __script_content = ADD_DEPENDENCY_RUBY_SCRIPT
|
||||
|
||||
__result = _create_script(a_script_path, __script_content)
|
||||
|
||||
return __result
|
||||
|
||||
|
||||
const RESOLVE_DEPENDENCIES_BASH_SCRIPT = """
|
||||
#!/bin/bash
|
||||
set -e # Exit on error
|
||||
|
||||
xcodebuild -resolvePackageDependencies \
|
||||
-project "%s.xcodeproj" \
|
||||
-scheme "%s"
|
||||
"""
|
||||
func _generate_resolve_dependencies_script(a_script_path: String, a_base_dir: String,
|
||||
a_project_name: String) -> Error:
|
||||
var __result: Error = Error.OK
|
||||
|
||||
var __script_content = RESOLVE_DEPENDENCIES_BASH_SCRIPT \
|
||||
% [ ProjectSettings.globalize_path(a_base_dir.path_join(a_project_name)), a_project_name ]
|
||||
|
||||
__result = _create_script(a_script_path, __script_content)
|
||||
|
||||
return __result
|
||||
|
||||
|
||||
func _create_script(a_script_path: String, a_script_content: String) -> Error:
|
||||
var __result: Error = Error.OK
|
||||
|
||||
var __script_file = FileAccess.open(a_script_path, FileAccess.WRITE)
|
||||
if __script_file:
|
||||
__script_file.store_string(a_script_content)
|
||||
__script_file.close()
|
||||
else:
|
||||
__result = Error.ERR_FILE_CANT_WRITE
|
||||
|
||||
var chmod_output: Array = []
|
||||
var chmod_code = OS.execute("chmod", ["+x", a_script_path], chmod_output, true, false)
|
||||
if chmod_code != 0:
|
||||
GmpLogger.log_error("Failed to chmod %s script: %s"
|
||||
% [a_script_path, (chmod_output if chmod_output.size() > 0 else "Unknown error")])
|
||||
__result = Error.ERR_FILE_NO_PERMISSION
|
||||
|
||||
return __result
|
||||
@@ -0,0 +1 @@
|
||||
uid://ombwj85k4mvh
|
||||
@@ -0,0 +1,350 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
|
||||
@icon("icon.png")
|
||||
class_name InlineAdaptiveBanner
|
||||
extends Control
|
||||
|
||||
const MINIMUM_VALID_WIDTH: float = 50.0
|
||||
const MINIMUM_CLIP_THRESHOLD: float = 0.05
|
||||
const MAXIMUM_CLIP_THRESHOLD: float = 1.0
|
||||
const MINIMUM_RESIZE_THRESHOLD: float = 10.0
|
||||
const MAXIMUM_RESIZE_THRESHOLD: float = 500.0
|
||||
|
||||
## Maximum pixel height of the requested ad. If set to -1, height will be automatically determined.
|
||||
@export var max_ad_height: int = -1
|
||||
|
||||
## Minimum portion of the banner’s area (as a percentage) that must be clipped before the banner is considered hidden.
|
||||
@export_range(MINIMUM_CLIP_THRESHOLD, MAXIMUM_CLIP_THRESHOLD, 0.05) var clip_threshold: float = 0.1:
|
||||
set(a_value):
|
||||
clip_threshold = clampf(a_value, MINIMUM_CLIP_THRESHOLD, MAXIMUM_CLIP_THRESHOLD)
|
||||
|
||||
## Width-change threshold (in pixels) that triggers a banner reload when the ad container is resized by this amount
|
||||
## or more.
|
||||
@export_range(MINIMUM_RESIZE_THRESHOLD, MAXIMUM_RESIZE_THRESHOLD, 5.0) var resize_threshold: float = 50.0:
|
||||
set(a_value):
|
||||
resize_threshold = clampf(a_value, MINIMUM_RESIZE_THRESHOLD, MAXIMUM_RESIZE_THRESHOLD)
|
||||
|
||||
## Path to Admob node.
|
||||
@export_node_path("Admob") var admob_path: NodePath
|
||||
|
||||
## Whether the inline-adaptive banner ad should be automatically loaded.
|
||||
@export var auto_load: bool = false
|
||||
|
||||
@export_category("Ad Unit Identifier")
|
||||
## Use ad unit identifier value defined in the Admob node.
|
||||
@export var inherit_from_admob_node: bool = false
|
||||
|
||||
@export_group("Android", "ad_unit_id_android")
|
||||
## Ad unit ID of the inline adaptive banner ad to be loaded on the Android platform.
|
||||
@export var ad_unit_id_android_debug: String = "ca-app-pub-3940256099942544/2014213617"
|
||||
|
||||
## Ad unit ID of the inline adaptive banner ad to be loaded on the Android platform.
|
||||
@export var ad_unit_id_android_real: String = ""
|
||||
|
||||
@export_group("iOS", "ad_unit_id_ios")
|
||||
## Ad unit ID of the inline adaptive banner ad to be loaded on the iOS platform.
|
||||
@export var ad_unit_id_ios_debug: String = "ca-app-pub-3940256099942544/2934735716"
|
||||
|
||||
## Ad unit ID of the inline adaptive banner ad to be loaded on the iOS platform.
|
||||
@export var ad_unit_id_ios_real: String = ""
|
||||
|
||||
var admob: Admob
|
||||
var _ad_unit_id: String
|
||||
var ad_id: String = ""
|
||||
|
||||
var last_width: float
|
||||
|
||||
var pending_load: bool = false
|
||||
var is_position_dirty: bool = false
|
||||
var is_banner_visible: bool = false
|
||||
var do_ignore_resize: bool = false
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
var __admob: Admob
|
||||
if admob_path:
|
||||
__admob = get_node(admob_path)
|
||||
|
||||
if __admob:
|
||||
initialize(__admob)
|
||||
else:
|
||||
push_warning("Admob node not found")
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if ad_id != "":
|
||||
remove_ad()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||||
|
||||
last_width = size.x
|
||||
resized.connect(_on_resized)
|
||||
|
||||
|
||||
func initialize(a_admob_node: Admob) -> void:
|
||||
admob = a_admob_node
|
||||
|
||||
visibility_changed.connect(_on_visibility_changed)
|
||||
admob.banner_ad_loaded.connect(_on_banner_ad_loaded)
|
||||
admob.banner_ad_failed_to_load.connect(_on_banner_ad_failed_to_load)
|
||||
admob.banner_ad_refreshed.connect(_on_banner_ad_refreshed)
|
||||
admob.banner_ad_size_measured.connect(_on_banner_ad_size_measured)
|
||||
|
||||
if admob.is_initialization_completed:
|
||||
if auto_load:
|
||||
call_deferred("_deferred_load_ad")
|
||||
else:
|
||||
admob.initialization_completed.connect(_on_Admob_initialization_completed)
|
||||
|
||||
if inherit_from_admob_node:
|
||||
_ad_unit_id = admob._banner_id
|
||||
else:
|
||||
if OS.has_feature("ios"):
|
||||
if admob.is_real:
|
||||
_ad_unit_id = ad_unit_id_ios_real
|
||||
else:
|
||||
_ad_unit_id = ad_unit_id_ios_debug
|
||||
else:
|
||||
if admob.is_real:
|
||||
_ad_unit_id = ad_unit_id_android_real
|
||||
else:
|
||||
_ad_unit_id = ad_unit_id_android_debug
|
||||
|
||||
|
||||
func _deferred_load_ad() -> void:
|
||||
load_ad()
|
||||
_mark_position_dirty()
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# AD MANIPULATION
|
||||
# --------------------------------------------------------------
|
||||
|
||||
|
||||
func load_ad() -> void:
|
||||
if _ad_unit_id == "":
|
||||
return
|
||||
|
||||
var req := LoadAdRequest.new()
|
||||
req.set_ad_unit_id(_ad_unit_id)
|
||||
req.set_ad_size(LoadAdRequest.RequestedAdSize.INLINE_ADAPTIVE)
|
||||
|
||||
if custom_minimum_size.x < MINIMUM_VALID_WIDTH:
|
||||
GmpLogger.log_warn("Can't load ad. Invalid inline adaptive banner width: %.1f" % custom_minimum_size.x)
|
||||
return
|
||||
|
||||
req.set_adaptive_width(round(custom_minimum_size.x))
|
||||
|
||||
if max_ad_height != -1:
|
||||
req.set_adaptive_max_height(max_ad_height)
|
||||
|
||||
req.set_ad_position(LoadAdRequest.AdPosition.CUSTOM)
|
||||
|
||||
pending_load = true
|
||||
admob.load_banner_ad(req)
|
||||
|
||||
|
||||
func show_ad() -> void:
|
||||
if not is_banner_visible:
|
||||
admob.show_banner_ad(ad_id)
|
||||
is_banner_visible = true
|
||||
|
||||
|
||||
func hide_ad() -> void:
|
||||
if is_banner_visible:
|
||||
admob.hide_banner_ad(ad_id)
|
||||
is_banner_visible = false
|
||||
|
||||
|
||||
func move_ad(a_physical_position: Vector2) -> void:
|
||||
admob.move_banner_ad(ad_id, a_physical_position.x, a_physical_position.y)
|
||||
|
||||
|
||||
func remove_ad() -> void:
|
||||
admob.remove_banner_ad(ad_id)
|
||||
is_banner_visible = false
|
||||
ad_id = ""
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# POSITIONING
|
||||
# --------------------------------------------------------------
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if is_position_dirty:
|
||||
_deferred_update_position()
|
||||
is_position_dirty = false
|
||||
else:
|
||||
update_banner_position()
|
||||
|
||||
|
||||
func _mark_position_dirty() -> void:
|
||||
is_position_dirty = true
|
||||
call_deferred("_deferred_update_position")
|
||||
|
||||
|
||||
func _deferred_update_position() -> void:
|
||||
update_banner_position()
|
||||
|
||||
|
||||
func update_banner_position() -> void:
|
||||
if ad_id == "":
|
||||
return
|
||||
|
||||
# Check basic tree visibility (Tabs, hidden parents)
|
||||
if not is_visible_in_tree():
|
||||
hide_ad()
|
||||
return
|
||||
|
||||
# Smart clipping (visibility logic)
|
||||
var is_clipped_out: bool = false
|
||||
|
||||
if size.x > 1.0 and size.y > 1.0:
|
||||
var virtual_rect := get_global_rect()
|
||||
var original_area := virtual_rect.get_area()
|
||||
var visible_region := virtual_rect
|
||||
var parent = get_parent()
|
||||
|
||||
# Walk up the tree to find ScrollContainers or other clippers
|
||||
while parent is Control:
|
||||
if parent.clip_contents:
|
||||
var parent_rect: Rect2 = parent.get_global_rect()
|
||||
var intersection := visible_region.intersection(parent_rect)
|
||||
|
||||
# No intersection -> fully clipped (100%)
|
||||
if intersection.get_area() <= 0:
|
||||
is_clipped_out = true
|
||||
break
|
||||
|
||||
visible_region = intersection
|
||||
parent = parent.get_parent()
|
||||
|
||||
# Final check
|
||||
if not get_viewport_rect().intersects(virtual_rect):
|
||||
is_clipped_out = true
|
||||
else:
|
||||
# Calculate the percentage clipped
|
||||
var visible_area := visible_region.get_area()
|
||||
var clipped_ratio := 1.0 - (visible_area / original_area)
|
||||
|
||||
if clipped_ratio >= clip_threshold:
|
||||
is_clipped_out = true
|
||||
|
||||
if is_clipped_out:
|
||||
if is_banner_visible:
|
||||
hide_ad()
|
||||
else:
|
||||
if not is_banner_visible:
|
||||
show_ad()
|
||||
|
||||
move_ad(_godot_to_physical(global_position))
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# SIGNAL HANDLERS
|
||||
# --------------------------------------------------------------
|
||||
|
||||
|
||||
func _on_Admob_initialization_completed(_status: InitializationStatus) -> void:
|
||||
if auto_load:
|
||||
call_deferred("_deferred_load_ad")
|
||||
|
||||
|
||||
func _on_resized() -> void:
|
||||
if ad_id == "":
|
||||
return
|
||||
|
||||
if do_ignore_resize:
|
||||
do_ignore_resize = false
|
||||
return
|
||||
|
||||
if abs(size.x - last_width) < resize_threshold:
|
||||
return
|
||||
|
||||
last_width = size.x
|
||||
remove_ad()
|
||||
call_deferred("_deferred_load_ad")
|
||||
|
||||
_mark_position_dirty()
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if ad_id != "":
|
||||
if is_visible_in_tree():
|
||||
show_ad()
|
||||
else:
|
||||
hide_ad()
|
||||
|
||||
|
||||
func _on_banner_ad_loaded(loaded_ad_info: AdInfo, _response: ResponseInfo) -> void:
|
||||
if !pending_load:
|
||||
return
|
||||
|
||||
if loaded_ad_info.get_load_ad_request().get_ad_size() != LoadAdRequest.RequestedAdSize.INLINE_ADAPTIVE:
|
||||
return
|
||||
|
||||
if loaded_ad_info.get_load_ad_request().get_ad_unit_id().casecmp_to(_ad_unit_id) != 0:
|
||||
return
|
||||
|
||||
pending_load = false
|
||||
ad_id = loaded_ad_info.get_ad_id()
|
||||
|
||||
_apply_loaded_size(Vector2(loaded_ad_info.get_measured_width(), loaded_ad_info.get_measured_height()))
|
||||
_mark_position_dirty()
|
||||
|
||||
|
||||
func _on_banner_ad_failed_to_load(failed_ad_info: AdInfo, _err: LoadAdError) -> void:
|
||||
if failed_ad_info.get_load_ad_request().get_ad_size() != LoadAdRequest.RequestedAdSize.INLINE_ADAPTIVE:
|
||||
return
|
||||
|
||||
if failed_ad_info.get_load_ad_request().get_ad_unit_id().casecmp_to(_ad_unit_id) != 0:
|
||||
return
|
||||
|
||||
if pending_load:
|
||||
pending_load = false
|
||||
|
||||
|
||||
func _on_banner_ad_size_measured(ad_info: AdInfo) -> void:
|
||||
if ad_info.get_ad_id().casecmp_to(ad_id) == 0:
|
||||
_apply_loaded_size(Vector2(ad_info.get_measured_width(), ad_info.get_measured_height()))
|
||||
|
||||
|
||||
func _on_banner_ad_refreshed(refreshed_ad_info: AdInfo, _response: ResponseInfo) -> void:
|
||||
if refreshed_ad_info.get_ad_id().casecmp_to(ad_id) == 0:
|
||||
hide_ad() # Prevent ad from briefly displaying out of position
|
||||
_apply_loaded_size(Vector2(refreshed_ad_info.get_measured_width(), refreshed_ad_info.get_measured_height()))
|
||||
_mark_position_dirty()
|
||||
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# UTILITY
|
||||
# --------------------------------------------------------------
|
||||
|
||||
|
||||
func _apply_loaded_size(a_size: Vector2) -> void:
|
||||
do_ignore_resize = true
|
||||
|
||||
custom_minimum_size = a_size
|
||||
size = a_size
|
||||
|
||||
|
||||
func _calculate_scale_factor() -> Vector2:
|
||||
var screen_size: Vector2 = DisplayServer.window_get_size() as Vector2
|
||||
var virtual_size: Vector2 = get_viewport().get_visible_rect().size
|
||||
return screen_size / virtual_size
|
||||
|
||||
|
||||
func _physical_to_godot(a_physical_size: Vector2) -> Vector2:
|
||||
return a_physical_size / _calculate_scale_factor()
|
||||
|
||||
|
||||
func _godot_to_physical(a_godot_size: Vector2) -> Vector2:
|
||||
return a_godot_size * _calculate_scale_factor()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dq4pb7uer2kjh
|
||||
@@ -0,0 +1,8 @@
|
||||
[General]
|
||||
is_real=false
|
||||
|
||||
[Debug]
|
||||
app_id="ca-app-pub-3940256099942544~3347511713"
|
||||
|
||||
[Release]
|
||||
app_id=""
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,72 @@
|
||||
class_name AdCache
|
||||
extends RefCounted
|
||||
|
||||
var limit: int
|
||||
var label: String
|
||||
var remove_ad_callable: Callable
|
||||
|
||||
var _ads: Dictionary[String, Object]
|
||||
var _ad_queue: Array[String]
|
||||
|
||||
|
||||
func _init(a_limit: int, a_label: String, a_callable: Callable) -> void:
|
||||
self.limit = a_limit
|
||||
self.label = a_label
|
||||
self.remove_ad_callable = a_callable
|
||||
|
||||
_ads = {}
|
||||
_ad_queue = []
|
||||
|
||||
|
||||
func is_empty() -> bool:
|
||||
return _ads.is_empty()
|
||||
|
||||
|
||||
func has_key(a_key: String) -> bool:
|
||||
return _ads.has(a_key)
|
||||
|
||||
|
||||
func last_key() -> String:
|
||||
return "" if _ad_queue.is_empty() else _ad_queue[0]
|
||||
|
||||
|
||||
func all_keys() -> Array[String]:
|
||||
return _ads.keys()
|
||||
|
||||
|
||||
func cache(a_ad_id: String, a_ad_data: Object) -> void:
|
||||
_ads[a_ad_id] = a_ad_data
|
||||
_ad_queue.push_front(a_ad_id)
|
||||
while _ads.size() > limit:
|
||||
(
|
||||
GmpLogger
|
||||
. log_warn(
|
||||
(
|
||||
"%s: %s cache size (%d) has exceeded maximum (%d)"
|
||||
% [
|
||||
Admob.PLUGIN_SINGLETON_NAME,
|
||||
label,
|
||||
_ads.size(),
|
||||
limit,
|
||||
]
|
||||
),
|
||||
)
|
||||
)
|
||||
remove_ad_callable.call(_erase_oldest())
|
||||
|
||||
|
||||
func erase(a_ad_id: String) -> void:
|
||||
_ad_queue.erase(a_ad_id)
|
||||
_ads.erase(a_ad_id)
|
||||
|
||||
|
||||
func erase_last() -> String:
|
||||
var __removed_ad_id: String = _ad_queue.pop_front()
|
||||
_ads.erase(__removed_ad_id)
|
||||
return __removed_ad_id
|
||||
|
||||
|
||||
func _erase_oldest() -> String:
|
||||
var __removed_ad_id: String = _ad_queue.pop_back()
|
||||
_ads.erase(__removed_ad_id)
|
||||
return __removed_ad_id
|
||||
@@ -0,0 +1 @@
|
||||
uid://c8k2i5b2rg7qx
|
||||
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdmobAndroidExportConfig
|
||||
extends AdmobExportConfig
|
||||
|
||||
const ANDROID_CONFIG_FILE_PATH: String = "res://addons/" + PLUGIN_NAME + "/android_export.cfg"
|
||||
|
||||
|
||||
func get_config_file_path() -> String:
|
||||
return ANDROID_CONFIG_FILE_PATH
|
||||
|
||||
|
||||
func load_platform_specific_export_config_from_node(a_node: Admob) -> Error:
|
||||
debug_application_id = a_node.android_debug_application_id
|
||||
real_application_id = a_node.android_real_application_id
|
||||
|
||||
return Error.OK
|
||||
|
||||
|
||||
func print_loaded_config() -> void:
|
||||
super.print_loaded_config()
|
||||
GmpLogger.log_info("... debug_application_id: %s" % debug_application_id)
|
||||
GmpLogger.log_info("... real_application_id: %s" % real_application_id)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bd7jn56dvb8v4
|
||||
@@ -0,0 +1,190 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdmobExportConfig
|
||||
extends RefCounted
|
||||
|
||||
const PLUGIN_NODE_TYPE_NAME = "Admob"
|
||||
const PLUGIN_NAME: String = "AdmobPlugin"
|
||||
|
||||
const CONFIG_FILE_SECTION_GENERAL: String = "General"
|
||||
const CONFIG_FILE_SECTION_DEBUG: String = "Debug"
|
||||
const CONFIG_FILE_SECTION_RELEASE: String = "Release"
|
||||
const CONFIG_FILE_SECTION_MEDIATION: String = "Mediation"
|
||||
|
||||
const CONFIG_FILE_KEY_IS_REAL: String = "is_real"
|
||||
const CONFIG_FILE_KEY_APP_ID: String = "app_id"
|
||||
const CONFIG_FILE_KEY_ENABLED_NETWORKS: String = "enabled_networks"
|
||||
|
||||
var is_real: bool
|
||||
var debug_application_id: String
|
||||
var real_application_id: String
|
||||
var enabled_mediation_networks: Array[MediationNetwork] = []
|
||||
|
||||
|
||||
func get_config_file_path() -> String:
|
||||
return ""
|
||||
|
||||
|
||||
func export_config_file_exists() -> bool:
|
||||
return FileAccess.file_exists(get_config_file_path())
|
||||
|
||||
|
||||
func load_export_config_from_file() -> Error:
|
||||
GmpLogger.log_info("Loading export config from file!")
|
||||
|
||||
var __result = Error.OK
|
||||
|
||||
var __config_file_path = get_config_file_path()
|
||||
var __config_file = ConfigFile.new()
|
||||
|
||||
var __load_result = __config_file.load(__config_file_path)
|
||||
if __load_result == Error.OK:
|
||||
is_real = __config_file.get_value(CONFIG_FILE_SECTION_GENERAL, CONFIG_FILE_KEY_IS_REAL)
|
||||
debug_application_id = __config_file.get_value(CONFIG_FILE_SECTION_DEBUG, CONFIG_FILE_KEY_APP_ID)
|
||||
real_application_id = __config_file.get_value(CONFIG_FILE_SECTION_RELEASE, CONFIG_FILE_KEY_APP_ID)
|
||||
|
||||
if __config_file.has_section(CONFIG_FILE_SECTION_MEDIATION):
|
||||
if __config_file.has_section_key(CONFIG_FILE_SECTION_MEDIATION, CONFIG_FILE_KEY_ENABLED_NETWORKS):
|
||||
var __network_array := (
|
||||
Array(
|
||||
__config_file.get_value(CONFIG_FILE_SECTION_MEDIATION, CONFIG_FILE_KEY_ENABLED_NETWORKS, []),
|
||||
TYPE_STRING,
|
||||
&"",
|
||||
null,
|
||||
)
|
||||
as Array[String]
|
||||
)
|
||||
|
||||
for __network in __network_array:
|
||||
if MediationNetwork.is_valid_tag(__network):
|
||||
enabled_mediation_networks.append(MediationNetwork.get_by_tag(__network))
|
||||
else:
|
||||
GmpLogger.log_error("Invalid network tag '%s' in file %s!" % [__network, __config_file_path])
|
||||
else:
|
||||
(
|
||||
GmpLogger
|
||||
. log_error(
|
||||
(
|
||||
"Missing key %s in section %s of %s!"
|
||||
% [CONFIG_FILE_KEY_ENABLED_NETWORKS, CONFIG_FILE_SECTION_MEDIATION, __config_file_path]
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
if is_real == null or debug_application_id == null or real_application_id == null:
|
||||
__result = Error.ERR_INVALID_DATA
|
||||
else:
|
||||
__result = load_platform_specific_export_config_from_file(__config_file)
|
||||
|
||||
if __result != Error.OK:
|
||||
GmpLogger.log_error("Invalid export config file %s!" % __config_file_path)
|
||||
else:
|
||||
__result = Error.ERR_CANT_OPEN
|
||||
GmpLogger.log_error("Failed to open export config file %s!" % __config_file_path)
|
||||
|
||||
if __result == Error.OK:
|
||||
print_loaded_config()
|
||||
|
||||
return __result
|
||||
|
||||
|
||||
func load_platform_specific_export_config_from_file(a_config_file: ConfigFile) -> Error:
|
||||
return Error.OK
|
||||
|
||||
|
||||
func load_export_config_from_node() -> Error:
|
||||
GmpLogger.log_info("Loading export config from node!")
|
||||
|
||||
var __result = Error.OK
|
||||
|
||||
var __admob_node: Admob
|
||||
|
||||
GmpLogger.log_info("Searching edited scene for %s node..." % PLUGIN_NODE_TYPE_NAME)
|
||||
var __edited_scene_root: Node = EditorInterface.get_edited_scene_root()
|
||||
if __edited_scene_root:
|
||||
__admob_node = get_plugin_node(__edited_scene_root)
|
||||
else:
|
||||
GmpLogger.log_info("No edited scene found")
|
||||
|
||||
if not __admob_node:
|
||||
GmpLogger.log_info("Searching main scene for %s node..." % PLUGIN_NODE_TYPE_NAME)
|
||||
var __main_scene_path: String = ProjectSettings.get_setting("application/run/main_scene")
|
||||
if __main_scene_path and __main_scene_path != "":
|
||||
var __packed_main: PackedScene = load(__main_scene_path)
|
||||
if __packed_main:
|
||||
var __main_scene = __packed_main.instantiate()
|
||||
__admob_node = get_plugin_node(__main_scene)
|
||||
else:
|
||||
GmpLogger.log_info("Main scene path not defined in the project settings")
|
||||
|
||||
if not __admob_node:
|
||||
GmpLogger.log_info("Searching all project scenes for %s node..." % PLUGIN_NODE_TYPE_NAME)
|
||||
|
||||
var collect_scene_paths: Callable = func(
|
||||
a_dir_path: String,
|
||||
a_collected_paths: Array[String],
|
||||
a_recursive_func: Callable,
|
||||
) -> void:
|
||||
for __file in DirAccess.get_files_at(a_dir_path):
|
||||
if __file.ends_with(".tscn") or __file.ends_with(".scn"):
|
||||
a_collected_paths.append(a_dir_path.path_join(__file))
|
||||
|
||||
for __dir in DirAccess.get_directories_at(a_dir_path):
|
||||
a_recursive_func.call(a_dir_path.path_join(__dir), a_collected_paths, a_recursive_func)
|
||||
|
||||
var __scene_paths: Array[String] = []
|
||||
collect_scene_paths.call("res://", __scene_paths, collect_scene_paths)
|
||||
|
||||
for __scene_path in __scene_paths:
|
||||
var packed: PackedScene = load(__scene_path)
|
||||
if packed:
|
||||
var __instance = packed.instantiate()
|
||||
var __found_node: Admob = get_plugin_node(__instance)
|
||||
if __found_node:
|
||||
GmpLogger.log_info("Found %s node in scene: %s" % [PLUGIN_NODE_TYPE_NAME, __scene_path])
|
||||
__admob_node = __found_node
|
||||
break
|
||||
|
||||
# Load configuration if node found
|
||||
if __admob_node:
|
||||
is_real = __admob_node.is_real
|
||||
enabled_mediation_networks = MediationNetwork.get_all_enabled(__admob_node.enabled_networks)
|
||||
|
||||
__result = load_platform_specific_export_config_from_node(__admob_node)
|
||||
if __result == Error.OK:
|
||||
print_loaded_config()
|
||||
else:
|
||||
GmpLogger.log_error("Invalid %s node for %s!" % [PLUGIN_NODE_TYPE_NAME, PLUGIN_NAME])
|
||||
else:
|
||||
GmpLogger.log_error("%s failed to find %s node!" % [PLUGIN_NAME, PLUGIN_NODE_TYPE_NAME])
|
||||
__result = Error.ERR_UNCONFIGURED
|
||||
|
||||
return __result
|
||||
|
||||
|
||||
func load_platform_specific_export_config_from_node(a_node: Admob) -> Error:
|
||||
return Error.OK
|
||||
|
||||
|
||||
func print_loaded_config() -> void:
|
||||
GmpLogger.log_info("Loaded export configuration settings:")
|
||||
GmpLogger.log_info(" is_real: %s" % ("true" if is_real else "false"))
|
||||
GmpLogger.log_info(
|
||||
" enabled_mediation_networks: %s" % MediationNetwork.generate_tag_list(enabled_mediation_networks)
|
||||
)
|
||||
|
||||
|
||||
func get_plugin_node(a_node: Node) -> Admob:
|
||||
var __result: Admob
|
||||
|
||||
if a_node is Admob:
|
||||
__result = a_node
|
||||
elif a_node.get_child_count() > 0:
|
||||
for __child in a_node.get_children():
|
||||
var __child_result = get_plugin_node(__child)
|
||||
if __child_result is Admob:
|
||||
__result = __child_result
|
||||
break
|
||||
|
||||
return __result
|
||||
@@ -0,0 +1 @@
|
||||
uid://byw0f6m12b2s2
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdmobIosExportConfig
|
||||
extends AdmobExportConfig
|
||||
|
||||
const IOS_CONFIG_FILE_PATH: String = "res://addons/" + PLUGIN_NAME + "/ios_export.cfg"
|
||||
|
||||
const CONFIG_FILE_SECTION_ATT: String = "ATT"
|
||||
|
||||
const CONFIG_FILE_KEY_ATT_ENABLED: String = "att_enabled"
|
||||
const CONFIG_FILE_KEY_ATT_TEXT: String = "att_text"
|
||||
|
||||
var att_enabled: bool
|
||||
var att_text: String
|
||||
|
||||
|
||||
func get_config_file_path() -> String:
|
||||
return IOS_CONFIG_FILE_PATH
|
||||
|
||||
|
||||
func load_platform_specific_export_config_from_file(a_config_file: ConfigFile) -> Error:
|
||||
att_enabled = a_config_file.get_value(CONFIG_FILE_SECTION_ATT, CONFIG_FILE_KEY_ATT_ENABLED, false)
|
||||
att_text = a_config_file.get_value(CONFIG_FILE_SECTION_ATT, CONFIG_FILE_KEY_ATT_TEXT)
|
||||
|
||||
return Error.OK
|
||||
|
||||
|
||||
func load_platform_specific_export_config_from_node(a_node: Admob) -> Error:
|
||||
debug_application_id = a_node.ios_debug_application_id
|
||||
real_application_id = a_node.ios_real_application_id
|
||||
att_enabled = a_node.att_enabled
|
||||
att_text = a_node.att_text
|
||||
|
||||
return Error.OK
|
||||
|
||||
|
||||
func print_loaded_config() -> void:
|
||||
super.print_loaded_config()
|
||||
GmpLogger.log_info("... debug_application_id: %s" % debug_application_id)
|
||||
GmpLogger.log_info("... real_application_id: %s" % real_application_id)
|
||||
GmpLogger.log_info("... att_enabled: %s" % ("true" if att_enabled else "false"))
|
||||
GmpLogger.log_info("... att_text: %s" % att_text)
|
||||
@@ -0,0 +1 @@
|
||||
uid://hamb6dlvl4bc
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cmkpgeo3anvuw"
|
||||
path="res://.godot/imported/icon.png-928f79d906c5a286de384358dfb1ba26.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/AdmobPlugin/icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-928f79d906c5a286de384358dfb1ba26.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,12 @@
|
||||
[General]
|
||||
is_real=false
|
||||
|
||||
[Debug]
|
||||
app_id="ca-app-pub-3940256099942544~1458002511"
|
||||
|
||||
[Release]
|
||||
app_id=""
|
||||
|
||||
[ATT]
|
||||
att_enabled=false
|
||||
att_text="Deine Erlaubnis hilft uns, Werbung zu messen und das Spiel zu verbessern."
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdError
|
||||
extends RefCounted
|
||||
|
||||
const CODE_PROPERTY := &"code"
|
||||
const DOMAIN_PROPERTY := &"domain"
|
||||
const MESSAGE_PROPERTY := &"message"
|
||||
const CAUSE_PROPERTY := &"cause"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_code() -> int:
|
||||
return _data[CODE_PROPERTY]
|
||||
|
||||
|
||||
func get_domain() -> String:
|
||||
return _data[DOMAIN_PROPERTY]
|
||||
|
||||
|
||||
func get_message() -> String:
|
||||
return _data[MESSAGE_PROPERTY]
|
||||
|
||||
|
||||
func get_cause() -> AdError:
|
||||
return AdError.new(_data[CAUSE_PROPERTY]) if _data.has(CAUSE_PROPERTY) else null
|
||||
@@ -0,0 +1 @@
|
||||
uid://0att8tjqjm8t
|
||||
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdInfo
|
||||
extends RefCounted
|
||||
|
||||
const AD_ID_PROPERTY := &"ad_id"
|
||||
const MEASURED_WIDTH_PROPERTY := &"measured_width"
|
||||
const MEASURED_HEIGHT_PROPERTY := &"measured_height"
|
||||
const IS_COLLAPSIBLE_PROPERTY := &"is_collapsible"
|
||||
const LOAD_AD_REQUEST_PROPERTY := &"load_ad_request"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_ad_id() -> String:
|
||||
return _data[AD_ID_PROPERTY] if _data.has(AD_ID_PROPERTY) else ""
|
||||
|
||||
|
||||
func get_measured_width() -> int:
|
||||
return _data[MEASURED_WIDTH_PROPERTY] if _data.has(MEASURED_WIDTH_PROPERTY) else 0
|
||||
|
||||
|
||||
func get_measured_height() -> int:
|
||||
return _data[MEASURED_HEIGHT_PROPERTY] if _data.has(MEASURED_HEIGHT_PROPERTY) else 0
|
||||
|
||||
|
||||
func get_is_collapsible() -> bool:
|
||||
return _data[IS_COLLAPSIBLE_PROPERTY] if _data.has(IS_COLLAPSIBLE_PROPERTY) else false
|
||||
|
||||
|
||||
func get_load_ad_request() -> LoadAdRequest:
|
||||
return LoadAdRequest.new(_data[LOAD_AD_REQUEST_PROPERTY]) if _data.has(LOAD_AD_REQUEST_PROPERTY) else null
|
||||
@@ -0,0 +1 @@
|
||||
uid://pm7kx5541j4
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdSize
|
||||
extends RefCounted
|
||||
|
||||
const WIDTH_PROPERTY := &"width"
|
||||
const HEIGHT_PROPERTY := &"height"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data if a_data else {}
|
||||
|
||||
|
||||
func get_width() -> int:
|
||||
return _data[WIDTH_PROPERTY] if _data.has(WIDTH_PROPERTY) else 0
|
||||
|
||||
|
||||
func get_height() -> int:
|
||||
return _data[HEIGHT_PROPERTY] if _data.has(HEIGHT_PROPERTY) else 0
|
||||
@@ -0,0 +1 @@
|
||||
uid://1y453yingj1w
|
||||
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdapterResponseInfo
|
||||
extends RefCounted
|
||||
|
||||
const AD_ERROR_PROPERTY := &"ad_error"
|
||||
const AD_SOURCE_ID_PROPERTY := &"ad_source_id"
|
||||
const AD_SOURCE_INSTANCE_ID_PROPERTY := &"ad_source_instance_id"
|
||||
const AD_SOURCE_INSTANCE_NAME_PROPERTY := &"ad_source_instance_name"
|
||||
const AD_SOURCE_NAME_PROPERTY := &"ad_source_name"
|
||||
const ADAPTER_CLASS_NAME_PROPERTY := &"adapter_class_name"
|
||||
const NETWORK_TAG_PROPERTY := &"network_tag"
|
||||
const LATENCY_PROPERTY := &"latency"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_ad_error() -> AdError:
|
||||
return AdError.new(_data[AD_ERROR_PROPERTY]) if _data.has(AD_ERROR_PROPERTY) else null
|
||||
|
||||
|
||||
func get_ad_source_id() -> String:
|
||||
return _data[AD_SOURCE_ID_PROPERTY]
|
||||
|
||||
|
||||
func get_ad_source_instance_id() -> String:
|
||||
return _data[AD_SOURCE_INSTANCE_ID_PROPERTY]
|
||||
|
||||
|
||||
func get_ad_source_instance_name() -> String:
|
||||
return _data[AD_SOURCE_INSTANCE_NAME_PROPERTY]
|
||||
|
||||
|
||||
func get_ad_source_name() -> String:
|
||||
return _data[AD_SOURCE_NAME_PROPERTY]
|
||||
|
||||
|
||||
func get_adapter_class_name() -> String:
|
||||
return _data[ADAPTER_CLASS_NAME_PROPERTY]
|
||||
|
||||
|
||||
func get_network_tag() -> String:
|
||||
return _data[NETWORK_TAG_PROPERTY]
|
||||
|
||||
|
||||
func get_latency() -> int:
|
||||
return _data[LATENCY_PROPERTY]
|
||||
@@ -0,0 +1 @@
|
||||
uid://kwsy2dkniyn8
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdapterStatus
|
||||
extends RefCounted
|
||||
|
||||
const ADAPTER_CLASS_PROPERTY := &"adapter_class"
|
||||
const LATENCY_PROPERTY := &"latency"
|
||||
const INITIALIZATION_STATE_PROPERTY := &"initialization_state"
|
||||
const DESCRIPTION_PROPERTY := &"description"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_adapter_class() -> String:
|
||||
return _data[ADAPTER_CLASS_PROPERTY]
|
||||
|
||||
|
||||
func get_latency() -> int:
|
||||
return _data[LATENCY_PROPERTY]
|
||||
|
||||
|
||||
func get_initialization_state() -> String:
|
||||
return _data[INITIALIZATION_STATE_PROPERTY]
|
||||
|
||||
|
||||
func get_description() -> String:
|
||||
return _data[DESCRIPTION_PROPERTY]
|
||||
@@ -0,0 +1 @@
|
||||
uid://scnfdeiyquod
|
||||
@@ -0,0 +1,105 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdmobConfig
|
||||
extends RefCounted
|
||||
|
||||
enum ContentRating {
|
||||
G, ## G means "General Audiences" and is suitable for all ages, containing no objectionable material
|
||||
## (minimal violence, no nudity or sex scenes, and no drug use).
|
||||
PG, ## PG stands for "Parental Guidance Suggested," meaning that some material may not be suitable for young
|
||||
## children (may include themes, language, or mild violence).
|
||||
T, ## T means Teen, and indicates content suitable for ages 13 and older (can include violence, suggestive themes,
|
||||
## crude humor, simulated gambling, and/or infrequent strong language).
|
||||
MA, ## MA stands for "Mature Audience", signifying that the material is intended for adults (may include graphic
|
||||
## violence, strong language, or explicit sexual activity).
|
||||
}
|
||||
|
||||
enum TagForChildDirectedTreatment {
|
||||
UNSPECIFIED = -1, ## Means that you have not provided a specific instruction for your app's content to be treated
|
||||
## as child-directed for COPPA purposes.
|
||||
FALSE = 0, ## Means you are indicating that your app's content is not child-directed for the purposes of the
|
||||
## Children's Online Privacy Protection Act (COPPA).
|
||||
TRUE = 1, ## Tells ad networks to treat ad requests as if the content is directed towards children, which is
|
||||
## important for complying with regulations like COPPA.
|
||||
}
|
||||
|
||||
enum TagForUnderAgeOfConsent {
|
||||
UNSPECIFIED = -1, ## Means you have not provided any information on whether the user is under the age of consent,
|
||||
## so the system does not apply any specific treatment for these users based on this tag alone.
|
||||
FALSE = 0, ## Indicates that you do not want the specific ad request to receive the special handling suitable for
|
||||
## users under the age of consent in the EEA, the UK, and Switzerland.
|
||||
TRUE = 1, ## Indicates that you want the ad request to be handled in a manner suitable for users under the age of
|
||||
## consent within the EEA, the UK, and Switzerland.
|
||||
}
|
||||
|
||||
enum PersonalizationState {
|
||||
DEFAULT = 0, ## By default, the SDK will attempt to serve personalized ads based on the user's past behavior and
|
||||
## interests.
|
||||
ENABLED = 1, ## Indicates that the Google Mobile Ads SDK is authorized to serve ads that are tailored to the user
|
||||
## based on past activity and collected data.
|
||||
DISABLED = 2, ## Means that ad requests are set to serve non-personalized ads (NPA) only.
|
||||
}
|
||||
|
||||
const DATA_KEY_IS_REAL := &"is_real"
|
||||
const DATA_KEY_MAX_AD_CONTENT_RATING := &"max_ad_content_rating"
|
||||
const DATA_KEY_CHILD_DIRECTED_TREATMENT := &"tag_for_child_directed_treatment"
|
||||
const DATA_KEY_UNDER_AGE_OF_CONSENT := &"tag_for_under_age_of_consent"
|
||||
const DATA_KEY_FIRST_PARTY_ID_ENABLED := &"first_party_id_enabled"
|
||||
const DATA_KEY_PERSONALIZATION_STATE := &"personalization_state"
|
||||
const DATA_KEY_TEST_DEVICE_IDS := &"test_device_ids"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init():
|
||||
_data = {
|
||||
DATA_KEY_TEST_DEVICE_IDS: [],
|
||||
}
|
||||
|
||||
|
||||
func set_is_real(a_value: bool) -> AdmobConfig:
|
||||
_data[DATA_KEY_IS_REAL] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_max_ad_content_rating(a_value: ContentRating) -> AdmobConfig:
|
||||
_data[DATA_KEY_MAX_AD_CONTENT_RATING] = ContentRating.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func set_child_directed_treatment(a_value: TagForChildDirectedTreatment) -> AdmobConfig:
|
||||
_data[DATA_KEY_CHILD_DIRECTED_TREATMENT] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_under_age_of_consent(a_value: TagForUnderAgeOfConsent) -> AdmobConfig:
|
||||
_data[DATA_KEY_UNDER_AGE_OF_CONSENT] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_first_party_id_enabled(a_value: bool) -> AdmobConfig:
|
||||
_data[DATA_KEY_FIRST_PARTY_ID_ENABLED] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_personalization_state(a_value: PersonalizationState) -> AdmobConfig:
|
||||
_data[DATA_KEY_PERSONALIZATION_STATE] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_test_device_ids(a_value: Array) -> AdmobConfig:
|
||||
if a_value == null:
|
||||
_data[DATA_KEY_TEST_DEVICE_IDS] = []
|
||||
else:
|
||||
_data[DATA_KEY_TEST_DEVICE_IDS] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func add_test_device_id(a_value: String) -> AdmobConfig:
|
||||
_data[DATA_KEY_TEST_DEVICE_IDS].append(a_value)
|
||||
return self
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
return _data
|
||||
@@ -0,0 +1 @@
|
||||
uid://ihpl6qb5lkw2
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# © 2026-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name AdmobSettings
|
||||
extends RefCounted
|
||||
|
||||
const DATA_KEY_AD_VOLUME := &"ad_volume"
|
||||
const DATA_KEY_ADS_MUTED := &"ads_muted"
|
||||
const DATA_KEY_APPLY_AT_STARTUP := &"apply_at_startup"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary = {}) -> void:
|
||||
_data = a_data
|
||||
|
||||
|
||||
func set_ad_volume(a_value: float) -> AdmobSettings:
|
||||
_data[DATA_KEY_AD_VOLUME] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_ad_volume() -> float:
|
||||
return _data[DATA_KEY_AD_VOLUME]
|
||||
|
||||
|
||||
func set_ads_muted(a_value: bool) -> AdmobSettings:
|
||||
_data[DATA_KEY_ADS_MUTED] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func are_ads_muted() -> bool:
|
||||
return _data[DATA_KEY_ADS_MUTED]
|
||||
|
||||
|
||||
func set_apply_at_startup(a_value: bool) -> AdmobSettings:
|
||||
_data[DATA_KEY_APPLY_AT_STARTUP] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_apply_at_startup() -> bool:
|
||||
return _data[DATA_KEY_APPLY_AT_STARTUP]
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
return _data
|
||||
@@ -0,0 +1 @@
|
||||
uid://u1bg67vtlhd8
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name ConsentRequestParameters
|
||||
extends RefCounted
|
||||
|
||||
enum DebugGeography {
|
||||
NOT_SET = -1, ## Don't specify location. (Actual location will be used.)
|
||||
DISABLED = 0, ## Use actual location.
|
||||
EEA = 1, ## Use European Economic Area.
|
||||
NOT_EEA = 2, ## Deprecated.
|
||||
REGULATED_US_STATE = 3, ## Use a regulated state of USA. (ie. California)
|
||||
OTHER = 4, ## Use any non-regulated location.
|
||||
}
|
||||
|
||||
const IS_REAL_PROPERTY := &"is_real"
|
||||
const TAG_FOR_UNDER_AGE_OF_CONSENT_PROPERTY := &"tag_for_under_age_of_consent"
|
||||
const DEBUG_GEOGRAPHY_PROPERTY := &"debug_geography"
|
||||
const TEST_DEVICE_HASHED_IDS_PROPERTY := &"test_device_hashed_ids"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init():
|
||||
_data = {
|
||||
TEST_DEVICE_HASHED_IDS_PROPERTY: [],
|
||||
}
|
||||
|
||||
|
||||
func set_is_real(a_value: bool) -> ConsentRequestParameters:
|
||||
_data[IS_REAL_PROPERTY] = a_value
|
||||
|
||||
return self
|
||||
|
||||
|
||||
func set_tag_for_under_age_of_consent(a_value: AdmobConfig.TagForUnderAgeOfConsent) -> ConsentRequestParameters:
|
||||
match a_value:
|
||||
AdmobConfig.TagForChildDirectedTreatment.TRUE:
|
||||
_data[TAG_FOR_UNDER_AGE_OF_CONSENT_PROPERTY] = true
|
||||
AdmobConfig.TagForChildDirectedTreatment.FALSE:
|
||||
_data[TAG_FOR_UNDER_AGE_OF_CONSENT_PROPERTY] = false
|
||||
|
||||
return self
|
||||
|
||||
|
||||
func set_debug_geography(a_value: DebugGeography) -> ConsentRequestParameters:
|
||||
_data[DEBUG_GEOGRAPHY_PROPERTY] = a_value
|
||||
|
||||
return self
|
||||
|
||||
|
||||
func add_test_device_hashed_id(a_value: String) -> ConsentRequestParameters:
|
||||
_data[TEST_DEVICE_HASHED_IDS_PROPERTY].append(a_value)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
func get_device_ids() -> Array:
|
||||
return _data[TEST_DEVICE_HASHED_IDS_PROPERTY]
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
return _data
|
||||
@@ -0,0 +1 @@
|
||||
uid://5nuqawjs80oi
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name FormError
|
||||
extends RefCounted
|
||||
|
||||
const CODE_PROPERTY := &"code"
|
||||
const MESSAGE_PROPERTY := &"message"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data if a_data else {}
|
||||
|
||||
|
||||
func get_code() -> int:
|
||||
return _data[CODE_PROPERTY] if _data.has(CODE_PROPERTY) else 0
|
||||
|
||||
|
||||
func get_message() -> String:
|
||||
return _data[MESSAGE_PROPERTY] if _data.has(MESSAGE_PROPERTY) else ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://f4ywykxwjpal
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name InitializationStatus
|
||||
extends RefCounted
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
if a_data == null:
|
||||
_data = {}
|
||||
else:
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_network_tags() -> Array:
|
||||
return _data.keys()
|
||||
|
||||
|
||||
func get_adapter_status(a_network_tag: String) -> AdapterStatus:
|
||||
return AdapterStatus.new(_data[a_network_tag]) if _data.has(a_network_tag) else null
|
||||
@@ -0,0 +1 @@
|
||||
uid://b0oie3ngw68ha
|
||||
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name LoadAdError
|
||||
extends AdError
|
||||
|
||||
const RESPONSE_INFO_PROPERTY := &"response_info"
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
super(a_data)
|
||||
|
||||
|
||||
func get_response_info() -> ResponseInfo:
|
||||
return ResponseInfo.new(_data[RESPONSE_INFO_PROPERTY]) if _data.has(RESPONSE_INFO_PROPERTY) else null
|
||||
@@ -0,0 +1 @@
|
||||
uid://ddnpjk4ksplb5
|
||||
@@ -0,0 +1,332 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name LoadAdRequest
|
||||
extends RefCounted
|
||||
|
||||
enum AdPosition {
|
||||
TOP, ## Ad will be anchored at the top of the screen.
|
||||
BOTTOM, ## Ad will be anchored at the bottom of the screen.
|
||||
LEFT, ## Ad will be anchored to the left of the screen.
|
||||
RIGHT, ## Ad will be anchored to the right of the screen.
|
||||
TOP_LEFT, ## Ad will be anchored at the top-left of the screen.
|
||||
TOP_RIGHT, ## Ad will be anchored at the top-right of the screen.
|
||||
BOTTOM_LEFT, ## Ad will be anchored at the bottom-left of the screen.
|
||||
BOTTOM_RIGHT, ## Ad will be anchored at the bottom-right of the screen.
|
||||
CENTER, ## Ad will be anchored at the center of the screen.
|
||||
CUSTOM, ## Ad position will be set dynamically.
|
||||
}
|
||||
|
||||
enum RequestedAdSize {
|
||||
BANNER, ## A standard ad size that refers to a rectangular ad unit, most commonly 320x50 density-independent pixels
|
||||
## (dp).
|
||||
LARGE_BANNER, ## A fixed-size banner with dimensions of 320x100 density-independent pixels (dp).
|
||||
MEDIUM_RECTANGLE, ## A standard 300x250 pixel ad, often referred to as the Interactive Advertising Bureau (IAB)
|
||||
## medium rectangle.
|
||||
FULL_BANNER, ## An ad size constant for an Interactive Advertising Bureau (IAB) full-size banner, which has a fixed
|
||||
## size of 468x60 density-independent pixels (dp).
|
||||
LEADERBOARD, ## A banner ad with dimensions of 728 pixels wide by 90 pixels tall. This is a standard display ad
|
||||
## size that is designed for tablet screens.
|
||||
ADAPTIVE, ## An ad that automatically adjusts its width and height to fit the device's available screen space,
|
||||
## providing the best-performing banner size for that specific layout.
|
||||
INLINE_ADAPTIVE, ## An ad that dynamically optimizes its height for the available inline content width, ensuring a
|
||||
## smoothly integrated banner that fits naturally within scrollable or in-feed layouts.
|
||||
SKYSCRAPER, ## Deprecated
|
||||
FLUID, ## Deprecated
|
||||
}
|
||||
|
||||
enum CollapsiblePosition {
|
||||
DISABLED, ## The banner ad will not be collapsible.
|
||||
TOP, ## The banner ad will be collapsible from bottom to top.
|
||||
BOTTOM, ## The banner ad will be collapsible from top to bottom.
|
||||
}
|
||||
|
||||
## Controls which aspect ratios the SDK should prefer when requesting native ad media.
|
||||
## Maps to NativeAdOptions.NATIVE_MEDIA_ASPECT_RATIO_* constants.
|
||||
enum NativeMediaAspectRatio {
|
||||
UNKNOWN = 0, ## No preference for aspect ratio (SDK default).
|
||||
ANY = 1, ## Any aspect ratio is acceptable.
|
||||
LANDSCAPE = 2, ## Prefer landscape (wider than tall) media.
|
||||
PORTRAIT = 3, ## Prefer portrait (taller than wide) media.
|
||||
SQUARE = 4, ## Prefer square (1:1) media.
|
||||
}
|
||||
|
||||
## Controls where the AdChoices icon is placed within the native ad view.
|
||||
## Maps to NativeAdOptions.ADCHOICES_* constants.
|
||||
enum NativeAdChoicesPlacement {
|
||||
TOP_LEFT = 0, ## AdChoices icon in the top-left corner.
|
||||
TOP_RIGHT = 1, ## AdChoices icon in the top-right corner (SDK default).
|
||||
BOTTOM_RIGHT = 2, ## AdChoices icon in the bottom-right corner.
|
||||
BOTTOM_LEFT = 3, ## AdChoices icon in the bottom-left corner.
|
||||
}
|
||||
|
||||
## Controls how icon/image assets are scaled inside their ImageView.
|
||||
## Maps directly to Android's ImageView.ScaleType enum.
|
||||
enum NativeImageScaleType {
|
||||
MATRIX = 0, ## Scale using the image Matrix.
|
||||
FIT_XY = 1, ## Scale to fill the view bounds, ignoring aspect ratio.
|
||||
FIT_START = 2, ## Scale to fit within bounds, aligned to top-left.
|
||||
FIT_CENTER = 3, ## Scale to fit within bounds, centered (Android default).
|
||||
FIT_END = 4, ## Scale to fit within bounds, aligned to bottom-right.
|
||||
CENTER = 5, ## Center image without scaling.
|
||||
CENTER_CROP = 6, ## Scale so shorter dimension fits; crop the longer one.
|
||||
CENTER_INSIDE = 7, ## Scale to fit within bounds if larger; center otherwise.
|
||||
}
|
||||
|
||||
const COLLAPSIBLE_POSITION_NAMES: Dictionary = {
|
||||
CollapsiblePosition.TOP: "top",
|
||||
CollapsiblePosition.BOTTOM: "bottom",
|
||||
}
|
||||
|
||||
const DATA_KEY_AD_UNIT_ID := &"ad_unit_id"
|
||||
const DATA_KEY_REQUEST_AGENT := &"request_agent"
|
||||
const DATA_KEY_AD_SIZE := &"ad_size"
|
||||
const DATA_KEY_ADAPTIVE_WIDTH := &"adaptive_width"
|
||||
const DATA_KEY_ADAPTIVE_MAX_HEIGHT := &"adaptive_max_height"
|
||||
const DATA_KEY_AD_POSITION := &"ad_position"
|
||||
const DATA_KEY_COLLAPSIBLE_POSITION := &"collapsible_position"
|
||||
const DATA_KEY_ANCHOR_TO_SAFE_AREA := &"anchor_to_safe_area"
|
||||
const DATA_KEY_KEYWORDS := &"keywords"
|
||||
const DATA_KEY_USER_ID := &"user_id"
|
||||
const DATA_KEY_CUSTOM_DATA := &"custom_data"
|
||||
const DATA_KEY_NETWORK_EXTRAS := &"network_extras"
|
||||
|
||||
# Native ad option keys — sent to the Java layer inside the ad-request dictionary.
|
||||
const DATA_KEY_NATIVE_MEDIA_ASPECT_RATIO := &"native_media_aspect_ratio"
|
||||
const DATA_KEY_NATIVE_RETURN_URLS_FOR_IMAGE_ASSETS := &"native_return_urls_for_image_assets"
|
||||
const DATA_KEY_NATIVE_REQUEST_MULTIPLE_IMAGES := &"native_request_multiple_images"
|
||||
const DATA_KEY_NATIVE_AD_CHOICES_PLACEMENT := &"native_ad_choices_placement"
|
||||
const DATA_KEY_NATIVE_IMAGE_SCALE_TYPE := &"native_image_scale_type"
|
||||
const DATA_KEY_NATIVE_DISABLE_VALIDATOR := &"native_disable_validator"
|
||||
|
||||
const DEFAULT_DATA: Dictionary = {
|
||||
DATA_KEY_KEYWORDS: [],
|
||||
DATA_KEY_NETWORK_EXTRAS: [],
|
||||
}
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary = DEFAULT_DATA.duplicate()) -> void:
|
||||
_data = a_data
|
||||
|
||||
|
||||
func set_ad_unit_id(a_value: String) -> LoadAdRequest:
|
||||
_data[DATA_KEY_AD_UNIT_ID] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_ad_unit_id() -> String:
|
||||
return _data[DATA_KEY_AD_UNIT_ID]
|
||||
|
||||
|
||||
func set_request_agent(a_value: String) -> LoadAdRequest:
|
||||
_data[DATA_KEY_REQUEST_AGENT] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_request_agent() -> String:
|
||||
return _data[DATA_KEY_REQUEST_AGENT]
|
||||
|
||||
|
||||
func set_ad_size(a_value: RequestedAdSize) -> LoadAdRequest:
|
||||
_data[DATA_KEY_AD_SIZE] = RequestedAdSize.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_ad_size() -> RequestedAdSize:
|
||||
return RequestedAdSize[_data[DATA_KEY_AD_SIZE]] if _data.has(DATA_KEY_AD_SIZE) else RequestedAdSize.BANNER
|
||||
|
||||
|
||||
func set_adaptive_width(a_value: int) -> LoadAdRequest:
|
||||
_data[DATA_KEY_ADAPTIVE_WIDTH] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_adaptive_width() -> int:
|
||||
return _data[DATA_KEY_ADAPTIVE_WIDTH]
|
||||
|
||||
|
||||
func set_adaptive_max_height(a_value: int) -> LoadAdRequest:
|
||||
_data[DATA_KEY_ADAPTIVE_MAX_HEIGHT] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_adaptive_max_height() -> int:
|
||||
return _data[DATA_KEY_ADAPTIVE_MAX_HEIGHT]
|
||||
|
||||
|
||||
func set_ad_position(a_value: AdPosition) -> LoadAdRequest:
|
||||
_data[DATA_KEY_AD_POSITION] = AdPosition.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_ad_position() -> AdPosition:
|
||||
return AdPosition[_data[DATA_KEY_AD_POSITION]] if _data.has(DATA_KEY_AD_POSITION) else AdPosition.CUSTOM
|
||||
|
||||
|
||||
func set_collapsible_position(a_value: CollapsiblePosition) -> LoadAdRequest:
|
||||
if a_value != CollapsiblePosition.DISABLED:
|
||||
_data[DATA_KEY_COLLAPSIBLE_POSITION] = COLLAPSIBLE_POSITION_NAMES[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_collapsible_position() -> CollapsiblePosition:
|
||||
return (
|
||||
CollapsiblePosition[_data[DATA_KEY_COLLAPSIBLE_POSITION]]
|
||||
if _data.has(DATA_KEY_COLLAPSIBLE_POSITION)
|
||||
else CollapsiblePosition.DISABLED
|
||||
)
|
||||
|
||||
|
||||
func set_anchor_to_safe_area(a_value: bool) -> LoadAdRequest:
|
||||
_data[DATA_KEY_ANCHOR_TO_SAFE_AREA] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_anchor_to_safe_area() -> bool:
|
||||
return _data[DATA_KEY_ANCHOR_TO_SAFE_AREA] if _data.has(DATA_KEY_ANCHOR_TO_SAFE_AREA) else false
|
||||
|
||||
|
||||
func set_keywords(a_value: Array) -> LoadAdRequest:
|
||||
if a_value == null:
|
||||
_data[DATA_KEY_KEYWORDS] = []
|
||||
else:
|
||||
_data[DATA_KEY_KEYWORDS] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func add_keyword(a_value: String) -> LoadAdRequest:
|
||||
_data[DATA_KEY_KEYWORDS].append(a_value)
|
||||
return self
|
||||
|
||||
|
||||
func get_keywords() -> Array:
|
||||
return _data[DATA_KEY_KEYWORDS] if _data.has(DATA_KEY_KEYWORDS) else []
|
||||
|
||||
|
||||
func set_user_id(a_value: String) -> LoadAdRequest:
|
||||
_data[DATA_KEY_USER_ID] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_user_id() -> String:
|
||||
return _data[DATA_KEY_USER_ID] if _data.has(DATA_KEY_USER_ID) else ""
|
||||
|
||||
|
||||
func set_custom_data(a_value: String) -> LoadAdRequest:
|
||||
_data[DATA_KEY_CUSTOM_DATA] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_custom_data() -> String:
|
||||
return _data[DATA_KEY_CUSTOM_DATA] if _data.has(DATA_KEY_CUSTOM_DATA) else ""
|
||||
|
||||
|
||||
func set_network_extras(a_value: Array) -> LoadAdRequest:
|
||||
if a_value == null:
|
||||
_data[DATA_KEY_NETWORK_EXTRAS] = []
|
||||
else:
|
||||
_data[DATA_KEY_NETWORK_EXTRAS] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_network_extras() -> Array:
|
||||
return _data[DATA_KEY_NETWORK_EXTRAS] if _data.has(DATA_KEY_NETWORK_EXTRAS) else []
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Native Ad Options
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
## Sets a preferred media aspect ratio for native ads.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_media_aspect_ratio(a_value: NativeMediaAspectRatio) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_MEDIA_ASPECT_RATIO] = NativeMediaAspectRatio.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_native_media_aspect_ratio() -> NativeMediaAspectRatio:
|
||||
return (
|
||||
NativeMediaAspectRatio[_data[DATA_KEY_NATIVE_MEDIA_ASPECT_RATIO]]
|
||||
if _data.has(DATA_KEY_NATIVE_MEDIA_ASPECT_RATIO)
|
||||
else NativeMediaAspectRatio.UNKNOWN
|
||||
)
|
||||
|
||||
|
||||
## When true the SDK returns image asset URLs instead of pre-fetched Drawable
|
||||
## objects, allowing the app to download and manage images itself.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_return_urls_for_image_assets(a_value: bool) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_RETURN_URLS_FOR_IMAGE_ASSETS] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_native_return_urls_for_image_assets() -> bool:
|
||||
return (
|
||||
_data[DATA_KEY_NATIVE_RETURN_URLS_FOR_IMAGE_ASSETS]
|
||||
if _data.has(DATA_KEY_NATIVE_RETURN_URLS_FOR_IMAGE_ASSETS)
|
||||
else false
|
||||
)
|
||||
|
||||
|
||||
## When true the SDK may return ads that contain multiple images for a single
|
||||
## asset slot. By default only one image per slot is returned.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_request_multiple_images(a_value: bool) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_REQUEST_MULTIPLE_IMAGES] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_native_request_multiple_images() -> bool:
|
||||
return (
|
||||
_data[DATA_KEY_NATIVE_REQUEST_MULTIPLE_IMAGES] if _data.has(DATA_KEY_NATIVE_REQUEST_MULTIPLE_IMAGES) else false
|
||||
)
|
||||
|
||||
|
||||
## Sets where the AdChoices icon is placed inside the native ad view.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_ad_choices_placement(a_value: NativeAdChoicesPlacement) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_AD_CHOICES_PLACEMENT] = NativeAdChoicesPlacement.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_native_ad_choices_placement() -> NativeAdChoicesPlacement:
|
||||
return (
|
||||
NativeAdChoicesPlacement[_data[DATA_KEY_NATIVE_AD_CHOICES_PLACEMENT]]
|
||||
if _data.has(DATA_KEY_NATIVE_AD_CHOICES_PLACEMENT)
|
||||
else NativeAdChoicesPlacement.TOP_RIGHT
|
||||
)
|
||||
|
||||
|
||||
## Sets how icon and image assets are scaled inside their Android ImageView.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_image_scale_type(a_value: NativeImageScaleType) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_IMAGE_SCALE_TYPE] = NativeImageScaleType.keys()[a_value]
|
||||
return self
|
||||
|
||||
|
||||
func get_native_image_scale_type() -> NativeImageScaleType:
|
||||
return (
|
||||
NativeImageScaleType[_data[DATA_KEY_NATIVE_IMAGE_SCALE_TYPE]]
|
||||
if _data.has(DATA_KEY_NATIVE_IMAGE_SCALE_TYPE)
|
||||
else NativeImageScaleType.FIT_CENTER
|
||||
)
|
||||
|
||||
|
||||
## When true the SDK's native ad validator is disabled. The validator normally
|
||||
## logs warnings when required view bindings are missing; disabling it suppresses
|
||||
## those warnings in test / custom-layout scenarios.
|
||||
## Has no effect when used for non-native ad types.
|
||||
func set_native_disable_validator(a_value: bool) -> LoadAdRequest:
|
||||
_data[DATA_KEY_NATIVE_DISABLE_VALIDATOR] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_native_disable_validator() -> bool:
|
||||
return _data[DATA_KEY_NATIVE_DISABLE_VALIDATOR] if _data.has(DATA_KEY_NATIVE_DISABLE_VALIDATOR) else false
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
return _data
|
||||
@@ -0,0 +1 @@
|
||||
uid://c86msp23213bn
|
||||
@@ -0,0 +1,322 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name MediationNetwork
|
||||
extends RefCounted
|
||||
|
||||
enum Flag {
|
||||
APPLOVIN = 1 << 0, ## AppLovin
|
||||
CHARTBOOST = 1 << 1, ## Chartboost
|
||||
DTEXCHANGE = 1 << 2, ## DT Exchange (previously Fyber)
|
||||
IMOBILE = 1 << 3, ## i-mobile
|
||||
INMOBI = 1 << 4, ## InMobi
|
||||
IRONSOURCE = 1 << 5, ## ironSource
|
||||
LIFTOFF = 1 << 6, ## Liftoff Monetize (previously Vungle)
|
||||
LINE = 1 << 7, ## LINE Ads Network
|
||||
MAIO = 1 << 8, ## maio
|
||||
META = 1 << 9, ## Meta Audience Network (previously Facebook)
|
||||
MINTEGRAL = 1 << 10, ## Mintegral
|
||||
MOLOCO = 1 << 11, ## Moloco
|
||||
MYTARGET = 1 << 12, ## myTarget
|
||||
PANGLE = 1 << 13, ## Pangle
|
||||
UNITY = 1 << 14, ## Unity Ads
|
||||
}
|
||||
|
||||
const FLAG_PROPERTY := &"flag"
|
||||
const TAG_PROPERTY := &"tag"
|
||||
const DEPENDENCIES_PROPERTY := &"dependencies"
|
||||
const MAVEN_REPO_PROPERTY := &"maven_repo"
|
||||
const PACKAGE_PROPERTY := &"package"
|
||||
const PACKAGE_URL_PROPERTY := &"package_url"
|
||||
const PACKAGE_VERSION_PROPERTY := &"package_version"
|
||||
const SK_AD_NETWORK_IDS_PROPERTY := &"sk_ad_network_ids"
|
||||
const GOOGLE_SK_AD_NETWORK_IDS = [ "cstr6suwn9", "4fzdc2evr5", "2fnua5tdw4", "ydx93a7ass", "p78axxw29g", "v72qych5uu", "ludvb6z3bs", "cp8zw746q7", "3sh42y64q3", "c6k4g5qg8m", "s39g8k73mm", "3qy4746246", "f38h382jlk", "hs6bdukanm", "mlmmfzh3r3", "v4nxqhlyqp", "wzmmz9fp6w", "su67r6k2v3", "yclnxrl5pm", "t38b2kh725", "7ug5zh24hu", "gta9lk7p23", "vutu7akeur", "y5ghdn5j9k", "v9wttpbfk9", "n38lu8286q", "47vhws6wlr", "kbd757ywx3", "9t245vhmpl", "a2p9lx4jpn", "22mmun2rn5", "44jx6755aq", "k674qkevps", "4468km3ulz", "2u9pt9hc89", "8s468mfl3y", "klf5c3l5u5", "ppxm28t8ap", "kbmxgpxpgc", "uw77j35x4d", "578prtvx9j", "4dzt52r2t5", "tl55sbb4fm", "c3frkrj4fj", "e5fvkxwrpn", "8c4e2ghe7u", "3rd42ekr43", "97r2b46745", "3qcr597p9d" ]
|
||||
|
||||
const SK_AD_NETWORK_ITEM_LIST_FORMAT: String = """
|
||||
<key>SKAdNetworkItems</key>
|
||||
<array>
|
||||
%s
|
||||
</array>
|
||||
"""
|
||||
|
||||
const SK_AD_NETWORK_ITEM_FORMAT: String = """
|
||||
<dict>
|
||||
<key>SKAdNetworkIdentifier</key>
|
||||
<string>%s.skadnetwork</string>
|
||||
</dict>
|
||||
"""
|
||||
|
||||
const MEDIATION_NETWORKS: Dictionary = {
|
||||
Flag.APPLOVIN: {
|
||||
FLAG_PROPERTY: Flag.APPLOVIN,
|
||||
TAG_PROPERTY: "applovin",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:applovin:13.4.0.1"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "AppLovinAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-applovin.git",
|
||||
PACKAGE_VERSION_PROPERTY: "13.4.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["22mmun2rn5", "238da6jt44", "24t9a8vw3c", "24zw6aqk47", "252b5q8x7y", "275upjj5gd", "294l99pt4k", "2fnua5tdw4", "2u9pt9hc89", "32z4fx6l9h", "3l6bd9hu43", "3qcr597p9d", "3qy4746246", "3rd42ekr43", "3sh42y64q3", "424m5254lk", "4468km3ulz", "44jx6755aq", "44n7hlldy6", "47vhws6wlr", "488r3q3dtq", "4dzt52r2t5", "4fzdc2evr5", "4mn522wn87", "4pfyvq9l8r", "4w7y6s5ca2", "523jb4fst2", "52fl2v3hgk", "54nzkqm89y", "578prtvx9j", "5a6flpkh64", "5l3tpt7t6e", "5lm9lj6jb7", "5tjdwbrq8w", "6964rsfnh4", "6g9af3uyq4", "6p4ks3rnbw", "6v7lgmsu45", "6xzpu9s2p8", "737z793b9f", "74b6s63p6l", "79pbpufp6p", "7fmhfwg9en", "7rz58n8ntl", "7ug5zh24hu", "84993kbrcf", "89z7zv988g", "8c4e2ghe7u", "8m87ys6875", "8r8llnkz5a", "8s468mfl3y", "97r2b46745", "9b89h5y424", "9nlqeag3gk", "9rd848q2bz", "9t245vhmpl", "9vvzujtq5s", "9yg77x724h", "a2p9lx4jpn", "a7xqa6mtl2", "a8cz6cu7e5", "av6w8kgt66", "b9bk5wbcq9", "bxvub5ada5", "c3frkrj4fj", "c6k4g5qg8m", "cg4yq2srnc", "cj5566h2ga", "cp8zw746q7", "cs644xg564", "cstr6suwn9", "dbu4b84rxf", "dkc879ngq3", "dzg6xy7pwj", "e5fvkxwrpn", "ecpz2srf59", "eh6m2bh4zr", "ejvt5qm6ak", "f38h382jlk", "f73kdq92p3", "f7s53z58qe", "feyaarzu9v", "g28c52eehv", "g2y4y55b64", "g6gcrrvk4p", "ggvn48r87g", "glqzh8vgby", "gta8lk7p23", "gta9lk7p23", "hb56zgv37p", "hdw39hrw9y", "hs6bdukanm", "k674qkevps", "kbd757ywx3", "kbmxgpxpgc", "klf5c3l5u5", "krvm3zuq6h", "lr83yxwka7", "ludvb6z3bs", "m297p6643m", "m5mvw97r93", "m8dbw4sv7c", "mj797d8u6f", "mlmmfzh3r3", "mls7yz5dvl", "mp6xlyr22a", "mqn7fxpca7", "mtkv5xtk9e", "n38lu8286q", "n66cz3y3bx", "n6fk4nfna4", "n9x2a789qt", "nzq8sh4pbs", "p78axxw29g", "ppxm28t8ap", "prcb7njmu6", "pwa73g5rt2", "pwdxu55a5a", "qqp299437r", "qu637u8glc", "r45fhb6rf7", "rvh3l7un93", "rx5hdcabgc", "s39g8k73mm", "s69wq72ugq", "su67r6k2v3", "t38b2kh725", "tl55sbb4fm", "u679fj5vs4", "uw77j35x4d", "v4nxqhlyqp", "v72qych5uu", "v79kvwwj4g", "v9wttpbfk9", "vcra2ehyfk", "vhf287vqwu", "vutu7akeur", "w9q455wk68", "wg4vff78zm", "wzmmz9fp6w", "x44k69ngh6", "x5l83yy675", "x8jxxk4ff5", "x8uqf25wch", "xga6mpmplv", "xy9t38ct57", "y45688jllp", "y5ghdn5j9k", "yclnxrl5pm", "ydx93a7ass", "zmvfpc5aq8", "zq492l623r"],
|
||||
},
|
||||
Flag.CHARTBOOST: {
|
||||
FLAG_PROPERTY: Flag.CHARTBOOST,
|
||||
TAG_PROPERTY: "chartboost",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:chartboost:9.10.0.1"],
|
||||
MAVEN_REPO_PROPERTY: "https://cboost.jfrog.io/artifactory/chartboost-ads/",
|
||||
PACKAGE_PROPERTY: "ChartboostAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-chartboost.git",
|
||||
PACKAGE_VERSION_PROPERTY: "9.11.001",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["f38h382jlk"],
|
||||
},
|
||||
Flag.DTEXCHANGE: {
|
||||
FLAG_PROPERTY: Flag.DTEXCHANGE,
|
||||
TAG_PROPERTY: "dtexchange",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:fyber:8.4.0.0"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "DTExchangeAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-dtexchange.git",
|
||||
PACKAGE_VERSION_PROPERTY: "8.4.600",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["ydx93a7ass", "t6d3zquu66", "4fzdc2evr5", "a8cz6cu7e5", "9nlqeag3gk", "a2p9lx4jpn", "k674qkevps", "c3frkrj4fj", "n6fk4nfna4", "mtkv5xtk9e", "p78axxw29g", "n9x2a789qt", "kbmxgpxpgc", "s39g8k73mm", "krvm3zuq6h", "294l99pt4k", "3rd42ekr43", "ggvn48r87g", "4pfyvq9l8r", "cg4yq2srnc", "5a6flpkh64", "v72qych5uu", "x8uqf25wch", "c6k4g5qg8m", "wg4vff78zm", "rx5hdcabgc", "32z4fx6l9h", "3qy4746246", "252b5q8x7y", "f38h382jlk", "24t9a8vw3c", "hs6bdukanm", "9rd848q2bz", "prcb7njmu6", "m8dbw4sv7c", "9g2aggbj52", "wzmmz9fp6w", "yclnxrl5pm", "t38b2kh725", "7ug5zh24hu", "5lm9lj6jb7", "ejvt5qm6ak", "7rz58n8ntl", "kbd757ywx3", "9t245vhmpl", "44jx6755aq", "tl55sbb4fm", "8s468mfl3y", "4468km3ulz", "2u9pt9hc89", "av6w8kgt66", "klf5c3l5u5", "hdw39hrw9y", "y45688jllp", "dzg6xy7pwj", "3sh42y64q3", "ppxm28t8ap", "f73kdq92p3", "5l3tpt7t6e", "uw77j35x4d", "mlmmfzh3r3", "6g9af3uyq4", "su67r6k2v3", "g28c52eehv", "pwa73g5rt2", "zq492l623r", "22mmun2rn5", "8r8llnkz5a", "47vhws6wlr", "5tjdwbrq8w", "h65wbv5k3f", "2fnua5tdw4", "7fmhfwg9en", "tvvz7th9br", "x44k69ngh6", "vhf287vqwu", "4dzt52r2t5", "x8yj322td6", "tskbem2b5g", "cp8zw746q7", "cj5566h2ga", "578prtvx9j", "e5fvkxwrpn", "r45fhb6rf7", "mqn7fxpca7", "g6gcrrvk4p", "xga6mpmplv", "qu637u8glc", "w9q455wk68", "275upjj5gd", "97r2b46745", "cstr6suwn9"],
|
||||
},
|
||||
Flag.IMOBILE: {
|
||||
FLAG_PROPERTY: Flag.IMOBILE,
|
||||
TAG_PROPERTY: "imobile",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:imobile:2.3.2.1"],
|
||||
MAVEN_REPO_PROPERTY: "https://imobile.github.io/adnw-sdk-android",
|
||||
PACKAGE_PROPERTY: "IMobileAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-imobile.git",
|
||||
PACKAGE_VERSION_PROPERTY: "2.3.402",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["v4nxqhlyqp"],
|
||||
},
|
||||
Flag.INMOBI: {
|
||||
FLAG_PROPERTY: Flag.INMOBI,
|
||||
TAG_PROPERTY: "inmobi",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:inmobi:10.8.8.1"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "InMobiAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-inmobi.git",
|
||||
PACKAGE_VERSION_PROPERTY: "10.8.600",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["uw77j35x4d", "7ug5zh24hu", "hs6bdukanm", "4fzdc2evr5", "ggvn48r87g", "5lm9lj6jb7", "9rd848q2bz", "c6k4g5qg8m", "wzmmz9fp6w", "3sh42y64q3", "yclnxrl5pm", "kbd757ywx3", "f73kdq92p3", "ydx93a7ass", "w9q455wk68", "prcb7njmu6", "wg4vff78zm", "mlmmfzh3r3", "tl55sbb4fm", "4pfyvq9l8r", "t38b2kh725", "5l3tpt7t6e", "7rz58n8ntl", "klf5c3l5u5", "cg4yq2srnc", "av6w8kgt66", "9t245vhmpl", "v72qych5uu", "2u9pt9hc89", "44jx6755aq", "8s468mfl3y", "p78axxw29g", "ppxm28t8ap", "424m5254lk", "5a6flpkh64", "pwa73g5rt2", "e5fvkxwrpn", "9nlqeag3gk", "k674qkevps", "cj5566h2ga", "mtkv5xtk9e", "3rd42ekr43", "g28c52eehv", "2fnua5tdw4", "4468km3ulz", "97r2b46745", "glqzh8vgby", "3qcr597p9d", "578prtvx9j", "n6fk4nfna4", "b9bk5wbcq9", "kbmxgpxpgc", "294l99pt4k", "523jb4fst2", "mls7yz5dvl", "74b6s63p6l", "22mmun2rn5", "52fl2v3hgk", "6g9af3uyq4", "x5l83yy675", "mqn7fxpca7", "g6gcrrvk4p", "r45fhb6rf7", "c3frkrj4fj", "ejvt5qm6ak", "f38h382jlk", "488r3q3dtq", "55644vm79v", "5tjdwbrq8w", "nzq8sh4pbs", "m8dbw4sv7c", "7fmhfwg9en", "6v7lgmsu45", "s39g8k73mm", "6yxyv74ff7", "55y65gfgn7", "mqn7fxpca7", "qqp299437r", "32z4fx6l9h", "feyaarzu9v", "cp8zw746q7", "252b5q8x7y", "qu637u8glc", "vhf287vqwu", "a8cz6cu7e5", "cwn433xbcr", "fq6vru337s", "87u5trcl3r", "mj797d8u6f", "dbu4b84rxf", "238da6jt44", "4dzt52r2t5", "a2p9lx4jpn", "t6d3zquu66", "zq492l623r", "cstr6suwn9", "xga6mpmplv", "tmhh9296z4", "6xzpu9s2p8", "ludvb6z3bs", "v9wttpbfk9", "n38lu8286q", "fz2k2k5tej", "g2y4y55b64", "su67r6k2v3", "v79kvwwj4g", "275upjj5gd", "24zw6aqk47", "44n7hlldy6", "ecpz2srf59", "bvpn9ufa9b", "gta9lk7p23"],
|
||||
},
|
||||
Flag.IRONSOURCE: {
|
||||
FLAG_PROPERTY: Flag.IRONSOURCE,
|
||||
TAG_PROPERTY: "ironsource",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:ironsource:9.0.0.1"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "IronSourceAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-ironsource.git",
|
||||
PACKAGE_VERSION_PROPERTY: "8.10.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["su67r6k2v3"],
|
||||
},
|
||||
Flag.LIFTOFF: {
|
||||
FLAG_PROPERTY: Flag.LIFTOFF,
|
||||
TAG_PROPERTY: "liftoff",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:vungle:7.6.0.0"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "LiftoffMonetizeAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-liftoffmonetize.git",
|
||||
PACKAGE_VERSION_PROPERTY: "7.6.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["22mmun2rn5", "238da6jt44", "24t9a8vw3c", "24zw6aqk47", "275upjj5gd", "294l99pt4k", "2fnua5tdw4", "2u9pt9hc89", "32z4fx6l9h", "3l6bd9hu43", "3qcr597p9d", "3qy4746246", "3rd42ekr43", "3sh42y64q3", "424m5254lk", "4468km3ulz", "44jx6755aq", "44n7hlldy6", "488r3q3dtq", "4dzt52r2t5", "4fzdc2evr5", "4pfyvq9l8r", "4w7y6s5ca2", "523jb4fst2", "52fl2v3hgk", "54nzkqm89y", "578prtvx9j", "5a6flpkh64", "5l3tpt7t6e", "5lm9lj6jb7", "5tjdwbrq8w", "6964rsfnh4", "6g9af3uyq4", "6lz2ygh3q6", "6p4ks3rnbw", "6rd35atwn8", "6v7lgmsu45", "6xzpu9s2p8", "6yxyv74ff7", "737z793b9f", "74b6s63p6l", "79pbpufp6p", "7fmhfwg9en", "7rz58n8ntl", "7ug5zh24hu", "84993kbrcf", "87u5trcl3r", "89z7zv988g", "8m87ys6875", "8s468mfl3y", "97r2b46745", "9b89h5y424", "9nlqeag3gk", "9rd848q2bz", "9t245vhmpl", "9vvzujtq5s", "a2p9lx4jpn", "a7xqa6mtl2", "a8cz6cu7e5", "apzhy3va96", "av6w8kgt66", "b9bk5wbcq9", "bvpn9ufa9b", "bxvub5ada5", "c3frkrj4fj", "c6k4g5qg8m", "cg4yq2srnc", "cj5566h2ga", "cp8zw746q7", "cs644xg564", "cstr6suwn9", "cwn433xbcr", "dbu4b84rxf", "dkc879ngq3", "dzg6xy7pwj", "e5fvkxwrpn", "ecpz2srf59", "ejvt5qm6ak", "f2zub97jtl", "f38h382jlk", "f73kdq92p3", "f7s53z58qe", "feyaarzu9v", "fq6vru337s", "fz2k2k5tej", "g28c52eehv", "g2y4y55b64", "g6gcrrvk4p", "ggvn48r87g", "glqzh8vgby", "gta9lk7p23", "hb56zgv37p", "hdw39hrw9y", "hs6bdukanm", "k674qkevps", "k6y4y55b64", "kbd757ywx3", "kbmxgpxpgc", "klf5c3l5u5", "krvm3zuq6h", "ln5gz23vtd", "lr83yxwka7", "ludvb6z3bs", "m297p6643m", "m2jqnlggk3", "m5mvw97r93", "m8dbw4sv7c", "mj797d8u6f", "mlmmfzh3r3", "mls7yz5dvl", "mp6xlyr22a", "mqn7fxpca7", "mtkv5xtk9e", "n38lu8286q", "n6fk4nfna4", "n9x2a789qt", "ns5j362hk7", "p78axxw29g", "pg7ctvrt6f", "ppxm28t8ap", "prcb7njmu6", "pwa73g5rt2", "pwdxu55a5a", "qqp299437r", "qu637u8glc", "qwpu75vrh2", "r45fhb6rf7", "raa6f494kr", "rvh3l7un93", "rx5hdcabgc", "s39g8k73mm", "sczv5946wb", "su67r6k2v3", "t38b2kh725", "t6d3zquu66", "thzdn4h5nc", "tl55sbb4fm", "tmhh9296z4", "u679fj5vs4", "uw77j35x4d", "v72qych5uu", "v79kvwwj4g", "v9wttpbfk9", "vcra2ehyfk", "vhf287vqwu", "w9q455wk68", "wg4vff78zm", "wzmmz9fp6w", "x44k69ngh6", "x5l83yy675", "x8uqf25wch", "xga6mpmplv", "xy9t38ct57", "y45688jllp", "y5ghdn5j9k", "yclnxrl5pm", "ydx93a7ass", "z959bm4gru", "zmvfpc5aq8", "zq492l623r"],
|
||||
},
|
||||
Flag.LINE: {
|
||||
FLAG_PROPERTY: Flag.LINE,
|
||||
TAG_PROPERTY: "line",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:line:2.9.20250924.1"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "LineAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-line.git",
|
||||
PACKAGE_VERSION_PROPERTY: "2.9.2025111900",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["vutu7akeur", "eh6m2bh4zr", "cstr6suwn9", "578prtvx9j", "9t245vhmpl", "v72qych5uu", "x8uqf25wch", "7ug5zh24hu", "hs6bdukanm", "dbu4b84rxf", "8c4e2ghe7u"],
|
||||
},
|
||||
Flag.MAIO: {
|
||||
FLAG_PROPERTY: Flag.MAIO,
|
||||
TAG_PROPERTY: "maio",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:maio:2.0.6.0"],
|
||||
MAVEN_REPO_PROPERTY: "https://imobile-maio.github.io/maven",
|
||||
PACKAGE_PROPERTY: "MaioAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-maio.git",
|
||||
PACKAGE_VERSION_PROPERTY: "2.2.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["v4nxqhlyqp"],
|
||||
},
|
||||
Flag.META: {
|
||||
FLAG_PROPERTY: Flag.META,
|
||||
TAG_PROPERTY: "meta",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:facebook:6.20.0.2"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "MetaAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-meta.git",
|
||||
PACKAGE_VERSION_PROPERTY: "6.20.100",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["v9wttpbfk9", "n38lu8286q"],
|
||||
},
|
||||
Flag.MINTEGRAL: {
|
||||
FLAG_PROPERTY: Flag.MINTEGRAL,
|
||||
TAG_PROPERTY: "mintegral",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:mintegral:16.9.91.2"],
|
||||
MAVEN_REPO_PROPERTY: "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea",
|
||||
PACKAGE_PROPERTY: "MintegralAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-mintegral.git",
|
||||
PACKAGE_VERSION_PROPERTY: "7.7.901",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["kbd757ywx3"],
|
||||
},
|
||||
Flag.MOLOCO: {
|
||||
FLAG_PROPERTY: Flag.MOLOCO,
|
||||
TAG_PROPERTY: "moloco",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:moloco:4.2.0.0"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "MolocoAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-moloco.git",
|
||||
PACKAGE_VERSION_PROPERTY: "4.1.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["9t245vhmpl"],
|
||||
},
|
||||
Flag.MYTARGET: {
|
||||
FLAG_PROPERTY: Flag.MYTARGET,
|
||||
TAG_PROPERTY: "mytarget",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:mytarget:5.27.3.0"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "MyTargetAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-mytarget.git",
|
||||
PACKAGE_VERSION_PROPERTY: "5.36.0",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["n9x2a789qt", "r26jy69rpl"],
|
||||
},
|
||||
Flag.PANGLE: {
|
||||
FLAG_PROPERTY: Flag.PANGLE,
|
||||
TAG_PROPERTY: "pangle",
|
||||
DEPENDENCIES_PROPERTY: ["com.google.ads.mediation:pangle:7.6.0.5.0"],
|
||||
MAVEN_REPO_PROPERTY: "https://artifact.bytedance.com/repository/pangle/",
|
||||
PACKAGE_PROPERTY: "PangleAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-pangle.git",
|
||||
PACKAGE_VERSION_PROPERTY: "7.6.600",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["22mmun2rn5"],
|
||||
},
|
||||
Flag.UNITY: {
|
||||
FLAG_PROPERTY: Flag.UNITY,
|
||||
TAG_PROPERTY: "unity",
|
||||
DEPENDENCIES_PROPERTY: ["com.unity3d.ads:unity-ads:4.16.2", "com.google.ads.mediation:unity:4.16.3.0"],
|
||||
MAVEN_REPO_PROPERTY: "",
|
||||
PACKAGE_PROPERTY: "UnityAdapterTarget",
|
||||
PACKAGE_URL_PROPERTY: "https://github.com/googleads/googleads-mobile-ios-mediation-unity.git",
|
||||
PACKAGE_VERSION_PROPERTY: "4.16.4",
|
||||
SK_AD_NETWORK_IDS_PROPERTY: ["9nlqeag3gk", "hs6bdukanm", "9rd848q2bz", "22mmun2rn5", "f73kdq92p3", "tl55sbb4fm", "prcb7njmu6", "n9x2a789qt", "97r2b46745", "zmvfpc5aq8", "av6w8kgt66", "uw77j35x4d", "pwa73g5rt2", "e5fvkxwrpn", "klf5c3l5u5", "xga6mpmplv", "wg4vff78zm", "lr83yxwka7", "5tjdwbrq8w", "7ug5zh24hu", "glqzh8vgby", "feyaarzu9v", "6yxyv74ff7", "mqn7fxpca7", "vhf287vqwu", "g6gcrrvk4p", "v79kvwwj4g", "32z4fx6l9h", "2fnua5tdw4", "a8cz6cu7e5", "v72qych5uu", "a2p9lx4jpn", "5f5u5tfb26", "4fzdc2evr5", "5lm9lj6jb7", "4w7y6s5ca2", "3sh42y64q3", "4468km3ulz", "mj797d8u6f", "488r3q3dtq", "mlmmfzh3r3", "9t245vhmpl", "x44k69ngh6", "kbd757ywx3", "4dzt52r2t5", "k674qkevps", "294l99pt4k", "m8dbw4sv7c", "2u9pt9hc89", "p78axxw29g", "424m5254lk", "238da6jt44", "ydx93a7ass", "s39g8k73mm", "v9wttpbfk9", "44jx6755aq", "578prtvx9j", "yclnxrl5pm", "k6y4y55b64", "5a6flpkh64", "3rd42ekr43", "f38h382jlk", "cstr6suwn9", "ppxm28t8ap", "f7s53z58qe", "zq492l623r", "t38b2kh725", "mp6xlyr22a", "3qy4746246", "5l3tpt7t6e", "c6k4g5qg8m", "w9q455wk68", "4pfyvq9l8r", "wzmmz9fp6w", "8s468mfl3y"],
|
||||
},
|
||||
}
|
||||
|
||||
const MEDIATION_NETWORK_TAGS: Dictionary = {
|
||||
"applovin": Flag.APPLOVIN,
|
||||
"chartboost": Flag.CHARTBOOST,
|
||||
"dtexchange": Flag.DTEXCHANGE,
|
||||
"imobile": Flag.IMOBILE,
|
||||
"inmobi": Flag.INMOBI,
|
||||
"ironsource": Flag.IRONSOURCE,
|
||||
"liftoff": Flag.LIFTOFF,
|
||||
"line": Flag.LINE,
|
||||
"maio": Flag.MAIO,
|
||||
"meta": Flag.META,
|
||||
"mintegral": Flag.MINTEGRAL,
|
||||
"moloco": Flag.MOLOCO,
|
||||
"mytarget": Flag.MYTARGET,
|
||||
"pangle": Flag.PANGLE,
|
||||
"unity": Flag.UNITY,
|
||||
}
|
||||
|
||||
var flag: Flag
|
||||
var tag: String
|
||||
var android_dependencies: Array
|
||||
var android_custom_maven_repo: String
|
||||
var swift_package: String
|
||||
var swift_package_url: String
|
||||
var swift_package_version: String
|
||||
var sk_ad_network_ids: PackedStringArray
|
||||
|
||||
|
||||
func _init(a_data: Dictionary) -> void:
|
||||
flag = a_data[FLAG_PROPERTY]
|
||||
tag = a_data[TAG_PROPERTY]
|
||||
android_dependencies = a_data[DEPENDENCIES_PROPERTY]
|
||||
android_custom_maven_repo = a_data[MAVEN_REPO_PROPERTY]
|
||||
swift_package = a_data[PACKAGE_PROPERTY]
|
||||
swift_package_url = a_data[PACKAGE_URL_PROPERTY]
|
||||
swift_package_version = a_data[PACKAGE_VERSION_PROPERTY]
|
||||
sk_ad_network_ids = a_data[SK_AD_NETWORK_IDS_PROPERTY]
|
||||
|
||||
|
||||
func get_spm_dependency() -> SpmDependency:
|
||||
return SpmDependency.new({
|
||||
SpmDependency.URL_PROPERTY: swift_package_url,
|
||||
SpmDependency.VERSION_PROPERTY: swift_package_version,
|
||||
SpmDependency.PRODUCTS_PROPERTY: [swift_package],
|
||||
})
|
||||
|
||||
static func is_flag_enabled(a_value: int, a_flag: Flag) -> bool:
|
||||
return a_value & a_flag
|
||||
|
||||
|
||||
static func is_valid_tag(a_tag: String) -> bool:
|
||||
return MEDIATION_NETWORK_TAGS.has(a_tag)
|
||||
|
||||
|
||||
static func get_by_flag(a_flag: Flag) -> MediationNetwork:
|
||||
return MediationNetwork.new(MEDIATION_NETWORKS[a_flag])
|
||||
|
||||
|
||||
static func get_by_tag(a_tag: String) -> MediationNetwork:
|
||||
return get_by_flag(MEDIATION_NETWORK_TAGS[a_tag])
|
||||
|
||||
|
||||
static func get_all_enabled(a_value: int) -> Array[MediationNetwork]:
|
||||
var __enabled_networks: Array[MediationNetwork] = []
|
||||
|
||||
for __flag in Flag.values():
|
||||
if is_flag_enabled(a_value, __flag):
|
||||
__enabled_networks.append(get_by_flag(__flag))
|
||||
|
||||
return __enabled_networks
|
||||
|
||||
|
||||
static func get_all_enabled_tags(a_value: int) -> Array[String]:
|
||||
var __enabled_network_tags: Array[String] = []
|
||||
|
||||
for __flag in Flag.values():
|
||||
if is_flag_enabled(a_value, __flag):
|
||||
var __network: MediationNetwork = get_by_flag(__flag)
|
||||
__enabled_network_tags.append(__network.tag)
|
||||
|
||||
return __enabled_network_tags
|
||||
|
||||
|
||||
static func generate_sk_ad_network_plist(a_networks: Array[MediationNetwork]) -> String:
|
||||
var __sk_ad_ids_plist_content: String
|
||||
|
||||
var __unique_sk_network_ad_ids: Dictionary = { }
|
||||
|
||||
# Add Google-required SK Ad Network IDs
|
||||
for __network_id in GOOGLE_SK_AD_NETWORK_IDS:
|
||||
if not __unique_sk_network_ad_ids.has(__network_id):
|
||||
__unique_sk_network_ad_ids.set(__network_id, null)
|
||||
|
||||
# Add SK Ad Network IDs required by other networks
|
||||
for __network in a_networks:
|
||||
for __network_id in __network.sk_ad_network_ids:
|
||||
if not __unique_sk_network_ad_ids.has(__network_id):
|
||||
__unique_sk_network_ad_ids.set(__network_id, null)
|
||||
|
||||
for __network_id in __unique_sk_network_ad_ids.keys():
|
||||
__sk_ad_ids_plist_content += SK_AD_NETWORK_ITEM_FORMAT % __network_id
|
||||
|
||||
return SK_AD_NETWORK_ITEM_LIST_FORMAT % __sk_ad_ids_plist_content
|
||||
|
||||
|
||||
static func get_spm_dependencies(a_networks: Array[MediationNetwork]) -> Array[SpmDependency]:
|
||||
var __spm_dependencies: Array[SpmDependency] = []
|
||||
|
||||
for __network in a_networks:
|
||||
__spm_dependencies.append(__network.get_spm_dependency())
|
||||
|
||||
return __spm_dependencies
|
||||
|
||||
|
||||
static func generate_tag_list(a_networks: Array[MediationNetwork]) -> String:
|
||||
var __enabled_network_tags: PackedStringArray = []
|
||||
|
||||
for __network in a_networks:
|
||||
__enabled_network_tags.append(__network.tag)
|
||||
|
||||
return ",".join(__enabled_network_tags)
|
||||
@@ -0,0 +1 @@
|
||||
uid://devoemkicbhtc
|
||||
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name NetworkExtras
|
||||
extends Resource
|
||||
|
||||
const NETWORK_TAG_PROPERTY := &"network_tag"
|
||||
const EXTRAS_PROPERTY := &"extras"
|
||||
|
||||
## Identifies the target ad network for the extras.
|
||||
@export var network_flag: MediationNetwork.Flag = MediationNetwork.Flag.APPLOVIN
|
||||
|
||||
## Dictionary holding one or more extras. Only keys of type String are allowed. Values can be String, int, or bool.
|
||||
@export var extras: Dictionary
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
var __network: MediationNetwork = MediationNetwork.get_by_flag(network_flag)
|
||||
var __raw_data: Dictionary
|
||||
|
||||
__raw_data = {NETWORK_TAG_PROPERTY: __network.tag, EXTRAS_PROPERTY: extras}
|
||||
|
||||
return __raw_data
|
||||
|
||||
|
||||
static func build_raw_data_array(a_network_extras: Array[NetworkExtras]) -> Array:
|
||||
var __raw_data_array: Array[Dictionary] = []
|
||||
|
||||
for __network_extras in a_network_extras:
|
||||
__raw_data_array.append(__network_extras.get_raw_data())
|
||||
|
||||
return __raw_data_array
|
||||
@@ -0,0 +1 @@
|
||||
uid://cxw2idjnk2d72
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name NetworkPrivacySettings
|
||||
extends RefCounted
|
||||
|
||||
const HAS_GDPR_CONSENT_PROPERTY := &"has_gdpr_consent"
|
||||
const IS_AGE_RESTRICTED_USER_PROPERTY := &"is_age_restricted_user"
|
||||
const HAS_CCPA_SALE_CONSENT_PROPERTY := &"has_ccpa_sale_consent"
|
||||
const ENABLED_NETWORKS_PROPERTY := &"enabled_networks"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
_data = {
|
||||
ENABLED_NETWORKS_PROPERTY: [],
|
||||
}
|
||||
|
||||
|
||||
func set_has_gdpr_consent(a_value: bool) -> NetworkPrivacySettings:
|
||||
_data[HAS_GDPR_CONSENT_PROPERTY] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_is_age_restricted_user(a_value: bool) -> NetworkPrivacySettings:
|
||||
_data[IS_AGE_RESTRICTED_USER_PROPERTY] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_has_ccpa_sale_consent(a_value: bool) -> NetworkPrivacySettings:
|
||||
_data[HAS_CCPA_SALE_CONSENT_PROPERTY] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func set_enabled_networks(a_value: Array[String]) -> NetworkPrivacySettings:
|
||||
if a_value == null:
|
||||
_data[ENABLED_NETWORKS_PROPERTY] = []
|
||||
else:
|
||||
_data[ENABLED_NETWORKS_PROPERTY] = a_value
|
||||
return self
|
||||
|
||||
|
||||
func get_raw_data() -> Dictionary:
|
||||
return _data
|
||||
@@ -0,0 +1 @@
|
||||
uid://b42fjtxon0ynl
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name ResponseInfo
|
||||
extends RefCounted
|
||||
|
||||
const ADAPTER_RESPONSES_PROPERTY := &"adapter_responses"
|
||||
const LOADED_ADAPTER_RESPONSE_PROPERTY := &"loaded_adapter_response"
|
||||
const ADAPTER_CLASS_NAME_PROPERTY := &"adapter_class_name"
|
||||
const NETWORK_TAG_PROPERTY := &"network_tag"
|
||||
const RESPONSE_ID_PROPERTY := &"response_id"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_adapter_responses() -> Array[AdapterResponseInfo]:
|
||||
var __responses: Array[AdapterResponseInfo] = []
|
||||
|
||||
for __response_dict in _data[ADAPTER_RESPONSES_PROPERTY]:
|
||||
__responses.append(AdapterResponseInfo.new(__response_dict))
|
||||
|
||||
return __responses
|
||||
|
||||
|
||||
func get_loaded_adapter_response() -> AdapterResponseInfo:
|
||||
return (
|
||||
AdapterResponseInfo.new(_data[LOADED_ADAPTER_RESPONSE_PROPERTY])
|
||||
if _data.has(LOADED_ADAPTER_RESPONSE_PROPERTY)
|
||||
else null
|
||||
)
|
||||
|
||||
|
||||
func get_adapter_class_name() -> String:
|
||||
return _data[ADAPTER_CLASS_NAME_PROPERTY] if _data.has(ADAPTER_CLASS_NAME_PROPERTY) else ""
|
||||
|
||||
|
||||
func get_network_tag() -> String:
|
||||
return _data[NETWORK_TAG_PROPERTY] if _data.has(NETWORK_TAG_PROPERTY) else ""
|
||||
|
||||
|
||||
func get_response_id() -> String:
|
||||
return _data[RESPONSE_ID_PROPERTY] if _data.has(RESPONSE_ID_PROPERTY) else ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://b3jib8n1rbnyv
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name RewardItem
|
||||
extends RefCounted
|
||||
|
||||
const AMOUNT_PROPERTY := &"amount"
|
||||
const TYPE_PROPERTY := &"type"
|
||||
|
||||
var _data: Dictionary
|
||||
|
||||
|
||||
func _init(a_data: Dictionary):
|
||||
_data = a_data
|
||||
|
||||
|
||||
func get_amount() -> int:
|
||||
return _data[AMOUNT_PROPERTY]
|
||||
|
||||
|
||||
func get_type() -> String:
|
||||
return _data[TYPE_PROPERTY]
|
||||
@@ -0,0 +1 @@
|
||||
uid://cf0fkl05bgokb
|
||||
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# © 2024-present https://github.com/cengiz-pz
|
||||
#
|
||||
class_name UserConsent
|
||||
extends RefCounted
|
||||
|
||||
enum Status {
|
||||
UNKNOWN,
|
||||
NOT_REQUIRED,
|
||||
REQUIRED,
|
||||
OBTAINED,
|
||||
}
|
||||
|
||||
var status: Status
|
||||
|
||||
|
||||
func _init(a_status_string: String = "") -> void:
|
||||
if a_status_string == "":
|
||||
status = Status.UNKNOWN
|
||||
else:
|
||||
status = string_to_status(a_status_string)
|
||||
|
||||
|
||||
func to_status_string() -> String:
|
||||
return Status.keys()[status]
|
||||
|
||||
|
||||
static func status_to_string(a_status: Status) -> String:
|
||||
return Status.keys()[a_status]
|
||||
|
||||
|
||||
static func string_to_status(a_string: String) -> Status:
|
||||
return Status.get(a_string)
|
||||
@@ -0,0 +1 @@
|
||||
uid://dcbs2sidgjetb
|
||||
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; © 2024-present https://github.com/cengiz-pz
|
||||
;
|
||||
[plugin]
|
||||
|
||||
name="Admob"
|
||||
description="Allows displaying of AdMob ads."
|
||||
author="Cengiz"
|
||||
version="7.0"
|
||||
script="AdmobPlugin.gd"
|
||||
Reference in new issue
Block a user