diff --git a/NuGet/Chartboost.CSharp.Mediation.Unity.4.8.0.nupkg b/NuGet/Chartboost.CSharp.Mediation.Unity.4.9.0.nupkg similarity index 89% rename from NuGet/Chartboost.CSharp.Mediation.Unity.4.8.0.nupkg rename to NuGet/Chartboost.CSharp.Mediation.Unity.4.9.0.nupkg index 6f1ab25f..d06915ed 100644 Binary files a/NuGet/Chartboost.CSharp.Mediation.Unity.4.8.0.nupkg and b/NuGet/Chartboost.CSharp.Mediation.Unity.4.9.0.nupkg differ diff --git a/NuGet/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices.4.0.0.nupkg b/NuGet/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices.4.0.0.nupkg new file mode 100644 index 00000000..d20985f5 Binary files /dev/null and b/NuGet/Chartboost.CSharp.Mediation.Unity.Adapter.AmazonPublisherServices.4.0.0.nupkg differ diff --git a/NuGet/Chartboost.CSharp.Threading.Unity.1.0.0.nupkg b/NuGet/Chartboost.CSharp.Threading.Unity.1.0.0.nupkg new file mode 100644 index 00000000..14d35077 Binary files /dev/null and b/NuGet/Chartboost.CSharp.Threading.Unity.1.0.0.nupkg differ diff --git a/NuGet/Chartboost.CSharp.Utilities.Unity.1.0.0.nupkg b/NuGet/Chartboost.CSharp.Utilities.Unity.1.0.0.nupkg new file mode 100644 index 00000000..8d7e9c88 Binary files /dev/null and b/NuGet/Chartboost.CSharp.Utilities.Unity.1.0.0.nupkg differ diff --git a/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config b/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config index 96cd9cad..c7030630 100644 --- a/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config +++ b/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config @@ -1,4 +1,6 @@  - + + + diff --git a/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config.meta b/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config.meta index 26bd3293..63b798ce 100644 --- a/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config.meta +++ b/com.chartboost.mediation.demo.nuget/Assets/Packages/packages.config.meta @@ -15,6 +15,17 @@ PluginImporter: platformData: - first: Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps second: enabled: 1 settings: {} diff --git a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle b/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle deleted file mode 100644 index 9871b967..00000000 --- a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle +++ /dev/null @@ -1,62 +0,0 @@ -// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN - -apply plugin: 'com.android.application' - -dependencies { - implementation project(':unityLibrary') - } - -android { - compileSdkVersion **APIVERSION** - buildToolsVersion '**BUILDTOOLS**' - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - multiDexEnabled true - minSdkVersion **MINSDKVERSION** - targetSdkVersion **TARGETSDKVERSION** - applicationId '**APPLICATIONID**' - ndk { - abiFilters **ABIFILTERS** - } - versionCode **VERSIONCODE** - versionName '**VERSIONNAME**' - } - - aaptOptions { - noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ') - ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" - }**SIGN** - - lintOptions { - abortOnError false - } - - buildTypes { - debug { - minifyEnabled **MINIFY_DEBUG** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - jniDebuggable true - } - release { - minifyEnabled **MINIFY_RELEASE** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - } - }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS** -**BUILT_APK_LOCATION** - bundle { - language { - enableSplit = false - } - density { - enableSplit = false - } - abi { - enableSplit = true - } - } -}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP** diff --git a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle.meta b/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle.meta deleted file mode 100644 index e480fbc7..00000000 --- a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/launcherTemplate.gradle.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c5c4c3a5a4d764ec488567071673b528 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/mainTemplate.gradle b/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/mainTemplate.gradle index 3f254ca8..9fec898d 100644 --- a/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/mainTemplate.gradle +++ b/com.chartboost.mediation.demo.nuget/Assets/Plugins/Android/mainTemplate.gradle @@ -1,5 +1,3 @@ -// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN - // Android Resolver Repos Start ([rootProject] + (rootProject.subprojects as List)).each { project -> project.repositories { @@ -28,7 +26,7 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:20 implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:11 implementation 'com.chartboost:chartboost-mediation-adapter-chartboost:4.9.6.1+@aar' // Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml:5 - implementation 'com.chartboost:chartboost-mediation-sdk:4.8+' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:10 + implementation 'com.chartboost:chartboost-mediation-sdk:4.9+' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:10 implementation 'com.chartboost:chartboost-sdk:9.6.1' // Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml:8 implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:24 implementation 'com.google.android.gms:play-services-appset:16.0.2' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:25 @@ -74,13 +72,13 @@ android { versionName '**VERSIONNAME**' consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD** } - + lintOptions { abortOnError false } aaptOptions { - noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ') + noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" }**PACKAGING_OPTIONS** }**REPOSITORIES** diff --git a/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml b/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml index ecba77d4..f93bdf90 100644 --- a/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml +++ b/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml @@ -7,7 +7,7 @@ - + @@ -27,7 +27,7 @@ - + https://github.com/CocoaPods/Specs diff --git a/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/selections.json b/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/selections.json index 14815401..0866d83f 100644 --- a/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/selections.json +++ b/com.chartboost.mediation.demo.nuget/Assets/com.chartboost.mediation/Editor/selections.json @@ -1,5 +1,5 @@ { - "mediationVersion": "4.8.0", + "mediationVersion": "4.9.0", "adapterSelections": [ { "id": "chartboost", diff --git a/com.chartboost.mediation.demo.nuget/Packages/manifest.json b/com.chartboost.mediation.demo.nuget/Packages/manifest.json index 184a7ca1..39dc3845 100644 --- a/com.chartboost.mediation.demo.nuget/Packages/manifest.json +++ b/com.chartboost.mediation.demo.nuget/Packages/manifest.json @@ -3,8 +3,8 @@ "com.chartboost.mediation.demo": "file:../../com.chartboost.mediation.demo", "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", "com.google.external-dependency-manager": "file:../../GooglePackages/com.google.external-dependency-manager-1.2.177.tgz", - "com.unity.ide.rider": "3.0.21", - "com.unity.ide.visualstudio": "2.0.18", + "com.unity.ide.rider": "3.0.27", + "com.unity.ide.visualstudio": "2.0.22", "com.unity.ide.vscode": "1.2.5", "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.test-framework": "1.1.33", diff --git a/com.chartboost.mediation.demo.nuget/Packages/packages-lock.json b/com.chartboost.mediation.demo.nuget/Packages/packages-lock.json index 0c73f315..e62ea733 100644 --- a/com.chartboost.mediation.demo.nuget/Packages/packages-lock.json +++ b/com.chartboost.mediation.demo.nuget/Packages/packages-lock.json @@ -27,7 +27,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.21", + "version": "3.0.27", "depth": 0, "source": "registry", "dependencies": { @@ -36,7 +36,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.18", + "version": "2.0.22", "depth": 0, "source": "registry", "dependencies": { diff --git a/com.chartboost.mediation.demo.nuget/ProjectSettings/AndroidResolverDependencies.xml b/com.chartboost.mediation.demo.nuget/ProjectSettings/AndroidResolverDependencies.xml index 13840ceb..6a727b90 100644 --- a/com.chartboost.mediation.demo.nuget/ProjectSettings/AndroidResolverDependencies.xml +++ b/com.chartboost.mediation.demo.nuget/ProjectSettings/AndroidResolverDependencies.xml @@ -4,7 +4,7 @@ androidx.lifecycle:lifecycle-extensions:2.2.0 androidx.localbroadcastmanager:localbroadcastmanager:1.1.0 com.chartboost:chartboost-mediation-adapter-chartboost:4.9.6.1+@aar - com.chartboost:chartboost-mediation-sdk:4.8+ + com.chartboost:chartboost-mediation-sdk:4.9+ com.chartboost:chartboost-sdk:9.6.1 com.google.android.gms:play-services-ads-identifier:18.0.1 com.google.android.gms:play-services-appset:16.0.2 diff --git a/com.chartboost.mediation.demo.nuget/ProjectSettings/MemorySettings.asset b/com.chartboost.mediation.demo.nuget/ProjectSettings/MemorySettings.asset new file mode 100644 index 00000000..5b5facec --- /dev/null +++ b/com.chartboost.mediation.demo.nuget/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectSettings.asset b/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectSettings.asset index 6e9b3267..1ed9174c 100644 --- a/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectSettings.asset +++ b/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 22 + serializedVersion: 24 productGUID: b0a305ac4af124f7fb70967a24dfe018 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -48,6 +48,7 @@ PlayerSettings: defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 + unsupportedMSAAFallback: 0 m_MTRendering: 1 mipStripping: 0 numberOfMipsStripped: 0 @@ -74,6 +75,7 @@ PlayerSettings: androidMinimumWindowWidth: 400 androidMinimumWindowHeight: 300 androidFullscreenMode: 1 + androidAutoRotationBehavior: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -121,6 +123,7 @@ PlayerSettings: switchNVNOtherPoolsGranularity: 16777216 switchNVNMaxPublicTextureIDCount: 0 switchNVNMaxPublicSamplerIDCount: 0 + switchMaxWorkerMultiple: 8 stadiaPresentMode: 0 stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 @@ -134,7 +137,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 4.7.0 + bundleVersion: 4.9.0 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 @@ -145,6 +148,7 @@ PlayerSettings: enable360StereoCapture: 0 isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 useHDRDisplay: 0 D3DHDRBitDepth: 0 m_ColorGamuts: 00000000 @@ -182,7 +186,7 @@ PlayerSettings: iOSTargetOSVersionString: 11.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 11.0 + tvOSTargetOSVersionString: 12.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -220,6 +224,7 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] + macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 @@ -242,7 +247,7 @@ PlayerSettings: useCustomMainManifest: 1 useCustomLauncherManifest: 0 useCustomMainGradleTemplate: 1 - useCustomLauncherGradleManifest: 1 + useCustomLauncherGradleManifest: 0 useCustomBaseGradleTemplate: 0 useCustomGradlePropertiesTemplate: 1 useCustomProguardFile: 0 @@ -347,38 +352,59 @@ PlayerSettings: m_Height: 192 m_Kind: 0 m_SubKind: - - m_Textures: - - {fileID: 0} + - m_Textures: [] m_Width: 144 m_Height: 144 m_Kind: 0 m_SubKind: - - m_Textures: - - {fileID: 0} + - m_Textures: [] m_Width: 96 m_Height: 96 m_Kind: 0 m_SubKind: - - m_Textures: - - {fileID: 0} + - m_Textures: [] m_Width: 72 m_Height: 72 m_Kind: 0 m_SubKind: - - m_Textures: - - {fileID: 0} + - m_Textures: [] m_Width: 48 m_Height: 48 m_Kind: 0 m_SubKind: - - m_Textures: - - {fileID: 0} + - m_Textures: [] m_Width: 36 m_Height: 36 m_Kind: 0 m_SubKind: - m_BuildTarget: iPhone m_Icons: + - m_Textures: + - {fileID: 2800000, guid: 5fe9f4c774e3e45f3856188902537b58, type: 3} + m_Width: 180 + m_Height: 180 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 167 + m_Height: 167 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 152 + m_Height: 152 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 76 + m_Height: 76 + m_Kind: 0 + m_SubKind: iPad - m_Textures: [] m_Width: 120 m_Height: 120 @@ -449,32 +475,6 @@ PlayerSettings: m_Height: 1024 m_Kind: 4 m_SubKind: App Store - - m_Textures: - - {fileID: 2800000, guid: 5fe9f4c774e3e45f3856188902537b58, type: 3} - m_Width: 180 - m_Height: 180 - m_Kind: 0 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 120 - m_Height: 120 - m_Kind: 0 - m_SubKind: iPhone - - m_Textures: [] - m_Width: 167 - m_Height: 167 - m_Kind: 0 - m_SubKind: iPad - - m_Textures: [] - m_Width: 152 - m_Height: 152 - m_Kind: 0 - m_SubKind: iPad - - m_Textures: [] - m_Width: 76 - m_Height: 76 - m_Kind: 0 - m_SubKind: iPad m_BuildTargetBatching: - m_BuildTarget: Standalone m_StaticBatching: 1 @@ -491,6 +491,7 @@ PlayerSettings: - m_BuildTarget: WebGL m_StaticBatching: 0 m_DynamicBatching: 0 + m_BuildTargetShaderSettings: [] m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport m_GraphicsJobs: 0 @@ -526,7 +527,7 @@ PlayerSettings: m_BuildTargetGraphicsAPIs: - m_BuildTarget: AndroidPlayer m_APIs: 150000000b000000 - m_Automatic: 0 + m_Automatic: 1 - m_BuildTarget: iOSSupport m_APIs: 10000000 m_Automatic: 1 @@ -542,6 +543,8 @@ PlayerSettings: m_Devices: - Oculus - OpenVR + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 openGLRequireES31: 0 openGLRequireES31AEP: 0 openGLRequireES32: 0 @@ -553,6 +556,7 @@ PlayerSettings: m_BuildTargetGroupLightmapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -570,7 +574,8 @@ PlayerSettings: switchSocketConcurrencyLimit: 14 switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 - switchUseGOLDLinker: 0 + switchEnableFileSystemTrace: 0 + switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: switchTitleNames_0: @@ -646,7 +651,6 @@ PlayerSettings: switchReleaseVersion: 0 switchDisplayVersion: 1.0.0 switchStartupUserAccount: 0 - switchTouchScreenUsage: 0 switchSupportedLanguagesMask: 0 switchLogoType: 0 switchApplicationErrorCodeCategory: @@ -688,6 +692,7 @@ PlayerSettings: switchNativeFsCacheSize: 32 switchIsHoldTypeHorizontal: 0 switchSupportedNpadCount: 8 + switchEnableTouchScreen: 1 switchSocketConfigEnabled: 0 switchTcpInitialSendBufferSize: 32 switchTcpInitialReceiveBufferSize: 64 @@ -698,8 +703,8 @@ PlayerSettings: switchSocketBufferEfficiency: 4 switchSocketInitializeEnabled: 1 switchNetworkInterfaceManagerInitializeEnabled: 1 - switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 + switchUseLegacyFmodPriorities: 1 switchUseMicroSleepForYield: 1 switchEnableRamDiskSupport: 0 switchMicroSleepForYieldTime: 25 @@ -799,27 +804,41 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 + webGLPowerPreference: 2 scriptingDefineSymbols: - 1: - 4: - 7: + Android: + Standalone: + iPhone: additionalCompilerArguments: - 1: + Android: - -warnaserror - 4: + Standalone: - -warnaserror - 7: + iPhone: - -warnaserror platformArchitecture: {} scriptingBackend: Android: 1 il2cppCompilerConfiguration: {} - managedStrippingLevel: {} + managedStrippingLevel: + Android: 1 + EmbeddedLinux: 1 + GameCoreScarlett: 1 + GameCoreXboxOne: 1 + Lumin: 1 + Nintendo Switch: 1 + PS4: 1 + PS5: 1 + Stadia: 1 + WebGL: 1 + Windows Store Apps: 1 + XboxOne: 1 + iPhone: 1 + tvOS: 1 incrementalIl2cppBuild: {} suppressCommonWarnings: 1 allowUnsafeCode: 0 useDeterministicCompilation: 1 - useReferenceAssemblies: 1 enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 @@ -900,6 +919,7 @@ PlayerSettings: m_VersionName: apiCompatibilityLevel: 6 activeInputHandler: 0 + windowsGamepadBackendHint: 0 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] @@ -907,4 +927,6 @@ PlayerSettings: organizationId: cloudEnabled: 0 legacyClampBlendShapeWeights: 0 + playerDataPath: + forceSRGBBlit: 1 virtualTexturingSupportEnabled: 0 diff --git a/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectVersion.txt b/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectVersion.txt index 02c62958..26d0e2da 100644 --- a/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectVersion.txt +++ b/com.chartboost.mediation.demo.nuget/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.37f1 -m_EditorVersionWithRevision: 2020.3.37f1 (8c66806a0c04) +m_EditorVersion: 2021.3.36f1 +m_EditorVersionWithRevision: 2021.3.36f1 (7a0645017be0) diff --git a/com.chartboost.mediation.demo.nuget/ProjectSettings/boot.config b/com.chartboost.mediation.demo.nuget/ProjectSettings/boot.config new file mode 100644 index 00000000..e69de29b diff --git a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle b/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle deleted file mode 100644 index 9871b967..00000000 --- a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle +++ /dev/null @@ -1,62 +0,0 @@ -// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN - -apply plugin: 'com.android.application' - -dependencies { - implementation project(':unityLibrary') - } - -android { - compileSdkVersion **APIVERSION** - buildToolsVersion '**BUILDTOOLS**' - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - multiDexEnabled true - minSdkVersion **MINSDKVERSION** - targetSdkVersion **TARGETSDKVERSION** - applicationId '**APPLICATIONID**' - ndk { - abiFilters **ABIFILTERS** - } - versionCode **VERSIONCODE** - versionName '**VERSIONNAME**' - } - - aaptOptions { - noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ') - ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" - }**SIGN** - - lintOptions { - abortOnError false - } - - buildTypes { - debug { - minifyEnabled **MINIFY_DEBUG** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - jniDebuggable true - } - release { - minifyEnabled **MINIFY_RELEASE** - proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG** - } - }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS** -**BUILT_APK_LOCATION** - bundle { - language { - enableSplit = false - } - density { - enableSplit = false - } - abi { - enableSplit = true - } - } -}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP** diff --git a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle.meta b/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle.meta deleted file mode 100644 index e480fbc7..00000000 --- a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/launcherTemplate.gradle.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c5c4c3a5a4d764ec488567071673b528 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/mainTemplate.gradle b/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/mainTemplate.gradle index 22c29657..9fec898d 100644 --- a/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/mainTemplate.gradle +++ b/com.chartboost.mediation.demo.upm/Assets/Plugins/Android/mainTemplate.gradle @@ -1,8 +1,7 @@ -// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN - // Android Resolver Repos Start ([rootProject] + (rootProject.subprojects as List)).each { project -> project.repositories { + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") maven { url "https://maven.google.com" } @@ -27,7 +26,7 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:20 implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:11 implementation 'com.chartboost:chartboost-mediation-adapter-chartboost:4.9.6.1+@aar' // Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml:5 - implementation 'com.chartboost:chartboost-mediation-sdk:4.8+' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:10 + implementation 'com.chartboost:chartboost-mediation-sdk:4.9+' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:10 implementation 'com.chartboost:chartboost-sdk:9.6.1' // Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml:8 implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:24 implementation 'com.google.android.gms:play-services-appset:16.0.2' // Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml:25 @@ -73,13 +72,13 @@ android { versionName '**VERSIONNAME**' consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD** } - + lintOptions { abortOnError false } aaptOptions { - noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ') + noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ') ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~" }**PACKAGING_OPTIONS** }**REPOSITORIES** diff --git a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml.meta b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml.meta index c4754aa9..18c37b09 100644 --- a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml.meta +++ b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 016ff9a0727bd4c4aa7ec07b3ea4da13 +guid: 095b8c811edff4d93a38cd3206246850 TextScriptImporter: externalObjects: {} userData: diff --git a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml index ecba77d4..f93bdf90 100644 --- a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml +++ b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/ChartboostMediationDependencies.xml @@ -7,7 +7,7 @@ - + @@ -27,7 +27,7 @@ - + https://github.com/CocoaPods/Specs diff --git a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/selections.json b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/selections.json index 14815401..0866d83f 100644 --- a/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/selections.json +++ b/com.chartboost.mediation.demo.upm/Assets/com.chartboost.mediation/Editor/selections.json @@ -1,5 +1,5 @@ { - "mediationVersion": "4.8.0", + "mediationVersion": "4.9.0", "adapterSelections": [ { "id": "chartboost", diff --git a/com.chartboost.mediation.demo.upm/Packages/manifest.json b/com.chartboost.mediation.demo.upm/Packages/manifest.json index 271fbd75..81388a6d 100644 --- a/com.chartboost.mediation.demo.upm/Packages/manifest.json +++ b/com.chartboost.mediation.demo.upm/Packages/manifest.json @@ -2,9 +2,11 @@ "dependencies": { "com.chartboost.mediation": "file:../../com.chartboost.mediation", "com.chartboost.mediation.demo": "file:../../com.chartboost.mediation.demo", + "com.chartboost.unity.utilities": "file:../../com.chartboost.unity.utilities", + "com.chartboost.unity.threading": "file:../../com.chartboost.unity.threading", "com.google.external-dependency-manager": "file:../../GooglePackages/com.google.external-dependency-manager-1.2.177.tgz", - "com.unity.ide.rider": "3.0.21", - "com.unity.ide.visualstudio": "2.0.18", + "com.unity.ide.rider": "3.0.27", + "com.unity.ide.visualstudio": "2.0.22", "com.unity.ide.vscode": "1.2.5", "com.unity.nuget.newtonsoft-json": "3.2.1", "com.unity.test-framework": "1.1.33", @@ -43,6 +45,8 @@ "com.unity.modules.xr": "1.0.0" }, "testables": [ - "com.chartboost.mediation" + "com.chartboost.mediation", + "com.chartboost.unity.threading", + "com.chartboost.unity.utilities" ] } diff --git a/com.chartboost.mediation.demo.upm/Packages/packages-lock.json b/com.chartboost.mediation.demo.upm/Packages/packages-lock.json index b008b44f..a7f3836d 100644 --- a/com.chartboost.mediation.demo.upm/Packages/packages-lock.json +++ b/com.chartboost.mediation.demo.upm/Packages/packages-lock.json @@ -5,7 +5,9 @@ "depth": 0, "source": "local", "dependencies": { - "com.unity.nuget.newtonsoft-json": "3.2.1" + "com.unity.nuget.newtonsoft-json": "3.2.1", + "com.chartboost.unity.threading": "1.0.0", + "com.chartboost.unity.utilities": "1.0.0" } }, "com.chartboost.mediation.demo": { @@ -14,6 +16,20 @@ "source": "local", "dependencies": {} }, + "com.chartboost.unity.threading": { + "version": "file:../../com.chartboost.unity.threading", + "depth": 0, + "source": "local", + "dependencies": { + "com.chartboost.unity.utilities": "1.0.0" + } + }, + "com.chartboost.unity.utilities": { + "version": "file:../../com.chartboost.unity.utilities", + "depth": 0, + "source": "local", + "dependencies": {} + }, "com.google.external-dependency-manager": { "version": "file:../../GooglePackages/com.google.external-dependency-manager-1.2.177.tgz", "depth": 0, @@ -28,7 +44,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.21", + "version": "3.0.27", "depth": 0, "source": "registry", "dependencies": { @@ -37,7 +53,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.18", + "version": "2.0.22", "depth": 0, "source": "registry", "dependencies": { diff --git a/com.chartboost.mediation.demo.upm/ProjectSettings/AndroidResolverDependencies.xml b/com.chartboost.mediation.demo.upm/ProjectSettings/AndroidResolverDependencies.xml index 55b9afb2..6a727b90 100644 --- a/com.chartboost.mediation.demo.upm/ProjectSettings/AndroidResolverDependencies.xml +++ b/com.chartboost.mediation.demo.upm/ProjectSettings/AndroidResolverDependencies.xml @@ -4,7 +4,7 @@ androidx.lifecycle:lifecycle-extensions:2.2.0 androidx.localbroadcastmanager:localbroadcastmanager:1.1.0 com.chartboost:chartboost-mediation-adapter-chartboost:4.9.6.1+@aar - com.chartboost:chartboost-mediation-sdk:4.8+ + com.chartboost:chartboost-mediation-sdk:4.9+ com.chartboost:chartboost-sdk:9.6.1 com.google.android.gms:play-services-ads-identifier:18.0.1 com.google.android.gms:play-services-appset:16.0.2 @@ -31,7 +31,7 @@ - + diff --git a/com.chartboost.mediation.demo.upm/ProjectSettings/MemorySettings.asset b/com.chartboost.mediation.demo.upm/ProjectSettings/MemorySettings.asset new file mode 100644 index 00000000..5b5facec --- /dev/null +++ b/com.chartboost.mediation.demo.upm/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectSettings.asset b/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectSettings.asset index 5fcc4d2f..2966b884 100644 --- a/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectSettings.asset +++ b/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 22 + serializedVersion: 24 productGUID: b0a305ac4af124f7fb70967a24dfe018 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -48,6 +48,7 @@ PlayerSettings: defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 + unsupportedMSAAFallback: 0 m_MTRendering: 1 mipStripping: 0 numberOfMipsStripped: 0 @@ -74,6 +75,7 @@ PlayerSettings: androidMinimumWindowWidth: 400 androidMinimumWindowHeight: 300 androidFullscreenMode: 1 + androidAutoRotationBehavior: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 1 @@ -121,6 +123,7 @@ PlayerSettings: switchNVNOtherPoolsGranularity: 16777216 switchNVNMaxPublicTextureIDCount: 0 switchNVNMaxPublicSamplerIDCount: 0 + switchMaxWorkerMultiple: 8 stadiaPresentMode: 0 stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 @@ -134,7 +137,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 4.7.0 + bundleVersion: 4.9.0 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 @@ -145,6 +148,7 @@ PlayerSettings: enable360StereoCapture: 0 isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 useHDRDisplay: 0 D3DHDRBitDepth: 0 m_ColorGamuts: 00000000 @@ -160,11 +164,11 @@ PlayerSettings: iPhone: com.chartboost.mediation.unity.demo buildNumber: Standalone: 0 - iPhone: 0 + iPhone: 1708899043 tvOS: 0 overrideDefaultApplicationIdentifier: 1 AndroidBundleVersionCode: 1 - AndroidMinSdkVersion: 21 + AndroidMinSdkVersion: 22 AndroidTargetSdkVersion: 33 AndroidPreferredInstallLocation: 1 aotOptions: @@ -182,7 +186,7 @@ PlayerSettings: iOSTargetOSVersionString: 11.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 11.0 + tvOSTargetOSVersionString: 12.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -220,6 +224,7 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] + macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 @@ -242,7 +247,7 @@ PlayerSettings: useCustomMainManifest: 1 useCustomLauncherManifest: 0 useCustomMainGradleTemplate: 1 - useCustomLauncherGradleManifest: 1 + useCustomLauncherGradleManifest: 0 useCustomBaseGradleTemplate: 0 useCustomGradlePropertiesTemplate: 1 useCustomProguardFile: 0 @@ -488,6 +493,7 @@ PlayerSettings: - m_BuildTarget: WebGL m_StaticBatching: 0 m_DynamicBatching: 0 + m_BuildTargetShaderSettings: [] m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport m_GraphicsJobs: 0 @@ -523,7 +529,7 @@ PlayerSettings: m_BuildTargetGraphicsAPIs: - m_BuildTarget: AndroidPlayer m_APIs: 150000000b000000 - m_Automatic: 0 + m_Automatic: 1 - m_BuildTarget: iOSSupport m_APIs: 10000000 m_Automatic: 1 @@ -539,6 +545,8 @@ PlayerSettings: m_Devices: - Oculus - OpenVR + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 openGLRequireES31: 0 openGLRequireES31AEP: 0 openGLRequireES32: 0 @@ -550,6 +558,7 @@ PlayerSettings: m_BuildTargetGroupLightmapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -567,7 +576,8 @@ PlayerSettings: switchSocketConcurrencyLimit: 14 switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 - switchUseGOLDLinker: 0 + switchEnableFileSystemTrace: 0 + switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: switchTitleNames_0: @@ -643,7 +653,6 @@ PlayerSettings: switchReleaseVersion: 0 switchDisplayVersion: 1.0.0 switchStartupUserAccount: 0 - switchTouchScreenUsage: 0 switchSupportedLanguagesMask: 0 switchLogoType: 0 switchApplicationErrorCodeCategory: @@ -685,6 +694,7 @@ PlayerSettings: switchNativeFsCacheSize: 32 switchIsHoldTypeHorizontal: 0 switchSupportedNpadCount: 8 + switchEnableTouchScreen: 1 switchSocketConfigEnabled: 0 switchTcpInitialSendBufferSize: 32 switchTcpInitialReceiveBufferSize: 64 @@ -695,8 +705,8 @@ PlayerSettings: switchSocketBufferEfficiency: 4 switchSocketInitializeEnabled: 1 switchNetworkInterfaceManagerInitializeEnabled: 1 - switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 + switchUseLegacyFmodPriorities: 1 switchUseMicroSleepForYield: 1 switchEnableRamDiskSupport: 0 switchMicroSleepForYieldTime: 25 @@ -796,26 +806,41 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 + webGLPowerPreference: 2 scriptingDefineSymbols: - 4: - 7: + Android: + iPhone: additionalCompilerArguments: - 1: + Android: - -warnaserror - 4: + Standalone: - -warnaserror - 7: + iPhone: - -warnaserror platformArchitecture: {} scriptingBackend: Android: 1 + iPhone: 1 il2cppCompilerConfiguration: {} - managedStrippingLevel: {} + managedStrippingLevel: + Android: 1 + EmbeddedLinux: 1 + GameCoreScarlett: 1 + GameCoreXboxOne: 1 + Lumin: 1 + Nintendo Switch: 1 + PS4: 1 + PS5: 1 + Stadia: 1 + WebGL: 1 + Windows Store Apps: 1 + XboxOne: 1 + iPhone: 1 + tvOS: 1 incrementalIl2cppBuild: {} suppressCommonWarnings: 1 allowUnsafeCode: 0 useDeterministicCompilation: 1 - useReferenceAssemblies: 1 enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 @@ -896,6 +921,7 @@ PlayerSettings: m_VersionName: apiCompatibilityLevel: 6 activeInputHandler: 0 + windowsGamepadBackendHint: 0 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] @@ -903,4 +929,6 @@ PlayerSettings: organizationId: cloudEnabled: 0 legacyClampBlendShapeWeights: 0 + playerDataPath: + forceSRGBBlit: 1 virtualTexturingSupportEnabled: 0 diff --git a/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectVersion.txt b/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectVersion.txt index 02c62958..26d0e2da 100644 --- a/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectVersion.txt +++ b/com.chartboost.mediation.demo.upm/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.37f1 -m_EditorVersionWithRevision: 2020.3.37f1 (8c66806a0c04) +m_EditorVersion: 2021.3.36f1 +m_EditorVersionWithRevision: 2021.3.36f1 (7a0645017be0) diff --git a/com.chartboost.mediation.demo.upm/ProjectSettings/boot.config b/com.chartboost.mediation.demo.upm/ProjectSettings/boot.config new file mode 100644 index 00000000..e69de29b diff --git a/com.chartboost.mediation.demo/Editor/com.chartboost.mediation.demo.Editor.asmdef b/com.chartboost.mediation.demo/Editor/Chartboost.Mediation.Demo.Editor.asmdef similarity index 89% rename from com.chartboost.mediation.demo/Editor/com.chartboost.mediation.demo.Editor.asmdef rename to com.chartboost.mediation.demo/Editor/Chartboost.Mediation.Demo.Editor.asmdef index b4ddb873..be7b2ef0 100644 --- a/com.chartboost.mediation.demo/Editor/com.chartboost.mediation.demo.Editor.asmdef +++ b/com.chartboost.mediation.demo/Editor/Chartboost.Mediation.Demo.Editor.asmdef @@ -1,5 +1,5 @@ { - "name": "com.chartboost.mediation.demo.Editor", + "name": "Chartboost.Mediation.Demo.Editor", "rootNamespace": "Chartboost.Editor", "references": [ "GUID:1fa23cf67f36740369216fe6b6716e5a", diff --git a/com.chartboost.mediation.demo/Editor/com.chartboost.mediation.demo.Editor.asmdef.meta b/com.chartboost.mediation.demo/Editor/Chartboost.Mediation.Demo.Editor.asmdef.meta similarity index 100% rename from com.chartboost.mediation.demo/Editor/com.chartboost.mediation.demo.Editor.asmdef.meta rename to com.chartboost.mediation.demo/Editor/Chartboost.Mediation.Demo.Editor.asmdef.meta diff --git a/com.chartboost.mediation.demo/Editor/DemoSetupOnEditorLaunch.cs b/com.chartboost.mediation.demo/Editor/DemoSetupOnEditorLaunch.cs index 65c05814..688b7a3f 100644 --- a/com.chartboost.mediation.demo/Editor/DemoSetupOnEditorLaunch.cs +++ b/com.chartboost.mediation.demo/Editor/DemoSetupOnEditorLaunch.cs @@ -21,7 +21,7 @@ public class DemoSetupOnEditorLaunch [MenuItem("Chartboost Mediation/Setup Demo")] private static void SetupDemoApp() { - Debug.Log("Configuring Chartboost Mediation SDK Unity Demo App."); + Debug.Log($"Configuring {ProductName}."); PlayerSettings.companyName = CompanyName; PlayerSettings.productName = ProductName; @@ -45,7 +45,6 @@ private static void SetupDemoApp() PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, ApplicationBundleIdentifier); PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.iOS, ApplicationBundleIdentifier); PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Standalone, ApplicationBundleIdentifier); - PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Unknown, ApplicationBundleIdentifier); PlayerSettings.SetAdditionalCompilerArgumentsForGroup(BuildTargetGroup.Android, CompilerFlags); PlayerSettings.SetAdditionalCompilerArgumentsForGroup(BuildTargetGroup.iOS, CompilerFlags); diff --git a/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdController.cs b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdController.cs index 2da30ef3..ba70c767 100644 --- a/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdController.cs +++ b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdController.cs @@ -5,25 +5,19 @@ namespace Chartboost.Mediation.Demo.AdControllers { - public sealed class FullscreenAdController : SimpleAdController + public class FullscreenAdController : SimpleAdController { - public FullscreenAdController(string placementIdentifier) : base(placementIdentifier) { } + protected IChartboostMediationFullscreenAd FullscreenPlacement; - private IChartboostMediationFullscreenAd _fullscreenPlacement; + public FullscreenAdController(string placementIdentifier) : base(placementIdentifier) { } public override async void Load() { - if (_fullscreenPlacement != null) + if (FullscreenPlacement != null) Invalidate(); var fullscreenAdRequest = new ChartboostMediationFullscreenAdLoadRequest(PlacementIdentifier, DefaultKeywords); - fullscreenAdRequest.DidRecordImpression += OnDidRecordImpression; - fullscreenAdRequest.DidClick += OnDidClick; - fullscreenAdRequest.DidReward += OnDidReward; - fullscreenAdRequest.DidExpire += OnDidExpire; - fullscreenAdRequest.DidClose += OnDidClose; - LoadingOverlay.Instance.ToggleLoadingOverlay(true); var adLoadResult = await ChartboostMediation.LoadFullscreenAd(fullscreenAdRequest); LoadingOverlay.Instance.ToggleLoadingOverlay(false); @@ -34,14 +28,23 @@ public override async void Load() return; } - _fullscreenPlacement = adLoadResult.Ad; + FullscreenPlacement = adLoadResult.Ad; + + if (FullscreenPlacement != null) + { + FullscreenPlacement.DidRecordImpression += OnDidRecordImpression; + FullscreenPlacement.DidClick += OnDidClick; + FullscreenPlacement.DidReward += OnDidReward; + FullscreenPlacement.DidExpire += OnDidExpire; + FullscreenPlacement.DidClose += OnDidClose; + } + Debug.Log("Fullscreen Loaded!"); } - public override async void Show() { - var adShowResult = await _fullscreenPlacement.Show(); + var adShowResult = await FullscreenPlacement.Show(); if (adShowResult.Error.HasValue) { @@ -54,33 +57,33 @@ public override async void Show() public override void Invalidate() { - _fullscreenPlacement.Invalidate(); - _fullscreenPlacement = null; + FullscreenPlacement?.Invalidate(); + FullscreenPlacement = null; } #region Fullscreen Callbacks - private void OnDidRecordImpression(IChartboostMediationFullscreenAd ad) + protected void OnDidRecordImpression(IChartboostMediationFullscreenAd ad) { Debug.Log("Fullscreen RecordImpression!"); } - private void OnDidClick(IChartboostMediationFullscreenAd ad) + protected void OnDidClick(IChartboostMediationFullscreenAd ad) { Debug.Log("Fullscreen Clicked!"); } - private void OnDidReward(IChartboostMediationFullscreenAd ad) + protected void OnDidReward(IChartboostMediationFullscreenAd ad) { Debug.Log("Fullscreen Rewarded!"); } - private void OnDidExpire(IChartboostMediationFullscreenAd ad) + protected void OnDidExpire(IChartboostMediationFullscreenAd ad) { Debug.Log("Fullscreen Expired!"); } - private void OnDidClose(IChartboostMediationFullscreenAd ad, ChartboostMediationError? error) + protected void OnDidClose(IChartboostMediationFullscreenAd ad, ChartboostMediationError? error) { Debug.Log("Fullscreen Close!"); } diff --git a/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs new file mode 100644 index 00000000..cc575190 --- /dev/null +++ b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs @@ -0,0 +1,107 @@ +using Chartboost.AdFormats.Fullscreen.Queue; +using Chartboost.Requests; +using UnityEngine; +using UnityEngine.UI; + +namespace Chartboost.Mediation.Demo.AdControllers +{ + public sealed class FullscreenAdControllerWithQueue : FullscreenAdController + { + private readonly Button _loadButton; + private readonly Button _queueButton; + private readonly Toggle _queueToggle; + private readonly ChartboostMediationFullscreenAdQueue _queue; + + public FullscreenAdControllerWithQueue(string placementIdentifier, Toggle queueToggle, Button queueButton, Button loadButton) : base( + placementIdentifier) + { + _loadButton = loadButton; + _queueButton = queueButton; + _queueToggle = queueToggle; + + _queue = ChartboostMediationFullscreenAdQueue.Queue(placementIdentifier); + _queue.DidUpdate += OnQueueUpdated; + _queue.DidRemoveExpiredAd += OnQueueRemovedExpiredAd; + + _queueToggle.isOn = _queue.IsRunning; + _queueButton.onClick.AddListener(StartStopQueue); + _queueToggle.onValueChanged.AddListener(OnEnableQueueingToggle); + _queueButton.GetComponentInChildren().text = _queue.IsRunning ? "Stop Queue" : "Start Queue"; + } + + public override void Load() + { + if (!_queueToggle.isOn) + { + base.Load(); + return; + } + + if (!_queue.HasNextAd()) + { + Debug.LogError("Queue Is Empty !"); + return; + } + + FullscreenPlacement = _queue.GetNextAd(); + FullscreenPlacement.DidRecordImpression += OnDidRecordImpression; + FullscreenPlacement.DidClick += OnDidClick; + FullscreenPlacement.DidReward += OnDidReward; + FullscreenPlacement.DidExpire += OnDidExpire; + FullscreenPlacement.DidClose += OnDidClose; + + _loadButton.GetComponentInChildren().text = $"Load from Queue({_queue.NumberOfAdsReady}/{_queue.QueueCapacity})"; + } + + /// + public override void Invalidate() + { + base.Invalidate(); + _queueToggle.isOn = false; + _queue.Stop(); + _queue.DidUpdate -= OnQueueUpdated; + _queue.DidRemoveExpiredAd -= OnQueueRemovedExpiredAd; + + _queueButton.onClick.RemoveListener(StartStopQueue); + _queueToggle.onValueChanged.RemoveListener(OnEnableQueueingToggle); + + _loadButton.GetComponentInChildren().text = "Load"; + _queueButton.GetComponentInChildren().text = "Start Queue"; + } + + private void StartStopQueue() + { + if (_queue.IsRunning) + { + _queue.Stop(); + _queueButton.GetComponentInChildren().text = "Start Queue"; + } + else + { + _queue.Start(); + _queueButton.GetComponentInChildren().text = "Stop Queue"; + } + } + + private void OnEnableQueueingToggle(bool isOn) + { + _loadButton.GetComponentInChildren().text = isOn + ? $"Load from Queue({_queue.NumberOfAdsReady}/{_queue.QueueCapacity})" + : "Load"; + } + + private void OnQueueUpdated(ChartboostMediationFullscreenAdQueue queue, ChartboostMediationAdLoadResult adLoadResult, int numberOfAdsReady) + { + Debug.Log("Fullscreen Queue Updated !"); + if(_queueToggle.isOn) + _loadButton.GetComponentInChildren().text = $"Load from Queue({_queue.NumberOfAdsReady}/{_queue.QueueCapacity})"; + } + + private void OnQueueRemovedExpiredAd(ChartboostMediationFullscreenAdQueue queue, int numberOfAdsRead) + { + Debug.Log("Fullscreen Queue Removed Expired Ad !"); + if(_queueToggle.isOn) + _loadButton.GetComponentInChildren().text = $"Load from Queue({_queue.NumberOfAdsReady}/{_queue.QueueCapacity})"; + } + } +} diff --git a/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs.meta b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs.meta new file mode 100644 index 00000000..6f4f6466 --- /dev/null +++ b/com.chartboost.mediation.demo/Runtime/AdControllers/FullscreenAdControllerWithQueue.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0460fc4483324ffd8dc1a79bd5c76a9c +timeCreated: 1710862897 \ No newline at end of file diff --git a/com.chartboost.mediation.demo/Runtime/AdControllers/SimpleAdController.cs b/com.chartboost.mediation.demo/Runtime/AdControllers/SimpleAdController.cs index 6ea439cf..f51a3cc0 100644 --- a/com.chartboost.mediation.demo/Runtime/AdControllers/SimpleAdController.cs +++ b/com.chartboost.mediation.demo/Runtime/AdControllers/SimpleAdController.cs @@ -22,8 +22,8 @@ protected SimpleAdController(string placementIdentifier) public abstract void Load(); - public abstract void Show(); + public abstract void Show(); - public abstract void Invalidate(); + public abstract void Invalidate(); } } diff --git a/com.chartboost.mediation.demo/Runtime/com.chartboost.mediation.demo.asmdef b/com.chartboost.mediation.demo/Runtime/Chartboost.Mediation.Demo.asmdef similarity index 89% rename from com.chartboost.mediation.demo/Runtime/com.chartboost.mediation.demo.asmdef rename to com.chartboost.mediation.demo/Runtime/Chartboost.Mediation.Demo.asmdef index 11e59205..a0210916 100644 --- a/com.chartboost.mediation.demo/Runtime/com.chartboost.mediation.demo.asmdef +++ b/com.chartboost.mediation.demo/Runtime/Chartboost.Mediation.Demo.asmdef @@ -1,5 +1,5 @@ { - "name": "com.chartboost.mediation.demo", + "name": "Chartboost.Mediation.Demo", "rootNamespace": "Chartboost.Mediation.Demo", "references": [ "GUID:1fa23cf67f36740369216fe6b6716e5a" diff --git a/com.chartboost.mediation.demo/Runtime/com.chartboost.mediation.demo.asmdef.meta b/com.chartboost.mediation.demo/Runtime/Chartboost.Mediation.Demo.asmdef.meta similarity index 100% rename from com.chartboost.mediation.demo/Runtime/com.chartboost.mediation.demo.asmdef.meta rename to com.chartboost.mediation.demo/Runtime/Chartboost.Mediation.Demo.asmdef.meta diff --git a/com.chartboost.mediation.demo/Runtime/Pages/AdFormatsPage.cs b/com.chartboost.mediation.demo/Runtime/Pages/AdFormatsPage.cs index b7de76b5..ceba08cd 100644 --- a/com.chartboost.mediation.demo/Runtime/Pages/AdFormatsPage.cs +++ b/com.chartboost.mediation.demo/Runtime/Pages/AdFormatsPage.cs @@ -21,6 +21,7 @@ public class AdFormatsPage : MonoBehaviour private const string UnityBannerPreparationText = "A UnityBanner advertisement must first be loaded."; private const string InterstitialPreparationText = "A fullscreen Interstitial advertisement must first be loaded."; private const string RewardedPreparationText = "A fullscreen Rewarded advertisement must first be loaded."; + private const string FullscreenQueuePreparationText = "A fullscreen advertisement queue must first be started to allow loading from queue."; private const string FullscreenLoadCompletionText = "After it has been successfully loaded it can then be shown."; private const string BannerLoadCompletionText = "After it has been successfully loaded it will then be automatically shown in the specified location."; @@ -45,11 +46,11 @@ private void OnDestroy() private void MoveToUnityBannerPlacement() => MoveToPlacementPage(unityBannerPlacement, UnityBannerPreparationText, BannerLoadCompletionText); - private void MoveToInterstitialPlacement() => MoveToPlacementPage(interstitialPlacement, InterstitialPreparationText, FullscreenLoadCompletionText); + private void MoveToInterstitialPlacement() => MoveToPlacementPage(interstitialPlacement, InterstitialPreparationText, FullscreenLoadCompletionText, FullscreenQueuePreparationText); - private void MoveToRewardedPlacement() => MoveToPlacementPage(rewardedPlacement, RewardedPreparationText, FullscreenLoadCompletionText); + private void MoveToRewardedPlacement() => MoveToPlacementPage(rewardedPlacement, RewardedPreparationText, FullscreenLoadCompletionText, FullscreenQueuePreparationText); - private void MoveToPlacementPage(Placement placement, string preparationText, string loadCompletionText) + private void MoveToPlacementPage(Placement placement, string preparationText, string loadCompletionText, string queuePreparationText = null) { var pageInstanceGameObject = PageController.MoveToPage(PageType.Placement); var placementPageInstance = pageInstanceGameObject.GetComponent(); @@ -57,7 +58,7 @@ private void MoveToPlacementPage(Placement placement, string preparationText, st if (placementPageInstance == null) Debug.LogError("PlacementPage instance was not found."); - placementPageInstance.Configure(placement,preparationText, loadCompletionText); + placementPageInstance.Configure(placement,preparationText, loadCompletionText, queuePreparationText); } } } diff --git a/com.chartboost.mediation.demo/Runtime/Pages/PlacementPage.cs b/com.chartboost.mediation.demo/Runtime/Pages/PlacementPage.cs index 90b70e8e..5a19c58f 100644 --- a/com.chartboost.mediation.demo/Runtime/Pages/PlacementPage.cs +++ b/com.chartboost.mediation.demo/Runtime/Pages/PlacementPage.cs @@ -42,10 +42,14 @@ public class PlacementPage : MonoBehaviour [SerializeField] private Button showButton; [SerializeField] private Button backButton; + [Header("Queueing")] + [SerializeField] private Text queuePreparationText; + [SerializeField] private Button queueButton; + [SerializeField] private Toggle queueToggle; private Placement _currentPlacement; private SimpleAdController _currentController; - + private void Awake() { backButton.onClick.AddListener(MoveToAdFormats); @@ -64,18 +68,19 @@ private void MoveToAdFormats() _currentController?.Invalidate(); } - public void Configure(Placement placement, string preparationTextContents, string loadCompletionTextContents) + public void Configure(Placement placement, string preparationTextContents, string loadCompletionTextContents, string queuePreparationTextContents = null) { var placementType = placement.placementType; placementTypeText.text = placementType.ToString(); placementIcon.sprite = placement.placementSprite; preparationText.text = preparationTextContents; + queuePreparationText.text = queuePreparationTextContents; loadCompletionText.text = loadCompletionTextContents; _currentController = placementType switch { - PlacementType.Interstitial => new FullscreenAdController(placement.placementIdentifier), - PlacementType.Rewarded => new FullscreenAdController(placement.placementIdentifier), + PlacementType.Interstitial => new FullscreenAdControllerWithQueue(placement.placementIdentifier, queueToggle, queueButton, loadButton), + PlacementType.Rewarded => new FullscreenAdControllerWithQueue(placement.placementIdentifier, queueToggle, queueButton, loadButton), PlacementType.Banner => new BannerAdController(placement.placementIdentifier), _ => new UnityBannerAdController(placement.placementIdentifier) }; @@ -86,6 +91,7 @@ public void Configure(Placement placement, string preparationTextContents, strin showButton.onClick.AddListener(_currentController.Show); } + queueToggle.gameObject.SetActive(placementType == PlacementType.Interstitial || placementType == PlacementType.Rewarded); showButton.gameObject.SetActive(placementType == PlacementType.Interstitial || placementType == PlacementType.Rewarded); unityIcon.gameObject.SetActive(placementType == PlacementType.UnityBanner); } diff --git a/com.chartboost.mediation.demo/Runtime/Prefabs/Page - Placement.prefab b/com.chartboost.mediation.demo/Runtime/Prefabs/Page - Placement.prefab index dd28581c..379bdbe9 100644 --- a/com.chartboost.mediation.demo/Runtime/Prefabs/Page - Placement.prefab +++ b/com.chartboost.mediation.demo/Runtime/Prefabs/Page - Placement.prefab @@ -29,10 +29,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241292515675666} m_Father: {fileID: 1773241291060228592} - m_RootOrder: 6 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -147,10 +148,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241290788162345} m_Father: {fileID: 1773241291060228592} - m_RootOrder: 4 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -185,6 +187,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241292126521559} m_RootOrder: 0 @@ -264,6 +267,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241290657939921} m_RootOrder: 0 @@ -337,6 +341,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241291564967703} m_Father: {fileID: 1773241291060228592} @@ -377,10 +382,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241291739540656} m_Father: {fileID: 1773241291060228592} - m_RootOrder: 7 + m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -518,15 +524,19 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241291153464948} - {fileID: 1773241290941302023} + - {fileID: 7769010838223255791} + - {fileID: 6841596099573421864} - {fileID: 1773241291844232960} - {fileID: 1773241292126521559} - {fileID: 1773241290657939921} - {fileID: 1773241291755528181} - {fileID: 1773241290421790671} - {fileID: 1773241291059808350} + - {fileID: 8042582133907820301} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -590,12 +600,16 @@ MonoBehaviour: m_EditorClassIdentifier: unityIcon: {fileID: 1773241291134194497} placementIcon: {fileID: 1773241291564967702} + enableQueueingText: {fileID: 2970797335666096482} placementTypeText: {fileID: 1773241291153464947} preparationText: {fileID: 1773241291844233023} loadCompletionText: {fileID: 1773241291755528180} loadButton: {fileID: 1773241292126521558} showButton: {fileID: 1773241290421790670} backButton: {fileID: 1773241291059808348} + queuePreparationText: {fileID: 2970797335666096482} + queueButton: {fileID: 3119621262436181691} + queueToggle: {fileID: 7926853655014319915} --- !u!1 &1773241291134194499 GameObject: m_ObjectHideFlags: 0 @@ -624,6 +638,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241291564967703} m_RootOrder: 0 @@ -699,6 +714,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241291060228592} m_RootOrder: 0 @@ -778,6 +794,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241291134194498} m_Father: {fileID: 1773241290941302023} @@ -854,6 +871,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241291059808350} m_RootOrder: 0 @@ -933,9 +951,10 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241291060228592} - m_RootOrder: 5 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1012,9 +1031,10 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241291060228592} - m_RootOrder: 2 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1092,10 +1112,11 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1773241290780303267} m_Father: {fileID: 1773241291060228592} - m_RootOrder: 3 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1212,6 +1233,7 @@ RectTransform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1773241290421790671} m_RootOrder: 0 @@ -1263,3 +1285,829 @@ MonoBehaviour: m_VerticalOverflow: 0 m_LineSpacing: 1 m_Text: Show +--- !u!1 &1933373330530538110 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7769280706070630417} + - component: {fileID: 4183574334830051564} + - component: {fileID: 6766786598967776635} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7769280706070630417 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933373330530538110} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8042582133907820301} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 40, y: 0} + m_SizeDelta: {x: 140, y: 0} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &4183574334830051564 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933373330530538110} + m_CullTransparentMesh: 1 +--- !u!114 &6766786598967776635 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1933373330530538110} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enable Queueing +--- !u!1 &3303544278066560085 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8769690354088630539} + - component: {fileID: 2327891036101711896} + - component: {fileID: 1320619974262754462} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8769690354088630539 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3303544278066560085} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8174238478901353306} + m_Father: {fileID: 8042582133907820301} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 5, y: 0} + m_SizeDelta: {x: 25, y: -10} + m_Pivot: {x: 0, y: 0.5} +--- !u!222 &2327891036101711896 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3303544278066560085} + m_CullTransparentMesh: 1 +--- !u!114 &1320619974262754462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3303544278066560085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &3505431140320616297 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6841596099573421864} + m_Layer: 5 + m_Name: IconHolder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6841596099573421864 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3505431140320616297} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4416691260125905178} + m_Father: {fileID: 1773241291060228592} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &3555501712212755954 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5827382863475122246} + - component: {fileID: 7464268499650572850} + - component: {fileID: 402566290365780748} + - component: {fileID: 3119621262436181691} + m_Layer: 5 + m_Name: Button - Queue + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5827382863475122246 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3555501712212755954} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2445959356209416168} + m_Father: {fileID: 7769010838223255791} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: -100} + m_SizeDelta: {x: 0, y: 45} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &7464268499650572850 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3555501712212755954} + m_CullTransparentMesh: 1 +--- !u!114 &402566290365780748 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3555501712212755954} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.4784314, g: 0.74509805, b: 0.21176472, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3119621262436181691 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3555501712212755954} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 402566290365780748} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &5295902794282270040 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2445959356209416168} + - component: {fileID: 9131820991381030909} + - component: {fileID: 630003992014452530} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2445959356209416168 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5295902794282270040} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 5827382863475122246} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9131820991381030909 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5295902794282270040} + m_CullTransparentMesh: 1 +--- !u!114 &630003992014452530 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5295902794282270040} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 17 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Start Queue +--- !u!1 &7146680808531351631 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7769010838223255791} + m_Layer: 5 + m_Name: Panel - Queueing + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &7769010838223255791 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7146680808531351631} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1662694873374753512} + - {fileID: 5827382863475122246} + m_Father: {fileID: 1773241291060228592} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 720, y: -252.5} + m_SizeDelta: {x: 1410, y: 145} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &7288740611261008237 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4416691260125905178} + - component: {fileID: 4135073940569500663} + - component: {fileID: 5177824096701739557} + m_Layer: 5 + m_Name: Icon - Arrow Down + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4416691260125905178 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7288740611261008237} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6841596099573421864} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4135073940569500663 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7288740611261008237} + m_CullTransparentMesh: 1 +--- !u!114 &5177824096701739557 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7288740611261008237} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 29c9047d87adb4958a699fbde1721b35, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8268496032531268872 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8042582133907820301} + - component: {fileID: 7926853655014319915} + - component: {fileID: 7780138917992223792} + - component: {fileID: 2655870073645911041} + - component: {fileID: 5813839533866244616} + m_Layer: 5 + m_Name: Toggle - Queueing + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8042582133907820301 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8268496032531268872} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8769690354088630539} + - {fileID: 7769280706070630417} + m_Father: {fileID: 1773241291060228592} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 32} + m_SizeDelta: {x: 175, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &7926853655014319915 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8268496032531268872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1320619974262754462} + toggleTransition: 1 + graphic: {fileID: 2866153470077576332} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 7146680808531351631} + m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine + m_MethodName: SetActive + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_IsOn: 0 +--- !u!114 &7780138917992223792 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8268496032531268872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!222 &2655870073645911041 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8268496032531268872} + m_CullTransparentMesh: 1 +--- !u!114 &5813839533866244616 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8268496032531268872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.47843137, g: 0.74509805, b: 0.21176471, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8291029042378414301 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8174238478901353306} + - component: {fileID: 7064151546012253067} + - component: {fileID: 2866153470077576332} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8174238478901353306 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8291029042378414301} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8769690354088630539} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7064151546012253067 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8291029042378414301} + m_CullTransparentMesh: 1 +--- !u!114 &2866153470077576332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8291029042378414301} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!1 &8671027029805889108 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1662694873374753512} + - component: {fileID: 4914589835312217838} + - component: {fileID: 2970797335666096482} + m_Layer: 5 + m_Name: Text - Queue Preparation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1662694873374753512 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8671027029805889108} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7769010838223255791} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 100} + m_Pivot: {x: 0.5, y: 1} +--- !u!222 &4914589835312217838 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8671027029805889108} + m_CullTransparentMesh: 1 +--- !u!114 &2970797335666096482 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8671027029805889108} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 25 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: What needs to be done to prepare for queueing ? diff --git a/com.chartboost.mediation.demo/package.json b/com.chartboost.mediation.demo/package.json index 3d46742f..d59c69b0 100644 --- a/com.chartboost.mediation.demo/package.json +++ b/com.chartboost.mediation.demo/package.json @@ -1,6 +1,6 @@ { "name": "com.chartboost.mediation.demo", - "version": "4.8.0", + "version": "4.9.0", "displayName": "Chartboost Mediation Demo", "description": "The Demo app for Chartboost Mediation Unity SDK", "unity": "2020.3", diff --git a/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/libs/unity-classes.jar b/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/libs/unity-classes.jar old mode 100755 new mode 100644 index 0fe6c573..0cdb41b0 Binary files a/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/libs/unity-classes.jar and b/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/libs/unity-classes.jar differ diff --git a/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/src/main/java/com/chartboost/mediation/unity/UnityBridge.kt b/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/src/main/java/com/chartboost/mediation/unity/UnityBridge.kt index 603c3bd3..0cb87402 100644 --- a/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/src/main/java/com/chartboost/mediation/unity/UnityBridge.kt +++ b/com.chartboost.mediation/Android~/chartboost-mediation-android-bridge/src/main/java/com/chartboost/mediation/unity/UnityBridge.kt @@ -62,6 +62,13 @@ class UnityBridge { return bannerAdWrapper } + @JvmStatic + fun getFullscreenAdQueue(placementName: String, fullscreenAdQueueListener: ChartboostMediationFullscreenAdQueueListener) : ChartboostMediationFullscreenAdQueue { + val queue = ChartboostMediationFullscreenAdQueueManager.queue(UnityPlayer.currentActivity, placementName) + queue.adQueueListener = fullscreenAdQueueListener + return queue + } + @JvmStatic fun getUIScaleFactor(): Float { return UnityPlayer.currentActivity.resources?.displayMetrics?.density ?: DisplayMetrics.DENSITY_DEFAULT.toFloat() diff --git a/com.chartboost.mediation/Android~/local.properties b/com.chartboost.mediation/Android~/local.properties index 46d287db..e1a1857f 100644 --- a/com.chartboost.mediation/Android~/local.properties +++ b/com.chartboost.mediation/Android~/local.properties @@ -5,4 +5,4 @@ # For customization when using a Version Control System, please read the # header note. #Mon Aug 15 12:09:08 CDT 2022 -sdk.dir=/Applications/Unity/Hub/Editor/2020.3.37f1/PlaybackEngines/AndroidPlayer/SDK +sdk.dir=/Applications/Unity/Hub/Editor/2021.3.35f1/PlaybackEngines/AndroidPlayer/SDK diff --git a/com.chartboost.mediation/CHANGELOG.md b/com.chartboost.mediation/CHANGELOG.md index f41a0b20..5f400cf1 100644 --- a/com.chartboost.mediation/CHANGELOG.md +++ b/com.chartboost.mediation/CHANGELOG.md @@ -1,6 +1,20 @@ # Changelog All notable changes to this project will be documented in this file using the standards as defined at [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0). +### Version 4.9.0 *(2024-03-21)* +The following new dependencies are added : + +`"com.chartboost.unity.threading": "1.0.0"`
+`"com.chartboost.unity.utilities": "1.0.0"` + +Improvements: +- Added support for Ad Queueing. Ad Queueing is a new feature that builds upon the existing Fullscreen ad experience that allows Publishers to queue up multiple Fullscreen ads and show them in succession. + +API Changes: +- Added Fullscreen Ad related events to `IChartboostMediationFullscreenAd` object. +- Marked events in `ChartboostMediationFullscreenAdLoadRequest` as deprecated. Use events from `IChartboostMediationFullscreenAd` instead. + + ### Version 4.8.0 *(2024-02-08)* The following ad networks have been deprecated: - AdColony diff --git a/com.chartboost.mediation/Chartboost.CSharp.Mediation.Unity.nuspec b/com.chartboost.mediation/Chartboost.CSharp.Mediation.Unity.nuspec index c140e6e7..32272e1f 100644 --- a/com.chartboost.mediation/Chartboost.CSharp.Mediation.Unity.nuspec +++ b/com.chartboost.mediation/Chartboost.CSharp.Mediation.Unity.nuspec @@ -2,17 +2,21 @@ Chartboost.CSharp.Mediation.Unity - 4.8.0 + 4.9.0 Chartboost Mediation icon.png The Chartboost Mediation Unity SDK. Better monetization powered by bidding Chartboost Chartboost - https://github.com/ChartBoost/chartboost-mediation-unity-sdk/blob/develop/LICENSE.md + LICENSE.md README.md https://www.chartboost.com/mediate - Copyright 2017 + Copyright 2023 Chartboost, Ads, Mediation, Unity, cs + + + + diff --git a/com.chartboost.mediation/Documentation/integration/loading-ads.md b/com.chartboost.mediation/Documentation/integration/loading-ads.md index 050b9b17..f63b052b 100644 --- a/com.chartboost.mediation/Documentation/integration/loading-ads.md +++ b/com.chartboost.mediation/Documentation/integration/loading-ads.md @@ -57,6 +57,44 @@ Debug.Log($"Fullscreen Placement Loaded with PlacementName: {placementName}") > **Warning** \ > The new fullscreen API utilizes instance based callbacks to notify information regarding the advertisement life-cycle. You must take this into account when migrating from the old API static callbacks. +### Queueing Fullscreen Ads +Ad queueing is a new feature for SDK 4.9.0+ that builds upon the existing fullscreen ad experience that allows publishers to queue up multiple fullscreen ads and show them in succession. This can reduce and potentially eliminate latency for ad experiences that require showing fullscreen ads back to back. + + + + Queues are a "singleton per placement", meaning that if attempted to create multiple queues with the same placement ID the same object will be returned each time. + +```csharp + +// Get Queue +var queue = ChartboostMediationFullscreenAdQueue.Queue("placementName"); +Debug.Log($"Queue capacity : {queue.QueueCapacity}"); + +// Monitor Queue +queue.DidUpdate += (adQueue, adLoadResult, numberOfAdsReady) + => Debug.Log($"Queue Updated. NumberOfAdsReady : {numberOfAdsReady}"); + queue.DidRemoveExpiredAd += (adQueue, numberOfAdsReady) + => Debug.Log($"Removed expired ad. NumberOfAdsReady : {numberOfAdsReady}"); + + // Start queue + queue.Start(); + +// Wait for some time for the queue to load an ad or subscribe to `DidUpdate` event as shown above +// to be notified when an ad is loaded into queue + +// Load an ad from queue +if (queue.HasNextAd()) +{ + // removes and returns the oldest ad in the queue + // and starts a new load request + var fullscreenAd = queue.GetNextAd(); + } + +// Stop queue +queue.Stop(); + +``` + ## Banner Ad Objects Mediation SDK 4.6.0 introduces a new [Adaptive Banner](https://docs.chartboost.com/en/mediation/ad-types/#adaptive-banner/) ad format, capable of serving flexible and fixed sized ads in the placement. The new [Adaptive Banner]([/en/mediation/ad-types/#adaptive-banner/](https://docs.chartboost.com/en/mediation/ad-types/#adaptive-banner/)) ad format has the following features: diff --git a/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs b/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs new file mode 100644 index 00000000..d60f9c95 --- /dev/null +++ b/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Chartboost.Editor.EditorWindows.Adapters; +using Chartboost.Editor.EditorWindows.Adapters.Serialization; +using JetBrains.Annotations; +using Newtonsoft.Json; +using UnityEditor; +using UnityEngine; + +namespace Chartboost.Editor.BuildTools +{ + public class ChartboostMediationBuildUtils + { + private const string PathToAdapterUpdates = "adapter_updates.txt"; + private const string ArgBuildTarget = "buildTarget"; + private const string ArgAddNewNetworks = "addNewNetworks"; + + private static readonly string EOL = System.Environment.NewLine; + + private const string Unselected = "Unselected"; + private static bool DefaultAddCondition(string id, Dictionary selections) + { + if (id == "aps") + return false; + + return !selections.ContainsKey(id) || selections[id].android == Unselected || + selections[id].ios == Unselected; + } + + [MenuItem("Chartboost Mediation/Update Adapters")] + public static void UpdateAdapters() + { + ParseCommandLineArgumentsToUnity(out var args); + args[ArgAddNewNetworks] = "true"; + args[ArgBuildTarget] = "android"; + + var platform = GetPlatform(args); + var adapterUpdates = string.Empty; + if(File.Exists(adapterUpdates)) + File.Delete(adapterUpdates); + + AdapterDataSource.Update(); + AdaptersWindow.LoadSelections(); + + if(args.TryGetValue(ArgAddNewNetworks, out var addNetworks)) + { + if (addNetworks == "true") + { + var newNetworks = AdaptersWindow.AddNewNetworks(platform, DefaultAddCondition); + + if (newNetworks.Count > 0) + { + adapterUpdates = $"New Networks: \n {JsonConvert.SerializeObject(newNetworks, Formatting.Indented)}"; + File.AppendAllText(PathToAdapterUpdates, $"\n{adapterUpdates}"); + } + Log(newNetworks.Count > 0 ? $"[Adapters] {adapterUpdates}" : "[Adapters] No New Networks"); + } + } + + var upgrades = AdaptersWindow.UpgradePlatformToLatest(platform); + if (upgrades.Count > 0) + { + adapterUpdates = $"Upgraded: \n {JsonConvert.SerializeObject(upgrades, Formatting.Indented)}"; + File.WriteAllText(PathToAdapterUpdates, adapterUpdates); + } + Log(upgrades.Count > 0 ? $"[Adapters] {adapterUpdates}" : "[Adapters] No Upgrades."); + + AdaptersWindow.SaveSelections(); + + var changed = AdaptersWindow.CheckChartboostMediationVersion(); + Log(changed ? $"[Adapters] Chartboost Mediation Version Has Been Updated" : "[Adapters] Chartboost Mediation Version is Up to Date"); + } + + private static void ParseCommandLineArgumentsToUnity(out Dictionary providedArguments) + { + providedArguments = new Dictionary(); + var args = System.Environment.GetCommandLineArgs(); + Debug.Log( + $"{EOL}" + + $"#####################{EOL}" + + $"# Parsing Arguments #{EOL}" + + $"#####################{EOL}" + + $"{EOL}" + ); + + for (int current = 0, next = 1; current < args.Length; current++, next++) + { + // Parse any flags + var isFlag = args[current].StartsWith("-"); + if (!isFlag) + continue; + var flag = args[current].TrimStart('-'); + + // Parse optional value + var flagHasValue = next < args.Length && !args[next].StartsWith("-"); + var flagValue = flagHasValue ? args[next].TrimStart('-') : string.Empty; + var displayValue = $"{flagValue}"; + + // Assign Value + Debug.Log($"Found Flag \"{flag}\" with value \"{displayValue}\""); + providedArguments.Add(flag, displayValue); + } + } + + private static void Log(string message) + { + if (Application.isBatchMode) + Console.WriteLine(message); + else + Debug.Log(message); + } + + private static Platform GetPlatform([NotNull] Dictionary args) + { + if (args == null) + throw new ArgumentNullException(nameof(args)); + + if (args.TryGetValue(ArgBuildTarget, out var buildPlatform)) + return buildPlatform switch + { + "android" => Platform.Android, + "ios" => Platform.IOS, + _ => Platform.None + }; + + Log("ERROR => Platform not provided"); + return Platform.None; + } + } +} diff --git a/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs.meta b/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs.meta new file mode 100644 index 00000000..351692d4 --- /dev/null +++ b/com.chartboost.mediation/Editor/BuildTools/ChartboostMediationBuildUtils.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 831f047f987b4100b4694cd46a3fa485 +timeCreated: 1708132792 \ No newline at end of file diff --git a/com.chartboost.mediation/Editor/EditorWindows/Adapters/AdaptersWindow.Utilities.cs b/com.chartboost.mediation/Editor/EditorWindows/Adapters/AdaptersWindow.Utilities.cs index ec13b29f..b95f1e41 100644 --- a/com.chartboost.mediation/Editor/EditorWindows/Adapters/AdaptersWindow.Utilities.cs +++ b/com.chartboost.mediation/Editor/EditorWindows/Adapters/AdaptersWindow.Utilities.cs @@ -1,9 +1,12 @@ #if !NO_ADAPTERS_WINDOW using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Chartboost.Editor.EditorWindows.Adapters.Comparers; using Chartboost.Editor.EditorWindows.Adapters.Serialization; +using Newtonsoft.Json; +using NUnit.Framework; using UnityEditor; using UnityEngine; @@ -18,7 +21,7 @@ public partial class AdaptersWindow /// current selections /// private static bool DefaultAddCondition(string id, Dictionary selections) => !selections.ContainsKey(id) || selections[id].android == Unselected || selections[id].ios == Unselected; - + /// /// Adds adapter networks to user selections. /// @@ -116,6 +119,45 @@ public static List UpgradePlatformToLatest(Platform platform) NoChangesDialog(); return selectionChanges; } + + public static List UpdateAdapters(string[] adapters, Platform platform) + { + var selectionChanges = new List(); + if (!WarningDialog()) + return selectionChanges; + + var currentSelections = UserSelectedVersions.ToDictionary(kv => kv.Key, kv => kv.Value); + + foreach (var selection in currentSelections) + { + if(!adapters.Contains(selection.Key)) + continue; + + var adapterId = selection.Key; + if (AdapterDeletionDialog(adapterId)) + continue; + + var updateAndroid = new Action(() => UpdateSelection(PartnerSDKVersions[adapterId].android, selectionChanges, adapterId, selection.Value.android, Platform.Android));; + var updateIOS = new Action(() => UpdateSelection(PartnerSDKVersions[adapterId].ios, selectionChanges, adapterId, selection.Value.ios, Platform.IOS)); + + switch (platform) + { + case Platform.Android | Platform.IOS: + updateAndroid(); + updateIOS(); + break; + case Platform.Android: + updateAndroid(); + break; + default: + updateIOS(); + break; + } + } + + NoChangesDialog(); + return selectionChanges; + } /// /// Makes sure Chartboost Mediation dependencies stays up to date with package information. diff --git a/com.chartboost.mediation/Editor/SKAdNetwork/SKAdNetworkRequest.cs b/com.chartboost.mediation/Editor/SKAdNetwork/SKAdNetworkRequest.cs index 4800f43a..0eeaf6d5 100644 --- a/com.chartboost.mediation/Editor/SKAdNetwork/SKAdNetworkRequest.cs +++ b/com.chartboost.mediation/Editor/SKAdNetwork/SKAdNetworkRequest.cs @@ -28,16 +28,14 @@ void MergeIDs(params SKAdNetworkIds[] ids) // json compatible SkAdNetworkFetching var appLovinIds = Request(SKAdNetworkConstants.AppLovin); - var adColonyIds = Request(SKAdNetworkConstants.AdColony); var chartboostIds = Request(SKAdNetworkConstants.Chartboost); var fyberIds = Request(SKAdNetworkConstants.Fyber); var inMobiIds = Request(SKAdNetworkConstants.InMobi); - var tapJoyIds = Request(SKAdNetworkConstants.TapJoy); var vungleIds = Request(SKAdNetworkConstants.Vungle); var unityIds = RequestUnity(SKAdNetworkConstants.Unity); // merge all ids - MergeIDs(appLovinIds, adColonyIds, chartboostIds, fyberIds, inMobiIds, tapJoyIds, vungleIds, unityIds); + MergeIDs(appLovinIds, chartboostIds, fyberIds, inMobiIds, vungleIds, unityIds); // SkAdNetwork that does not provide easy json/cvs compatibility // 1. Facebook (https://developers.facebook.com/docs/setting-up/platform-setup/ios/SKAdNetwork/) @@ -182,7 +180,7 @@ private static SKAdNetworkIds RequestUnity(string url) } private static void LogNetworkFailureMessage(UnityWebRequest request) - => Debug.LogWarning($"SKAdNetworkRequest failed with error: {request.error}"); + => Debug.LogWarning($"SKAdNetworkRequest failed for: {request.url} with error: {request.error}"); private static void LogSKAdNetworkRequestExceptionMessage(string url, Exception e) => Debug.LogWarning($"SKAdNetworkRequest failed to parse json for: {url} due to exception {e}"); diff --git a/com.chartboost.mediation/Runtime/AdFormats/Banner/ChartboostMediationBannerViewIOS.cs b/com.chartboost.mediation/Runtime/AdFormats/Banner/ChartboostMediationBannerViewIOS.cs index e7241a2d..13e0995b 100644 --- a/com.chartboost.mediation/Runtime/AdFormats/Banner/ChartboostMediationBannerViewIOS.cs +++ b/com.chartboost.mediation/Runtime/AdFormats/Banner/ChartboostMediationBannerViewIOS.cs @@ -120,7 +120,7 @@ public override async Task Load(Chartboos Request = request; await base.Load(request, screenLocation); - var (proxy, hashCode) = _setupProxy(); + var (proxy, hashCode) = AwaitableProxies.SetupProxy(); CacheManager.TrackBannerAdLoadRequest(hashCode, request); var placement = request.PlacementName; @@ -140,7 +140,7 @@ public override async Task Load(Chartboos Request = request; await base.Load(request, x, y); - var (proxy, hashCode) = _setupProxy(); + var (proxy, hashCode) = AwaitableProxies.SetupProxy(); CacheManager.TrackBannerAdLoadRequest(hashCode, request); var placement = request.PlacementName; diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdBase.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdBase.cs index 33e8c58d..7bfb732c 100644 --- a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdBase.cs +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdBase.cs @@ -21,6 +21,11 @@ internal abstract class ChartboostMediationFullscreenAdBase : IChartboostMediati public abstract BidInfo WinningBidInfo { get; } public abstract Task Show(); public abstract void Invalidate(); + public event ChartboostMediationFullscreenAdEvent DidClick; + public event ChartboostMediationFullscreenAdEventWithError DidClose; + public event ChartboostMediationFullscreenAdEvent DidExpire; + public event ChartboostMediationFullscreenAdEvent DidRecordImpression; + public event ChartboostMediationFullscreenAdEvent DidReward; protected void Invalidate(bool isCollected) { @@ -35,5 +40,15 @@ protected static ChartboostMediationAdShowResult GetAdShowResultForInvalidAd() var error = new ChartboostMediationError(InvalidAdError); return new ChartboostMediationAdShowResult(error); } + + internal void OnClick(IChartboostMediationFullscreenAd ad) => DidClick?.Invoke(ad); + + internal void OnClose(IChartboostMediationFullscreenAd ad, ChartboostMediationError? error) => DidClose?.Invoke(ad, error); + + internal void OnRecordImpression(IChartboostMediationFullscreenAd ad) => DidRecordImpression?.Invoke(ad); + + internal void OnExpire(IChartboostMediationFullscreenAd ad) => DidExpire?.Invoke(ad); + + internal void OnReward(IChartboostMediationFullscreenAd ad) => DidReward?.Invoke(ad); } } diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdIOS.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdIOS.cs index 161faa02..4fa0ec1e 100644 --- a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdIOS.cs +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/ChartboostMediationFullscreenAdIOS.cs @@ -5,6 +5,7 @@ using Chartboost.Platforms.IOS; using Chartboost.Requests; using Chartboost.Utilities; +using Newtonsoft.Json; namespace Chartboost.AdFormats.Fullscreen { @@ -13,16 +14,34 @@ namespace Chartboost.AdFormats.Fullscreen /// internal sealed class ChartboostMediationFullscreenAdIOS : ChartboostMediationFullscreenAdBase { - public ChartboostMediationFullscreenAdIOS(IntPtr uniqueID, string loadId, ChartboostMediationFullscreenAdLoadRequest request, BidInfo winningBid) : base(uniqueId: uniqueID) + private ChartboostMediationFullscreenAdLoadRequest _request; + private string _loadId; + private BidInfo? _winningBidInfo; + + public ChartboostMediationFullscreenAdIOS(IntPtr uniqueID) : base(uniqueID) + { + CacheManager.TrackFullscreenAd(uniqueID.ToInt64(), this); + } + + public ChartboostMediationFullscreenAdIOS(IntPtr uniqueID, ChartboostMediationFullscreenAdLoadRequest request) : base(uniqueId: uniqueID) { - LoadId = loadId; - Request = request; - WinningBidInfo = winningBid; + _request = request; CacheManager.TrackFullscreenAd(uniqueID.ToInt64(), this); } /// - public override ChartboostMediationFullscreenAdLoadRequest Request { get; } + public override ChartboostMediationFullscreenAdLoadRequest Request + { + get + { + if (_request != null) + return _request; + + var requestJson = _chartboostMediationFullscreenAdRequest(uniqueId); + _request = JsonConvert.DeserializeObject(requestJson); + return _request; + } + } /// public override string CustomData @@ -37,10 +56,21 @@ public override string CustomData } /// - public override string LoadId { get; } + public override string LoadId => _chartboostMediationFullscreenAdLoadId(uniqueId); /// - public override BidInfo WinningBidInfo { get; } + public override BidInfo WinningBidInfo + { + get + { + if (_winningBidInfo != null) + return _winningBidInfo.Value; + + var winningBidInfoJson = _chartboostMediationFullscreenAdWinningBidInfo(uniqueId); + _winningBidInfo = JsonConvert.DeserializeObject(winningBidInfoJson); + return _winningBidInfo.Value; + } + } /// public override async Task Show() @@ -48,7 +78,7 @@ public override async Task Show() if (!isValid) return GetAdShowResultForInvalidAd(); - var (proxy, hashCode) = ChartboostMediationIOS._setupProxy(); + var (proxy, hashCode) = AwaitableProxies.SetupProxy(); _chartboostMediationShowFullscreenAd(uniqueId, hashCode, ChartboostMediationIOS.FullscreenAdShowResultCallbackProxy); return await proxy; } @@ -69,6 +99,9 @@ public override void Invalidate() [DllImport(IOSConstants.Internal)] private static extern void _chartboostMediationFullscreenSetCustomData(IntPtr uniqueId, string customData); [DllImport(IOSConstants.Internal)] private static extern void _chartboostMediationInvalidateFullscreenAd(IntPtr uniqueId); [DllImport(IOSConstants.Internal)] private static extern void _chartboostMediationShowFullscreenAd(IntPtr uniqueId, int hashCode, ChartboostMediationIOS.ExternChartboostMediationFullscreenAdShowResultEvent callback); + [DllImport(IOSConstants.Internal)] private static extern string _chartboostMediationFullscreenAdLoadId(IntPtr uniqueId); + [DllImport(IOSConstants.Internal)] private static extern string _chartboostMediationFullscreenAdWinningBidInfo(IntPtr uniqueId); + [DllImport(IOSConstants.Internal)] private static extern string _chartboostMediationFullscreenAdRequest(IntPtr uniqueId); } } #endif diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/IChartboostMediationFullscreenAd.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/IChartboostMediationFullscreenAd.cs index 794b221b..53d6f249 100644 --- a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/IChartboostMediationFullscreenAd.cs +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/IChartboostMediationFullscreenAd.cs @@ -38,5 +38,30 @@ public interface IChartboostMediationFullscreenAd /// Invalidate the ad. This should be called when the ad is no longer needed. /// public abstract void Invalidate(); + + /// + /// Called when the ad executes its click-through. This may happen multiple times for the same ad. + /// + public event ChartboostMediationFullscreenAdEvent DidClick; + + /// + /// Called when the ad is closed. + /// + public event ChartboostMediationFullscreenAdEventWithError DidClose; + + /// + /// Called when the ad is expired by the partner SDK/adapter. + /// + public event ChartboostMediationFullscreenAdEvent DidExpire; + + /// + /// Called when an ad impression occurs. This signal is when Chartboost Mediation fires an impression and is independent of any partner impression. + /// + public event ChartboostMediationFullscreenAdEvent DidRecordImpression; + + /// + /// Called when the user should receive the reward associated with this rewarded ad. + /// + public event ChartboostMediationFullscreenAdEvent DidReward; } } diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue.meta new file mode 100644 index 00000000..50012f5c --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3d755306cfff4c4f8bd554ac986d7b32 +timeCreated: 1706648030 diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs new file mode 100644 index 00000000..ca624425 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Chartboost.Requests; + +namespace Chartboost.AdFormats.Fullscreen.Queue +{ + public delegate void ChartboostMediationFullscreenAdQueueEvent(ChartboostMediationFullscreenAdQueue adQueue, + ChartboostMediationAdLoadResult adLoadResult, int numberOfAdsReady); + public delegate void ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent(ChartboostMediationFullscreenAdQueue adQueue, int numberOfAdsReady); + + // ReSharper disable once InconsistentNaming + /// + /// Manages the pre-loading of fullscreen ads. Each manages ads for one placement. + /// + /// + public interface ChartboostMediationFullscreenAdQueue + { + /// + /// Returns a . Queue will not begin loading ads until `Start()` is called. + /// Calling more than once with the same placement ID returns the same object each time. + /// + /// Identifier for the Chartboost placement this queue should load ads from. + /// + static ChartboostMediationFullscreenAdQueue Queue(string placementName) + { + // ReSharper disable once JoinDeclarationAndInitializer + ChartboostMediationFullscreenAdQueue queue; + #if UNITY_EDITOR + queue = ChartboostMediationFullscreenAdQueueUnsupported.Queue(placementName); + #elif UNITY_ANDROID + queue = ChartboostMediationFullscreenAdQueueAndroid.Queue(placementName); + #elif UNITY_IOS + queue = ChartboostMediationFullscreenAdQueueIOS.Queue(placementName); + #else + queue = ChartboostMediationFullscreenAdQueueUnsupported.Queue(placementName); + #endif + + return queue; + } + + /// + /// Maximum number of loaded ads the queue can hold at one time. + /// + int QueueCapacity { get; } + + /// + /// Number of ready-to-show ads that can currently be retrieved with + /// + int NumberOfAdsReady { get; } + + /// + /// The keywords for the queue. Every load request made by this queue will include these keywords. + /// + Dictionary Keywords { get; set; } + + /// + /// Whether or not the ad queue is currently running (active) and automatically queueing ads. + /// + bool IsRunning { get; } + + /// + /// Gets the next ad from the queue. + /// + /// A ad + IChartboostMediationFullscreenAd GetNextAd(); + + /// + /// Checks if there's an ad available. + /// + /// Whether or not there exists an ad in the queue. + bool HasNextAd(); + + /// + /// Starts loading ads and append them to the queue automatically until capacity has been reached. + /// + void Start(); + + /// + /// Stops loading ads + /// + void Stop(); + + /// + /// Request a new queue size. If the number of ad slots requested is larger than the maximum + /// configured by the dashboard this method will log an error and set the queue size to maximum + /// allowed size as configured on dashboard. + /// + /// The most loaded ads the queue should be able to hold at once. + void SetCapacity(int capacity); + + /// + /// Event triggered when a completes a load request. + /// + event ChartboostMediationFullscreenAdQueueEvent DidUpdate; + + /// + /// Event triggered when an ad expires and is removed from the queue. + /// + event ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent DidRemoveExpiredAd; + + } + +} diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs.meta new file mode 100644 index 00000000..d1050ba4 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueue.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 74a795abf65a4f5086364ce54eca5995 +timeCreated: 1706648060 diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs new file mode 100644 index 00000000..d3d22ff5 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs @@ -0,0 +1,102 @@ +#if UNITY_ANDROID +using System; +using System.Collections.Generic; +using Chartboost.Events; +using Chartboost.Platforms.Android; +using Chartboost.Requests; +using Chartboost.Utilities; +using UnityEngine; +using Logger = Chartboost.Utilities.Logger; + +namespace Chartboost.AdFormats.Fullscreen.Queue +{ + internal sealed class ChartboostMediationFullscreenAdQueueAndroid : ChartboostMediationFullscreenAdQueueBase + { + private readonly AndroidJavaObject _nativeQueue; + private Dictionary _keywords = new Dictionary(); + + private ChartboostMediationFullscreenAdQueueAndroid(AndroidJavaObject nativeQueue) : base(new IntPtr(nativeQueue.HashCode())) + { + LogTag = "ChartboostMediationFullscreenAdQueue (Android)"; + _nativeQueue = nativeQueue; + } + + /// + public override Dictionary Keywords + { + get => _keywords; + set + { + try + { + _nativeQueue.Call(AndroidConstants.FunSetKeywords, value.ToKeywords()); + _keywords = value; + } + catch (Exception e) + { + EventProcessor.ReportUnexpectedSystemError($"Error setting keywords => {e.Message}"); + } + } + } + + /// + public override int QueueCapacity => _nativeQueue.Get(AndroidConstants.PropertyQueueCapacity); + + /// + public override int NumberOfAdsReady => _nativeQueue.Call(AndroidConstants.PropertyNumberOfAdsReady); + + /// + public override bool IsRunning => _nativeQueue.Get(AndroidConstants.PropertyIsRunning); + + /// + public override bool HasNextAd() + => _nativeQueue.Call(AndroidConstants.FunHasNextAd); + + /// + public override void Start() + => _nativeQueue.Call(AndroidConstants.FunStart); + + /// + public override void Stop() + => _nativeQueue.Call(AndroidConstants.FunStop); + + /// + public override void SetCapacity(int capacity) + => _nativeQueue.Set(AndroidConstants.PropertyQueueCapacity, capacity); + + /// + public override IChartboostMediationFullscreenAd GetNextAd() + { + var nativeAd = _nativeQueue.Call(AndroidConstants.FunGetNextAd); + + if (nativeAd == null) + { + Logger.Log(LogTag, "GetNextAd() :: No more ads left in queue returning NULL"); + return null; + } + + nativeAd.Call(AndroidConstants.FunChartboostMediationFullscreenAdListener, ChartboostMediationAndroid.ChartboostMediationFullscreenAdListener.Instance); + var nativeRequest = nativeAd.Get(AndroidConstants.PropertyRequest); + var placement = nativeRequest.Get(AndroidConstants.PropertyPlacementName); + var loadRequest = new ChartboostMediationFullscreenAdLoadRequest(placement, Keywords); + + return new ChartboostMediationFullscreenAdAndroid(nativeAd, loadRequest); + } + + internal static ChartboostMediationFullscreenAdQueueAndroid Queue(string placementName) + { + // Queues are a "singleton per placement", meaning that if a publisher attempts to + // create multiple queues with the same placement ID the same object will be returned each time. + using var unityBridge = ChartboostMediationAndroid.GetUnityBridge(); + var nativeQueue = unityBridge.CallStatic(AndroidConstants.FunGetFullscreenAdQueue, placementName, ChartboostMediationAndroid.ChartboostMediationFullscreenAdQueueListener.Instance); + + var queue = (ChartboostMediationFullscreenAdQueueAndroid)CacheManager.GetFullscreenAdQueue(nativeQueue.HashCode()); + if (queue != null) + return queue; + + queue = new ChartboostMediationFullscreenAdQueueAndroid(nativeQueue); + return queue; + } + } +} +#endif diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs.meta new file mode 100644 index 00000000..e784cbc6 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueAndroid.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 4ffe281577db4f59b9bcd1cd03a36e7e +timeCreated: 1706651812 diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs new file mode 100644 index 00000000..cfe1d85b --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Chartboost.Requests; +using Chartboost.Utilities; + +namespace Chartboost.AdFormats.Fullscreen.Queue +{ + public abstract class ChartboostMediationFullscreenAdQueueBase : ChartboostMediationFullscreenAdQueue + { + protected static string LogTag = "ChartboostMediationFullscreenAdQueue (Base)"; + protected IntPtr UniqueId; + + protected ChartboostMediationFullscreenAdQueueBase(IntPtr uniqueId) + { + UniqueId = uniqueId; + CacheManager.TrackFullscreenAdQueue(UniqueId.ToInt64(), this); + } + + /// + public abstract int QueueCapacity { get; } + + /// + public abstract int NumberOfAdsReady { get; } + + /// + public abstract Dictionary Keywords { get; set; } + + /// + public abstract bool IsRunning { get; } + + /// + public abstract IChartboostMediationFullscreenAd GetNextAd(); + + /// + public abstract bool HasNextAd(); + + /// + public abstract void Start(); + + /// + public abstract void Stop(); + + /// + public abstract void SetCapacity(int capacity); + + /// + public event ChartboostMediationFullscreenAdQueueEvent DidUpdate; + + /// + public event ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent DidRemoveExpiredAd; + + internal void OnFullscreenAdQueueUpdated(ChartboostMediationFullscreenAdQueue adQueue, ChartboostMediationAdLoadResult result, int numberOfAdsReady) + => MainThreadDispatcher.Post(_ => DidUpdate?.Invoke(adQueue, result, numberOfAdsReady)); + + internal void OnFullscreenAdQueueDidRemoveExpiredAd(ChartboostMediationFullscreenAdQueue adQueue, int numberOfAdsReady) + => MainThreadDispatcher.Post(_ => DidRemoveExpiredAd?.Invoke(adQueue, numberOfAdsReady)); + } + +} diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs.meta new file mode 100644 index 00000000..7015e0dc --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6d208418e2f24e139e1036d114fb1429 +timeCreated: 1706725099 diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs new file mode 100644 index 00000000..ebb66b9f --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs @@ -0,0 +1,127 @@ +#if UNITY_IOS +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Chartboost.Events; +using Chartboost.Requests; +using Chartboost.Utilities; +using Newtonsoft.Json; + +namespace Chartboost.AdFormats.Fullscreen.Queue +{ + internal sealed class ChartboostMediationFullscreenAdQueueIOS : ChartboostMediationFullscreenAdQueueBase + { + private Dictionary _keywords; + + private ChartboostMediationFullscreenAdQueueIOS(IntPtr uniqueId) : base(uniqueId) + { + LogTag = "ChartboostMediationFullscreenAdQueue (IOS)"; + } + + /// + public override Dictionary Keywords + { + get => _keywords; + set + { + try + { + var keywordsJson = string.Empty; + if (_keywords.Count > 0) + keywordsJson = JsonConvert.SerializeObject(_keywords); + _chartboostMediationFullscreenAdQueueSetKeywords(UniqueId, keywordsJson); + _keywords = value; + } + catch (Exception e) + { + EventProcessor.ReportUnexpectedSystemError($"Error setting keywords => {e.Message}"); + } + } + } + + /// + public override int QueueCapacity => _chartboostMediationFullscreenAdQueueQueueCapacity(UniqueId); + + /// + public override int NumberOfAdsReady => _chartboostMediationFullscreenAdQueueNumberOfAdsReady(UniqueId); + + /// + public override bool IsRunning => _chartboostMediationFullscreenAdQueueIsRunning(UniqueId); + + /// + public override IChartboostMediationFullscreenAd GetNextAd() + { + try + { + var nativeAd = _chartboostMediationFullscreenAdQueueGetNextAd(UniqueId); + // TODO: check if nativeAd is NULL + return new ChartboostMediationFullscreenAdIOS(nativeAd); + } + catch (Exception) + { + Logger.Log(LogTag, "GetNextAd() :: No more ads left in queue returning NULL"); + return null; + } + } + + /// + public override bool HasNextAd() + => _chartboostMediationFullscreenAdQueueHasNextAd(UniqueId); + + /// + public override void Start() + => _chartboostMediationFullscreenAdQueueStart(UniqueId); + + /// + public override void Stop() + => _chartboostMediationFullscreenAdQueueStop(UniqueId); + + /// + public override void SetCapacity(int capacity) + => _chartboostMediationFullscreenAdQueueSetCapacity(UniqueId, capacity); + + internal static ChartboostMediationFullscreenAdQueueIOS Queue(string placementName) + { + // Queues are a "singleton per placement", meaning that if a publisher attempts to + // create multiple queues with the same placement ID the same object will be returned each time. + var nativeQueue = _chartboostMediationFullscreenAdQueueQueue(placementName); + var queue = (ChartboostMediationFullscreenAdQueueIOS)CacheManager.GetFullscreenAdQueue(nativeQueue.ToInt64()); + if (queue != null) + return queue; + + queue = new ChartboostMediationFullscreenAdQueueIOS(nativeQueue); + return queue; + } + + [DllImport(IOSConstants.Internal)] + private static extern IntPtr _chartboostMediationFullscreenAdQueueQueue(string placementName); + + [DllImport(IOSConstants.Internal)] + private static extern void _chartboostMediationFullscreenAdQueueSetKeywords(IntPtr uniqueId, string keywordsJson); + + [DllImport(IOSConstants.Internal)] + private static extern int _chartboostMediationFullscreenAdQueueQueueCapacity(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern int _chartboostMediationFullscreenAdQueueNumberOfAdsReady(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern bool _chartboostMediationFullscreenAdQueueIsRunning(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern IntPtr _chartboostMediationFullscreenAdQueueGetNextAd(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern bool _chartboostMediationFullscreenAdQueueHasNextAd(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern void _chartboostMediationFullscreenAdQueueStart(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern void _chartboostMediationFullscreenAdQueueStop(IntPtr uniqueId); + + [DllImport(IOSConstants.Internal)] + private static extern void _chartboostMediationFullscreenAdQueueSetCapacity(IntPtr uniqueId, int capacity); + } +} +#endif diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs.meta new file mode 100644 index 00000000..866ba2ac --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueIOS.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 12485b7dcfd64c80b54abe1ded6c69c4 +timeCreated: 1706652217 diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs new file mode 100644 index 00000000..978e0328 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Chartboost.Utilities; + +namespace Chartboost.AdFormats.Fullscreen.Queue +{ + public class ChartboostMediationFullscreenAdQueueUnsupported : ChartboostMediationFullscreenAdQueueBase + { + private ChartboostMediationFullscreenAdQueueUnsupported(IntPtr uniqueId) : base(IntPtr.Zero) + { + LogTag = "ChartboostMediationFullscreenAdQueue (Unsupported)"; + Logger.Log(LogTag, $"Creating FullscreenAdQueue for placement : {uniqueId}"); + } + // TODO : Do we want to return an exception or default values ? + public override int QueueCapacity => 0; + public override int NumberOfAdsReady => 0; + public override Dictionary Keywords { get; set; } = null; + public override bool IsRunning => false; + + public override IChartboostMediationFullscreenAd GetNextAd() => null; + + public override bool HasNextAd() => false; + + public override void Start() {} + + public override void Stop() {} + + public override void SetCapacity(int capacity) {} + + public static ChartboostMediationFullscreenAdQueueUnsupported Queue(string placementName) + { + var nativeQueue = IntPtr.Zero; + var queue = (ChartboostMediationFullscreenAdQueueUnsupported)CacheManager.GetFullscreenAdQueue(nativeQueue.ToInt64()); + if (queue != null) + return queue; + + queue = new ChartboostMediationFullscreenAdQueueUnsupported(nativeQueue); + return queue; + } + } +} diff --git a/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs.meta b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs.meta new file mode 100644 index 00000000..8c68ad42 --- /dev/null +++ b/com.chartboost.mediation/Runtime/AdFormats/Fullscreen/Queue/ChartboostMediationFullscreenAdQueueUnsupported.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 04b14f3f8c954805972946c855b6f91b +timeCreated: 1706811844 diff --git a/com.chartboost.mediation/Runtime/ChartboostMediation.cs b/com.chartboost.mediation/Runtime/ChartboostMediation.cs index 4d26a8d8..c2688699 100644 --- a/com.chartboost.mediation/Runtime/ChartboostMediation.cs +++ b/com.chartboost.mediation/Runtime/ChartboostMediation.cs @@ -208,7 +208,7 @@ public static event ChartboostMediationPlacementEvent DidRecordImpressionBanner // Functions for showing ads ////////////////////////////////////////////////////// - public static string Version => "4.8.0"; + public static string Version => "4.9.0"; /// /// Load a fullscreen ad (interstitial, rewarded video, rewarded interstitial). diff --git a/com.chartboost.mediation/Runtime/Events/EventProcessor.cs b/com.chartboost.mediation/Runtime/Events/EventProcessor.cs index 8fae75af..e61ac5c9 100644 --- a/com.chartboost.mediation/Runtime/Events/EventProcessor.cs +++ b/com.chartboost.mediation/Runtime/Events/EventProcessor.cs @@ -1,12 +1,11 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using Chartboost.AdFormats.Banner; +using Chartboost.AdFormats.Fullscreen; +using Chartboost.AdFormats.Fullscreen.Queue; +using Chartboost.Requests; using Chartboost.Utilities; -using UnityEditor; -using UnityEngine; // ReSharper disable InconsistentNaming // ReSharper disable IdentifierTypo @@ -30,75 +29,25 @@ internal enum BannerAdEvents RecordImpression = 2, Drag = 3 } - - private static SynchronizationContext _context; - private static TaskScheduler _unityScheduler; - - /// - /// Called when an unexpected system error occurred. - /// - // ReSharper disable once InconsistentNaming - public static event ChartboostMediationEvent UnexpectedSystemErrorDidOccur; - - /// - /// Initializes Chartboost Mediation Event Processor, must be called from main thread. - /// - #if UNITY_EDITOR - [InitializeOnLoadMethod] - #endif - [RuntimeInitializeOnLoadMethod] - private static void Initialize() - { - _context ??= SynchronizationContext.Current; - _unityScheduler ??= TaskScheduler.FromCurrentSynchronizationContext(); - } - /// - /// Creates a continuation that executes asynchronously, on the Unity main thread, when the target completes. - /// - /// Target . - /// An action to run when the completes. - /// The type of the result produced by the . - /// A new continuation . - public static Task ContinueWithOnMainThread(this Task task, Action> continuation) + internal enum FullscreenAdQueueEvents { - var ret = Task.Factory.StartNew(async () => - { - await task; - continuation.Invoke(task); - }, CancellationToken.None, TaskCreationOptions.None, _unityScheduler).Unwrap(); - - ret.AppendExceptionLogging(); - return ret; + Update = 0, + RemoveExpiredAd = 1 } /// - /// Creates a continuation that executes asynchronously, on the Unity main thread, when the target completes. + /// Called when an unexpected system error occurred. /// - /// Target . - /// An action to run when the completes. - /// The type of the result produced by the . - /// A new continuation . - public static Task ContinueWithOnMainThread(this Task task, Action continuation) - { - var ret = Task.Factory.StartNew(async () => - { - await task; - continuation.Invoke(task); - }, CancellationToken.None, TaskCreationOptions.None, _unityScheduler).Unwrap(); - ret.AppendExceptionLogging(); - return ret; - } + // ReSharper disable once InconsistentNaming + public static event ChartboostMediationEvent UnexpectedSystemErrorDidOccur; - private static void AppendExceptionLogging(this Task inputTask) - => inputTask.ContinueWith(faultedTask => Debug.LogException(faultedTask.Exception), TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.ExecuteSynchronously); - public static void ProcessEventWithILRD(string dataString, ChartboostMediationILRDEvent ilrdEvent) { if (ilrdEvent == null) return; - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -112,7 +61,7 @@ public static void ProcessEventWithILRD(string dataString, ChartboostMediationIL { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessEventWithPartnerInitializationData(string dataString, ChartboostMediationPartnerInitializationEvent partnerInitializationEvent) @@ -120,7 +69,7 @@ public static void ProcessEventWithPartnerInitializationData(string dataString, if (partnerInitializationEvent == null) return; - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -130,7 +79,7 @@ public static void ProcessEventWithPartnerInitializationData(string dataString, { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessChartboostMediationEvent(string error, ChartboostMediationEvent chartboostMediationEvent) @@ -138,7 +87,7 @@ public static void ProcessChartboostMediationEvent(string error, ChartboostMedia if (chartboostMediationEvent == null) return; - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -148,7 +97,7 @@ public static void ProcessChartboostMediationEvent(string error, ChartboostMedia { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessChartboostMediationPlacementEvent(string placementName, string error, ChartboostMediationPlacementEvent placementEvent) @@ -156,7 +105,7 @@ public static void ProcessChartboostMediationPlacementEvent(string placementName if (placementEvent == null) return; - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -166,7 +115,7 @@ public static void ProcessChartboostMediationPlacementEvent(string placementName { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessChartboostMediationLoadEvent(string placementName, string loadId, string auctionId, string partnerId, double price, string lineItemName, string lineItemId, string error, ChartboostMediationPlacementLoadEvent bidEvent) @@ -174,7 +123,7 @@ public static void ProcessChartboostMediationLoadEvent(string placementName, str if (bidEvent == null) return; - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -185,12 +134,12 @@ public static void ProcessChartboostMediationLoadEvent(string placementName, str { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessChartboostMediationBannerEvent(long adHashCode, int eventType, float x = default, float y = default) { - _context.Post(o => + MainThreadDispatcher.Post(o => { try { @@ -222,20 +171,20 @@ public static void ProcessChartboostMediationBannerEvent(long adHashCode, int ev { ReportUnexpectedSystemError(e.ToString()); } - }, null); + }); } public static void ProcessEvent(Action customEvent) { - _context.Post(o => + MainThreadDispatcher.Post(o => { customEvent?.Invoke(); - }, null); + }); } public static void ProcessFullscreenEvent(long adHashCode, int eventType, string code, string message) { - _context.Post(o => + MainThreadDispatcher.Post(o => { var ad = CacheManager.GetFullscreenAd(adHashCode); @@ -253,28 +202,57 @@ public static void ProcessFullscreenEvent(long adHashCode, int eventType, string { case FullscreenAdEvents.RecordImpression: ad.Request?.OnRecordImpression(ad); + ((ChartboostMediationFullscreenAdBase)ad).OnRecordImpression(ad); break; case FullscreenAdEvents.Click: ad.Request?.OnClick(ad); + ((ChartboostMediationFullscreenAdBase)ad).OnClick(ad); break; case FullscreenAdEvents.Reward: ad.Request?.OnReward(ad); + ((ChartboostMediationFullscreenAdBase)ad).OnReward(ad); break; case FullscreenAdEvents.Expire: ad.Request?.OnExpire(ad); + ((ChartboostMediationFullscreenAdBase)ad).OnExpire(ad); CacheManager.ReleaseFullscreenAd(adHashCode); break; case FullscreenAdEvents.Close: + ((ChartboostMediationFullscreenAdBase)ad).OnClose(ad, error); ad.Request?.OnClose(ad, error); CacheManager.ReleaseFullscreenAd(adHashCode); break; default: return; } - }, null); + }); + } + + public static void ProcessFullscreenAdQueueEvent(long queueHashCode, int eventType, ChartboostMediationAdLoadResult adLoadResult, int numberOfAdsReady) + { + MainThreadDispatcher.Post(o => + { + var queue = CacheManager.GetFullscreenAdQueue(queueHashCode); + + // Queue event was fired but no reference for it exists. Developer did not set strong reference to it so it was gc. + if (queue == null) + return; + + switch ((FullscreenAdQueueEvents)eventType) + { + case FullscreenAdQueueEvents.Update : + ((ChartboostMediationFullscreenAdQueueBase)queue).OnFullscreenAdQueueUpdated(queue, adLoadResult, numberOfAdsReady); + break; + case FullscreenAdQueueEvents.RemoveExpiredAd: + ((ChartboostMediationFullscreenAdQueueBase)queue).OnFullscreenAdQueueDidRemoveExpiredAd(queue, numberOfAdsReady); + break; + default: + throw new ArgumentOutOfRangeException(nameof(eventType), eventType, null); + } + }); } internal static void ReportUnexpectedSystemError(string message) - => _context.Post(o => UnexpectedSystemErrorDidOccur?.Invoke(message), null); + => MainThreadDispatcher.Post(o => UnexpectedSystemErrorDidOccur?.Invoke(message)); } } diff --git a/com.chartboost.mediation/Runtime/Platforms/Android/ChartboostMediationAndroid.Callbacks.cs b/com.chartboost.mediation/Runtime/Platforms/Android/ChartboostMediationAndroid.Callbacks.cs index 1ca91c39..61b2cce3 100644 --- a/com.chartboost.mediation/Runtime/Platforms/Android/ChartboostMediationAndroid.Callbacks.cs +++ b/com.chartboost.mediation/Runtime/Platforms/Android/ChartboostMediationAndroid.Callbacks.cs @@ -178,6 +178,27 @@ private void onAdDrag(AndroidJavaObject ad, float x, float y) } #endregion + + #region FullscreenAd Queue + internal class ChartboostMediationFullscreenAdQueueListener : AndroidJavaProxy + { + internal static readonly ChartboostMediationFullscreenAdQueueListener Instance = new ChartboostMediationFullscreenAdQueueListener(); + private ChartboostMediationFullscreenAdQueueListener() : base(GetQualifiedNativeClassName(AndroidConstants.ClassFullscreenAdQueueListener, true)) {} + + private void onFullScreenAdQueueUpdated(AndroidJavaObject adQueue, AndroidJavaObject adLoadResult, int numberOfAdsReady) + { + var error = adLoadResult.ToChartboostMediationError(); + var loadId = adLoadResult.Get(AndroidConstants.PropertyLoadId); + var metrics = adLoadResult.Get(AndroidConstants.PropertyMetrics).JsonObjectToMetrics(); + var loadResult = new ChartboostMediationAdLoadResult(loadId, metrics, error); + + EventProcessor.ProcessFullscreenAdQueueEvent(adQueue.HashCode(), (int)EventProcessor.FullscreenAdQueueEvents.Update, loadResult, numberOfAdsReady); + } + + private void onFullscreenAdQueueExpiredAdRemoved(AndroidJavaObject adQueue, int numberOfAdsReady) + => EventProcessor.ProcessFullscreenAdQueueEvent(adQueue.HashCode(), (int)EventProcessor.FullscreenAdQueueEvents.RemoveExpiredAd, null, numberOfAdsReady); + } + #endregion } } #endif diff --git a/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.Callbacks.cs b/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.Callbacks.cs index 593bbc5a..ef3f4679 100644 --- a/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.Callbacks.cs +++ b/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.Callbacks.cs @@ -29,24 +29,6 @@ internal sealed partial class ChartboostMediationIOS private delegate void ExternChartboostMediationPlacementEvent(string placementName, string error); private delegate void ExternChartboostMediationPlacementLoadEvent(string placementName, string loadId, string auctionId, string partnerId, double price, string lineItemName, string lineItemId, string error); - private static readonly Dictionary WaitingProxies = new Dictionary(); - - internal static (Later proxy, int hashCode) _setupProxy() { - var proxy = new Later(); - var hashCode = proxy.GetHashCode(); - WaitingProxies[hashCode] = proxy; - return (proxy, hashCode); - } - private static void ResolveCallbackProxy(int hashCode, TResponse response) { - if (!WaitingProxies.ContainsKey(hashCode)) - return; - - if (WaitingProxies[hashCode] is Later later) - later.Complete(response); - - WaitingProxies.Remove(hashCode); - } - [DllImport(IOSConstants.Internal)] private static extern void _setLifeCycleCallbacks(ExternChartboostMediationEvent DidStartCallback, ExternChartboostMediationILRDEvent DidReceiveILRDCallback, ExternChartboostMediationPartnerInitializationDataEvent DidReceivePartnerInitializationDataCallback); @@ -56,6 +38,9 @@ private static extern void _setLifeCycleCallbacks(ExternChartboostMediationEvent [DllImport(IOSConstants.Internal)] private static extern void _setBannerAdCallbacks(ExternChartboostMediationBannerAdEvent bannerAdEvents); + + [DllImport(IOSConstants.Internal)] + private static extern void _setFullscreenAdQueueCallbacks(ExternChartboostMediationFullscreenAdQueueUpdateEvent updateEvent, ExternChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent removeExpiredAdEvent); #region LifeCycle Callbacks [MonoPInvokeCallback(typeof(ExternChartboostMediationEvent))] @@ -86,15 +71,15 @@ private static void FullscreenAdLoadResultCallbackProxy(int hashCode, IntPtr adH var error = new ChartboostMediationError(code, message); adLoadResult = new ChartboostMediationFullscreenAdLoadResult(error); CacheManager.ReleaseFullscreenAdLoadRequest(hashCode); - ResolveCallbackProxy(hashCode, adLoadResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adLoadResult); return; } var winningBid = string.IsNullOrEmpty(winningBidJson) ? new BidInfo() : JsonConvert.DeserializeObject(winningBidJson); var metrics = string.IsNullOrEmpty(metricsJson)? new Metrics() : JsonConvert.DeserializeObject(metricsJson); - var iosAd = new ChartboostMediationFullscreenAdIOS(adHashCode, loadId, CacheManager.GetFullScreenAdLoadRequest(hashCode), winningBid); + var iosAd = new ChartboostMediationFullscreenAdIOS(adHashCode, CacheManager.GetFullScreenAdLoadRequest(hashCode)); adLoadResult = new ChartboostMediationFullscreenAdLoadResult(iosAd, loadId, metrics); - ResolveCallbackProxy(hashCode, adLoadResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adLoadResult); }); } @@ -108,13 +93,13 @@ internal static void FullscreenAdShowResultCallbackProxy(int hashCode, string me { var error = new ChartboostMediationError(code, message); adShowResult = new ChartboostMediationAdShowResult(error); - ResolveCallbackProxy(hashCode, adShowResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adShowResult); return; } var metrics = JsonConvert.DeserializeObject(metricsJson); adShowResult = new ChartboostMediationAdShowResult(metrics); - ResolveCallbackProxy(hashCode, adShowResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adShowResult); }); } @@ -135,14 +120,14 @@ internal static void BannerAdLoadResultCallbackProxy(int hashCode, IntPtr adHash { var error = new ChartboostMediationError(code, message); adLoadResult = new ChartboostMediationBannerAdLoadResult(error); - ResolveCallbackProxy(hashCode, adLoadResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adLoadResult); CacheManager.ReleaseBannerAdLoadRequest(hashCode); return; } var metrics = string.IsNullOrEmpty(metricsJson)? new Metrics() : JsonConvert.DeserializeObject(metricsJson); var size = ChartboostMediationBannerSize.Adaptive(sizeWidth, sizeHeight); adLoadResult = new ChartboostMediationBannerAdLoadResult(loadId, metrics, null, size); - ResolveCallbackProxy(hashCode, adLoadResult); + AwaitableProxies.ResolveCallbackProxy(hashCode, adLoadResult); CacheManager.ReleaseBannerAdLoadRequest(hashCode); }); } @@ -163,8 +148,41 @@ internal static void BannerAdDragEvent(long adHashCode, float x, float y) EventProcessor.ProcessChartboostMediationBannerEvent(adHashCode,(int)EventProcessor.BannerAdEvents.Drag, x, Screen.height - y); } + #endregion + + #region Fullscreen Ad Queue + private delegate void ExternChartboostMediationFullscreenAdQueueUpdateEvent(long hashCode, string loadId, string metricsJson, string code, string message, int numberOfAdsReady); + private delegate void ExternChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent(long hashCode, int numberOfAdsReady); + + [MonoPInvokeCallback(typeof(ExternChartboostMediationFullscreenAdQueueUpdateEvent))] + internal static void FullscreenAdQueueUpdateEvent(long hashCode, string loadId, string metricsJson, string code, string message, + int numberOfAdsReady) + { + ChartboostMediationAdLoadResult loadResult; + + if (!string.IsNullOrEmpty(code) && !string.IsNullOrEmpty(message)) + { + var error = new ChartboostMediationError(code, message); + loadResult = new ChartboostMediationAdLoadResult(error); + } + else + { + var metrics = string.IsNullOrEmpty(metricsJson) ? new Metrics() : JsonConvert.DeserializeObject(metricsJson); + loadResult = new ChartboostMediationAdLoadResult(loadId, metrics, null); + } + EventProcessor.ProcessFullscreenAdQueueEvent(hashCode, (int)EventProcessor.FullscreenAdQueueEvents.Update, loadResult, + numberOfAdsReady); + } + + [MonoPInvokeCallback(typeof(ExternChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent))] + internal static void FullscreenAdQueueRemoveExpiredAdEvent(long hashCode, int numberOfAdsReady) + { + EventProcessor.ProcessFullscreenAdQueueEvent(hashCode, (int)EventProcessor.FullscreenAdQueueEvents.RemoveExpiredAd, null, + numberOfAdsReady); + } #endregion + } } #endif diff --git a/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.cs b/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.cs index e9b1b680..95086618 100644 --- a/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.cs +++ b/com.chartboost.mediation/Runtime/Platforms/IOS/ChartboostMediationIOS.cs @@ -75,14 +75,14 @@ public ChartboostMediationIOS() ExternDidClickRewarded, ExternDidRecordImpressionRewarded, ExternDidReceiveReward); - - _setFullscreenCallbacks(FullscreenAdEvents); - + _setBannerCallbacks(ExternDidLoadBanner, ExternDidRecordImpressionBanner, ExternDidClickBanner); + _setFullscreenCallbacks(FullscreenAdEvents); _setBannerAdCallbacks(BannerAdEvents); + _setFullscreenAdQueueCallbacks(FullscreenAdQueueUpdateEvent, FullscreenAdQueueRemoveExpiredAdEvent); } [Obsolete("Init has been deprecated and will be removed in future versions of the SDK.")] @@ -184,7 +184,7 @@ public override async Task LoadFullsc return await Task.FromResult(adLoadResult); } - var (proxy, hashCode) = _setupProxy(); + var (proxy, hashCode) = AwaitableProxies.SetupProxy(); CacheManager.TrackFullscreenAdLoadRequest(hashCode, request); var keywordsJson = string.Empty; if (request.Keywords.Count > 0) diff --git a/com.chartboost.mediation/Runtime/Plugins/Android/chartboost-mediation-android-bridge.jar b/com.chartboost.mediation/Runtime/Plugins/Android/chartboost-mediation-android-bridge.jar index 13d81389..e8e486c1 100644 Binary files a/com.chartboost.mediation/Runtime/Plugins/Android/chartboost-mediation-android-bridge.jar and b/com.chartboost.mediation/Runtime/Plugins/Android/chartboost-mediation-android-bridge.jar differ diff --git a/com.chartboost.mediation/Runtime/Plugins/iOS/ChartboostMediationUnityBridge.mm b/com.chartboost.mediation/Runtime/Plugins/iOS/ChartboostMediationUnityBridge.mm index e0490cb9..08cc3a7c 100644 --- a/com.chartboost.mediation/Runtime/Plugins/iOS/ChartboostMediationUnityBridge.mm +++ b/com.chartboost.mediation/Runtime/Plugins/iOS/ChartboostMediationUnityBridge.mm @@ -8,12 +8,7 @@ #import #import "UnityAppController.h" #import "ChartboostMediationBannerAdWrapper.h" - -// Converts C style string to NSString -#define GetStringParam(_x_) (_x_ != NULL) ? [NSString stringWithUTF8String:_x_] : [NSString stringWithUTF8String:""] - -// Converts C style string to NSString as long as it isnt empty -#define GetStringParamOrNil(_x_) (_x_ != NULL && strlen(_x_)) ? [NSString stringWithUTF8String:_x_] : nil +#import "ChartboostUnityUtilities.h" typedef void (*ChartboostMediationEvent)(const char* error); typedef void (*ChartboostMediationILRDEvent)(const char* impressionData); @@ -30,60 +25,9 @@ typedef void (*ChartboostMediationBannerAdEvent)(long hashCode, int eventType); typedef void (*ChartboostMediationBannerAdLoadResultEvent)(int hashCode, const void* adHashCode, const char *loadId, const char *metricsJson, float width, float height, const char *code, const char *message); - -typedef void (^block)(void); - -static void sendToMain(block block) { - dispatch_async(dispatch_get_main_queue(), block); -} - -template -TObj objFromJsonString(const char* jsonString) { - NSData* jsonData = [[NSString stringWithUTF8String:jsonString] dataUsingEncoding:NSUTF8StringEncoding]; - NSError* error = nil; - TObj arr = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; - - if (error != nil) - return nil; - - return arr; -} - -static char* ConvertNSStringToCString(const NSString* nsString) { - if (nsString == NULL) return NULL; - const char* nsStringUtf8 = [nsString UTF8String]; - char* cString = (char*)malloc(strlen(nsStringUtf8) + 1); - strcpy(cString, nsStringUtf8); - return cString; -} - -const char * getCStringOrNull(NSString* nsString) { - if (nsString == NULL) - return NULL; - - const char* nsStringUtf8 = [nsString UTF8String]; - //create a null terminated C string on the heap so that our string's memory isn't wiped out right after method's return - char* cString = (char*)malloc(strlen(nsStringUtf8) + 1); - strcpy(cString, nsStringUtf8); - return cString; -} - -const char * toJSON(id _Nonnull data) -{ - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:data options:0 error:&error]; - if (! jsonData) { - NSLog(@"%s: error: %@", __func__, error.localizedDescription); - return ""; - } - NSString *json = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - return getCStringOrNull(json); -} - -const char* dictionaryToJSON(NSDictionary *data) -{ - return toJSON(data); -} +// Fullscreen Queue Events +typedef void (*ChartboostMediationFullscreenAdQueueUpdateEvent)(long hashCode, const char * loadId, const char * metricsJson, const char * code, const char * message, int numberOfAdsReady); +typedef void (*ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent)(long hashCode, int numberOfAdsReady); const char * sizeToJSON(ChartboostMediationBannerSize* size) { @@ -108,7 +52,19 @@ TObj objFromJsonString(const char* jsonString) { } NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:sizeTypeValue,sizeTypeKey,aspectRatioValue,aspectRatioKey,widthValue,widthKey,heightValue,heightKey,typeValue, typeKey, nil]; - return dictionaryToJSON(dict); + return toJSON(dict); +} + +template +TObj objFromJsonString(const char* jsonString) { + NSData* jsonData = [[NSString stringWithUTF8String:jsonString] dataUsingEncoding:NSUTF8StringEncoding]; + NSError* error = nil; + TObj arr = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; + + if (error != nil) + return nil; + + return arr; } const void serializeEvent(ChartboostMediationError *error, ChartboostMediationEvent event) @@ -116,7 +72,7 @@ const void serializeEvent(ChartboostMediationError *error, ChartboostMediationEv if (event == nil) return; - event(error.localizedDescription.UTF8String); + event(toCStringOrNull(error.localizedDescription)); } const void serializePlacementWithError(NSString *placementName, ChartboostMediationError *error, ChartboostMediationPlacementEvent placementEvent) @@ -124,7 +80,7 @@ const void serializePlacementWithError(NSString *placementName, ChartboostMediat if (placementEvent == nil) return; - placementEvent(placementName.UTF8String, error.localizedDescription.UTF8String); + placementEvent(toCStringOrNull(placementName), toCStringOrNull(error.localizedDescription)); } const void serializePlacementLoadWithError(NSString *placementName, NSString *requestIdentifier, NSDictionary *winningBidInfo, ChartboostMediationError *error, ChartboostMediationPlacementLoadEvent placementLoadEvent) @@ -138,7 +94,7 @@ const void serializePlacementLoadWithError(NSString *placementName, NSString *re NSString* lineItemName = [winningBidInfo objectForKey:@"line_item_name"] ?: @""; NSString* lineItemId = [winningBidInfo objectForKey:@"line_item_id"] ?: @""; - placementLoadEvent(placementName.UTF8String, requestIdentifier.UTF8String, auctionId.UTF8String, partnerId.UTF8String, [price doubleValue], lineItemName.UTF8String, lineItemId.UTF8String, error.localizedDescription.UTF8String); + placementLoadEvent(toCStringOrNull(placementName), toCStringOrNull(requestIdentifier), toCStringOrNull(auctionId), toCStringOrNull(partnerId), [price doubleValue], toCStringOrNull(lineItemName), toCStringOrNull(lineItemId), toCStringOrNull([error localizedDescription])); } static ChartboostMediationBannerView * _getBannerView(const void * uniqueId){ @@ -151,9 +107,10 @@ const void serializePlacementLoadWithError(NSString *placementName, NSString *re static NSMutableDictionary * storedWrappers; enum fullscreenEvents {RecordImpression = 0, Click = 1, Reward = 2, Close = 3, Expire = 4}; enum bannerEvents {BannerAppear = 0, BannerClick = 1, BannerRecordImpression = 2 }; +enum fullscreenQueueEvents { QueueUpdate = 0, QueueRemoveExpiredAd = 1 }; -@interface ChartboostMediationObserver : NSObject +@interface ChartboostMediationObserver : NSObject + (instancetype) sharedObserver; @@ -188,6 +145,10 @@ + (instancetype) sharedObserver; // banner callbacks @property ChartboostMediationBannerAdEvent bannerAdEvents; +// fullscreen queue callbacks +@property ChartboostMediationFullscreenAdQueueUpdateEvent fullscreenAdQueueUpdateEvent; +@property ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent fullscreenAdQueueRemoveExpiredAdEvent; + @end @implementation ChartboostMediationObserver @@ -230,7 +191,7 @@ - (void)storeAd:(id)ad placementName:(const char *)placement multiPlacementSuppo [storedAds setObject:ad forKey:key]; } else - [storedAds setObject:ad forKey:GetStringParam(placement)]; + [storedAds setObject:ad forKey:toNSStringOrEmpty(placement)]; } - (void)releaseAd:(NSNumber*)adId placementName:(NSString *)placementName multiPlacementSupport:(BOOL)multiPlacementSupport @@ -266,10 +227,10 @@ - (void)subscribeToPartnerInitializationNotifications partnerInitializationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSNotification.heliumDidReceiveInitResults object:nil queue:nil usingBlock:^(NSNotification * _Nonnull notification) { // Extract the results payload. NSDictionary *results = (NSDictionary *)notification.object; - const char* jsonToUnity = dictionaryToJSON(results); - - if (_didReceivePartnerInitializationDataCallback != nil) - _didReceivePartnerInitializationDataCallback(jsonToUnity); + const char* jsonToUnity = toJSON(results); + + if (self->_didReceivePartnerInitializationDataCallback != nil) + self->_didReceivePartnerInitializationDataCallback(jsonToUnity); }]; } @@ -288,10 +249,10 @@ - (void)subscribeToILRDNotifications placement, @"placementName", json ? json : [NSNull null], @"ilrd", nil]; - const char* jsonToUnity = dictionaryToJSON(data); + const char* jsonToUnity = toJSON(data); - if (_didReceiveILRDCallback != nil) - _didReceiveILRDCallback(jsonToUnity); + if (self ->_didReceiveILRDCallback != nil) + self ->_didReceiveILRDCallback(jsonToUnity); }]; } @@ -303,8 +264,8 @@ - (void)serializeFullscreenEvent: (id)ad fulls if (error != nil) { ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; - code = [[NSString stringWithFormat:@"CM_%ld", codeInt] UTF8String]; - message = [[error localizedDescription] UTF8String]; + code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + message = toCStringOrNull([error localizedDescription]); } _fullscreenAdEvents((long)ad, (int)fullscreenEvent, code, message); @@ -317,6 +278,28 @@ - (void)serializeBannerEvent: (ChartboostMediationBannerView*) ad bannerEvent:(b _bannerAdEvents((long)wrapper, (int)bannerEvent); } +- (void) serializeFullscreenAdQueueUpdateEvent: (ChartboostMediationFullscreenAdQueue *) queue adLoadResult:(ChartboostMediationFullscreenAdLoadResult *)adLoadResult numberOfAdsReady:(int)numberOfAdsReady { + + ChartboostMediationError *error = [adLoadResult error]; + if (error != nil) + { + ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; + const char *code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + const char *message = toCStringOrNull([error localizedDescription]); + _fullscreenAdQueueUpdateEvent((long)queue, "", "", code, message, numberOfAdsReady); + return; + } + + const char *loadId = toCStringOrNull([adLoadResult loadID]); + const char *metricsJson = toJSON([adLoadResult metrics]); + _fullscreenAdQueueUpdateEvent((long)queue, loadId, metricsJson, "", "", numberOfAdsReady); +} + +- (void) serializeFullscreenAdQueueRemoveExpiredAdEvent: (ChartboostMediationFullscreenAdQueue *) queue numberOfAdsReady:(int)numberOfAdsReady +{ + _fullscreenAdQueueRemoveExpiredAdEvent((long)queue, numberOfAdsReady); +} + - (UIViewController*) getBannerViewController: (ChartboostMediationBannerView*) bannerView size:(CGSize)size x:(float) x y:(float) y { UIViewController *unityVC = GetAppController().rootViewController; @@ -507,7 +490,7 @@ - (void)didExpireWithAd:(id _Nonnull)ad { #pragma mark ChartboostMediationBannerAdDelegate - (void)willAppearWithBannerView:(ChartboostMediationBannerView *)bannerView { // run on next iteration of the run loop - sendToMain(^{ + toMain(^{ [self serializeBannerEvent:bannerView bannerEvent:BannerAppear]; }); } @@ -520,6 +503,15 @@ - (void)didRecordImpressionWithBannerView:(ChartboostMediationBannerView *)banne [self serializeBannerEvent:bannerView bannerEvent:BannerRecordImpression]; } +#pragma mark FullscreenAdQueue +- (void)fullscreenAdQueue:(ChartboostMediationFullscreenAdQueue *)adQueue didFinishLoadingWithResult:(ChartboostMediationAdLoadResult *)didFinishLoadingWithResult numberOfAdsReady:(NSInteger)numberOfAdsReady { + [self serializeFullscreenAdQueueUpdateEvent:adQueue adLoadResult:didFinishLoadingWithResult numberOfAdsReady:numberOfAdsReady]; +} + +- (void)fullscreenAdQueueDidRemoveExpiredAd:(ChartboostMediationFullscreenAdQueue *)adQueue numberOfAdsReady:(NSInteger)numberOfAdsReady { + [self serializeFullscreenAdQueueRemoveExpiredAdEvent:adQueue numberOfAdsReady:numberOfAdsReady]; +} + @end #pragma mark Bridge Functions @@ -568,6 +560,11 @@ void _setBannerAdCallbacks(ChartboostMediationBannerAdEvent bannerEvents){ [[ChartboostMediationObserver sharedObserver] setBannerAdEvents:bannerEvents]; } +void _setFullscreenAdQueueCallbacks(ChartboostMediationFullscreenAdQueueUpdateEvent updateEvent, ChartboostMediationFullscreenAdQueueRemoveExpiredAdEvent removeExpiredAdEvent){ + [[ChartboostMediationObserver sharedObserver] setFullscreenAdQueueUpdateEvent:updateEvent]; + [[ChartboostMediationObserver sharedObserver] setFullscreenAdQueueRemoveExpiredAdEvent:removeExpiredAdEvent]; +} + void _chartboostMediationInit(const char *appId, const char *appSignature, const char *unityVersion, const char** initializationOptions, int initializationOptionsSize) { HeliumInitializationOptions* heliumInitializationOptions = nil; @@ -577,12 +574,12 @@ void _chartboostMediationInit(const char *appId, const char *appSignature, const for (int x = 0; x < initializationOptionsSize; x++) { if(strlen(initializationOptions[x]) > 0) - [initializationPartners addObject:[NSString stringWithUTF8String:initializationOptions[x]]]; + [initializationPartners addObject:toNSStringOrNull(initializationOptions[x])]; } heliumInitializationOptions = [[HeliumInitializationOptions alloc] initWithSkippedPartnerIdentifiers:initializationPartners]; } - [[Helium sharedHelium] startWithAppId:GetStringParam(appId) andAppSignature:GetStringParam(appSignature) options:heliumInitializationOptions delegate:[ChartboostMediationObserver sharedObserver]]; + [[Helium sharedHelium] startWithAppId:toNSStringOrEmpty(appId) andAppSignature:toNSStringOrEmpty(appSignature) options:heliumInitializationOptions delegate:[ChartboostMediationObserver sharedObserver]]; } void _chartboostMediationSetSubjectToCoppa(BOOL isSubject) @@ -607,12 +604,12 @@ void _chartboostMediationSetCCPAConsent(BOOL hasGivenConsent) void _chartboostMediationSetUserIdentifier(const char * userIdentifier) { - [[Helium sharedHelium] setUserIdentifier:GetStringParam(userIdentifier)]; + [[Helium sharedHelium] setUserIdentifier:toNSStringOrEmpty(userIdentifier)]; } -char * _chartboostMediationGetUserIdentifier() +const char * _chartboostMediationGetUserIdentifier() { - return ConvertNSStringToCString([[Helium sharedHelium] userIdentifier]); + return toCStringOrNull([[Helium sharedHelium] userIdentifier]); } float _chartboostMediationGetUIScaleFactor() { @@ -642,10 +639,7 @@ float _chartboostMediationGetUIScaleFactor() { void _chartboostMediationSetTestMode(BOOL isTestModeEnabled) { - Implementation implementation = [[ChartboostMediationObserver sharedObserver] getImplementationFromClassNamed:@"CHBHTestModeHelper" selectorName:@"setIsTestModeEnabled_isForcedOn:"]; - typedef void (*Signature)(id, SEL, BOOL); - Signature function = (Signature)implementation.imp; - function([ChartboostMediationObserver sharedObserver], implementation.selector, isTestModeEnabled); + Helium.isTestModeEnabled = isTestModeEnabled; } void _chartboostMediationDiscardOversizedAds(BOOL shouldDiscard) @@ -680,7 +674,7 @@ void _chartboostMediationDiscardOversizedAds(BOOL shouldDiscard) void * _chartboostMediationGetInterstitialAd(const char *placementName) { - id ad = [[Helium sharedHelium] interstitialAdProviderWithDelegate: [ChartboostMediationObserver sharedObserver] andPlacementName: GetStringParam(placementName)]; + id ad = [[Helium sharedHelium] interstitialAdProviderWithDelegate: [ChartboostMediationObserver sharedObserver] andPlacementName: toNSStringOrEmpty(placementName)]; if (ad == NULL) return NULL; @@ -693,18 +687,18 @@ BOOL _chartboostMediationInterstitialSetKeyword(const void *uniqueId, const char id ad = (__bridge id)uniqueId; if (ad.keywords == nil) ad.keywords = [[HeliumKeywords alloc] init]; - return [ad.keywords setKeyword:GetStringParam(keyword) value:GetStringParam(value)]; + return [ad.keywords setKeyword:toNSStringOrEmpty(keyword) value:toNSStringOrEmpty(value)]; } -char * _chartboostMediationInterstitialRemoveKeyword(const void *uniqueId, const char *keyword) +const char * _chartboostMediationInterstitialRemoveKeyword(const void *uniqueId, const char *keyword) { id ad = (__bridge id)uniqueId; - return ConvertNSStringToCString([ad.keywords removeKeyword:GetStringParam(keyword)]); + return toCStringOrNull([ad.keywords removeKeyword:toNSStringOrEmpty(keyword)]); } void _chartboostMediationInterstitialAdLoad(const void * uniqueId) { - sendToMain(^{ + toMain(^{ id ad = (__bridge id)uniqueId; [ad loadAd]; }); @@ -718,7 +712,7 @@ void _chartboostMediationInterstitialClearLoaded(const void * uniqueId) void _chartboostMediationInterstitialAdShow(const void * uniqueId) { - sendToMain(^{ + toMain(^{ id ad = (__bridge id)uniqueId; [ad showAdWithViewController: UnityGetGLViewController()]; }); @@ -732,7 +726,7 @@ BOOL _chartboostMediationInterstitialAdReadyToShow(const void * uniqueId) void * _chartboostMediationGetRewardedAd(const char *placementName) { - id ad = [[Helium sharedHelium] rewardedAdProviderWithDelegate: [ChartboostMediationObserver sharedObserver] andPlacementName: GetStringParam(placementName)]; + id ad = [[Helium sharedHelium] rewardedAdProviderWithDelegate: [ChartboostMediationObserver sharedObserver] andPlacementName: toNSStringOrEmpty(placementName)]; if (ad == NULL) return NULL; @@ -745,18 +739,18 @@ BOOL _chartboostMediationRewardedSetKeyword(const void *uniqueId, const char *ke id ad = (__bridge id)uniqueId; if (ad.keywords == nil) ad.keywords = [[HeliumKeywords alloc] init]; - return [ad.keywords setKeyword:GetStringParam(keyword) value:GetStringParam(value)]; + return [ad.keywords setKeyword:toNSStringOrEmpty(keyword) value:toNSStringOrEmpty(value)]; } -char * _chartboostMediationRewardedRemoveKeyword(const void *uniqueId, const char *keyword) +const char * _chartboostMediationRewardedRemoveKeyword(const void *uniqueId, const char *keyword) { id ad = (__bridge id)uniqueId; - return ConvertNSStringToCString([ad.keywords removeKeyword:GetStringParam(keyword)]); + return toCStringOrNull([ad.keywords removeKeyword:toNSStringOrEmpty(keyword)]); } void _chartboostMediationRewardedAdLoad(const void * uniqueId) { - sendToMain(^{ + toMain(^{ id ad = (__bridge id)uniqueId; [ad loadAd]; }); @@ -770,7 +764,7 @@ void _chartboostMediationRewardedClearLoaded(const void * uniqueId) void _chartboostMediationRewardedAdShow(const void * uniqueId) { - sendToMain(^{ + toMain(^{ id ad = (__bridge id)uniqueId; [ad showAdWithViewController: UnityGetGLViewController()]; }); @@ -785,52 +779,52 @@ BOOL _chartboostMediationRewardedAdReadyToShow(const void * uniqueId) void _chartboostMediationRewardedAdSetCustomData(const void * uniqueId, const char * customData) { id ad = (__bridge id)uniqueId; - ad.customData = GetStringParam(customData); + ad.customData = toNSStringOrNull(customData); } void _chartboostMediationLoadFullscreenAd(const char *placementName, const char *keywords, int hashCode, ChartboostMediationFullscreenAdLoadResultEvent callback) { NSDictionary *formattedKeywords = objFromJsonString(keywords); - ChartboostMediationAdLoadRequest *loadRequest = [[ChartboostMediationAdLoadRequest alloc] initWithPlacement:GetStringParam(placementName) keywords:formattedKeywords]; + ChartboostMediationAdLoadRequest *loadRequest = [[ChartboostMediationAdLoadRequest alloc] initWithPlacement:toNSStringOrEmpty(placementName) keywords:formattedKeywords]; [[Helium sharedHelium] loadFullscreenAdWithRequest:loadRequest completion:^(ChartboostMediationFullscreenAdLoadResult * adLoadResult) { ChartboostMediationError *error = [adLoadResult error]; if (error != nil) { ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; - const char *code = [[NSString stringWithFormat:@"CM_%ld", codeInt] UTF8String]; - const char *message = [[error localizedDescription] UTF8String]; + const char *code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + const char *message = toCStringOrNull([error localizedDescription]); callback(hashCode, NULL, "", "", "", code, message); return; } id ad = [adLoadResult ad]; - [ad setDelegate:[ChartboostMediationObserver sharedObserver]]; [[ChartboostMediationObserver sharedObserver] storeAd:ad placementName:placementName multiPlacementSupport:true]; - const char *loadId = [[adLoadResult loadID] UTF8String]; - const char *winningBidJson = dictionaryToJSON([ad winningBidInfo]); - const char *metricsJson = dictionaryToJSON([adLoadResult metrics]); + [ad setDelegate:[ChartboostMediationObserver sharedObserver]]; + const char *loadId = toCStringOrNull([adLoadResult loadID]); + const char *winningBidJson = toJSON([ad winningBidInfo]); + const char *metricsJson = toJSON([adLoadResult metrics]); callback(hashCode, (__bridge void*)ad, loadId, winningBidJson, metricsJson, "", ""); }]; } void _chartboostMediationShowFullscreenAd(const void *uniqueId, int hashCode, ChartboostMediationFullscreenAdShowResultEvent callback) { - sendToMain(^{ + toMain(^{ id ad = (__bridge id)uniqueId; [ad showWith:UnityGetGLViewController() completion:^(ChartboostMediationAdShowResult *adShowResult) { ChartboostMediationError *error = [adShowResult error]; if (error != nil) { ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; - const char *code = [[NSString stringWithFormat:@"CM_%ld", codeInt] UTF8String]; - const char *message = [[error localizedDescription] UTF8String]; + const char *code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + const char *message = toCStringOrNull([error localizedDescription]); callback(hashCode, "", code, message); return; } - const char *metricsJson = dictionaryToJSON([adShowResult metrics]); + const char *metricsJson = toJSON([adShowResult metrics]); UnityPause(true); callback(hashCode, metricsJson, "", ""); }]; @@ -839,7 +833,7 @@ void _chartboostMediationShowFullscreenAd(const void *uniqueId, int hashCode, Ch void _chartboostMediationInvalidateFullscreenAd(const void *uniqueId) { - sendToMain(^() { + toMain(^() { id ad = (__bridge id)uniqueId; [ad invalidate]; [[ChartboostMediationObserver sharedObserver] releaseAd: [NSNumber numberWithLong:(long)uniqueId] placementName:nil multiPlacementSupport:true]; @@ -849,9 +843,30 @@ void _chartboostMediationInvalidateFullscreenAd(const void *uniqueId) void _chartboostMediationFullscreenSetCustomData(const void *uniqueId, const char *customData) { id ad = (__bridge id)uniqueId; - [ad setCustomData:GetStringParam(customData)]; + [ad setCustomData:toNSStringOrNull(customData)]; } +const char * _chartboostMediationFullscreenAdLoadId(const void *uniqueId) +{ + id ad = (__bridge id)uniqueId; + return toCStringOrNull([ad loadID]); +} + +const char * _chartboostMediationFullscreenAdWinningBidInfo(const void *uniqueId) +{ + id ad = (__bridge id)uniqueId; + return toJSON([ad winningBidInfo]); +} + +const char * _chartboostMediationFullscreenAdRequest(const void *uniqueId) +{ + id ad = (__bridge id)uniqueId; + NSString * placementKey = @"placementName"; NSString * placemnentValue = ad.request.placement; + NSString * keywordsKey = @"keywords"; NSDictionary * keywordsValue = ad.request.keywords; + + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:placemnentValue,placementKey,keywordsValue,keywordsKey, nil]; + return toJSON(dict); +} __deprecated void * _chartboostMediationGetBannerAd(const char *placementName, long size) @@ -870,7 +885,7 @@ void _chartboostMediationFullscreenSetCustomData(const void *uniqueId, const cha break; } - HeliumBannerView *ad = [[Helium sharedHelium] bannerProviderWithDelegate:[ChartboostMediationObserver sharedObserver] andPlacementName:GetStringParam(placementName) andSize:cbSize]; + HeliumBannerView *ad = [[Helium sharedHelium] bannerProviderWithDelegate:[ChartboostMediationObserver sharedObserver] andPlacementName:toNSStringOrEmpty(placementName) andSize:cbSize]; if (ad == NULL) return NULL; @@ -883,24 +898,24 @@ void _chartboostMediationFullscreenSetCustomData(const void *uniqueId, const cha BOOL _chartboostMediationBannerSetKeyword(const void *uniqueId, const char *keyword, const char *value) { id ad = (__bridge id)uniqueId; - sendToMain(^{ + toMain(^{ if (ad.keywords == nil) ad.keywords = [[HeliumKeywords alloc] init]; }); - return [ad.keywords setKeyword:GetStringParam(keyword) value:GetStringParam(value)]; + return [ad.keywords setKeyword:toNSStringOrEmpty(keyword) value:toNSStringOrEmpty(value)]; } __deprecated -char * _chartboostMediationBannerRemoveKeyword(const void *uniqueId, const char *keyword) +const char * _chartboostMediationBannerRemoveKeyword(const void *uniqueId, const char *keyword) { id ad = (__bridge id)uniqueId; - return ConvertNSStringToCString([ad.keywords removeKeyword:GetStringParam(keyword)]); + return toCStringOrNull([ad.keywords removeKeyword:toNSStringOrEmpty(keyword)]); } __deprecated void _chartboostMediationBannerAdLoad(const void * uniqueId, long screenLocation) { - sendToMain(^{ + toMain(^{ // TopLeft = 0, // TopCenter = 1, // TopRight = 2, @@ -968,7 +983,7 @@ void _chartboostMediationBannerAdLoad(const void * uniqueId, long screenLocation __deprecated void _chartboostMediationBannerClearLoaded(const void * uniqueId) { - sendToMain(^(){ + toMain(^(){ id ad = (__bridge id)uniqueId; [ad clearAd]; }); @@ -977,7 +992,7 @@ void _chartboostMediationBannerClearLoaded(const void * uniqueId) __deprecated void _chartboostMediationBannerRemove(const void * uniqueId) { - sendToMain(^(){ + toMain(^(){ HeliumBannerView* bannerView = (__bridge HeliumBannerView*)uniqueId; [bannerView removeFromSuperview]; [[ChartboostMediationObserver sharedObserver] releaseAd: [NSNumber numberWithLong:(long)uniqueId] placementName:nil multiPlacementSupport:true]; @@ -987,7 +1002,7 @@ void _chartboostMediationBannerRemove(const void * uniqueId) __deprecated void _chartboostMediationBannerSetVisibility(const void * uniqueId, BOOL isVisible) { - sendToMain(^{ + toMain(^{ HeliumBannerView* bannerView = (__bridge HeliumBannerView*)uniqueId; [bannerView setHidden:!isVisible]; }); @@ -996,8 +1011,8 @@ void _chartboostMediationBannerSetVisibility(const void * uniqueId, BOOL isVisib __deprecated void _chartboostMediationFreeAdObject(const void * uniqueId, const char * placementName, bool multiPlacementSupport) { - sendToMain(^(){ - [[ChartboostMediationObserver sharedObserver] releaseAd: [NSNumber numberWithLong:(long)uniqueId] placementName:GetStringParam(placementName) multiPlacementSupport:multiPlacementSupport]; + toMain(^(){ + [[ChartboostMediationObserver sharedObserver] releaseAd: [NSNumber numberWithLong:(long)uniqueId] placementName:toNSStringOrEmpty(placementName) multiPlacementSupport:multiPlacementSupport]; }); } @@ -1026,7 +1041,7 @@ void _chartboostMediationBannerViewLoadAdWithScreenPos(const void *uniqueId, con default: size = [ChartboostMediationBannerSize adaptiveWithWidth:0 maxHeight:0]; break; } - ChartboostMediationBannerLoadRequest *loadRequest = [[ChartboostMediationBannerLoadRequest alloc] initWithPlacement:GetStringParam(placementName) size:size]; + ChartboostMediationBannerLoadRequest *loadRequest = [[ChartboostMediationBannerLoadRequest alloc] initWithPlacement:toNSStringOrEmpty(placementName) size:size]; UIViewController* viewController = [[ChartboostMediationObserver sharedObserver] getBannerViewController:bannerView size:size.size screenLocation:screenLocation]; // Load @@ -1035,14 +1050,14 @@ void _chartboostMediationBannerViewLoadAdWithScreenPos(const void *uniqueId, con if (error != nil) { ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; - const char *code = [[NSString stringWithFormat:@"CM_%ld", codeInt] UTF8String]; - const char *message = [[error localizedDescription] UTF8String]; + const char *code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + const char *message = toCStringOrNull([error localizedDescription]); callback(hashCode, uniqueId, "", "", 0, 0, code, message); return; } - const char *loadId = [[adLoadResult loadID] UTF8String]; - const char *metricsJson = dictionaryToJSON([adLoadResult metrics]); + const char *loadId = toCStringOrNull([adLoadResult loadID]); + const char *metricsJson = toJSON([adLoadResult metrics]); float width = adLoadResult.size.size.width; float height = adLoadResult.size.size.height; callback(hashCode, uniqueId, loadId, metricsJson, width, height, "", ""); @@ -1064,7 +1079,7 @@ void _chartboostMediationBannerViewLoadAdWithXY(const void *uniqueId, const char default: size = [ChartboostMediationBannerSize adaptiveWithWidth:0 maxHeight:0]; break; } - ChartboostMediationBannerLoadRequest *loadRequest = [[ChartboostMediationBannerLoadRequest alloc] initWithPlacement:GetStringParam(placementName) size:size]; + ChartboostMediationBannerLoadRequest *loadRequest = [[ChartboostMediationBannerLoadRequest alloc] initWithPlacement:toNSStringOrEmpty(placementName) size:size]; UIViewController* viewController = [[ChartboostMediationObserver sharedObserver] getBannerViewController:bannerView size:size.size x:x y:y]; // Load @@ -1073,14 +1088,14 @@ void _chartboostMediationBannerViewLoadAdWithXY(const void *uniqueId, const char if (error != nil) { ChartboostMediationErrorCode codeInt = [error chartboostMediationCode]; - const char *code = [[NSString stringWithFormat:@"CM_%ld", codeInt] UTF8String]; - const char *message = [[error localizedDescription] UTF8String]; + const char *code = toCStringOrNull([NSString stringWithFormat:@"CM_%ld", codeInt]); + const char *message = toCStringOrNull([error localizedDescription]); callback(hashCode, uniqueId, "", "", 0, 0, code, message); return; } - const char *loadId = [[adLoadResult loadID] UTF8String]; - const char *metricsJson = dictionaryToJSON([adLoadResult metrics]); + const char *loadId = toCStringOrNull([adLoadResult loadID]); + const char *metricsJson = toJSON([adLoadResult metrics]); float width = adLoadResult.size.size.width; float height = adLoadResult.size.size.height; callback(hashCode, uniqueId, loadId, metricsJson, width, height, "", ""); @@ -1117,14 +1132,14 @@ void _chartboostMediationBannerViewSetKeywords(const void* uniqueId, const char const char * _chartboostMediationBannerViewGetWinningBidInfo(const void* uniqueId){ ChartboostMediationBannerView *bannerView = _getBannerView(uniqueId); if(bannerView.winningBidInfo != nil) - return dictionaryToJSON(bannerView.winningBidInfo); + return toJSON(bannerView.winningBidInfo); return NULL; } const char * _chartboostMediationBannerViewGetLoadMetrics(const void* uniqueId){ ChartboostMediationBannerView *bannerView = _getBannerView(uniqueId); if(bannerView.loadMetrics != nil) - return dictionaryToJSON(bannerView.loadMetrics); + return toJSON(bannerView.loadMetrics); return NULL; } @@ -1172,7 +1187,7 @@ void _chartboostMediationBannerViewReset(const void* uniqueId){ void _chartboostMediationBannerViewDestroy(const void * uniqueId) { - sendToMain(^(){ + toMain(^(){ ChartboostMediationBannerView* bannerView = _getBannerView(uniqueId); [bannerView removeFromSuperview]; [[ChartboostMediationObserver sharedObserver] releaseAd: [NSNumber numberWithLong:(long)uniqueId] placementName:nil multiPlacementSupport:true]; @@ -1183,7 +1198,7 @@ void _chartboostMediationBannerViewDestroy(const void * uniqueId) void _chartboostMediationBannerViewMoveTo(const void * uniqueId, float x, float y) { - sendToMain(^(){ + toMain(^(){ ChartboostMediationBannerView* bannerView = _getBannerView(uniqueId); CGRect frame = bannerView.frame; CGPoint origin = bannerView.frame.origin; @@ -1196,11 +1211,15 @@ void _chartboostMediationBannerViewMoveTo(const void * uniqueId, float x, float const char * _chartboostMediationGetPartnerConsentDictionary() { NSDictionary* consents = [[Helium sharedHelium] partnerConsents]; - return dictionaryToJSON(consents); + return toJSON(consents); } void _chartboostMediationSetPartnerConsent(const char* partnerIdentifier, bool consentGranted){ - NSString* partnerId = GetStringParam(partnerIdentifier); + + if (partnerIdentifier == nil) + return; + + NSString* partnerId = toNSStringOrEmpty(partnerIdentifier); NSNumber* consentValue = [NSNumber numberWithBool:consentGranted]; NSMutableDictionary* mutableCopy = [[[Helium sharedHelium] partnerConsents] mutableCopy]; [mutableCopy setValue:consentValue forKey:partnerId]; @@ -1227,7 +1246,7 @@ void _chartboostMediationClearConsents() int _chartboostMediationRemovePartnerConsent(const char* partnerIdentifier) { - NSString* partnerId = GetStringParam(partnerIdentifier); + NSString* partnerId = toNSStringOrEmpty(partnerIdentifier); NSMutableDictionary* mutableCopy = [[[Helium sharedHelium] partnerConsents] mutableCopy]; NSNumber* previousValue = [[mutableCopy valueForKey:partnerId] copy]; @@ -1239,4 +1258,76 @@ int _chartboostMediationRemovePartnerConsent(const char* partnerIdentifier) return [previousValue intValue]; } +void * _chartboostMediationFullscreenAdQueueQueue(const char * placementName) +{ + ChartboostMediationFullscreenAdQueue * queue = [ChartboostMediationFullscreenAdQueue queueForPlacement:toNSStringOrEmpty(placementName)]; + // TODO: This will reset the delegate on the queue with same placement name. Should be fine though ? + [queue setDelegate:[ChartboostMediationObserver sharedObserver]]; + return (__bridge void *)queue; +} + + +void _chartboostMediationFullscreenAdQueueSetKeywords(const void * uniqueId, const char * keywordsJson) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + NSMutableDictionary *formattedKeywords = objFromJsonString(keywordsJson); + [queue setKeywords:formattedKeywords]; +} + + +int _chartboostMediationFullscreenAdQueueQueueCapacity(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + return queue.queueCapacity; +} + + +int _chartboostMediationFullscreenAdQueueNumberOfAdsReady(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + return queue.numberOfAdsReady; +} + + +bool _chartboostMediationFullscreenAdQueueIsRunning(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + return queue.isRunning; +} + +void * _chartboostMediationFullscreenAdQueueGetNextAd(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue* queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + id ad = [queue getNextAd]; + const char * placementName = toCStringOrNull(ad.request.placement); + [[ChartboostMediationObserver sharedObserver] storeAd:ad placementName:placementName multiPlacementSupport:true]; + [ad setDelegate:[ChartboostMediationObserver sharedObserver]]; + + return (__bridge void*)ad; +} + +bool _chartboostMediationFullscreenAdQueueHasNextAd(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + return queue.hasNextAd; +} + +void _chartboostMediationFullscreenAdQueueStart(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + [queue start]; +} + +void _chartboostMediationFullscreenAdQueueStop(const void * uniqueId) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + [queue stop]; +} + +void _chartboostMediationFullscreenAdQueueSetCapacity(const void * uniqueId, int capacity) +{ + ChartboostMediationFullscreenAdQueue * queue = (__bridge ChartboostMediationFullscreenAdQueue *)uniqueId; + [queue setQueueCapacity:capacity]; +} + } diff --git a/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs new file mode 100644 index 00000000..e304613c --- /dev/null +++ b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs @@ -0,0 +1,46 @@ +namespace Chartboost.Requests +{ + /// + /// The Chartboost Mediation Banner ad load result. + /// + public class ChartboostMediationAdLoadResult + { + /// + /// Constructor for successful loads + /// + /// + /// + /// + public ChartboostMediationAdLoadResult(string loadId, Metrics? metrics, ChartboostMediationError? error) + { + LoadId = loadId; + Metrics = metrics; + Error = error; + } + + /// + /// Constructor for failed loads + /// + public ChartboostMediationAdLoadResult(ChartboostMediationError error) + { + LoadId = string.Empty; + Metrics = null; + Error = error; + } + + /// + /// The identifier for this load call. + /// + public string LoadId { get; } + + /// + /// Metrics data for the ad load event. + /// + public Metrics? Metrics { get; } + + /// + /// The error that occurred during the ad load event, if any. + /// + public ChartboostMediationError? Error { get; } + } +} diff --git a/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs.meta b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs.meta new file mode 100644 index 00000000..7ea68cb7 --- /dev/null +++ b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationAdLoadResult.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7c57138ca19849599535d370bd9dbce3 +timeCreated: 1706742166 diff --git a/com.chartboost.mediation/Runtime/Requests/ChartboostMediationFullscreenAdLoadRequest.cs b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationFullscreenAdLoadRequest.cs index 9085984d..bd24295b 100644 --- a/com.chartboost.mediation/Runtime/Requests/ChartboostMediationFullscreenAdLoadRequest.cs +++ b/com.chartboost.mediation/Runtime/Requests/ChartboostMediationFullscreenAdLoadRequest.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Chartboost.AdFormats.Fullscreen; @@ -18,26 +19,31 @@ public sealed class ChartboostMediationFullscreenAdLoadRequest : ChartboostMedia /// /// Called when the ad executes its click-through. This may happen multiple times for the same ad. /// + [Obsolete("Events on `ChartboostMediationFullscreenAdLoadRequest` are deprecated. Use DidClick event from `IChartboostMediationFullscreenAd` object instead")] public event ChartboostMediationFullscreenAdEvent DidClick; /// /// Called when the ad is closed. /// + [Obsolete("Events on `ChartboostMediationFullscreenAdLoadRequest` are deprecated. Use DidClose event from `IChartboostMediationFullscreenAd` object instead")] public event ChartboostMediationFullscreenAdEventWithError DidClose; /// /// Called when the ad is expired by the partner SDK/adapter. /// + [Obsolete("Events on `ChartboostMediationFullscreenAdLoadRequest` are deprecated. Use DidExpire event from `IChartboostMediationFullscreenAd` object instead")] public event ChartboostMediationFullscreenAdEvent DidExpire; /// /// Called when an ad impression occurs. This signal is when Chartboost Mediation fires an impression and is independent of any partner impression. /// + [Obsolete("Events on `ChartboostMediationFullscreenAdLoadRequest` are deprecated. Use DidRecordImpression event from `IChartboostMediationFullscreenAd` object instead")] public event ChartboostMediationFullscreenAdEvent DidRecordImpression; /// /// Called when the user should receive the reward associated with this rewarded ad. /// + [Obsolete("Events on `ChartboostMediationFullscreenAdLoadRequest` are deprecated. Use DidReward event from `IChartboostMediationFullscreenAd` object instead")] public event ChartboostMediationFullscreenAdEvent DidReward; internal void OnClick(IChartboostMediationFullscreenAd ad) => DidClick?.Invoke(ad); diff --git a/com.chartboost.mediation/Runtime/Utilities/AndroidConstants.cs b/com.chartboost.mediation/Runtime/Utilities/AndroidConstants.cs index 9d6f5647..73419dbe 100644 --- a/com.chartboost.mediation/Runtime/Utilities/AndroidConstants.cs +++ b/com.chartboost.mediation/Runtime/Utilities/AndroidConstants.cs @@ -6,7 +6,7 @@ internal static class AndroidConstants internal const string NamespaceChartboostMediationBridge = "com.chartboost.mediation"; internal const string NamespaceNativeChartboostMediationSDK = "com.chartboost.heliumsdk"; - + internal const string ClassUnityBridge = "UnityBridge"; internal const string ClassHeliumSdk = "HeliumSdk"; internal const string ClassUnityPlayer = "com.unity3d.player.UnityPlayer"; @@ -45,8 +45,10 @@ internal static class AndroidConstants internal const string FunSubscribeIlrd = "subscribeIlrd"; internal const string FunSubscribeInitializationResults = "subscribeInitializationResults"; internal const string FunShowFullscreenAd = "showFullscreenAd"; + internal const string FunGetFullscreenAdQueue = "getFullscreenAdQueue"; internal const string FunSetupEventListeners = "setupEventListeners"; internal const string FunStart = "start"; + internal const string FunSetCapacity = "setCapacity"; internal const string FunSetSubjectToCoppa = "setSubjectToCoppa"; internal const string FunSetSubjectToGDPR = "setSubjectToGDPR"; internal const string FunSetUserHasGivenConsent = "setUserHasGivenConsent"; @@ -89,7 +91,7 @@ internal static class AndroidConstants internal const string FunEntrySet = "entrySet"; internal const string FunGetKey = "getKey"; internal const string FunGetValue = "getValue"; - + internal const string PropertyChartboostMediationError = "chartboostMediationError"; internal const string PropertyAd = "ad"; internal const string PropertyMetrics = "metrics"; @@ -115,5 +117,17 @@ internal static class AndroidConstants internal const string BannerSizeMedium = "MEDIUM"; internal const string BannerSizeLeaderboard = "LEADERBOARD"; internal const string BannerSizeAdaptive = "ADAPTIVE"; + + internal const string PropertyQueueCapacity = "queueCapacity"; + internal const string PropertyNumberOfAdsReady = "getNumberOfAdsReady"; + internal const string PropertyIsRunning = "isRunning"; + internal const string FunHasNextAd = "hasNextAd"; + internal const string FunStop = "stop"; + internal const string FunGetNextAd = "getNextAd"; + internal const string PropertyKeywords = "keywords"; + internal const string PropertyRequest = "request"; + internal const string PropertyPlacementName = "placementName"; + internal const string ClassFullscreenAdQueueListener = "ChartboostMediationFullscreenAdQueueListener"; + internal const string FunChartboostMediationFullscreenAdListener = "setListener"; } } diff --git a/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs b/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs deleted file mode 100644 index a855e26c..00000000 --- a/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using UnityEngine; - -namespace Chartboost.Utilities -{ - internal class AwaitableAndroidJavaProxy : AndroidJavaProxy - { - public TaskAwaiter GetAwaiter() - { - if (_taskCompletionSource != null) - return _taskCompletionSource.Task.GetAwaiter(); - - _taskCompletionSource = new TaskCompletionSource(); - - if (_isComplete) - _setResult(); - else - DidComplete += result => _setResult(); - - return _taskCompletionSource.Task.GetAwaiter(); - } - - protected AwaitableAndroidJavaProxy(string nativeInterface) : base(nativeInterface) { } - - protected void _complete(TResult result) - { - if (_isComplete) - return; - - _result = result; - var toComplete = DidComplete; - DidComplete = null; - _isComplete = true; - toComplete?.Invoke(_result); - } - - private void _setResult() - { - try - { - _taskCompletionSource.TrySetResult(_result); - } - catch (ObjectDisposedException e) - { - Debug.Log(e.Message); - } - } - - private TaskCompletionSource _taskCompletionSource; - private event Action DidComplete; - private TResult _result; - private bool _isComplete; - } -} diff --git a/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs.meta b/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs.meta deleted file mode 100644 index 18d9814e..00000000 --- a/com.chartboost.mediation/Runtime/Utilities/AwaitableAndroidJavaProxy.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 9fca183b60b2444ab5ec17f0455a4122 -timeCreated: 1684172414 \ No newline at end of file diff --git a/com.chartboost.mediation/Runtime/Utilities/CacheManager.cs b/com.chartboost.mediation/Runtime/Utilities/CacheManager.cs index 781fafba..06c18b21 100644 --- a/com.chartboost.mediation/Runtime/Utilities/CacheManager.cs +++ b/com.chartboost.mediation/Runtime/Utilities/CacheManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Chartboost.AdFormats.Banner; using Chartboost.AdFormats.Fullscreen; +using Chartboost.AdFormats.Fullscreen.Queue; using Chartboost.Requests; namespace Chartboost.Utilities @@ -28,6 +29,11 @@ public static class CacheManager /// private static readonly Dictionary BannerAdLoadRequests; + /// + /// Weak reference cache to fullscreen ad queues. if publishers do not keep a strong ref, this will make sure they get disposed as needed. + /// + private static readonly Dictionary> FullscreenAdQueueCache; + static CacheManager() { FullscreenCache = new Dictionary>(); @@ -35,6 +41,8 @@ static CacheManager() BannerCache = new Dictionary>(); BannerAdLoadRequests = new Dictionary(); + + FullscreenAdQueueCache = new Dictionary>(); } #region Fullscreen @@ -181,8 +189,43 @@ public static void ReleaseBannerAdLoadRequest(long hashCode) #endregion + #region Fullscreen Ad Queue + /// + /// Keeps track of a with a weak reference so it can be disposed by GC. + /// + /// Associated hashCode. + /// Fullscreen ad to cache. + public static void TrackFullscreenAdQueue(long hashCode, ChartboostMediationFullscreenAdQueue queue) + => FullscreenAdQueueCache[hashCode] = new WeakReference(queue, false); + + /// + /// Retrieves a by hashcode if any. + /// + /// Associated hashCode. + /// Cached . + public static ChartboostMediationFullscreenAdQueue GetFullscreenAdQueue(long hashCode) + { + if (!FullscreenAdQueueCache.ContainsKey(hashCode)) + return null; + + var queue = FullscreenAdQueueCache[hashCode].TryGetTarget(out var fullscreenAdQueue); + return queue ? fullscreenAdQueue : null; + } + + /// + /// Releases a from the cache. + /// + /// Associated hashCode. + public static void ReleaseFullscreenAdQueue(long hashCode) + { + if (FullscreenAdQueueCache.ContainsKey(hashCode)) + FullscreenAdQueueCache.Remove(hashCode); + } + #endregion + public static string CacheInfo() => $"CacheManager : \n" + $"Fullscreen Cache: {FullscreenCache.Count}, FullscreenAdLoadRequest: {FullscreenAdLoadRequests.Count}\n" + - $"Banner Cache: {BannerCache.Count}, BannerAdLoadRequest: {BannerAdLoadRequests.Count}\n"; + $"Banner Cache: {BannerCache.Count}, BannerAdLoadRequest: {BannerAdLoadRequests.Count}\n" + + $"Fullscreen Ad Queue Cache: {FullscreenAdQueueCache.Count}\n"; } } diff --git a/com.chartboost.mediation/Runtime/Utilities/Later.cs b/com.chartboost.mediation/Runtime/Utilities/Later.cs deleted file mode 100644 index baad6953..00000000 --- a/com.chartboost.mediation/Runtime/Utilities/Later.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; - -namespace Chartboost.Utilities -{ - /// For referencing generically - public interface ILater { } - - /// Read-only interface for a standard - public interface ILater : ILater - { - event Action OnComplete; - - TaskAwaiter GetAwaiter(); - } - - /// Basic Later for passing a single type to callbacks and awaiters - public class Later : BaseLater - { - public void Complete(TResult result) => _complete(result); - } - - /// Separated implementation so the derivations can offer different methods for completion - public abstract class BaseLater : ILater - { - public event Action OnComplete - { - remove => DidComplete -= value; - add - { - if (_isComplete) - DidComplete += value; - else - value?.Invoke(_result); - } - } - - public TaskAwaiter GetAwaiter() - { - if (_completionSource != null) - return _completionSource.Task.GetAwaiter(); - - _completionSource = new TaskCompletionSource(); - - if (_isComplete) - _completionSource.TrySetResult(_result); - else - DidComplete += result => _completionSource.TrySetResult(result); - - return _completionSource.Task.GetAwaiter(); - } - - protected void _complete(TResult result) - { - if (_isComplete) - return; - - _result = result; - - var toComplete = DidComplete; - DidComplete = null; - - _isComplete = true; - toComplete?.Invoke(_result); - } - - private TaskCompletionSource _completionSource; - private event Action DidComplete; - private bool _isComplete; - private TResult _result; - } -} diff --git a/com.chartboost.mediation/Runtime/Utilities/Later.cs.meta b/com.chartboost.mediation/Runtime/Utilities/Later.cs.meta deleted file mode 100644 index 6cfc5c4c..00000000 --- a/com.chartboost.mediation/Runtime/Utilities/Later.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1fb44817999b4f4dba8ad693775c4da1 -timeCreated: 1684864390 \ No newline at end of file diff --git a/com.chartboost.mediation/Runtime/com.chartboost.mediation.asmdef b/com.chartboost.mediation/Runtime/com.chartboost.mediation.asmdef index ae9c82cc..7aa18c4d 100644 --- a/com.chartboost.mediation/Runtime/com.chartboost.mediation.asmdef +++ b/com.chartboost.mediation/Runtime/com.chartboost.mediation.asmdef @@ -1,7 +1,9 @@ { "name": "com.chartboost.mediation", "rootNamespace": "Chartboost", - "references": [], + "references": [ + "Chartboost.Threading" + ], "includePlatforms": [ "Android", "Editor", diff --git a/com.chartboost.mediation/Tests/Editor/TaskTests.cs b/com.chartboost.mediation/Tests/Editor/TaskTests.cs deleted file mode 100644 index 33e3d373..00000000 --- a/com.chartboost.mediation/Tests/Editor/TaskTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Chartboost.Events; -using NUnit.Framework; -using UnityEngine; -using UnityEngine.TestTools; - -namespace Chartboost.Tests.Editor -{ - public class TaskTests - { - private const string DummyTaskException = "Dummy Task Exception"; - - [UnityTest] - public IEnumerator TestContinueWithMainThreadCompletion() - { - var task = DummyTask(false).ContinueWithOnMainThread(t => Debug.Log("Task complete")); - - Debug.Log("Awaiting task completion...."); - yield return new WaitUntil(() => task.IsCompleted); - - Assert.False(task.Status == TaskStatus.Faulted); - Assert.True(task.Status == TaskStatus.RanToCompletion); - } - - [UnityTest] - public IEnumerator TestContinueWithMainThreadException() - { - var task = DummyTask(true).ContinueWithOnMainThread(t => Debug.Log("Task complete")); - - Debug.Log("Awaiting task completion...."); - yield return new WaitUntil(() => task.IsCompleted); - - LogAssert.Expect(LogType.Exception, new Regex($"Exception: {DummyTaskException}*")); - - Assert.True(task.Status == TaskStatus.Faulted); - Assert.False(task.Status == TaskStatus.RanToCompletion); - } - - private async Task DummyTask(bool throwException) - { - await Task.Delay(1000); - - if (throwException) - { - throw new Exception(DummyTaskException); - } - } - } -} diff --git a/com.chartboost.mediation/Tests/Editor/TaskTests.cs.meta b/com.chartboost.mediation/Tests/Editor/TaskTests.cs.meta deleted file mode 100644 index 9ac383a8..00000000 --- a/com.chartboost.mediation/Tests/Editor/TaskTests.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 820355d2da00434393e6ec90e0bd0ccd -timeCreated: 1702422807 \ No newline at end of file diff --git a/com.chartboost.mediation/Tests/Editor/VersionCheckTests.cs b/com.chartboost.mediation/Tests/Editor/VersionCheckTests.cs deleted file mode 100644 index 6c2ccb13..00000000 --- a/com.chartboost.mediation/Tests/Editor/VersionCheckTests.cs +++ /dev/null @@ -1,115 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Xml; -using NUnit.Framework; -using UnityEngine; - -namespace Chartboost.Tests.Editor -{ - public class VersionCheckTests - { - private const string ChartboostMediationUPMPackageName = "com.chartboost.mediation"; - private const string ChartboostMediationNuGetPackageName = "Chartboost.CSharp.Mediation.Unity"; - private const string NuGetVersionXPath = "/package/metadata/version"; - private const string NuGetXmlNamespace = "ns"; - private static readonly string NuGetVersionXPathWithNameSpace = $"/{NuGetXmlNamespace}:package/{NuGetXmlNamespace}:metadata/{NuGetXmlNamespace}:version"; - - [SetUp] - public void Setup() - { - Debug.Log($"SDK Version : {ChartboostMediation.Version}"); - } - - [Test] - public void CompareUPMVersionWithSDKVersion() - { - Debug.Log($"ChartboostMediationPackageLocation => {ChartboostMediationPackageLocation}"); - var packageJson = Directory.GetFiles(ChartboostMediationPackageLocation, "*.json").First(); - var upmVersion = GetUPMVersion(packageJson); - - Debug.Log($"UPMVersion : {upmVersion}"); - - Assert.AreEqual(ChartboostMediation.Version, upmVersion); - } - - [Test] - public void CompareNuGetVersionWithSDKVersion() - { - Debug.Log($"ChartboostMediationPackageLocation => {ChartboostMediationPackageLocation}"); - var nuspec = Directory.GetFiles(ChartboostMediationPackageLocation, "*.nuspec").First(); - var nuGetVersion = GetNuGetVersion(nuspec); - - Debug.Log($"NuGetVersion : {nuGetVersion}"); - - Assert.AreEqual(ChartboostMediation.Version, nuGetVersion); - } - - private static string ChartboostMediationPackageLocation => Directory.Exists($"Packages/{ChartboostMediationUPMPackageName}") ? - // UPM - $"Packages/{ChartboostMediationUPMPackageName}" : - // Nuget - $"Assets/Packages/{ChartboostMediationNuGetPackageName}.{ChartboostMediation.Version}"; - - private static string GetUPMVersion(string filePath) - { - Debug.Log($"UPM path : {filePath}"); - try - { - var jsonContent = System.IO.File.ReadAllText(filePath); - var jsonData = JsonUtility.FromJson(jsonContent); - return jsonData.version; - } - catch (Exception ex) - { - Debug.LogError($"An error occurred while reading the package.json file: {ex.Message}"); - return null; - } - } - - private static string GetNuGetVersion(string filePath) - { - Debug.Log($"NuGet path : {filePath}"); - var xmlDoc = new XmlDocument(); - - try - { - xmlDoc.Load(filePath); - XmlNode versionNode; - - if (!string.IsNullOrEmpty(xmlDoc.DocumentElement?.NamespaceURI)) - { - // Create an XmlNamespaceManager to handle namespaces - // https://stackoverflow.com/a/1089210 - var namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); - namespaceManager.AddNamespace(NuGetXmlNamespace, xmlDoc.DocumentElement.NamespaceURI); - versionNode = xmlDoc.SelectSingleNode(NuGetVersionXPathWithNameSpace, namespaceManager); - } - else - { - versionNode = xmlDoc.SelectSingleNode(NuGetVersionXPath); - } - - if (versionNode != null) - { - return versionNode.InnerText.Trim(); - } - - Debug.LogError("Version not found in the .nuspec metadata section."); - return null; - } - catch (Exception ex) - { - Debug.LogError($"An error occurred while reading the .nuspec file: {ex.Message}"); - return null; - } - } - } - - [Serializable] - public class PackageJsonData - { - public string version; - // Add other properties as needed - } -} diff --git a/com.chartboost.mediation/Tests/Editor/VersionValidator.cs b/com.chartboost.mediation/Tests/Editor/VersionValidator.cs new file mode 100644 index 00000000..c5672b6e --- /dev/null +++ b/com.chartboost.mediation/Tests/Editor/VersionValidator.cs @@ -0,0 +1,15 @@ +using Chartboost.Editor; +using NUnit.Framework; + +namespace Chartboost.Tests.Editor +{ + public class VersionCheckTests + { + private const string UnityPackageManagerPackageName = "com.chartboost.mediation"; + private const string NuGetPackageName = "Chartboost.CSharp.Mediation.Unity"; + + [Test] + public void ValidateVersion() + => VersionCheck.ValidateVersions(UnityPackageManagerPackageName, NuGetPackageName, ChartboostMediation.Version); + } +} diff --git a/com.chartboost.mediation/Tests/Editor/VersionCheckTests.cs.meta b/com.chartboost.mediation/Tests/Editor/VersionValidator.cs.meta similarity index 100% rename from com.chartboost.mediation/Tests/Editor/VersionCheckTests.cs.meta rename to com.chartboost.mediation/Tests/Editor/VersionValidator.cs.meta diff --git a/com.chartboost.mediation/Tests/Editor/com.chartboost.mediation.tests.editor.asmdef b/com.chartboost.mediation/Tests/Editor/com.chartboost.mediation.tests.editor.asmdef index 718e74ec..e0cbf713 100644 --- a/com.chartboost.mediation/Tests/Editor/com.chartboost.mediation.tests.editor.asmdef +++ b/com.chartboost.mediation/Tests/Editor/com.chartboost.mediation.tests.editor.asmdef @@ -4,7 +4,9 @@ "references": [ "UnityEngine.TestRunner", "UnityEditor.TestRunner", - "com.chartboost.mediation" + "com.chartboost.mediation", + "Chartboost.Threading", + "Chartboost.Utilities.Editor" ], "includePlatforms": [ "Editor" diff --git a/com.chartboost.mediation/Tests/Runtime/ConsentTests.cs b/com.chartboost.mediation/Tests/Runtime/ConsentTests.cs index a7344a0f..4c697882 100644 --- a/com.chartboost.mediation/Tests/Runtime/ConsentTests.cs +++ b/com.chartboost.mediation/Tests/Runtime/ConsentTests.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using NUnit.Framework; using UnityEngine; diff --git a/com.chartboost.mediation/package.json b/com.chartboost.mediation/package.json index e5fa819b..15d659a2 100644 --- a/com.chartboost.mediation/package.json +++ b/com.chartboost.mediation/package.json @@ -1,6 +1,6 @@ { "name": "com.chartboost.mediation", - "version": "4.8.0", + "version": "4.9.0", "displayName": "Chartboost Mediation", "description": "The Chartboost Mediation Unity SDK. Better monetization powered by bidding", "unity": "2020.3", @@ -9,7 +9,9 @@ "changelogUrl": "https://developers.chartboost.com/docs/mediation-unity-changelog", "licensesUrl": "https://answers.chartboost.com/child_article/legal", "dependencies": { - "com.unity.nuget.newtonsoft-json": "3.2.1" + "com.unity.nuget.newtonsoft-json": "3.2.1", + "com.chartboost.unity.threading": "1.0.0", + "com.chartboost.unity.utilities": "1.0.0" }, "keywords": [], "author": {