Explorar o código

Added Android AdMob Sample
Updated the CatapultWars demo to support android and iOS

Dean Ellis %!s(int64=13) %!d(string=hai) anos
pai
achega
6a6d0664ee
Modificáronse 26 ficheiros con 523 adicións e 32 borrados
  1. 38 0
      Samples/Android/MonoGame.Samples.AdMob/Activity1.cs
  2. 40 0
      Samples/Android/MonoGame.Samples.AdMob/AdMobHelper.cs
  3. 33 0
      Samples/Android/MonoGame.Samples.AdMob/AdMobHelper.java
  4. 19 0
      Samples/Android/MonoGame.Samples.AdMob/Assets/AboutAssets.txt
  5. 90 0
      Samples/Android/MonoGame.Samples.AdMob/Game1.cs
  6. BIN=BIN
      Samples/Android/MonoGame.Samples.AdMob/GoogleAdMobAdsSdk-4.3.1.jar
  7. 86 0
      Samples/Android/MonoGame.Samples.AdMob/MonoGame.Samples.AdMob.csproj
  8. 9 0
      Samples/Android/MonoGame.Samples.AdMob/Properties/AndroidManifest.xml
  9. 28 0
      Samples/Android/MonoGame.Samples.AdMob/Properties/AssemblyInfo.cs
  10. 44 0
      Samples/Android/MonoGame.Samples.AdMob/Resources/AboutResources.txt
  11. 51 0
      Samples/Android/MonoGame.Samples.AdMob/Resources/Resource.designer.cs
  12. BIN=BIN
      Samples/Android/MonoGame.Samples.AdMob/Resources/drawable/Icon.png
  13. BIN=BIN
      Samples/Android/MonoGame.Samples.AdMob/Resources/drawable/Splash.png
  14. 14 0
      Samples/Android/MonoGame.Samples.AdMob/Resources/layout/Main.axml
  15. 7 0
      Samples/Android/MonoGame.Samples.AdMob/Resources/values/Styles.xml
  16. 28 25
      Samples/Android/MonoGame.Samples.CatapultWars/MonoGame.Samples.CatapultWars.csproj
  17. 10 2
      Samples/MacOS/CatapaultWars/Catapult/Catapult.cs
  18. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/BoulderHit.wav
  19. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/CatapultExplosion.wav
  20. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/CatapultFire.wav
  21. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/Lose.wav
  22. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/RopeStretch.wav
  23. BIN=BIN
      Samples/MacOS/CatapaultWars/Content/Sounds/Win.wav
  24. 6 1
      Samples/MacOS/CatapaultWars/Screens/GameplayScreen.cs
  25. 13 3
      Samples/MacOS/CatapaultWars/Screens/InstructionsScreen.cs
  26. 7 1
      Samples/MonoGame.Samples.Android.sln

+ 38 - 0
Samples/Android/MonoGame.Samples.AdMob/Activity1.cs

@@ -0,0 +1,38 @@
+using System;
+
+using Android.App;
+using Android.Content;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Android.OS;
+using Microsoft.Xna.Framework;
+using AdSense;
+using Android.Content.PM;
+
+namespace MonoGame.Samples.AdMob
+{
+	[Activity (Label = "MonoGame.Samples.AdMob", MainLauncher = true
+	          , Icon = "@drawable/icon", Theme = "@style/Theme.Splash",ConfigurationChanges=ConfigChanges.Orientation|ConfigChanges.Keyboard|ConfigChanges.KeyboardHidden)]	
+	public class Activity1 : AndroidGameActivity
+	{
+		View adView;
+		protected override void OnCreate (Bundle bundle)
+		{
+			base.OnCreate (bundle);
+			Game1.Activity = this;
+			var g = new Game1();
+			FrameLayout fl = new FrameLayout(this);
+			fl.AddView(g.Window);                 
+			adView = AdMobHelper.CreateAdView(this,"publisherid");
+			//AdMobHelper.AddTestDevice(adView,"deviceid");
+			fl.AddView(adView);                        
+			AdMobHelper.RequestFreshAd(adView);
+			SetContentView (fl);            
+			g.Run();  
+			
+		}
+	}
+}
+
+

+ 40 - 0
Samples/Android/MonoGame.Samples.AdMob/AdMobHelper.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+
+using Android.App;
+using Android.Content;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Android.OS;
+
+namespace AdSense
+{
+	public static class AdMobHelper
+	{
+		private static IntPtr _helperClass = JNIEnv.FindClass("MonoGame/AdMobHelper");
+			
+		public static void AddTestDevice(View view,string deviceid)
+		{
+			var s = new Java.Lang.String(deviceid);	
+			IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "addTestDevice", "(Landroid/view/View;Ljava/lang/String;)V");
+			JNIEnv.CallStaticVoidMethod(_helperClass, methodId, new JValue[2] { new JValue(view), new JValue(s) });
+		}
+		
+		public static View CreateAdView(Activity context, string id)
+		{				
+			var s = new Java.Lang.String(id);			
+			IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "createAdView", "(Landroid/app/Activity;Ljava/lang/String;)Landroid/view/View;");
+			IntPtr view = JNIEnv.CallStaticObjectMethod(_helperClass, methodId, new JValue[2] { new JValue(context), new JValue(s) });
+			return new Java.Lang.Object(view, JniHandleOwnership.TransferLocalRef).JavaCast<View>();
+		}
+		
+		public static void RequestFreshAd(View view)
+		{
+			IntPtr methodId = JNIEnv.GetStaticMethodID(_helperClass, "requestFreshAd", "(Landroid/view/View;)V");
+			JNIEnv.CallStaticVoidMethod(_helperClass, methodId, new JValue(view));
+		}
+	}
+}
+
+

+ 33 - 0
Samples/Android/MonoGame.Samples.AdMob/AdMobHelper.java

@@ -0,0 +1,33 @@
+package MonoGame;
+
+import android.view.View;
+import android.app.Activity;
+import com.google.ads.AdView;
+import com.google.ads.AdRequest;
+import com.google.ads.AdSize;
+import java.lang.String;
+
+public class AdMobHelper
+{
+  private AdMobHelper() { }
+  
+  public static void addTestDevice(View view,String deviceid)
+  {
+    AdRequest request = new AdRequest();
+    request.addTestDevice(AdRequest.TEST_EMULATOR);
+    request.addTestDevice(deviceid); 
+    ((AdView)view).loadAd(request);  
+  }
+
+  public static View createAdView(Activity activity, String appid)
+  {
+    // Create the adView
+    AdView view = new AdView(activity, AdSize.BANNER, appid);    
+    return view;
+  }
+
+  public static void requestFreshAd(View view)
+  {
+    ((AdView)view).loadAd(new AdRequest());
+  }
+}

+ 19 - 0
Samples/Android/MonoGame.Samples.AdMob/Assets/AboutAssets.txt

@@ -0,0 +1,19 @@
+Any raw assets you want to be deployed with your application can be placed in
+this directory (and child directories) and given a Build Action of "AndroidAsset".
+
+These files will be deployed with you package and will be accessible using Android's
+AssetManager, like this:
+
+public class ReadAsset : Activity
+{
+	protected override void OnCreate (Bundle bundle)
+	{
+		base.OnCreate (bundle);
+
+		InputStream input = Assets.Open ("my_asset.txt");
+	}
+}
+
+Additionally, some Android functions will automatically load asset files:
+
+Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

+ 90 - 0
Samples/Android/MonoGame.Samples.AdMob/Game1.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+
+#if ANDROID
+using Android.App;
+#endif
+
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Xna.Framework.Storage;
+
+namespace MonoGame.Samples.AdMob
+{
+	/// <summary>
+	/// This is the main type for your game
+	/// </summary>
+	public class Game1 : Microsoft.Xna.Framework.Game
+	{
+		GraphicsDeviceManager graphics;
+		SpriteBatch spriteBatch;		
+		
+		public Game1 ()  
+		{
+			graphics = new GraphicsDeviceManager (this);
+			
+			Content.RootDirectory = "Content";
+			
+			graphics.PreferMultiSampling = true;
+			graphics.IsFullScreen = true;	
+
+			graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight | DisplayOrientation.Portrait;
+		}
+		
+		/// <summary>
+		/// Allows the game to perform any initialization it needs to before starting to run.
+		/// This is where it can query for any required services and load any non-graphic
+		/// related content.  Calling base.Initialize will enumerate through any components
+		/// and initialize them as well.
+		/// </summary>
+		protected override void Initialize ()
+		{
+			// TODO: Add your initialization logic here
+
+			base.Initialize ();
+		}
+
+		/// <summary>
+		/// LoadContent will be called once per game and is the place to load
+		/// all of your content.
+		/// </summary>
+		protected override void LoadContent ()
+		{
+			// Create a new SpriteBatch, which can be used to draw textures.
+			spriteBatch = new SpriteBatch (GraphicsDevice);
+			
+		}
+
+		/// <summary>
+		/// Allows the game to run logic such as updating the world,
+		/// checking for collisions, gathering input, and playing audio.
+		/// </summary>
+		/// <param name="gameTime">Provides a snapshot of timing values.</param>
+		protected override void Update (GameTime gameTime)
+		{
+			if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
+			{
+				Exit();
+			}
+			base.Update (gameTime);
+		}
+
+		/// <summary>
+		/// This is called when the game should draw itself.
+		/// </summary>
+		/// <param name="gameTime">Provides a snapshot of timing values.</param>
+		protected override void Draw (GameTime gameTime)
+		{
+			graphics.GraphicsDevice.Clear (Color.CornflowerBlue);
+			
+			// Won't be visible until we hide the movie
+			spriteBatch.Begin();
+			spriteBatch.End();
+		}
+	}
+}
+
+

BIN=BIN
Samples/Android/MonoGame.Samples.AdMob/GoogleAdMobAdsSdk-4.3.1.jar


+ 86 - 0
Samples/Android/MonoGame.Samples.AdMob/MonoGame.Samples.AdMob.csproj

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DD08D5F1-DE83-41C1-B599-76DC604643EB}</ProjectGuid>
+    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <OutputType>Library</OutputType>
+    <RootNamespace>MonoGame.Samples.AdMob</RootNamespace>
+    <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
+    <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
+    <AndroidResgenClass>Resource</AndroidResgenClass>
+    <AndroidApplication>True</AndroidApplication>
+    <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
+    <AssemblyName>MonoGame.Samples.AdMob</AssemblyName>
+    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;ANDROID</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+    <AndroidLinkMode>None</AndroidLinkMode>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
+    <ConsolePause>false</ConsolePause>
+    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
+    <DefineConstants>ANDROID</DefineConstants>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Core" />
+    <Reference Include="Mono.Android" />
+    <Reference Include="OpenTK" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Activity1.cs" />
+    <Compile Include="Resources\Resource.designer.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Game1.cs" />
+    <Compile Include="AdMobHelper.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\AboutResources.txt" />
+    <None Include="Assets\AboutAssets.txt" />
+    <None Include="Properties\AndroidManifest.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <AndroidResource Include="Resources\values\Styles.xml" />
+    <AndroidResource Include="Resources\drawable\Icon.png" />
+    <AndroidResource Include="Resources\drawable\Splash.png" />
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\MonoGame\MonoGame.Framework\MonoGame.Framework.Android.csproj">
+      <Project>{BA9476CF-99BA-4D03-92F2-73D2C5E58883}</Project>
+      <Name>MonoGame.Framework.Android</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Assets\Content\" />
+    <Folder Include="Resources\values\" />
+    <Folder Include="Resources\drawable\" />
+    <Folder Include="Resources\layout\" />
+  </ItemGroup>
+  <ItemGroup>
+    <AndroidJavaSource Include="AdMobHelper.java" />
+  </ItemGroup>
+  <ItemGroup>
+    <AndroidJavaLibrary Include="GoogleAdMobAdsSdk-4.3.1.jar" />
+  </ItemGroup>
+</Project>

+ 9 - 0
Samples/Android/MonoGame.Samples.AdMob/Properties/AndroidManifest.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="MonoGame.Samples.AdMob">
+	<application android:label="MonoGame.Samples.AdMob" android:icon="@drawable/icon">
+		 <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
+	</application>
+	<uses-sdk />
+	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+	<uses-permission android:name="android.permission.INTERNET" />
+</manifest>

+ 28 - 0
Samples/Android/MonoGame.Samples.AdMob/Properties/AssemblyInfo.cs

@@ -0,0 +1,28 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Android.App;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("MonoGame.Samples.AdMob")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("d_ellis")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.0")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

+ 44 - 0
Samples/Android/MonoGame.Samples.AdMob/Resources/AboutResources.txt

@@ -0,0 +1,44 @@
+Images, layout descriptions, binary blobs and string dictionaries can be included 
+in your application as resource files.  Various Android APIs are designed to 
+operate on the resource IDs instead of dealing with images, strings or binary blobs 
+directly.
+
+For example, a sample Android app that contains a user interface layout (main.axml),
+an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 
+would keep its resources in the "Resources" directory of the application:
+
+Resources/
+    drawable/
+        icon.png
+
+    layout/
+        main.axml
+
+    values/
+        strings.xml
+
+In order to get the build system to recognize Android resources, set the build action to
+"AndroidResource".  The native Android APIs do not operate directly with filenames, but 
+instead operate on resource IDs.  When you compile an Android application that uses resources, 
+the build system will package the resources for distribution and generate a class called "R" 
+(this is an Android convention) that contains the tokens for each one of the resources 
+included. For example, for the above Resources layout, this is what the R class would expose:
+
+public class R {
+    public class drawable {
+        public const int icon = 0x123;
+    }
+
+    public class layout {
+        public const int main = 0x456;
+    }
+
+    public class strings {
+        public const int first_string = 0xabc;
+        public const int second_string = 0xbcd;
+    }
+}
+
+You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 
+to reference the layout/main.axml file, or R.strings.first_string to reference the first 
+string in the dictionary file values/strings.xml.

+ 51 - 0
Samples/Android/MonoGame.Samples.AdMob/Resources/Resource.designer.cs

@@ -0,0 +1,51 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.488
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace MonoGame.Samples.AdMob
+{
+	
+	
+	public partial class Resource
+	{
+		
+		public partial class Attribute
+		{
+			
+			private Attribute()
+			{
+			}
+		}
+		
+		public partial class Drawable
+		{
+			
+			// aapt resource value: 0x7f020000
+			public const int Icon = 2130837504;
+			
+			// aapt resource value: 0x7f020001
+			public const int Splash = 2130837505;
+			
+			private Drawable()
+			{
+			}
+		}
+		
+		public partial class Style
+		{
+			
+			// aapt resource value: 0x7f030000
+			public const int Theme_Splash = 2130903040;
+			
+			private Style()
+			{
+			}
+		}
+	}
+}

BIN=BIN
Samples/Android/MonoGame.Samples.AdMob/Resources/drawable/Icon.png


BIN=BIN
Samples/Android/MonoGame.Samples.AdMob/Resources/drawable/Splash.png


+ 14 - 0
Samples/Android/MonoGame.Samples.AdMob/Resources/layout/Main.axml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+<Button  
+    android:id="@+id/myButton"
+    android:layout_width="fill_parent" 
+    android:layout_height="wrap_content" 
+    android:text="@string/hello"
+    />
+</LinearLayout>
+

+ 7 - 0
Samples/Android/MonoGame.Samples.AdMob/Resources/values/Styles.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <style name="Theme.Splash" parent="android:Theme">
+    <item name="android:windowBackground">@drawable/splash</item>
+    <item name="android:windowNoTitle">true</item>
+  </style>
+</resources>

+ 28 - 25
Samples/Android/MonoGame.Samples.CatapultWars/MonoGame.Samples.CatapultWars.csproj

@@ -21,7 +21,7 @@
     <DebugType>full</DebugType>
     <Optimize>false</Optimize>
     <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
+    <DefineConstants>DEBUG;ANDROID</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
@@ -36,6 +36,7 @@
     <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
     <ConsolePause>false</ConsolePause>
     <AndroidLinkMode>SdkOnly</AndroidLinkMode>
+    <DefineConstants>ANDROID</DefineConstants>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
@@ -166,30 +167,6 @@
       <Link>Assets\Content\Fonts\MenuFont.xnb</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\BoulderHit.xnb">
-      <Link>Assets\Content\Sounds\BoulderHit.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\CatapultExplosion.xnb">
-      <Link>Assets\Content\Sounds\CatapultExplosion.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\CatapultFire.xnb">
-      <Link>Assets\Content\Sounds\CatapultFire.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\Lose.xnb">
-      <Link>Assets\Content\Sounds\Lose.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\RopeStretch.xnb">
-      <Link>Assets\Content\Sounds\RopeStretch.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
-    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\Win.xnb">
-      <Link>Assets\Content\Sounds\Win.xnb</Link>
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </AndroidAsset>
     <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Textures\Ammo\rock_ammo.xnb">
       <Link>Assets\Content\Textures\Ammo\rock_ammo.xnb</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -286,5 +263,31 @@
       <Link>Assets\Content\Textures\Catapults\Red\redPullback\redCatapult_Pullback.xnb</Link>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\BoulderHit.wav">
+      <Link>Assets\Content\Sounds\BoulderHit.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\CatapultExplosion.wav">
+      <Link>Assets\Content\Sounds\CatapultExplosion.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\CatapultFire.wav">
+      <Link>Assets\Content\Sounds\CatapultFire.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\Lose.wav">
+      <Link>Assets\Content\Sounds\Lose.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\RopeStretch.wav">
+      <Link>Assets\Content\Sounds\RopeStretch.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Sounds\Win.wav">
+      <Link>Assets\Content\Sounds\Win.wav</Link>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Textures\Catapults\Fire_Miss\fire_miss.xnb">
+      <Link>Assets\Content\Textures\Catapults\Fire_Miss\fire_miss.xnb</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </AndroidAsset>
+    <AndroidAsset Include="..\..\MacOS\CatapaultWars\Content\Textures\Catapults\Hit_Smoke\smoke.xnb">
+      <Link>Assets\Content\Textures\Catapults\Hit_Smoke\smoke.xnb</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </AndroidAsset>
   </ItemGroup>
 </Project>

+ 10 - 2
Samples/MacOS/CatapaultWars/Catapult/Catapult.cs

@@ -176,8 +176,16 @@ namespace CatapultGame
             stallUpdateCycles = 0;
 
             // Load multiple animations form XML definition
-            XDocument doc = XDocument.Load("Content/Textures/Catapults/AnimationsDef.xml");
-            XName name = XName.Get("Definition");
+			XDocument doc = null;
+#if ANDROID
+			using(var stream = Game.Activity.Assets.Open(@"Content/Textures/Catapults/AnimationsDef.xml"))
+			{
+				doc = XDocument.Load(stream);
+			}
+#else			
+            doc = XDocument.Load("Content/Textures/Catapults/AnimationsDef.xml");            
+#endif		
+			XName name = XName.Get("Definition");
             var definitions = doc.Document.Descendants(name);
 
             // Loop over all definitions in XML

BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/BoulderHit.wav


BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/CatapultExplosion.wav


BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/CatapultFire.wav


BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/Lose.wav


BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/RopeStretch.wav


BIN=BIN
Samples/MacOS/CatapaultWars/Content/Sounds/Win.wav


+ 6 - 1
Samples/MacOS/CatapaultWars/Screens/GameplayScreen.cs

@@ -82,7 +82,9 @@ namespace CatapultGame
         public override void LoadContent()
         {
             base.LoadContent();
-
+#if ANDROID || IOS			
+			LoadAssets();
+#endif			
             // Start the game
             Start();
         }
@@ -100,6 +102,9 @@ namespace CatapultGame
             hudBackgroundTexture = Load<Texture2D>("Textures/HUD/hudBackground");
             windArrowTexture = Load<Texture2D>("Textures/HUD/windArrow");
             ammoTypeTexture = Load<Texture2D>("Textures/HUD/ammoType");
+			
+			
+			
             // Load font
             hudFont = Load<SpriteFont>("Fonts/HUDFont");
 

+ 13 - 3
Samples/MacOS/CatapaultWars/Screens/InstructionsScreen.cs

@@ -67,7 +67,7 @@ namespace CatapultGame
 				// If additional thread finished loading and the screen is not exiting
 				if (thread.ThreadState == System.Threading.ThreadState.Stopped && !IsExiting) {
 					isLoading = false;
-
+					
 					// Exit the screen and show the gameplay screen 
 					// with pre-loaded assets
 					ExitScreen ();
@@ -111,11 +111,21 @@ namespace CatapultGame
 					// Create a new instance of the gameplay screen
 					gameplayScreen = new GameplayScreen ();
 					gameplayScreen.ScreenManager = ScreenManager;
-
+					
+#if ANDROID || IOS					
+					isLoading = false;
+					
+					// Exit the screen and show the gameplay screen 
+					// with pre-loaded assets
+					ExitScreen ();
+					ScreenManager.AddScreen (gameplayScreen, null);
+#else				
 					// Start loading the resources in additional thread
 					thread = new System.Threading.Thread (new System.Threading.ThreadStart (gameplayScreen.LoadAssets));
 					isLoading = true;
-					thread.Start ();
+					thread.Start ();	
+#endif										
+					
 				}
 			}
 

+ 7 - 1
Samples/MonoGame.Samples.Android.sln

@@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orientation", "Android\Orie
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Samples.CatapultWars", "Android\MonoGame.Samples.CatapultWars\MonoGame.Samples.CatapultWars.csproj", "{289A3AF8-E006-47EF-B34C-CA01020E1655}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Samples.AdMob", "Android\MonoGame.Samples.AdMob\MonoGame.Samples.AdMob.csproj", "{DD08D5F1-DE83-41C1-B599-76DC604643EB}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -65,6 +67,10 @@ Global
 		{CB2084E4-BEC8-4318-8011-93CC2E3C9E94}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{CB2084E4-BEC8-4318-8011-93CC2E3C9E94}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{CB2084E4-BEC8-4318-8011-93CC2E3C9E94}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DD08D5F1-DE83-41C1-B599-76DC604643EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DD08D5F1-DE83-41C1-B599-76DC604643EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DD08D5F1-DE83-41C1-B599-76DC604643EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DD08D5F1-DE83-41C1-B599-76DC604643EB}.Release|Any CPU.Build.0 = Release|Any CPU
 		{DEDD20B5-8F83-46FD-AD05-8F8FCC49FCD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{DEDD20B5-8F83-46FD-AD05-8F8FCC49FCD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{DEDD20B5-8F83-46FD-AD05-8F8FCC49FCD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -81,7 +87,7 @@ Global
 		{E2B6ED3C-A769-47AF-9605-A7410F194B1C}.Release|Any CPU.Deploy.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = Android\MonoGame.Samples.CatapultWars\MonoGame.Samples.CatapultWars.csproj
+		StartupItem = Android\MonoGame.Samples.AdMob\MonoGame.Samples.AdMob.csproj
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE