the beginning
This commit is contained in:
commit
81031ff411
22 changed files with 592 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
bin/
|
||||||
|
obj/
|
||||||
|
/packages/
|
||||||
|
.idea
|
12
Android/.config/dotnet-tools.json
Normal file
12
Android/.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-mgcb": {
|
||||||
|
"version": "3.8.0.1375-develop",
|
||||||
|
"commands": [
|
||||||
|
"mgcb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
Android/Activity1.cs
Normal file
49
Android/Activity1.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
using Android.App;
|
||||||
|
using Android.Content.PM;
|
||||||
|
using Android.OS;
|
||||||
|
using Android.Views;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using MLEM.Extensions;
|
||||||
|
using MLEM.Misc;
|
||||||
|
using ThemeParkClicker;
|
||||||
|
|
||||||
|
namespace Android {
|
||||||
|
[Activity(
|
||||||
|
Label = "@string/app_name",
|
||||||
|
MainLauncher = true,
|
||||||
|
Icon = "@drawable/icon",
|
||||||
|
AlwaysRetainTaskState = true,
|
||||||
|
LaunchMode = LaunchMode.SingleInstance,
|
||||||
|
ScreenOrientation = ScreenOrientation.UserPortrait,
|
||||||
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
|
||||||
|
)]
|
||||||
|
public class Activity1 : AndroidGameActivity {
|
||||||
|
|
||||||
|
private GameImpl game;
|
||||||
|
private View view;
|
||||||
|
|
||||||
|
protected override void OnCreate(Bundle bundle) {
|
||||||
|
base.OnCreate(bundle);
|
||||||
|
// render under notches
|
||||||
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
||||||
|
this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
|
||||||
|
|
||||||
|
TextInputWrapper.Current = new TextInputWrapper.Mobile();
|
||||||
|
this.game = new GameImpl();
|
||||||
|
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window);
|
||||||
|
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
||||||
|
this.game.GraphicsDeviceManager.IsFullScreen = true;
|
||||||
|
this.view = this.game.Services.GetService(typeof(View)) as View;
|
||||||
|
|
||||||
|
this.SetContentView(this.view);
|
||||||
|
this.game.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnWindowFocusChanged(bool hasFocus) {
|
||||||
|
base.OnWindowFocusChanged(hasFocus);
|
||||||
|
// hide the status bar
|
||||||
|
this.view.SystemUiVisibility = (StatusBarVisibility) (SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
81
Android/Android.csproj
Normal file
81
Android/Android.csproj
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{410C0262-131C-4D0E-910D-D01B4F7143E0}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Android</RootNamespace>
|
||||||
|
<AssemblyName>Android</AssemblyName>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AndroidApplication>true</AndroidApplication>
|
||||||
|
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||||
|
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||||
|
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||||
|
<AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions>
|
||||||
|
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
|
||||||
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
|
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||||
|
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||||
|
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||||
|
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
|
||||||
|
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;ANDROID</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
|
||||||
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;ANDROID</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||||
|
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Mono.Android" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Activity1.cs" />
|
||||||
|
<Compile Include="Resources\Resource.Designer.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\Drawable\Icon.png" />
|
||||||
|
<AndroidResource Include="Resources\Values\Strings.xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
|
<MonoGameContentReference Include="..\ThemeParkClicker\Content\Content.mgcb" />
|
||||||
|
<None Include="..\ThemeParkClicker\Content\*\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Contentless" Version="2.0.6" />
|
||||||
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1375-develop" />
|
||||||
|
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.0.1375-develop" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ThemeParkClicker\ThemeParkClicker.csproj">
|
||||||
|
<Project>{3df7ae69-f3f0-461a-be98-f31eb576b5e2}</Project>
|
||||||
|
<Name>ThemeParkClicker</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
|
</Project>
|
5
Android/Properties/AndroidManifest.xml
Normal file
5
Android/Properties/AndroidManifest.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Android.Android" android:versionCode="1" android:versionName="1.0">
|
||||||
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
|
||||||
|
<application android:label="Android"></application>
|
||||||
|
</manifest>
|
30
Android/Properties/AssemblyInfo.cs
Normal file
30
Android/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Android.App;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Android")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Android")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
BIN
Android/Resources/Drawable/Icon.png
Normal file
BIN
Android/Resources/Drawable/Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
77
Android/Resources/Resource.Designer.cs
generated
Normal file
77
Android/Resources/Resource.Designer.cs
generated
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
#pragma warning disable 1591
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
[assembly: global::Android.Runtime.ResourceDesignerAttribute("Android.Resource", IsApplication=true)]
|
||||||
|
|
||||||
|
namespace Android
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||||
|
public partial class Resource
|
||||||
|
{
|
||||||
|
|
||||||
|
static Resource()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateIdValues()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class Attribute
|
||||||
|
{
|
||||||
|
|
||||||
|
static Attribute()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Attribute()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class Drawable
|
||||||
|
{
|
||||||
|
|
||||||
|
// aapt resource value: 0x7F010000
|
||||||
|
public const int Icon = 2130771968;
|
||||||
|
|
||||||
|
static Drawable()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class String
|
||||||
|
{
|
||||||
|
|
||||||
|
// aapt resource value: 0x7F020000
|
||||||
|
public const int app_name = 2130837504;
|
||||||
|
|
||||||
|
static String()
|
||||||
|
{
|
||||||
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#pragma warning restore 1591
|
4
Android/Resources/Values/Strings.xml
Normal file
4
Android/Resources/Values/Strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Android</string>
|
||||||
|
</resources>
|
12
Desktop/.config/dotnet-tools.json
Normal file
12
Desktop/.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-mgcb": {
|
||||||
|
"version": "3.8.0.1375-develop",
|
||||||
|
"commands": [
|
||||||
|
"mgcb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Desktop/Desktop.csproj
Normal file
25
Desktop/Desktop.csproj
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
<PublishReadyToRun>false</PublishReadyToRun>
|
||||||
|
<TieredCompilation>false</TieredCompilation>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Contentless" Version="2.0.*" />
|
||||||
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1375-develop" />
|
||||||
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1375-develop" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<MonoGameContentReference Include="..\ThemeParkClicker\Content\Content.mgcb" />
|
||||||
|
<None Include="..\ThemeParkClicker\Content\*\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ThemeParkClicker\ThemeParkClicker.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
18
Desktop/Program.cs
Normal file
18
Desktop/Program.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using MLEM.Misc;
|
||||||
|
using ThemeParkClicker;
|
||||||
|
|
||||||
|
namespace Desktop {
|
||||||
|
public static class Program {
|
||||||
|
|
||||||
|
public static void Main() {
|
||||||
|
TextInputWrapper.Current = new TextInputWrapper.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
|
||||||
|
using var game = new GameImpl();
|
||||||
|
game.GraphicsDeviceManager.PreferredBackBufferWidth = 1080 / 3;
|
||||||
|
game.GraphicsDeviceManager.PreferredBackBufferHeight = 1920 / 3;
|
||||||
|
game.IsMouseVisible = true;
|
||||||
|
game.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
28
ThemeParkClicker.sln
Normal file
28
ThemeParkClicker.sln
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThemeParkClicker", "ThemeParkClicker\ThemeParkClicker.csproj", "{3DF7AE69-F3F0-461A-BE98-F31EB576B5E2}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Android", "Android\Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Desktop", "Desktop\Desktop.csproj", "{41506EAE-7E73-4147-8C8F-CA70924DB7FA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3DF7AE69-F3F0-461A-BE98-F31EB576B5E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3DF7AE69-F3F0-461A-BE98-F31EB576B5E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3DF7AE69-F3F0-461A-BE98-F31EB576B5E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3DF7AE69-F3F0-461A-BE98-F31EB576B5E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{41506EAE-7E73-4147-8C8F-CA70924DB7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{41506EAE-7E73-4147-8C8F-CA70924DB7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{41506EAE-7E73-4147-8C8F-CA70924DB7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{41506EAE-7E73-4147-8C8F-CA70924DB7FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
32
ThemeParkClicker/Content/Content.mgcb
Normal file
32
ThemeParkClicker/Content/Content.mgcb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
#----------------------------- Global Properties ----------------------------#
|
||||||
|
|
||||||
|
/outputDir:bin
|
||||||
|
/intermediateDir:obj
|
||||||
|
/platform:DesktopGL
|
||||||
|
/config:
|
||||||
|
/profile:Reach
|
||||||
|
/compress:False
|
||||||
|
|
||||||
|
#-------------------------------- References --------------------------------#
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------- Content ---------------------------------#
|
||||||
|
|
||||||
|
#begin Textures/Ui.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:Textures/Ui.png
|
||||||
|
|
||||||
|
#begin Fonts/Regular.spritefont
|
||||||
|
/importer:FontDescriptionImporter
|
||||||
|
/processor:FontDescriptionProcessor
|
||||||
|
/build:Fonts/Regular.spritefont
|
||||||
|
|
BIN
ThemeParkClicker/Content/Fonts/EXEPixelPerfect.ttf
Normal file
BIN
ThemeParkClicker/Content/Fonts/EXEPixelPerfect.ttf
Normal file
Binary file not shown.
60
ThemeParkClicker/Content/Fonts/Regular.spritefont
Normal file
60
ThemeParkClicker/Content/Fonts/Regular.spritefont
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file contains an xml description of a font, and will be read by the XNA
|
||||||
|
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||||
|
of the font in your game, and to change the characters which are available to draw
|
||||||
|
with.
|
||||||
|
-->
|
||||||
|
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||||
|
<Asset Type="Graphics:FontDescription">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Modify this string to change the font that will be imported.
|
||||||
|
-->
|
||||||
|
<FontName>EXEPixelPerfect.ttf</FontName>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Size is a float value, measured in points. Modify this value to change
|
||||||
|
the size of the font.
|
||||||
|
-->
|
||||||
|
<Size>128</Size>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Spacing is a float value, measured in pixels. Modify this value to change
|
||||||
|
the amount of spacing in between characters.
|
||||||
|
-->
|
||||||
|
<Spacing>0</Spacing>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||||
|
will be used when placing characters.
|
||||||
|
-->
|
||||||
|
<UseKerning>true</UseKerning>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||||
|
and "Bold, Italic", and are case sensitive.
|
||||||
|
-->
|
||||||
|
<Style>Regular</Style>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If you uncomment this line, the default character will be substituted if you draw
|
||||||
|
or measure text that contains characters which were not included in the font.
|
||||||
|
-->
|
||||||
|
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
CharacterRegions control what letters are available in the font. Every
|
||||||
|
character from Start to End will be built and made available for drawing. The
|
||||||
|
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||||
|
character set. The characters are ordered according to the Unicode standard.
|
||||||
|
See the documentation for more information.
|
||||||
|
-->
|
||||||
|
<CharacterRegions>
|
||||||
|
<CharacterRegion>
|
||||||
|
<Start> </Start>
|
||||||
|
<End>Ā</End>
|
||||||
|
</CharacterRegion>
|
||||||
|
</CharacterRegions>
|
||||||
|
</Asset>
|
||||||
|
</XnaContent>
|
BIN
ThemeParkClicker/Content/Textures/Ui.aseprite
Normal file
BIN
ThemeParkClicker/Content/Textures/Ui.aseprite
Normal file
Binary file not shown.
BIN
ThemeParkClicker/Content/Textures/Ui.png
Normal file
BIN
ThemeParkClicker/Content/Textures/Ui.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
34
ThemeParkClicker/GameImpl.cs
Normal file
34
ThemeParkClicker/GameImpl.cs
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
using System.Numerics;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MLEM.Extensions;
|
||||||
|
using MLEM.Font;
|
||||||
|
using MLEM.Startup;
|
||||||
|
|
||||||
|
namespace ThemeParkClicker {
|
||||||
|
public class GameImpl : MlemGame {
|
||||||
|
|
||||||
|
public static GameImpl Instance { get; private set; }
|
||||||
|
public BigInteger Tickets = 200;
|
||||||
|
public Ui Ui { get; private set; }
|
||||||
|
|
||||||
|
public GameImpl() {
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadContent() {
|
||||||
|
base.LoadContent();
|
||||||
|
this.Ui = new Ui(this.UiSystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayTicketCount() {
|
||||||
|
return this.Tickets.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DoDraw(GameTime gameTime) {
|
||||||
|
this.GraphicsDevice.Clear(ColorExtensions.FromHex(0x86cfcb));
|
||||||
|
base.DoDraw(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
35
ThemeParkClicker/RainingTicket.cs
Normal file
35
ThemeParkClicker/RainingTicket.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MLEM.Extensions;
|
||||||
|
using MLEM.Misc;
|
||||||
|
using MLEM.Textures;
|
||||||
|
|
||||||
|
namespace ThemeParkClicker {
|
||||||
|
public class RainingTicket {
|
||||||
|
|
||||||
|
private static readonly Random Random = new Random();
|
||||||
|
private readonly Vector2 speed;
|
||||||
|
private readonly float rotationSpeed;
|
||||||
|
private float rotation;
|
||||||
|
private Vector2 position;
|
||||||
|
|
||||||
|
public RainingTicket() {
|
||||||
|
this.position = new Vector2((float) Random.NextDouble(), -0.15F);
|
||||||
|
this.speed = new Vector2((float) Random.NextDouble() * 0.0005F - 0.00025F, 0.005F + (float) Random.NextDouble() * 0.01F);
|
||||||
|
this.rotationSpeed = MathHelper.ToRadians((float) Random.NextDouble() * 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update() {
|
||||||
|
this.rotation += this.rotationSpeed;
|
||||||
|
this.position += this.speed;
|
||||||
|
return this.position.Y >= 1.15F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Draw(SpriteBatch batch, Vector2 viewport, float scale) {
|
||||||
|
var tex = Ui.Texture[2, 0];
|
||||||
|
batch.Draw(tex, this.position * viewport, Color.White, this.rotation, tex.Size.ToVector2() / 2, scale, SpriteEffects.None, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
18
ThemeParkClicker/ThemeParkClicker.csproj
Normal file
18
ThemeParkClicker/ThemeParkClicker.csproj
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MLEM.Startup" Version="3.3.2" />
|
||||||
|
<PackageReference Include="MonoGame.Framework.Portable" Version="3.7.1.189">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Content\Textures" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
68
ThemeParkClicker/Ui.cs
Normal file
68
ThemeParkClicker/Ui.cs
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Numerics;
|
||||||
|
using Coroutine;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MLEM.Font;
|
||||||
|
using MLEM.Startup;
|
||||||
|
using MLEM.Textures;
|
||||||
|
using MLEM.Ui;
|
||||||
|
using MLEM.Ui.Elements;
|
||||||
|
|
||||||
|
namespace ThemeParkClicker {
|
||||||
|
public class Ui {
|
||||||
|
|
||||||
|
public static readonly UniformTextureAtlas Texture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Ui"), 16, 16);
|
||||||
|
|
||||||
|
public Ui(UiSystem uiSystem) {
|
||||||
|
uiSystem.GlobalScale = 4;
|
||||||
|
uiSystem.AutoScaleWithScreen = true;
|
||||||
|
uiSystem.AutoScaleReferenceSize = new Point(720, 1280);
|
||||||
|
uiSystem.Style.Font = new GenericSpriteFont(MlemGame.LoadContent<SpriteFont>("Fonts/Regular"));
|
||||||
|
uiSystem.Style.TextScale = 0.1F;
|
||||||
|
|
||||||
|
// ticket store ui
|
||||||
|
var rainingTickets = new List<RainingTicket>();
|
||||||
|
Group ticketStoreUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
|
OnUpdated = (e, time) => {
|
||||||
|
for (var i = rainingTickets.Count - 1; i >= 0; i--) {
|
||||||
|
if (rainingTickets[i].Update())
|
||||||
|
rainingTickets.RemoveAt(i);
|
||||||
|
}
|
||||||
|
while (rainingTickets.Count < BigInteger.Min(GameImpl.Instance.Tickets / 100, 500))
|
||||||
|
rainingTickets.Add(new RainingTicket());
|
||||||
|
},
|
||||||
|
OnDrawn = (e, time, batch, alpha) => {
|
||||||
|
foreach (var ticket in rainingTickets)
|
||||||
|
ticket.Draw(batch, e.DisplayArea.Size, e.Scale);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ticketStoreUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => GameImpl.Instance.DisplayTicketCount(), true) {
|
||||||
|
TextScale = 0.3F
|
||||||
|
});
|
||||||
|
var storeGroup = ticketStoreUi.AddChild(new CustomDrawGroup(Anchor.AutoLeft, Vector2.One));
|
||||||
|
storeGroup.AddChild(new Image(Anchor.TopLeft, Vector2.One, Texture[0, 0, 2, 3]) {
|
||||||
|
OnPressed = e => {
|
||||||
|
GameImpl.Instance.Tickets++;
|
||||||
|
CoroutineHandler.Start(WobbleElement(storeGroup));
|
||||||
|
},
|
||||||
|
CanBeSelected = true,
|
||||||
|
CanBeMoused = true
|
||||||
|
});
|
||||||
|
ticketStoreUi.OnAreaUpdated += e => storeGroup.Size = new Vector2(e.DisplayArea.Width / e.Scale);
|
||||||
|
uiSystem.Add("TicketStore", ticketStoreUi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerator<IWait> WobbleElement(CustomDrawGroup element, float intensity = 0.01F) {
|
||||||
|
var sin = 0F;
|
||||||
|
while (sin < MathHelper.Pi) {
|
||||||
|
element.ScaleOrigin(1 + (float) Math.Sin(sin) * intensity * element.Scale);
|
||||||
|
sin += 0.2F;
|
||||||
|
yield return new WaitEvent(CoroutineEvents.Update);
|
||||||
|
}
|
||||||
|
element.Transform = Matrix.Identity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue