2020-06-14 01:18:12 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Android.App;
|
2020-06-30 19:06:35 +02:00
|
|
|
using Android.Content;
|
2020-06-14 01:18:12 +02:00
|
|
|
using Android.Gms.Ads;
|
2020-06-30 19:06:35 +02:00
|
|
|
using Android.Net;
|
2020-06-29 13:47:45 +02:00
|
|
|
using Android.Views;
|
2020-06-14 01:18:12 +02:00
|
|
|
using Android.Widget;
|
|
|
|
using GameAnalyticsSDK;
|
|
|
|
using GameAnalyticsSDK.Utilities;
|
|
|
|
using TouchyTickets;
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
public class AndroidPlatform : Platform {
|
|
|
|
|
|
|
|
private readonly Activity activity;
|
|
|
|
private readonly LinearLayout adLayout;
|
|
|
|
|
|
|
|
public AndroidPlatform(Activity activity, LinearLayout adLayout) {
|
|
|
|
this.activity = activity;
|
|
|
|
this.adLayout = adLayout;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void SetupAds() {
|
|
|
|
var ad = new AdView(this.activity) {
|
|
|
|
AdUnitId = "ca-app-pub-5754829579653773/7841535920",
|
|
|
|
AdSize = AdSize.SmartBanner
|
|
|
|
};
|
|
|
|
ad.LoadAd(new AdRequest.Builder()
|
|
|
|
.AddTestDevice("14B965C6457E17D2808061ADF7E34923")
|
|
|
|
.Build());
|
|
|
|
this.adLayout.AddView(ad);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void SetupAnalytics(Dictionary<string, object> json) {
|
2020-06-22 22:39:08 +02:00
|
|
|
GameAnalytics.SetAutoDetectAppVersion(true);
|
2020-06-14 01:18:12 +02:00
|
|
|
GameAnalytics.Initialize(this.activity, GA_MiniJSON.JsonEncode(new Hashtable(json)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
|
|
|
|
GameAnalytics.NewResourceEvent(sink ? GAResourceFlowType.Sink : GAResourceFlowType.Source, currency, amount, itemType, itemId);
|
|
|
|
}
|
|
|
|
|
2020-06-29 13:47:45 +02:00
|
|
|
public override void SetKeepScreenOn(bool keep) {
|
|
|
|
if (keep) {
|
|
|
|
this.activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
|
|
|
|
} else {
|
|
|
|
this.activity.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-30 19:06:35 +02:00
|
|
|
public override void OpenRateLink() {
|
|
|
|
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
|
|
|
}
|
|
|
|
|
2020-06-14 01:18:12 +02:00
|
|
|
}
|
|
|
|
}
|