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.rewardedAd.OnPaidEvent += this.HandleAdPaidEvent; | |
public void HandleAdPaidEvent(object sender, AdValueEventArgs args) | |
{ | |
AdValue adValue = args.AdValue; | |
Firebase.Analytics.Parameter[] LTVParameters = { | |
new Firebase.Analytics.Parameter("valuemicros", adValue.Value), | |
new Firebase.Analytics.Parameter("currency", adValue.CurrencyCode), |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Runtime.InteropServices; | |
using UnityEngine.UI; | |
using UnityEngine; | |
#if UNITY_IOS || UNITY_TVOS | |
public class NativeAPI { | |
[DllImport("__Internal")] |
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
#import <Foundation/Foundation.h> | |
#import "NativeCallProxy.h" | |
@implementation FrameworkLibAPI | |
id<NativeCallsProtocol> api = NULL; | |
+(void) registerAPIforNativeCalls:(id<NativeCallsProtocol>) aApi | |
{ | |
api = aApi; |
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
// [!] important set UnityFramework in Target Membership for this file | |
// [!] and set Public header visibility | |
#import <Foundation/Foundation.h> | |
// NativeCallsProtocol defines protocol with methods you want to be called from managed | |
@protocol NativeCallsProtocol | |
@required | |
- (void) loadedUnity:(NSString*)status; | |
// other methods |
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
func initUnity() { | |
if let nativeWindow = self.window { | |
if unityIsInitialized() { | |
UnitySampleUtils.showAlert(Constants.ERRORMESSAGES.ALREADY_INIT, Constants.ERRORMESSAGES.UNLOAD_FIREST, window: nativeWindow) | |
return | |
} | |
if didQuit { | |
UnitySampleUtils.showAlert(Constants.ERRORMESSAGES.CANNOTBE_INITIALIZED, Constants.ERRORMESSAGES.USE_UNLOAD, window:nativeWindow) |
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
// | |
// Use this file to import your target's public headers that you would like to expose to Swift. | |
// | |
#import <Foundation/Foundation.h> | |
#include <UnityFramework/UnityFramework.h> | |
#include <UnityFramework/NativeCallProxy.h> |
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
import UIKit | |
import UnityFramework | |
@main | |
class AppDelegate: UIResponder, UIApplicationDelegate, UnityFrameworkListener , NativeCallsProtocol { | |
func showHostMainWindow(_ color: String!) { | |
if(color == Constants.COLOR.BLUE) { | |
self.unitySampleView.nativeTitleLable.backgroundColor = .red | |
self.unitySampleView.nativeTitleLable.textColor = .white | |
} else if(color == Constants.COLOR.RED) { |
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
[UnityFrameworkLoad() unloadApplication]; | |
- (void)unityDidUnload:(NSNotification*)notification | |
{ | |
[[self ufw] unregisterFrameworkListener: self]; | |
[self setUfw: nil]; | |
} |
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
(void)initUnity | |
{ | |
[self setUfw: UnityFrameworkLoad()]; | |
[[self ufw] setDataBundleId: "com.unity3d.framework"]; | |
[[self ufw] registerFrameworkListener: self]; | |
[NSClassFromString(@"FrameworkLibAPI") registerAPIforNativeCalls:self]; | |
[[self ufw] runEmbeddedWithArgc: gArgc argv: gArgv appLaunchOpts: appLaunchOpts]; | |
} |
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
class MutableStack<E>(vararg items: E) { // 1 | |
private val elements = items.toMutableList() | |
fun push(element: E) = elements.add(element) // 2 | |
fun peek(): E = elements.last() // 3 | |
fun pop(): E = elements.removeAt(elements.size - 1) |