瀏覽代碼

Icon and build tweaks.

CartBlanche 1 月之前
父節點
當前提交
1cbe6afa5f

+ 3 - 3
AdMob/.vscode/launch.json

@@ -2,17 +2,17 @@
     "version": "0.2.0",
     "configurations": [
         {
-            "name": "MonoGame Android Build, Deploy & Run",
+            "name": "Android Build, Deploy & Run",
             "type": "coreclr",
             "request": "launch",
             "program": "dotnet",
             "args": [
-                "publish", "AdMob.Android.csproj", "-c", "Debug", "-f", "net8.0-android"
+                "run", "--project", "AdMob.Android.csproj", "-c", "Debug", "-f", "net8.0-android"
             ],
             "cwd": "${workspaceFolder}",
             "console": "integratedTerminal",
             "stopAtEntry": false,
-            "postDebugTask": "Install and Run APK"
+            "preLaunchTask": "build-android",
         }
     ]
 }

+ 9 - 5
AdMob/.vscode/tasks.json

@@ -2,10 +2,14 @@
     "version": "2.0.0",
     "tasks": [
         {
-            "label": "Install and Run APK",
-            "type": "shell",
-            "command": "adb install -r bin/Debug/net8.0-android/com.companyname.admob.apk && adb shell monkey -p com.companyname.admob -c android.intent.category.LAUNCHER 1",
-            "problemMatcher": []
-        }
+            "label": "build-android",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "build",
+                "AdMob.Android.csproj"
+            ],
+            "problemMatcher": "$msCompile"
+        },
     ]
 }

+ 3 - 17
AdMob/AdMob.Android.csproj

@@ -6,8 +6,8 @@
     <RootNamespace>MonoGame.Samples.AdMob</RootNamespace>
     <AssemblyName>MonoGame.Samples.AdMob</AssemblyName>
     <AndroidApplication>true</AndroidApplication>
-    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
     <UseMaui>false</UseMaui>
+    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
     <ImplicitUsings>disable</ImplicitUsings>
     <Nullable>disable</Nullable>
     <GenerateAssemblyInfo>true</GenerateAssemblyInfo>
@@ -16,23 +16,9 @@
     <AssemblyProduct>MonoGame AdMob Sample</AssemblyProduct>
   </PropertyGroup>
 
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <DefineConstants>DEBUG;ANDROID</DefineConstants>
-    <AndroidLinkMode>None</AndroidLinkMode>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-  </PropertyGroup>
-
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-    <DefineConstants>ANDROID</DefineConstants>
-    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
-    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
-    <DebugType>none</DebugType>
-  </PropertyGroup>
-
   <ItemGroup>
     <PackageReference Include="MonoGame.Framework.Android" Version="3.8.*" />
-    <PackageReference Include="Xamarin.GooglePlayServices.Ads" Version="120.0.0" />
+    <PackageReference Include="Xamarin.GooglePlayServices.Ads" Version="120.*" />
   </ItemGroup>
 
-</Project>
+</Project>

+ 4 - 4
AdMob/Game1.cs → AdMob/AdMobGame.cs

@@ -11,19 +11,19 @@ using Microsoft.Xna.Framework.Graphics;
 using Microsoft.Xna.Framework.Input;
 using Microsoft.Xna.Framework.Media;
 
-namespace MonoGame.Samples.AdMob
+namespace AdMob
 {
 	/// <summary>
 	/// This is the main type for your game
 	/// </summary>
-	public class Game1 : Game
+	public class AdMobGame : Game
 	{
-		public static Game1 Instance { get; private set; }
+		public static AdMobGame Instance { get; private set; }
 		
 		GraphicsDeviceManager graphics;
 		SpriteBatch spriteBatch;		
 		
-		public Game1 ()  
+		public AdMobGame ()  
 		{
 			Instance = this;
 			graphics = new GraphicsDeviceManager (this);

+ 4 - 4
AdMob/Activity1.cs → AdMob/MainActivity.cs

@@ -10,7 +10,7 @@ using Microsoft.Xna.Framework;
 using Android.Gms.Ads;
 using Android.Content.PM;
 
-namespace MonoGame.Samples.AdMob
+namespace AdMob.Android
 {
     [Activity (
         Label = "AdMob",
@@ -18,9 +18,9 @@ namespace MonoGame.Samples.AdMob
         Icon = "@drawable/icon",
         Theme = "@style/Theme.Splash",
         ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.Keyboard|ConfigChanges.KeyboardHidden)]	
-    public class Activity1 : AndroidGameActivity
+    public class MainActivity : AndroidGameActivity
     {
-        private Game1 _game;
+        private AdMobGame _game;
         private View _view;
 
         protected override void OnCreate(Bundle bundle)
@@ -31,7 +31,7 @@ namespace MonoGame.Samples.AdMob
             MobileAds.Initialize(this);
 
             // Create the MonoGame view
-            _game = new Game1();
+            _game = new AdMobGame();
             _view = _game.Services.GetService(typeof(View)) as View;
 
             // Create a layout to hold both the game and the ad

二進制
AdMob/Resources/drawable/Icon.png


二進制
AdMob/Resources/drawable/Splash.png