2016-04-16 11 views
0

Ich bin mitten in der App-Entwicklung mit Monogame, und ich wollte ein Projekt für Windows Phone hinzufügen. Ich habe ein Gerät mit Windows Mobile 8.1 zum Testen, und ich verwende Monogame 3.5 (neueste) + VS 2015. Aber wie erstelle ich ein Projekt?Wie installiere ich ein Projekt für Monogame + Windows 8.1?

Die Vorlagen für Monogame haben mehrere Plattformen, aber die einzige für Windows Mobile scheint Windows 10 Uniwersal Project (UWP) zu sein. Ich bezweifle, dass dies auf WM8.1 laufen würde. Oder würde es? Wenn nicht, wie erstelle ich das Projekt sonst?

Update:

Hat mehr Forschung auf diesem und es scheint, dass Sie mindestens Windows-8.1 auf Ihrem dev PC haben, müssen für Windows Phone entwickeln 8.1:

https://www.visualstudio.com/en-us/products/visual-studio-2015-compatibility-vs.aspx

Also ich denke, Ich werde nur Android und iOS wie alle anderen mobilen Apps unterstützen.

Antwort

1

Variante 1:

  • 8,1 win phone Projekt anlegen
  • hinzufügen NuGet Paket MonoGame.Framework.WindowsPhone81 (NuGet)
  • hinzufügen standart Game1.cs Quellcodedatei von Vorlagen
  • monogame
  • Hinzufügen in MainPage.xaml.cs

    using MonoGame.Framework; 
    
  • Änderung MainPage.xaml.cs

    public sealed partial class MainPage : SwapChainBackgroundPanel 
    { 
        readonly Game1 _game; 
    
        public MainPage(string launchArguments) 
        { 
         this.InitializeComponent(); 
    
         _game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this); 
        } 
    } 
    
  • ändern MainPage.xaml (MyGame - Standard-Projektnamespace)

    <SwapChainBackgroundPanel 
        x:Class="MyGame.MainPage" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:local="using:MyGame" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        mc:Ignorable="d"> 
    
        <Grid > 
    
        </Grid> 
    </SwapChainBackgroundPanel> 
    
  • ändern App Klasse in App.xaml.cs

    protected override void OnLaunched(LaunchActivatedEventArgs args) 
    { 
        var gamePage = Window.Current.Content as MainPage; 
    
        if (gamePage == null) 
        { 
         gamePage = new MainPage(args.Arguments); 
    
         if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) 
         { 
         } 
    
         Window.Current.Content = gamePage; 
        } 
    
        Window.Current.Activate(); 
    } 
    
    private void OnSuspending(object sender, SuspendingEventArgs e) 
    { 
        var deferral = e.SuspendingOperation.GetDeferral(); 
    
        deferral.Complete(); 
    } 
    
  • Inhalt hinzufügen.mgcb

  • monogameplatform Datei hinzufügen (CSPROJ) in Property Abschnitt

    <PropertyGroup> 
    ... 
    <MonoGamePlatform>WindowsStoreApp</MonoGamePlatform> 
    <MonoGameContentBuilderExe> 
    </MonoGameContentBuilderExe> 
    ... 
    </PropertyGroup> 
    
  • In nächste Zeile Datei zu projizieren (CSPROJ) in Projektabschnitt

    <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" /> 
    

Variante 2 zu projizieren: Verwenden Sie Werkzeug von Protobuild.org

+0

Keine von ihnen hat funktioniert. Protobuild (Variante 2) hat ein Projekt erstellt, aber VS konnte es nicht öffnen. Mit Variante eins scheint es keine Option zu geben, ein Windows Phone 8.1-Projekt überhaupt zu erstellen. Ich habe mehr Forschung und es scheint, das Problem ist mein Laptop OS, das Windows 7 ist. Ich markiere deine Antwort als gültig, wie es wahrscheinlich für neuere OS funktioniert und die Frage zu aktualisieren. – Arek