diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-25 11:06:32 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-25 11:06:32 +0100 |
| commit | 60f1bddda04ec5fa22778abf176171a547dde949 (patch) | |
| tree | 558473316ae408fdc3c43c1160489f158c1f7843 /Penguloon | |
| parent | 99c4ae188b672718af274db915b314358c0862af (diff) | |
inapp billing
Diffstat (limited to 'Penguloon')
| -rw-r--r-- | Penguloon/AdManager.cs | 6 | ||||
| -rw-r--r-- | Penguloon/MainApplication.cs | 63 | ||||
| -rw-r--r-- | Penguloon/Penguloon.csproj | 14 | ||||
| -rw-r--r-- | Penguloon/Properties/AndroidManifest.xml | 3 | ||||
| -rw-r--r-- | Penguloon/app.config | 11 | ||||
| -rw-r--r-- | Penguloon/packages.config | 2 |
6 files changed, 98 insertions, 1 deletions
diff --git a/Penguloon/AdManager.cs b/Penguloon/AdManager.cs index 65f464c..31135a5 100644 --- a/Penguloon/AdManager.cs +++ b/Penguloon/AdManager.cs @@ -24,8 +24,12 @@ namespace Penguloon public static InterstitialAd GameOverAd { get; set; } public static bool GameOverAdLoaded { get; set; } = false; + public static bool Enabled { get; set; } = false; + public static void Load(Main main) { + if (!Enabled) return; + LoadGameOverAd(main); } @@ -42,6 +46,8 @@ namespace Penguloon public static void ShowGameOverAd() { + if (!Enabled) return; + if (GameOverAdLoaded) GameOverAd.Show(); diff --git a/Penguloon/MainApplication.cs b/Penguloon/MainApplication.cs new file mode 100644 index 0000000..767d6f3 --- /dev/null +++ b/Penguloon/MainApplication.cs @@ -0,0 +1,63 @@ +using System; + +using Android.App; +using Android.OS; +using Android.Runtime; +using Plugin.CurrentActivity; + +namespace Penguloon +{ + //You can specify additional application information in this attribute + [Application] + public class MainApplication : Application, Application.IActivityLifecycleCallbacks + { + public MainApplication(IntPtr handle, JniHandleOwnership transer) + :base(handle, transer) + { + } + + public override void OnCreate() + { + base.OnCreate(); + RegisterActivityLifecycleCallbacks(this); + //A great place to initialize Xamarin.Insights and Dependency Services! + } + + public override void OnTerminate() + { + base.OnTerminate(); + UnregisterActivityLifecycleCallbacks(this); + } + + public void OnActivityCreated(Activity activity, Bundle savedInstanceState) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityDestroyed(Activity activity) + { + } + + public void OnActivityPaused(Activity activity) + { + } + + public void OnActivityResumed(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivitySaveInstanceState(Activity activity, Bundle outState) + { + } + + public void OnActivityStarted(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityStopped(Activity activity) + { + } + } +}
\ No newline at end of file diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj index 70adb27..837942b 100644 --- a/Penguloon/Penguloon.csproj +++ b/Penguloon/Penguloon.csproj @@ -62,6 +62,18 @@ <HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\netstandard1.3\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="OpenTK-1.0" /> + <Reference Include="Plugin.CurrentActivity, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll</HintPath> + </Reference> + <Reference Include="Plugin.InAppBilling, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.dll</HintPath> + </Reference> + <Reference Include="Plugin.InAppBilling.Abstractions, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.Abstractions.dll</HintPath> + </Reference> + <Reference Include="Plugin.InAppBilling.VendingLibrary, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.VendingLibrary.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.IO.Compression" /> @@ -117,6 +129,7 @@ <Compile Include="Levels\IceLevel3.cs" /> <Compile Include="Levels\IceLevel2.cs" /> <Compile Include="Levels\WaveManager.cs" /> + <Compile Include="MainApplication.cs" /> <Compile Include="Objects\KingPenguinObject.cs" /> <Compile Include="Objects\MortarObject.cs" /> <Compile Include="Objects\CannonObject.cs" /> @@ -150,6 +163,7 @@ <Compile Include="UserdataManager.cs" /> </ItemGroup> <ItemGroup> + <None Include="app.config" /> <None Include="packages.config" /> <None Include="Resources\AboutResources.txt" /> <None Include="Assets\AboutAssets.txt" /> diff --git a/Penguloon/Properties/AndroidManifest.xml b/Penguloon/Properties/AndroidManifest.xml index 370e54c..04d8e47 100644 --- a/Penguloon/Properties/AndroidManifest.xml +++ b/Penguloon/Properties/AndroidManifest.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.release.penguloon" android:versionCode="8" android:versionName="1.4" android:installLocation="preferExternal"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.release.penguloon" android:versionCode="9" android:versionName="1.4.1" android:installLocation="preferExternal"> <uses-sdk android:targetSdkVersion="19" android:minSdkVersion="19" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="com.android.vending.BILLING" /> <application android:label="Penguloon" android:icon="@drawable/Splash"> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> diff --git a/Penguloon/app.config b/Penguloon/app.config new file mode 100644 index 0000000..dde2c3c --- /dev/null +++ b/Penguloon/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Penguloon/packages.config b/Penguloon/packages.config index c1ab5d1..239ab89 100644 --- a/Penguloon/packages.config +++ b/Penguloon/packages.config @@ -5,6 +5,8 @@ <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="monoandroid44" /> <package id="NETStandard.Library" version="1.6.1" targetFramework="monoandroid44" /> <package id="Newtonsoft.Json" version="10.0.2" targetFramework="monoandroid44" /> + <package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid44" /> + <package id="Plugin.InAppBilling" version="1.2.4" targetFramework="monoandroid44" /> <package id="System.AppContext" version="4.3.0" targetFramework="monoandroid44" /> <package id="System.Collections" version="4.3.0" targetFramework="monoandroid44" /> <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="monoandroid44" /> |
