-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unity: Breaking out the Android ad event into individual unity callba…
…ck events (#7)
- Loading branch information
1 parent
558cb89
commit 6d8d46c
Showing
21 changed files
with
273 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 30 additions & 56 deletions
86
sample-app/Assets/Example/Scripts/NimbusEventListenerExample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,43 @@ | ||
using System; | ||
using Nimbus.Scripts.Internal; | ||
using Nimbus.Runtime.Scripts.Internal; | ||
using UnityEngine; | ||
|
||
namespace Example.Scripts { | ||
public class NimbusEventListenerExample : MonoBehaviour, IAdEvents { | ||
public void AdWasRendered(NimbusAdUnit nimbusAdUnit) { | ||
public void OnAdWasRendered(NimbusAdUnit nimbusAdUnit) { | ||
Debug.unityLogger.Log( | ||
$"NimbusEventListenerExample Ad was rendered for ad instance {nimbusAdUnit.InstanceID}"); | ||
$"NimbusEventListenerExample Ad was rendered for ad instance {nimbusAdUnit.InstanceID}"); | ||
} | ||
|
||
public void AdError(NimbusAdUnit nimbusAdUnit) { | ||
public void OnAdError(NimbusAdUnit nimbusAdUnit) { | ||
Debug.unityLogger.Log($"NimbusEventListenerExample Err {nimbusAdUnit.ErrorMessage()}"); | ||
} // ReSharper disable SwitchStatementMissingSomeEnumCasesNoDefault | ||
public void AdEvent(NimbusAdUnit nimbusAdUnit) { | ||
Debug.unityLogger.Log( | ||
$"NimbusEventListenerExample AdEvent {nimbusAdUnit.GetCurrentAdState()} for ad of type {nimbusAdUnit.AdType}"); | ||
switch (nimbusAdUnit.AdType) { | ||
// Handle Events for Banner and Interstitial ads | ||
case AdUnityType.Banner: | ||
case AdUnityType.Interstitial: | ||
switch (nimbusAdUnit.GetCurrentAdState()) { | ||
case AdEventTypes.NOT_LOADED: | ||
break; | ||
case AdEventTypes.LOADED: | ||
break; | ||
case AdEventTypes.CLICKED: | ||
break; | ||
case AdEventTypes.IMPRESSION: | ||
break; | ||
case AdEventTypes.DESTROYED: | ||
break; | ||
} | ||
} | ||
|
||
public void OnAdLoaded(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
break; | ||
// Handle Events for Rewarded video ads | ||
case AdUnityType.Rewarded: | ||
switch (nimbusAdUnit.GetCurrentAdState()) { | ||
case AdEventTypes.NOT_LOADED: | ||
break; | ||
case AdEventTypes.LOADED: | ||
break; | ||
case AdEventTypes.PAUSED: | ||
break; | ||
case AdEventTypes.RESUME: | ||
break; | ||
case AdEventTypes.CLICKED: | ||
break; | ||
case AdEventTypes.FIRST_QUARTILE: | ||
break; | ||
case AdEventTypes.MIDPOINT: | ||
break; | ||
case AdEventTypes.THIRD_QUARTILE: | ||
break; | ||
case AdEventTypes.COMPLETED: | ||
break; | ||
case AdEventTypes.IMPRESSION: | ||
break; | ||
case AdEventTypes.DESTROYED: | ||
break; | ||
} | ||
public void OnAdImpression(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
public void OnAdClicked(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
public void OnAdDestroyed(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
public void OnVideoAdPaused(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
public void OnVideoAdResume(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
|
||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException(); | ||
} | ||
public void OnVideoAdCompleted(NimbusAdUnit nimbusAdUnit) { | ||
// TODO | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
sample-app/Packages/AdsByNimbus/Nimbus/Runtime/Plugins/Android/UnityHelper.java.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 36 additions & 8 deletions
44
sample-app/Packages/AdsByNimbus/Nimbus/Runtime/Scripts/Internal/AdEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.