start of update
This commit is contained in:
parent
d4bd862b04
commit
f7bc8738d1
38 changed files with 2001 additions and 3398 deletions
36
Android/.config/dotnet-tools.json
Normal file
36
Android/.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-mgcb": {
|
||||||
|
"version": "3.8.1.303",
|
||||||
|
"commands": [
|
||||||
|
"mgcb"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-mgcb-editor": {
|
||||||
|
"version": "3.8.1.303",
|
||||||
|
"commands": [
|
||||||
|
"mgcb-editor"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-mgcb-editor-linux": {
|
||||||
|
"version": "3.8.1.303",
|
||||||
|
"commands": [
|
||||||
|
"mgcb-editor-linux"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-mgcb-editor-windows": {
|
||||||
|
"version": "3.8.1.303",
|
||||||
|
"commands": [
|
||||||
|
"mgcb-editor-windows"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dotnet-mgcb-editor-mac": {
|
||||||
|
"version": "3.8.1.303",
|
||||||
|
"commands": [
|
||||||
|
"mgcb-editor-mac"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,24 +1,23 @@
|
||||||
using System;
|
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
using Android.Gms.Common;
|
|
||||||
using Android.Gms.Games;
|
using Android.Gms.Games;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using GameAnalyticsSDK;
|
using GameAnalyticsSDK;
|
||||||
|
using Java.Lang;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extensions;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using TouchyTickets;
|
using TouchyTickets;
|
||||||
using static Android.Views.SystemUiFlags;
|
using static Android.Views.ViewGroup;
|
||||||
using static Android.Views.ViewGroup.LayoutParams;
|
|
||||||
using Uri = Android.Net.Uri;
|
using Uri = Android.Net.Uri;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android;
|
||||||
[Activity(
|
|
||||||
|
[Activity(
|
||||||
Label = "@string/app_name",
|
Label = "@string/app_name",
|
||||||
MainLauncher = true,
|
MainLauncher = true,
|
||||||
Icon = "@drawable/icon",
|
Icon = "@drawable/icon",
|
||||||
|
@ -26,8 +25,8 @@ namespace Android {
|
||||||
LaunchMode = LaunchMode.SingleInstance,
|
LaunchMode = LaunchMode.SingleInstance,
|
||||||
ScreenOrientation = ScreenOrientation.UserPortrait,
|
ScreenOrientation = ScreenOrientation.UserPortrait,
|
||||||
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
|
||||||
)]
|
)]
|
||||||
public class Activity1 : AndroidGameActivity {
|
public class Activity1 : AndroidGameActivity {
|
||||||
|
|
||||||
private GameImpl game;
|
private GameImpl game;
|
||||||
private AndroidPlatform platform;
|
private AndroidPlatform platform;
|
||||||
|
@ -49,7 +48,7 @@ namespace Android {
|
||||||
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
|
||||||
|
|
||||||
var gameView = this.game.Services.GetService(typeof(View)) as View;
|
var gameView = this.game.Services.GetService(typeof(View)) as View;
|
||||||
gameView.LayoutChange += (o, args) => {
|
gameView.LayoutChange += (_, args) => {
|
||||||
// force the game size to update when the ad size changes
|
// force the game size to update when the ad size changes
|
||||||
this.game.GraphicsDeviceManager.PreferredBackBufferWidth = args.Right - args.Left;
|
this.game.GraphicsDeviceManager.PreferredBackBufferWidth = args.Right - args.Left;
|
||||||
this.game.GraphicsDeviceManager.PreferredBackBufferHeight = args.Bottom - args.Top;
|
this.game.GraphicsDeviceManager.PreferredBackBufferHeight = args.Bottom - args.Top;
|
||||||
|
@ -62,12 +61,12 @@ namespace Android {
|
||||||
|
|
||||||
// total layout that is displayed
|
// total layout that is displayed
|
||||||
this.mainView = new LinearLayout(this) {Orientation = Orientation.Vertical};
|
this.mainView = new LinearLayout(this) {Orientation = Orientation.Vertical};
|
||||||
this.mainView.LayoutParameters = new LinearLayout.LayoutParams(MatchParent, MatchParent);
|
this.mainView.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
|
||||||
this.mainView.AddView(gameView);
|
this.mainView.AddView(gameView);
|
||||||
// height of 0 but high weight causes this element so scale based on the ad's height
|
// height of 0 but high weight causes this element so scale based on the ad's height
|
||||||
gameView.LayoutParameters = new LinearLayout.LayoutParams(MatchParent, 0, 1);
|
gameView.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, 0, 1);
|
||||||
this.mainView.AddView(adLayout);
|
this.mainView.AddView(adLayout);
|
||||||
adLayout.LayoutParameters = new LinearLayout.LayoutParams(MatchParent, WrapContent);
|
adLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
|
||||||
this.SetContentView(this.mainView);
|
this.SetContentView(this.mainView);
|
||||||
|
|
||||||
this.game.Run();
|
this.game.Run();
|
||||||
|
@ -86,10 +85,11 @@ namespace Android {
|
||||||
|
|
||||||
public override void OnWindowFocusChanged(bool hasFocus) {
|
public override void OnWindowFocusChanged(bool hasFocus) {
|
||||||
base.OnWindowFocusChanged(hasFocus);
|
base.OnWindowFocusChanged(hasFocus);
|
||||||
|
#pragma warning disable CS0618
|
||||||
// hide the status bar
|
// hide the status bar
|
||||||
if (hasFocus)
|
if (hasFocus)
|
||||||
this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility) (ImmersiveSticky | LayoutStable | LayoutHideNavigation | LayoutFullscreen | HideNavigation | Fullscreen);
|
this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility) (SystemUiFlags.ImmersiveSticky | SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen);
|
||||||
|
#pragma warning restore CS0618
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,94 +1,31 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>net6.0-android</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<SupportedOSPlatformVersion>31</SupportedOSPlatformVersion>
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
<OutputType>Exe</OutputType>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<ApplicationId>de.ellpeck.touchytickets</ApplicationId>
|
||||||
<ProjectGuid>{410C0262-131C-4D0E-910D-D01B4F7143E0}</ProjectGuid>
|
<ApplicationVersion>1.2.1</ApplicationVersion>
|
||||||
<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>
|
|
||||||
<AotAssemblies>false</AotAssemblies>
|
|
||||||
<EnableLLVM>false</EnableLLVM>
|
|
||||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
|
||||||
<BundleAssemblies>false</BundleAssemblies>
|
|
||||||
<MandroidI18n />
|
|
||||||
<AndroidPackageFormat>aab</AndroidPackageFormat>
|
|
||||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
|
||||||
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<ProjectReference Include="..\TouchyTickets\TouchyTickets.csproj"/>
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml" />
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303"/>
|
||||||
<Reference Include="Mono.Android" />
|
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.1.303"/>
|
||||||
|
<PackageReference Include="Contentless" Version="3.0.7"/>
|
||||||
|
<PackageReference Include="GameAnalytics.Xamarin.SDK" Version="5.2.5"/>
|
||||||
|
<PackageReference Include="Xamarin.GooglePlayServices.Games" Version="123.1.0.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Activity1.cs" />
|
<MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb"/>
|
||||||
<Compile Include="AndroidPlatform.cs" />
|
<None Include="..\TouchyTickets\Content\*\**">
|
||||||
<Compile Include="Resources\Resource.Designer.cs" />
|
<Link>Content/%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\Drawable\Icon.png" />
|
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
|
||||||
<AndroidResource Include="Resources\Values\Strings.xml" />
|
<Message Text="Restoring dotnet tools" Importance="High"/>
|
||||||
</ItemGroup>
|
<Exec Command="dotnet tool restore"/>
|
||||||
<ItemGroup>
|
</Target>
|
||||||
<None Include="Properties\AndroidManifest.xml" />
|
|
||||||
<None Include="..\TouchyTickets\Content\*\**" />
|
|
||||||
<MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb">
|
|
||||||
<Link>Content\Content.mgcb</Link>
|
|
||||||
</MonoGameContentReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Contentless" Version="3.0.6" />
|
|
||||||
<PackageReference Include="GameAnalytics.Xamarin.SDK" Version="5.2.3" />
|
|
||||||
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
|
|
||||||
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.0.1641" />
|
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Games" Version="121.0.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TouchyTickets\TouchyTickets.csproj">
|
|
||||||
<Project>{3df7ae69-f3f0-461a-be98-f31eb576b5e2}</Project>
|
|
||||||
<Name>TouchyTickets</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,9 +1,10 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.ellpeck.touchytickets" android:installLocation="auto"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.ellpeck.touchytickets"
|
||||||
android:versionCode="121" android:versionName="1.2.1">
|
android:installLocation="auto" android:versionCode="121" android:versionName="1.2.1">
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="31"/>
|
||||||
|
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||||
<application android:label="Touchy Tickets" android:resizeableActivity="true">
|
<application android:label="Touchy Tickets" android:resizeableActivity="true">
|
||||||
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\u003169609944700" />
|
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\u003169609944700"/>
|
||||||
</application>
|
</application>
|
||||||
<permission android:name="ACCESS_NETWORK_STATE"/>
|
<permission android:name="ACCESS_NETWORK_STATE"/>
|
||||||
<permission android:name="INTERNET"/>
|
<permission android:name="INTERNET"/>
|
|
@ -1,30 +1,27 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.Gms.Common;
|
|
||||||
using Android.Gms.Common.Apis;
|
using Android.Gms.Common.Apis;
|
||||||
using Android.Gms.Extensions;
|
|
||||||
using Android.Gms.Games;
|
using Android.Gms.Games;
|
||||||
using Android.Gms.Games.Achievement;
|
|
||||||
using Android.Runtime;
|
using Android.Runtime;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using Coroutine;
|
|
||||||
using GameAnalyticsSDK;
|
using GameAnalyticsSDK;
|
||||||
using GameAnalyticsSDK.Utilities;
|
using GameAnalyticsSDK.Utilities;
|
||||||
|
using Java.Lang;
|
||||||
using TouchyTickets;
|
using TouchyTickets;
|
||||||
using Achievement = TouchyTickets.Achievement;
|
using Achievement = TouchyTickets.Achievement;
|
||||||
using Uri = Android.Net.Uri;
|
using Uri = Android.Net.Uri;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android;
|
||||||
public class AndroidPlatform : Platform {
|
|
||||||
|
public class AndroidPlatform : Platform {
|
||||||
|
|
||||||
public const int GooglePlayLoginRequest = 9001;
|
public const int GooglePlayLoginRequest = 9001;
|
||||||
public const int ShowAchievementsRequest = 9002;
|
public const int ShowAchievementsRequest = 9002;
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> AchievementIds = new Dictionary<string, string> {
|
private static readonly Dictionary<string, string> AchievementIds = new() {
|
||||||
{"1Stars", "CgkI_Lyp7PcEEAIQAw"},
|
{"1Stars", "CgkI_Lyp7PcEEAIQAw"},
|
||||||
{"10Stars", "CgkI_Lyp7PcEEAIQBA"},
|
{"10Stars", "CgkI_Lyp7PcEEAIQBA"},
|
||||||
{"100Stars", "CgkI_Lyp7PcEEAIQBQ"},
|
{"100Stars", "CgkI_Lyp7PcEEAIQBQ"},
|
||||||
|
@ -62,7 +59,7 @@ namespace Android {
|
||||||
// Analytics
|
// Analytics
|
||||||
GameAnalytics.SetAutoDetectAppVersion(true);
|
GameAnalytics.SetAutoDetectAppVersion(true);
|
||||||
GameAnalytics.Initialize(this.activity, GA_MiniJSON.Serialize(new Hashtable(analyticsJson)));
|
GameAnalytics.Initialize(this.activity, GA_MiniJSON.Serialize(new Hashtable(analyticsJson)));
|
||||||
AndroidEnvironment.UnhandledExceptionRaiser += (o, args) => GameAnalytics.NewErrorEvent(GAErrorSeverity.Critical, args.Exception.ToString());
|
AndroidEnvironment.UnhandledExceptionRaiser += (_, args) => GameAnalytics.NewErrorEvent(GAErrorSeverity.Critical, args.Exception.ToString());
|
||||||
|
|
||||||
// TODO fix ads
|
// TODO fix ads
|
||||||
// Ads
|
// Ads
|
||||||
|
@ -98,12 +95,12 @@ namespace Android {
|
||||||
GameAnalytics.NewErrorEvent(GAErrorSeverity.Error, "GoogleApiClient " + e);
|
GameAnalytics.NewErrorEvent(GAErrorSeverity.Error, "GoogleApiClient " + e);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Sanity check to ensure that all achievements are mapped
|
// Sanity check to ensure that all achievements are mapped
|
||||||
foreach (var achievement in Achievement.Achievements.Values) {
|
foreach (var achievement in Achievement.Achievements.Values) {
|
||||||
var _ = AchievementIds[achievement.Name];
|
var _ = AndroidPlatform.AchievementIds[achievement.Name];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
|
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
|
||||||
|
@ -125,7 +122,7 @@ namespace Android {
|
||||||
public override bool GainAchievement(Achievement achievement) {
|
public override bool GainAchievement(Achievement achievement) {
|
||||||
try {
|
try {
|
||||||
if (this.GoogleApi != null && this.GoogleApi.IsConnected) {
|
if (this.GoogleApi != null && this.GoogleApi.IsConnected) {
|
||||||
GamesClass.Achievements.Unlock(this.GoogleApi, AchievementIds[achievement.Name]);
|
GamesClass.Achievements.Unlock(this.GoogleApi, AndroidPlatform.AchievementIds[achievement.Name]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -139,11 +136,10 @@ namespace Android {
|
||||||
if (this.GoogleApi == null || !this.GoogleApi.IsConnected)
|
if (this.GoogleApi == null || !this.GoogleApi.IsConnected)
|
||||||
return;
|
return;
|
||||||
var intent = GamesClass.Achievements.GetAchievementsIntent(this.GoogleApi);
|
var intent = GamesClass.Achievements.GetAchievementsIntent(this.GoogleApi);
|
||||||
this.activity.StartActivityForResult(intent, ShowAchievementsRequest);
|
this.activity.StartActivityForResult(intent, AndroidPlatform.ShowAchievementsRequest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GameAnalytics.NewErrorEvent(GAErrorSeverity.Error, "ShowAchievements " + e);
|
GameAnalytics.NewErrorEvent(GAErrorSeverity.Error, "ShowAchievements " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
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("Touchy Tickets")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Touchy Tickets")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
1037
Android/Resources/Resource.Designer.cs
generated
1037
Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -4,8 +4,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TouchyTickets", "TouchyTick
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Android", "Android\Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Android", "Android\Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS", "iOS\iOS.csproj", "{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -20,9 +18,5 @@ Global
|
||||||
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
|
||||||
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
|
||||||
{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
|
||||||
{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
|
|
||||||
{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -5,15 +5,16 @@ using System.Numerics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public class Achievement {
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, Achievement> Achievements = new Dictionary<string, Achievement>();
|
public class Achievement {
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, Achievement> Achievements = new();
|
||||||
|
|
||||||
static Achievement() {
|
static Achievement() {
|
||||||
foreach (var amount in new[] {1, 10, 100})
|
foreach (var amount in new[] {1, 10, 100})
|
||||||
Register(new Achievement($"{amount}Stars", g => g.Stars >= amount));
|
Achievement.Register(new Achievement($"{amount}Stars", g => g.Stars >= amount));
|
||||||
Register(new Achievement("FullMap", g => {
|
Achievement.Register(new Achievement("FullMap", g => {
|
||||||
for (var x = 0; x < g.Map.Width; x++) {
|
for (var x = 0; x < g.Map.Width; x++) {
|
||||||
for (var y = 0; y < g.Map.Height; y++) {
|
for (var y = 0; y < g.Map.Height; y++) {
|
||||||
if (g.Map.GetAttractionAt(new Point(x, y)) == null)
|
if (g.Map.GetAttractionAt(new Point(x, y)) == null)
|
||||||
|
@ -23,12 +24,12 @@ namespace TouchyTickets {
|
||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
foreach (var flag in new[] {AttractionFlags.Small, AttractionFlags.Relaxed, AttractionFlags.Walking, AttractionFlags.NonTechnology})
|
foreach (var flag in new[] {AttractionFlags.Small, AttractionFlags.Relaxed, AttractionFlags.Walking, AttractionFlags.NonTechnology})
|
||||||
Register(new Achievement($"Only{flag}Rides", g => g.Map.GetAttractionAmount(null) >= 100 && g.Map.GetAttractions().All(a => a.Item2.Type.Flags.HasFlag(flag))));
|
Achievement.Register(new Achievement($"Only{flag}Rides", g => g.Map.GetAttractionAmount(null) >= 100 && g.Map.GetAttractions().All(a => a.Item2.Type.Flags.HasFlag(flag))));
|
||||||
foreach (var amount in new[] {100, 500, 1000, 5000})
|
foreach (var amount in new[] {100, 500, 1000, 5000})
|
||||||
Register(new Achievement($"{amount}Modifiers", g => g.Map.GetAttractionAmount(null) > 0 && g.Map.GetAttractions().All(a => a.Item2.GetModifierAmount(null) >= amount)));
|
Achievement.Register(new Achievement($"{amount}Modifiers", g => g.Map.GetAttractionAmount(null) > 0 && g.Map.GetAttractions().All(a => a.Item2.GetModifierAmount(null) >= amount)));
|
||||||
for (var i = 1; i <= 10; i++) {
|
for (var i = 1; i <= 10; i++) {
|
||||||
var amount = BigInteger.Pow(1000, i + 1);
|
var amount = BigInteger.Pow(1000, i + 1);
|
||||||
Register(new Achievement($"{i}ExpTickets", g => g.Tickets >= amount));
|
Achievement.Register(new Achievement($"{i}ExpTickets", g => g.Tickets >= amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +54,7 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Register(Achievement achievement) {
|
public static void Register(Achievement achievement) {
|
||||||
Achievements.Add(achievement.Name, achievement);
|
Achievement.Achievements.Add(achievement.Name, achievement);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -5,8 +5,9 @@ using MLEM.Font;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public static class Assets {
|
|
||||||
|
public static class Assets {
|
||||||
|
|
||||||
public static UniformTextureAtlas TilesTexture { get; private set; }
|
public static UniformTextureAtlas TilesTexture { get; private set; }
|
||||||
public static UniformTextureAtlas AttractionTexture { get; private set; }
|
public static UniformTextureAtlas AttractionTexture { get; private set; }
|
||||||
|
@ -21,18 +22,17 @@ namespace TouchyTickets {
|
||||||
public static GenericFont MonospacedFont { get; private set; }
|
public static GenericFont MonospacedFont { get; private set; }
|
||||||
|
|
||||||
public static void Load() {
|
public static void Load() {
|
||||||
TilesTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Tiles"), 16, 16);
|
Assets.TilesTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Tiles"), 16, 16);
|
||||||
AttractionTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Attractions"), 16, 16);
|
Assets.AttractionTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Attractions"), 16, 16);
|
||||||
UiTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Ui"), 16, 16);
|
Assets.UiTexture = new UniformTextureAtlas(MlemGame.LoadContent<Texture2D>("Textures/Ui"), 16, 16);
|
||||||
|
|
||||||
ClickSound = MlemGame.LoadContent<SoundEffect>("Sounds/Click");
|
Assets.ClickSound = MlemGame.LoadContent<SoundEffect>("Sounds/Click");
|
||||||
PlaceSound = MlemGame.LoadContent<SoundEffect>("Sounds/Place");
|
Assets.PlaceSound = MlemGame.LoadContent<SoundEffect>("Sounds/Place");
|
||||||
BuySound = MlemGame.LoadContent<SoundEffect>("Sounds/StarBuy");
|
Assets.BuySound = MlemGame.LoadContent<SoundEffect>("Sounds/StarBuy");
|
||||||
|
|
||||||
TileSize = new Vector2(AttractionTexture.RegionWidth, AttractionTexture.RegionHeight);
|
Assets.TileSize = new Vector2(Assets.AttractionTexture.RegionWidth, Assets.AttractionTexture.RegionHeight);
|
||||||
Font = new GenericSpriteFont(MlemGame.LoadContent<SpriteFont>("Fonts/" + Localization.Get("Font")));
|
Assets.Font = new GenericSpriteFont(MlemGame.LoadContent<SpriteFont>("Fonts/" + Localization.Get("Font")));
|
||||||
MonospacedFont = new GenericSpriteFont(MlemGame.LoadContent<SpriteFont>("Fonts/Monospaced"));
|
Assets.MonospacedFont = new GenericSpriteFont(MlemGame.LoadContent<SpriteFont>("Fonts/Monospaced"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -5,20 +5,18 @@ using System.Numerics;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
using MLEM.Startup;
|
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
using static TouchyTickets.Attractions.AttractionFlags;
|
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||||
using static TouchyTickets.Attractions.AttractionType;
|
|
||||||
|
|
||||||
namespace TouchyTickets.Attractions {
|
namespace TouchyTickets.Attractions;
|
||||||
[DataContract]
|
|
||||||
public class Attraction {
|
[DataContract]
|
||||||
|
public class Attraction {
|
||||||
|
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public readonly List<ActiveModifier> Modifiers = new List<ActiveModifier>();
|
public readonly List<ActiveModifier> Modifiers = new();
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public readonly AttractionType Type;
|
public readonly AttractionType Type;
|
||||||
[DataMember]
|
[DataMember]
|
||||||
|
@ -107,5 +105,4 @@ namespace TouchyTickets.Attractions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TouchyTickets.Attractions {
|
namespace TouchyTickets.Attractions;
|
||||||
[Flags]
|
|
||||||
public enum AttractionFlags {
|
[Flags]
|
||||||
|
public enum AttractionFlags {
|
||||||
|
|
||||||
// base flags
|
// base flags
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@ -14,5 +15,4 @@ namespace TouchyTickets.Attractions {
|
||||||
Small = 32,
|
Small = 32,
|
||||||
All = ~0
|
All = ~0
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,23 +2,23 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Textures;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static TouchyTickets.Attractions.AttractionFlags;
|
using static TouchyTickets.Attractions.AttractionFlags;
|
||||||
|
|
||||||
namespace TouchyTickets.Attractions {
|
namespace TouchyTickets.Attractions;
|
||||||
[JsonConverter(typeof(Converter))]
|
|
||||||
public class AttractionModifier {
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, AttractionModifier> Modifiers = new Dictionary<string, AttractionModifier>();
|
[JsonConverter(typeof(Converter))]
|
||||||
|
public class AttractionModifier {
|
||||||
|
|
||||||
|
public static readonly Dictionary<string, AttractionModifier> Modifiers = new();
|
||||||
|
|
||||||
static AttractionModifier() {
|
static AttractionModifier() {
|
||||||
Register(new AttractionModifier("Lubricant", 200, Cars | FastCars, 1.02F, new Point(0, 4)));
|
AttractionModifier.Register(new AttractionModifier("Lubricant", 200, AttractionFlags.Cars | AttractionFlags.FastCars, 1.02F, new Point(0, 4)));
|
||||||
Register(new AttractionModifier("LouderMusic", 500, Relaxed, 1.03F, new Point(2, 4)));
|
AttractionModifier.Register(new AttractionModifier("LouderMusic", 500, AttractionFlags.Relaxed, 1.03F, new Point(2, 4)));
|
||||||
Register(new AttractionModifier("SmallAds", 800, Small, 1.35F, new Point(5, 4)));
|
AttractionModifier.Register(new AttractionModifier("SmallAds", 800, AttractionFlags.Small, 1.35F, new Point(5, 4)));
|
||||||
Register(new AttractionModifier("LongerQueue", 1000, All, 1.06F, new Point(1, 4)));
|
AttractionModifier.Register(new AttractionModifier("LongerQueue", 1000, AttractionFlags.All, 1.06F, new Point(1, 4)));
|
||||||
Register(new AttractionModifier("Bouncer", 1500, Walking, 1.2F, new Point(3, 4)));
|
AttractionModifier.Register(new AttractionModifier("Bouncer", 1500, AttractionFlags.Walking, 1.2F, new Point(3, 4)));
|
||||||
Register(new AttractionModifier("OnRideCameras", 2500, FastCars, 1.1F, new Point(4, 4)));
|
AttractionModifier.Register(new AttractionModifier("OnRideCameras", 2500, AttractionFlags.FastCars, 1.1F, new Point(4, 4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
|
@ -50,7 +50,7 @@ namespace TouchyTickets.Attractions {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AttractionModifier Register(AttractionModifier type) {
|
private static AttractionModifier Register(AttractionModifier type) {
|
||||||
Modifiers.Add(type.Name, type);
|
AttractionModifier.Modifiers.Add(type.Name, type);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,15 +62,15 @@ namespace TouchyTickets.Attractions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override AttractionModifier ReadJson(JsonReader reader, Type objectType, AttractionModifier existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
public override AttractionModifier ReadJson(JsonReader reader, Type objectType, AttractionModifier existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
||||||
return reader.Value != null ? Modifiers[reader.Value.ToString()] : null;
|
return reader.Value != null ? AttractionModifier.Modifiers[reader.Value.ToString()] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public class ActiveModifier {
|
public class ActiveModifier {
|
||||||
|
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public readonly AttractionModifier Modifier;
|
public readonly AttractionModifier Modifier;
|
||||||
|
@ -82,5 +82,4 @@ namespace TouchyTickets.Attractions {
|
||||||
this.Amount = amount;
|
this.Amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,31 +2,31 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Textures;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
using static TouchyTickets.Attractions.AttractionFlags;
|
using static TouchyTickets.Attractions.AttractionFlags;
|
||||||
|
|
||||||
namespace TouchyTickets.Attractions {
|
namespace TouchyTickets.Attractions;
|
||||||
[JsonConverter(typeof(Converter))]
|
|
||||||
public class AttractionType {
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, AttractionType> Attractions = new Dictionary<string, AttractionType>();
|
[JsonConverter(typeof(Converter))]
|
||||||
public static readonly AttractionType Carousel = Register(new AttractionType("Carousel", RectArea(1, 1), new Rectangle(0, 0, 1, 1), 0.5F, 50, Relaxed | Cars | Small));
|
public class AttractionType {
|
||||||
public static readonly AttractionType MirrorHouse = Register(new AttractionType("MirrorHouse", RectArea(1, 1), new Rectangle(3, 0, 1, 1), 1, 150, Relaxed | Walking | NonTechnology | Small));
|
|
||||||
public static readonly AttractionType FoodCourt = Register(new AttractionType("FoodCourt", RectArea(2, 1), new Rectangle(1, 0, 2, 1), 2F, 300, None));
|
public static readonly Dictionary<string, AttractionType> Attractions = new();
|
||||||
public static readonly AttractionType SpiralSlide = Register(new AttractionType("SpiralSlide", RectArea(1, 2), new Rectangle(5, 0, 1, 2), 4, 1200, Relaxed | Walking));
|
public static readonly AttractionType Carousel = AttractionType.Register(new AttractionType("Carousel", AttractionType.RectArea(1, 1), new Rectangle(0, 0, 1, 1), 0.5F, 50, AttractionFlags.Relaxed | AttractionFlags.Cars | AttractionFlags.Small));
|
||||||
public static readonly AttractionType HedgeMaze = Register(new AttractionType("HedgeMaze", RectArea(2, 2), new Rectangle(3, 3, 2, 2), 8, 2500, Relaxed | Walking | NonTechnology));
|
public static readonly AttractionType MirrorHouse = AttractionType.Register(new AttractionType("MirrorHouse", AttractionType.RectArea(1, 1), new Rectangle(3, 0, 1, 1), 1, 150, AttractionFlags.Relaxed | AttractionFlags.Walking | AttractionFlags.NonTechnology | AttractionFlags.Small));
|
||||||
public static readonly AttractionType FerrisWheel = Register(new AttractionType("FerrisWheel", RectArea(2, 2), new Rectangle(0, 1, 2, 2), 12, 4000, Relaxed | Cars));
|
public static readonly AttractionType FoodCourt = AttractionType.Register(new AttractionType("FoodCourt", AttractionType.RectArea(2, 1), new Rectangle(1, 0, 2, 1), 2F, 300, AttractionFlags.None));
|
||||||
public static readonly AttractionType FreefallCoaster = Register(new AttractionType("FreefallCoaster", new[,] {{true, false, true}, {true, true, true}}, new Rectangle(6, 0, 3, 2), 24, 8000, FastCars));
|
public static readonly AttractionType SpiralSlide = AttractionType.Register(new AttractionType("SpiralSlide", AttractionType.RectArea(1, 2), new Rectangle(5, 0, 1, 2), 4, 1200, AttractionFlags.Relaxed | AttractionFlags.Walking));
|
||||||
public static readonly AttractionType HauntedHouse = Register(new AttractionType("HauntedHouse", RectArea(2, 2), new Rectangle(3, 5, 2, 2), 30, 12000, FastCars));
|
public static readonly AttractionType HedgeMaze = AttractionType.Register(new AttractionType("HedgeMaze", AttractionType.RectArea(2, 2), new Rectangle(3, 3, 2, 2), 8, 2500, AttractionFlags.Relaxed | AttractionFlags.Walking | AttractionFlags.NonTechnology));
|
||||||
public static readonly AttractionType GoKarts = Register(new AttractionType("GoKarts", RectArea(2, 2), new Rectangle(5, 2, 2, 2), 50, 24000, Cars | Relaxed));
|
public static readonly AttractionType FerrisWheel = AttractionType.Register(new AttractionType("FerrisWheel", AttractionType.RectArea(2, 2), new Rectangle(0, 1, 2, 2), 12, 4000, AttractionFlags.Relaxed | AttractionFlags.Cars));
|
||||||
public static readonly AttractionType MiniGolf = Register(new AttractionType("MiniGolf", RectArea(2, 3), new Rectangle(9, 0, 2, 3), 75, 35000, Relaxed | Walking | NonTechnology));
|
public static readonly AttractionType FreefallCoaster = AttractionType.Register(new AttractionType("FreefallCoaster", new[,] {{true, false, true}, {true, true, true}}, new Rectangle(6, 0, 3, 2), 24, 8000, AttractionFlags.FastCars));
|
||||||
public static readonly AttractionType WildMouse = Register(new AttractionType("WildMouse", RectArea(3, 2), new Rectangle(2, 1, 3, 2), 100, 60000, FastCars));
|
public static readonly AttractionType HauntedHouse = AttractionType.Register(new AttractionType("HauntedHouse", AttractionType.RectArea(2, 2), new Rectangle(3, 5, 2, 2), 30, 12000, AttractionFlags.FastCars));
|
||||||
public static readonly AttractionType LogFlume = Register(new AttractionType("LogFlume", new[,] {{true, true, false}, {true, true, true}}, new Rectangle(0, 3, 3, 2), 160, 90000, FastCars));
|
public static readonly AttractionType GoKarts = AttractionType.Register(new AttractionType("GoKarts", AttractionType.RectArea(2, 2), new Rectangle(5, 2, 2, 2), 50, 24000, AttractionFlags.Cars | AttractionFlags.Relaxed));
|
||||||
public static readonly AttractionType HeartlineTwister = Register(new AttractionType("HeartlineTwister", RectArea(4, 2), new Rectangle(5, 4, 4, 2), 250, 150000, FastCars));
|
public static readonly AttractionType MiniGolf = AttractionType.Register(new AttractionType("MiniGolf", AttractionType.RectArea(2, 3), new Rectangle(9, 0, 2, 3), 75, 35000, AttractionFlags.Relaxed | AttractionFlags.Walking | AttractionFlags.NonTechnology));
|
||||||
public static readonly AttractionType WoodCoaster = Register(new AttractionType("WoodCoaster", RectArea(3, 3), new Rectangle(0, 5, 3, 3), 300, 215000, FastCars));
|
public static readonly AttractionType WildMouse = AttractionType.Register(new AttractionType("WildMouse", AttractionType.RectArea(3, 2), new Rectangle(2, 1, 3, 2), 100, 60000, AttractionFlags.FastCars));
|
||||||
public static readonly AttractionType SafariZone = Register(new AttractionType("SafariZone", RectArea(5, 3), new Rectangle(11, 0, 5, 3), 600, 750000, Relaxed | Walking | NonTechnology));
|
public static readonly AttractionType LogFlume = AttractionType.Register(new AttractionType("LogFlume", new[,] {{true, true, false}, {true, true, true}}, new Rectangle(0, 3, 3, 2), 160, 90000, AttractionFlags.FastCars));
|
||||||
|
public static readonly AttractionType HeartlineTwister = AttractionType.Register(new AttractionType("HeartlineTwister", AttractionType.RectArea(4, 2), new Rectangle(5, 4, 4, 2), 250, 150000, AttractionFlags.FastCars));
|
||||||
|
public static readonly AttractionType WoodCoaster = AttractionType.Register(new AttractionType("WoodCoaster", AttractionType.RectArea(3, 3), new Rectangle(0, 5, 3, 3), 300, 215000, AttractionFlags.FastCars));
|
||||||
|
public static readonly AttractionType SafariZone = AttractionType.Register(new AttractionType("SafariZone", AttractionType.RectArea(5, 3), new Rectangle(11, 0, 5, 3), 600, 750000, AttractionFlags.Relaxed | AttractionFlags.Walking | AttractionFlags.NonTechnology));
|
||||||
|
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
public readonly bool[,] Area;
|
public readonly bool[,] Area;
|
||||||
|
@ -67,7 +67,7 @@ namespace TouchyTickets.Attractions {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AttractionType Register(AttractionType type) {
|
private static AttractionType Register(AttractionType type) {
|
||||||
Attractions.Add(type.Name, type);
|
AttractionType.Attractions.Add(type.Name, type);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,10 +90,9 @@ namespace TouchyTickets.Attractions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override AttractionType ReadJson(JsonReader reader, Type objectType, AttractionType existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
public override AttractionType ReadJson(JsonReader reader, Type objectType, AttractionType existingValue, bool hasExistingValue, JsonSerializer serializer) {
|
||||||
return reader.Value != null ? Attractions[reader.Value.ToString()] : null;
|
return reader.Value != null ? AttractionType.Attractions[reader.Value.ToString()] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -7,9 +7,11 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Cameras;
|
using MLEM.Cameras;
|
||||||
using MLEM.Startup;
|
using MLEM.Startup;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
|
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public class GameImpl : MlemGame {
|
|
||||||
|
public class GameImpl : MlemGame {
|
||||||
|
|
||||||
public static GameImpl Instance { get; private set; }
|
public static GameImpl Instance { get; private set; }
|
||||||
public readonly ISet<Upgrade> AppliedUpgrades = new HashSet<Upgrade>();
|
public readonly ISet<Upgrade> AppliedUpgrades = new HashSet<Upgrade>();
|
||||||
|
@ -29,7 +31,7 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public GameImpl(Platform platform) {
|
public GameImpl(Platform platform) {
|
||||||
this.Platform = platform;
|
this.Platform = platform;
|
||||||
Instance = this;
|
GameImpl.Instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadContent() {
|
protected override void LoadContent() {
|
||||||
|
@ -121,10 +123,11 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetBuyableStars() {
|
public int GetBuyableStars() {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
return 3;
|
return 3;
|
||||||
#endif
|
#else
|
||||||
return (int) BigInteger.Min(3, this.Tickets / this.GetStarPrice());
|
return (int) BigInteger.Min(3, this.Tickets / this.GetStarPrice());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateMapOnce() {
|
private void UpdateMapOnce() {
|
||||||
|
@ -143,5 +146,4 @@ namespace TouchyTickets {
|
||||||
this.LastUpdate = now;
|
this.LastUpdate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,35 +4,35 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using MLEM.Startup;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public static class Localization {
|
|
||||||
|
|
||||||
public static readonly List<string> NumberFormat = LoadLocalized<List<string>>("NumberFormat", "json5");
|
public static class Localization {
|
||||||
private static readonly Dictionary<string, string> Strings = LoadLocalized<Dictionary<string, string>>("Localization");
|
|
||||||
private static readonly Dictionary<string, string> FallbackStrings = Load<Dictionary<string, string>>("Localization");
|
public static readonly List<string> NumberFormat = Localization.LoadLocalized<List<string>>("NumberFormat", "json5");
|
||||||
private static readonly List<string> News = LoadLocalized<List<string>>("News");
|
private static readonly Dictionary<string, string> Strings = Localization.LoadLocalized<Dictionary<string, string>>("Localization");
|
||||||
private static readonly Random Random = new Random();
|
private static readonly Dictionary<string, string> FallbackStrings = Localization.Load<Dictionary<string, string>>("Localization");
|
||||||
|
private static readonly List<string> News = Localization.LoadLocalized<List<string>>("News");
|
||||||
|
private static readonly Random Random = new();
|
||||||
|
|
||||||
public static string Get(string key) {
|
public static string Get(string key) {
|
||||||
if (Strings.TryGetValue(key, out var val))
|
if (Localization.Strings.TryGetValue(key, out var val))
|
||||||
return val;
|
return val;
|
||||||
if (FallbackStrings.TryGetValue(key, out var fallback))
|
if (Localization.FallbackStrings.TryGetValue(key, out var fallback))
|
||||||
return fallback;
|
return fallback;
|
||||||
return $"?{key}?";
|
return $"?{key}?";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetRandomNews() {
|
public static string GetRandomNews() {
|
||||||
return News[Random.Next(News.Count)];
|
return Localization.News[Localization.Random.Next(Localization.News.Count)];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static T LoadLocalized<T>(string name, string extension = "json") {
|
private static T LoadLocalized<T>(string name, string extension = "json") {
|
||||||
var culture = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
|
var culture = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
|
||||||
foreach (var path in new[] {$"{name}.{culture}", name}) {
|
foreach (var path in new[] {$"{name}.{culture}", name}) {
|
||||||
try {
|
try {
|
||||||
return Load<T>(path, extension);
|
return Localization.Load<T>(path, extension);
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
// move on to the next path
|
// move on to the next path
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,8 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
private static T Load<T>(string name, string extension = "json") {
|
private static T Load<T>(string name, string extension = "json") {
|
||||||
var path = $"{GameImpl.Instance.Content.RootDirectory}/Localization/{name}.{extension}";
|
var path = $"{GameImpl.Instance.Content.RootDirectory}/Localization/{name}.{extension}";
|
||||||
using (var reader = new JsonTextReader(new StreamReader(TitleContainer.OpenStream(path))))
|
using var reader = new JsonTextReader(new StreamReader(TitleContainer.OpenStream(path)));
|
||||||
return SaveHandler.Serializer.Deserialize<T>(reader);
|
return SaveHandler.Serializer.Deserialize<T>(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -3,9 +3,10 @@ using System.Runtime.Serialization;
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
[DataContract]
|
|
||||||
public class Options {
|
[DataContract]
|
||||||
|
public class Options {
|
||||||
|
|
||||||
public static Options Instance { get; private set; }
|
public static Options Instance { get; private set; }
|
||||||
|
|
||||||
|
@ -37,18 +38,18 @@ namespace TouchyTickets {
|
||||||
public int MinTicketsForAutoBuy = 50000;
|
public int MinTicketsForAutoBuy = 50000;
|
||||||
|
|
||||||
public static void Save() {
|
public static void Save() {
|
||||||
var file = GetOptionsFile(true);
|
var file = Options.GetOptionsFile(true);
|
||||||
using (var stream = new JsonTextWriter(file.CreateText()))
|
using var stream = new JsonTextWriter(file.CreateText());
|
||||||
SaveHandler.Serializer.Serialize(stream, Instance);
|
SaveHandler.Serializer.Serialize(stream, Options.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Load() {
|
public static void Load() {
|
||||||
var file = GetOptionsFile(false);
|
var file = Options.GetOptionsFile(false);
|
||||||
if (file.Exists) {
|
if (file.Exists) {
|
||||||
using (var stream = new JsonTextReader(file.OpenText()))
|
using var stream = new JsonTextReader(file.OpenText());
|
||||||
Instance = SaveHandler.Serializer.Deserialize<Options>(stream);
|
Options.Instance = SaveHandler.Serializer.Deserialize<Options>(stream);
|
||||||
} else {
|
} else {
|
||||||
Instance = new Options();
|
Options.Instance = new Options();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,5 +57,4 @@ namespace TouchyTickets {
|
||||||
return new FileInfo(Path.Combine(SaveHandler.GetGameDirectory(create).FullName, "Options"));
|
return new FileInfo(Path.Combine(SaveHandler.GetGameDirectory(create).FullName, "Options"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -12,9 +12,10 @@ using MLEM.Textures;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
[DataContract]
|
|
||||||
public class ParkMap {
|
[DataContract]
|
||||||
|
public class ParkMap {
|
||||||
|
|
||||||
private const int AdditionalRadius = 15;
|
private const int AdditionalRadius = 15;
|
||||||
private const int AutoBuyIntervalSecs = 30;
|
private const int AutoBuyIntervalSecs = 30;
|
||||||
|
@ -24,9 +25,9 @@ namespace TouchyTickets {
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public readonly int Height;
|
public readonly int Height;
|
||||||
[DataMember]
|
[DataMember]
|
||||||
private readonly List<(Point, Attraction)> attractions = new List<(Point, Attraction)>();
|
private readonly List<(Point, Attraction)> attractions = new();
|
||||||
private readonly Dictionary<Point, int> treePositions = new Dictionary<Point, int>();
|
private readonly Dictionary<Point, int> treePositions = new();
|
||||||
private readonly Dictionary<Point, int> fencePositions = new Dictionary<Point, int>();
|
private readonly Dictionary<Point, int> fencePositions = new();
|
||||||
private readonly Attraction[,] attractionGrid;
|
private readonly Attraction[,] attractionGrid;
|
||||||
|
|
||||||
[DataMember]
|
[DataMember]
|
||||||
|
@ -45,8 +46,8 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
// set up trees
|
// set up trees
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
for (var x = -AdditionalRadius; x < this.Width + AdditionalRadius; x++) {
|
for (var x = -ParkMap.AdditionalRadius; x < this.Width + ParkMap.AdditionalRadius; x++) {
|
||||||
for (var y = -AdditionalRadius; y < this.Height + AdditionalRadius; y++) {
|
for (var y = -ParkMap.AdditionalRadius; y < this.Height + ParkMap.AdditionalRadius; y++) {
|
||||||
var pos = new Point(x, y);
|
var pos = new Point(x, y);
|
||||||
if (this.IsInBounds(pos))
|
if (this.IsInBounds(pos))
|
||||||
continue;
|
continue;
|
||||||
|
@ -78,7 +79,7 @@ namespace TouchyTickets {
|
||||||
// handle auto-buying
|
// handle auto-buying
|
||||||
this.autoBuyCounter += toSimulate.TotalSeconds;
|
this.autoBuyCounter += toSimulate.TotalSeconds;
|
||||||
this.TryAutoBuy();
|
this.TryAutoBuy();
|
||||||
var autoBuysPerAttraction = ((float) this.autoBuyCounter / AutoBuyIntervalSecs / this.attractions.Count).Ceil();
|
var autoBuysPerAttraction = ((float) this.autoBuyCounter / ParkMap.AutoBuyIntervalSecs / this.attractions.Count).Ceil();
|
||||||
|
|
||||||
// update tickets
|
// update tickets
|
||||||
this.TicketsPerSecond = 0;
|
this.TicketsPerSecond = 0;
|
||||||
|
@ -141,14 +142,14 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
camera.ConstrainWorldBounds(new Vector2(-AdditionalRadius) * Assets.TileSize, new Vector2(this.Width + AdditionalRadius, this.Height + AdditionalRadius) * Assets.TileSize);
|
camera.ConstrainWorldBounds(new Vector2(-ParkMap.AdditionalRadius) * Assets.TileSize, new Vector2(this.Width + ParkMap.AdditionalRadius, this.Height + ParkMap.AdditionalRadius) * Assets.TileSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(GameTime time, SpriteBatch batch, Vector2 position, float scale, float alpha, bool showSurroundings, RectangleF visibleArea) {
|
public void Draw(GameTime time, SpriteBatch batch, Vector2 position, float scale, float alpha, bool showSurroundings, RectangleF visibleArea) {
|
||||||
var tileSize = Assets.TileSize * scale;
|
var tileSize = Assets.TileSize * scale;
|
||||||
// draw ground
|
// draw ground
|
||||||
var additionalRadius = showSurroundings ? AdditionalRadius : 0;
|
var additionalRadius = showSurroundings ? ParkMap.AdditionalRadius : 0;
|
||||||
var minX = Math.Max(-additionalRadius, visibleArea.Left / tileSize.X).Floor();
|
var minX = Math.Max(-additionalRadius, visibleArea.Left / tileSize.X).Floor();
|
||||||
var minY = Math.Max(-additionalRadius, visibleArea.Top / tileSize.Y).Floor();
|
var minY = Math.Max(-additionalRadius, visibleArea.Top / tileSize.Y).Floor();
|
||||||
var maxX = Math.Min(this.Width + additionalRadius, visibleArea.Right / tileSize.X).Ceil();
|
var maxX = Math.Min(this.Width + additionalRadius, visibleArea.Right / tileSize.X).Ceil();
|
||||||
|
@ -258,9 +259,9 @@ namespace TouchyTickets {
|
||||||
return false;
|
return false;
|
||||||
if (GameImpl.Instance.Tickets < Options.Instance.MinTicketsForAutoBuy)
|
if (GameImpl.Instance.Tickets < Options.Instance.MinTicketsForAutoBuy)
|
||||||
return false;
|
return false;
|
||||||
if (this.autoBuyCounter < AutoBuyIntervalSecs)
|
if (this.autoBuyCounter < ParkMap.AutoBuyIntervalSecs)
|
||||||
return false;
|
return false;
|
||||||
this.autoBuyCounter -= AutoBuyIntervalSecs;
|
this.autoBuyCounter -= ParkMap.AutoBuyIntervalSecs;
|
||||||
|
|
||||||
var success = false;
|
var success = false;
|
||||||
// auto-buy modifiers
|
// auto-buy modifiers
|
||||||
|
@ -280,5 +281,4 @@ namespace TouchyTickets {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public abstract class Platform {
|
|
||||||
|
public abstract class Platform {
|
||||||
|
|
||||||
public abstract void SetupOnlineInteractions(Dictionary<string, object> analyticsJson);
|
public abstract void SetupOnlineInteractions(Dictionary<string, object> analyticsJson);
|
||||||
|
|
||||||
|
@ -15,5 +16,4 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public abstract void ShowAchievements();
|
public abstract void ShowAchievements();
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,22 +2,22 @@ using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extensions;
|
||||||
using MLEM.Misc;
|
|
||||||
using MLEM.Textures;
|
using MLEM.Textures;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public class RainingTicket {
|
|
||||||
|
|
||||||
private static readonly Random Random = new Random();
|
public class RainingTicket {
|
||||||
|
|
||||||
|
private static readonly Random Random = new();
|
||||||
private readonly Vector2 speed;
|
private readonly Vector2 speed;
|
||||||
private readonly float rotationSpeed;
|
private readonly float rotationSpeed;
|
||||||
private float rotation;
|
private float rotation;
|
||||||
private Vector2 position;
|
private Vector2 position;
|
||||||
|
|
||||||
public RainingTicket() {
|
public RainingTicket() {
|
||||||
this.position = new Vector2((float) Random.NextDouble(), -0.15F);
|
this.position = new Vector2(RainingTicket.Random.NextSingle(), -0.15F);
|
||||||
this.speed = new Vector2((float) Random.NextDouble() * 0.0005F - 0.00025F, 0.005F + (float) Random.NextDouble() * 0.01F);
|
this.speed = new Vector2(RainingTicket.Random.NextSingle() * 0.0005F - 0.00025F, 0.005F + RainingTicket.Random.NextSingle() * 0.01F);
|
||||||
this.rotationSpeed = MathHelper.ToRadians((float) Random.NextDouble() * 5);
|
this.rotationSpeed = MathHelper.ToRadians(RainingTicket.Random.NextSingle() * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Update() {
|
public bool Update() {
|
||||||
|
@ -31,5 +31,4 @@ namespace TouchyTickets {
|
||||||
batch.Draw(tex, this.position * viewport, color, this.rotation, tex.Size.ToVector2() / 2, scale, SpriteEffects.None, 0);
|
batch.Draw(tex, this.position * viewport, color, this.rotation, tex.Size.ToVector2() / 2, scale, SpriteEffects.None, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,8 +6,9 @@ using System.Numerics;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public static class SaveHandler {
|
|
||||||
|
public static class SaveHandler {
|
||||||
|
|
||||||
public static readonly JsonSerializer Serializer = JsonSerializer.Create(new JsonSerializerSettings {
|
public static readonly JsonSerializer Serializer = JsonSerializer.Create(new JsonSerializerSettings {
|
||||||
TypeNameHandling = TypeNameHandling.Auto,
|
TypeNameHandling = TypeNameHandling.Auto,
|
||||||
|
@ -16,10 +17,10 @@ namespace TouchyTickets {
|
||||||
private const int SaveVersion = 3;
|
private const int SaveVersion = 3;
|
||||||
|
|
||||||
public static void Save(GameImpl game) {
|
public static void Save(GameImpl game) {
|
||||||
var file = GetSaveFile(true);
|
var file = SaveHandler.GetSaveFile(true);
|
||||||
using (var stream = new JsonTextWriter(file.CreateText())) {
|
using var stream = new JsonTextWriter(file.CreateText());
|
||||||
var data = new SaveData {
|
var data = new SaveData {
|
||||||
SaveVersion = SaveVersion,
|
SaveVersion = SaveHandler.SaveVersion,
|
||||||
Tickets = game.Tickets,
|
Tickets = game.Tickets,
|
||||||
LastUpdate = game.LastUpdate,
|
LastUpdate = game.LastUpdate,
|
||||||
Map = game.Map,
|
Map = game.Map,
|
||||||
|
@ -29,17 +30,16 @@ namespace TouchyTickets {
|
||||||
TutorialStep = game.Tutorial.CurrentStep,
|
TutorialStep = game.Tutorial.CurrentStep,
|
||||||
PlayTime = game.PlayTime
|
PlayTime = game.PlayTime
|
||||||
};
|
};
|
||||||
Serializer.Serialize(stream, data);
|
SaveHandler.Serializer.Serialize(stream, data);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Load(GameImpl game) {
|
public static bool Load(GameImpl game) {
|
||||||
var file = GetSaveFile(false);
|
var file = SaveHandler.GetSaveFile(false);
|
||||||
if (!file.Exists)
|
if (!file.Exists)
|
||||||
return false;
|
return false;
|
||||||
SaveData data;
|
SaveData data;
|
||||||
using (var stream = new JsonTextReader(file.OpenText()))
|
using (var stream = new JsonTextReader(file.OpenText()))
|
||||||
data = Serializer.Deserialize<SaveData>(stream);
|
data = SaveHandler.Serializer.Deserialize<SaveData>(stream);
|
||||||
|
|
||||||
game.Tickets = data.Tickets;
|
game.Tickets = data.Tickets;
|
||||||
game.LastUpdate = data.LastUpdate;
|
game.LastUpdate = data.LastUpdate;
|
||||||
|
@ -76,12 +76,12 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FileInfo GetSaveFile(bool create) {
|
private static FileInfo GetSaveFile(bool create) {
|
||||||
return new FileInfo(Path.Combine(GetGameDirectory(create).FullName, "Save"));
|
return new FileInfo(Path.Combine(SaveHandler.GetGameDirectory(create).FullName, "Save"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SaveData {
|
public class SaveData {
|
||||||
|
|
||||||
public int SaveVersion;
|
public int SaveVersion;
|
||||||
public BigInteger Tickets;
|
public BigInteger Tickets;
|
||||||
|
@ -93,5 +93,4 @@ namespace TouchyTickets {
|
||||||
public int TutorialStep;
|
public int TutorialStep;
|
||||||
public TimeSpan PlayTime;
|
public TimeSpan PlayTime;
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Coroutine" Version="2.1.3" />
|
<PackageReference Include="Coroutine" Version="2.1.4"/>
|
||||||
<PackageReference Include="MLEM.Startup" Version="5.3.0-365" />
|
<PackageReference Include="MLEM.Startup" Version="6.1.0"/>
|
||||||
<PackageReference Include="MonoGame.Framework.Portable" Version="3.7.1.189">
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2"/>
|
||||||
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -4,38 +4,39 @@ using MLEM.Ui;
|
||||||
using MLEM.Ui.Elements;
|
using MLEM.Ui.Elements;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public class Tutorial {
|
|
||||||
|
public class Tutorial {
|
||||||
|
|
||||||
private static readonly Step[] Steps = {
|
private static readonly Step[] Steps = {
|
||||||
// introduction
|
// introduction
|
||||||
new Step(g => true, "Tutorial1"),
|
new(_ => true, "Tutorial1"),
|
||||||
new Step(g => g.Tickets >= AttractionType.Carousel.InitialPrice, "Tutorial2"),
|
new(g => g.Tickets >= AttractionType.Carousel.InitialPrice, "Tutorial2"),
|
||||||
new Step(g => g.DrawMap && g.Map.PlacingAttraction?.Type == AttractionType.Carousel, "Tutorial3"),
|
new(g => g.DrawMap && g.Map.PlacingAttraction?.Type == AttractionType.Carousel, "Tutorial3"),
|
||||||
new Step(g => g.Map.GetAttractionAmount(AttractionType.Carousel) > 0, "Tutorial4", "Tutorial5", "Tutorial6"),
|
new(g => g.Map.GetAttractionAmount(AttractionType.Carousel) > 0, "Tutorial4", "Tutorial5", "Tutorial6"),
|
||||||
// modifier tutorial
|
// modifier tutorial
|
||||||
new Step(g => g.Map.GetAttractionAmount(null) >= 3, "Tutorial11"),
|
new(g => g.Map.GetAttractionAmount(null) >= 3, "Tutorial11"),
|
||||||
new Step(g => g.Map.PlacingModifier != null, "Tutorial12"),
|
new(g => g.Map.PlacingModifier != null, "Tutorial12"),
|
||||||
new Step(g => g.Map.GetModifierAmount(null) > 0, "Tutorial13"),
|
new(g => g.Map.GetModifierAmount(null) > 0, "Tutorial13"),
|
||||||
// star tutorial
|
// star tutorial
|
||||||
new Step(g => g.Tickets >= g.GetStarPrice(), "Tutorial7", "Tutorial8"),
|
new(g => g.Tickets >= g.GetStarPrice(), "Tutorial7", "Tutorial8"),
|
||||||
new Step(g => g.Stars > 0, "Tutorial9", "Tutorial10")
|
new(g => g.Stars > 0, "Tutorial9", "Tutorial10")
|
||||||
};
|
};
|
||||||
public int CurrentStep;
|
public int CurrentStep;
|
||||||
private int currentStepMessage;
|
private int currentStepMessage;
|
||||||
|
|
||||||
public void Update(GameImpl game) {
|
public void Update(GameImpl game) {
|
||||||
// stop if the tutorial is finished
|
// stop if the tutorial is finished
|
||||||
if (this.CurrentStep >= Steps.Length)
|
if (this.CurrentStep >= Tutorial.Steps.Length)
|
||||||
return;
|
return;
|
||||||
// don't do anything while a tutorial box is already displaying
|
// don't do anything while a tutorial box is already displaying
|
||||||
if (game.UiSystem.Get("TutorialBox") != null)
|
if (game.UiSystem.Get("TutorialBox") != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var step = Steps[this.CurrentStep];
|
var step = Tutorial.Steps[this.CurrentStep];
|
||||||
if (step.ShouldContinue(game)) {
|
if (step.ShouldContinue(game)) {
|
||||||
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnDrawn = (e2, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
OnDrawn = (e2, _, batch, _) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
||||||
};
|
};
|
||||||
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
||||||
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(step.Content[this.currentStepMessage])));
|
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(step.Content[this.currentStepMessage])));
|
||||||
|
@ -67,5 +68,4 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -5,11 +5,8 @@ using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Coroutine;
|
using Coroutine;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Audio;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
|
||||||
using Microsoft.Xna.Framework.Input.Touch;
|
using Microsoft.Xna.Framework.Input.Touch;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extensions;
|
||||||
using MLEM.Font;
|
|
||||||
using MLEM.Formatting.Codes;
|
using MLEM.Formatting.Codes;
|
||||||
using MLEM.Input;
|
using MLEM.Input;
|
||||||
using MLEM.Misc;
|
using MLEM.Misc;
|
||||||
|
@ -20,9 +17,11 @@ using MLEM.Ui;
|
||||||
using MLEM.Ui.Elements;
|
using MLEM.Ui.Elements;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
|
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||||
|
|
||||||
namespace TouchyTickets {
|
namespace TouchyTickets;
|
||||||
public class Ui {
|
|
||||||
|
public class Ui {
|
||||||
|
|
||||||
private static readonly BigInteger[] ExpoNums = Enumerable.Range(0, Localization.NumberFormat.Count).Select(i => BigInteger.Pow(1000, i + 1)).ToArray();
|
private static readonly BigInteger[] ExpoNums = Enumerable.Range(0, Localization.NumberFormat.Count).Select(i => BigInteger.Pow(1000, i + 1)).ToArray();
|
||||||
private readonly UiSystem uiSystem;
|
private readonly UiSystem uiSystem;
|
||||||
|
@ -41,7 +40,7 @@ namespace TouchyTickets {
|
||||||
// main ticket store ui
|
// main ticket store ui
|
||||||
var rainingTickets = new List<RainingTicket>();
|
var rainingTickets = new List<RainingTicket>();
|
||||||
var main = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var main = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnUpdated = (e, time) => {
|
OnUpdated = (e, _) => {
|
||||||
if (e.IsHidden)
|
if (e.IsHidden)
|
||||||
return;
|
return;
|
||||||
for (var i = rainingTickets.Count - 1; i >= 0; i--) {
|
for (var i = rainingTickets.Count - 1; i >= 0; i--) {
|
||||||
|
@ -51,7 +50,7 @@ namespace TouchyTickets {
|
||||||
while (rainingTickets.Count < Math.Min(GameImpl.Instance.Map.TicketsPerSecond / 30, Options.Instance.RainingTicketLimit))
|
while (rainingTickets.Count < Math.Min(GameImpl.Instance.Map.TicketsPerSecond / 30, Options.Instance.RainingTicketLimit))
|
||||||
rainingTickets.Add(new RainingTicket());
|
rainingTickets.Add(new RainingTicket());
|
||||||
},
|
},
|
||||||
OnDrawn = (e, time, batch, alpha) => {
|
OnDrawn = (e, _, batch, alpha) => {
|
||||||
batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha);
|
batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha);
|
||||||
foreach (var ticket in rainingTickets)
|
foreach (var ticket in rainingTickets)
|
||||||
ticket.Draw(batch, e.DisplayArea.Size, e.Scale, Color.White * alpha);
|
ticket.Draw(batch, e.DisplayArea.Size, e.Scale, Color.White * alpha);
|
||||||
|
@ -59,8 +58,8 @@ namespace TouchyTickets {
|
||||||
};
|
};
|
||||||
var currentNews = Localization.GetRandomNews();
|
var currentNews = Localization.GetRandomNews();
|
||||||
var newsTicker = main.AddChild(new Panel(Anchor.AutoCenter, new Vector2(1, 0.05F), Vector2.Zero));
|
var newsTicker = main.AddChild(new Panel(Anchor.AutoCenter, new Vector2(1, 0.05F), Vector2.Zero));
|
||||||
newsTicker.AddChild(new Paragraph(Anchor.CenterLeft, float.MaxValue, p => currentNews, true) {
|
newsTicker.AddChild(new Paragraph(Anchor.CenterLeft, float.MaxValue, _ => currentNews, true) {
|
||||||
OnUpdated = (e, time) => {
|
OnUpdated = (e, _) => {
|
||||||
e.PositionOffset -= new Vector2(1, 0);
|
e.PositionOffset -= new Vector2(1, 0);
|
||||||
if (e.PositionOffset.X <= -e.DisplayArea.Width / e.Scale - 20) {
|
if (e.PositionOffset.X <= -e.DisplayArea.Width / e.Scale - 20) {
|
||||||
e.PositionOffset = new Vector2(e.Parent.DisplayArea.Width / e.Scale + 20, 0);
|
e.PositionOffset = new Vector2(e.Parent.DisplayArea.Width / e.Scale + 20, 0);
|
||||||
|
@ -69,25 +68,25 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var ticketGroup = main.AddChild(new Group(Anchor.AutoCenter, new Vector2(1, 0.175F), false));
|
var ticketGroup = main.AddChild(new Group(Anchor.AutoCenter, new Vector2(1, 0.175F), false));
|
||||||
ticketGroup.AddChild(new Paragraph(Anchor.AutoCenter, 10000, p => PrettyPrintNumber(GameImpl.Instance.Tickets) + "<i ticket>", true) {
|
ticketGroup.AddChild(new Paragraph(Anchor.AutoCenter, 10000, _ => Ui.PrettyPrintNumber(GameImpl.Instance.Tickets) + "<i ticket>", true) {
|
||||||
RegularFont = Assets.MonospacedFont,
|
RegularFont = Assets.MonospacedFont,
|
||||||
TextScale = 0.3F
|
TextScale = 0.3F
|
||||||
});
|
});
|
||||||
ticketGroup.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => GameImpl.Instance.Map.TicketsPerSecond.ToString("#,0.##") + "<i ticket>/s", true));
|
ticketGroup.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => GameImpl.Instance.Map.TicketsPerSecond.ToString("#,0.##") + "<i ticket>/s", true));
|
||||||
BigInteger lastTickets = 0;
|
BigInteger lastTickets = 0;
|
||||||
ActiveCoroutine storeWobble = null;
|
ActiveCoroutine storeWobble = null;
|
||||||
var storeGroup = main.AddChild(new Group(Anchor.AutoCenter, new Vector2(1, 0.425F), false) {
|
var storeGroup = main.AddChild(new Group(Anchor.AutoCenter, new Vector2(1, 0.425F), false) {
|
||||||
OnUpdated = (e, time) => {
|
OnUpdated = (e, _) => {
|
||||||
if (lastTickets != GameImpl.Instance.Tickets) {
|
if (lastTickets != GameImpl.Instance.Tickets) {
|
||||||
lastTickets = GameImpl.Instance.Tickets;
|
lastTickets = GameImpl.Instance.Tickets;
|
||||||
// only wobble if we're not already wobbling
|
// only wobble if we're not already wobbling
|
||||||
if (storeWobble == null || storeWobble.IsFinished)
|
if (storeWobble == null || storeWobble.IsFinished)
|
||||||
storeWobble = CoroutineHandler.Start(WobbleElement(e));
|
storeWobble = CoroutineHandler.Start(Ui.WobbleElement(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
storeGroup.AddChild(new Image(Anchor.TopLeft, Vector2.One, Assets.UiTexture[0, 0, 2, 3]) {
|
storeGroup.AddChild(new Image(Anchor.TopLeft, Vector2.One, Assets.UiTexture[0, 0, 2, 3]) {
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
var rate = 1;
|
var rate = 1;
|
||||||
if (Upgrade.TapIncrease[2].IsActive()) {
|
if (Upgrade.TapIncrease[2].IsActive()) {
|
||||||
rate = 50;
|
rate = 50;
|
||||||
|
@ -96,9 +95,9 @@ namespace TouchyTickets {
|
||||||
} else if (Upgrade.TapIncrease[0].IsActive()) {
|
} else if (Upgrade.TapIncrease[0].IsActive()) {
|
||||||
rate = 5;
|
rate = 5;
|
||||||
}
|
}
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
rate = 500000;
|
rate = 500000;
|
||||||
#endif
|
#endif
|
||||||
GameImpl.Instance.Tickets += rate;
|
GameImpl.Instance.Tickets += rate;
|
||||||
},
|
},
|
||||||
CanBeSelected = true,
|
CanBeSelected = true,
|
||||||
|
@ -115,24 +114,24 @@ namespace TouchyTickets {
|
||||||
batch.Draw(this.uiSystem.Style.PanelTexture, new RectangleF(pos - new Vector2(2) * e.Scale, mapSize * scale + new Vector2(4) * e.Scale), Color.White * alpha, e.Scale);
|
batch.Draw(this.uiSystem.Style.PanelTexture, new RectangleF(pos - new Vector2(2) * e.Scale, mapSize * scale + new Vector2(4) * e.Scale), Color.White * alpha, e.Scale);
|
||||||
map.Draw(time, batch, pos, scale, alpha, false, new RectangleF(Vector2.Zero, mapSize * scale));
|
map.Draw(time, batch, pos, scale, alpha, false, new RectangleF(Vector2.Zero, mapSize * scale));
|
||||||
},
|
},
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
if (this.swipeProgress != 0)
|
if (this.swipeProgress != 0)
|
||||||
return;
|
return;
|
||||||
var map = GameImpl.Instance.Map;
|
var map = GameImpl.Instance.Map;
|
||||||
var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false};
|
var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false};
|
||||||
AddSelectedAttractionInfo(infoUi);
|
Ui.AddSelectedAttractionInfo(infoUi);
|
||||||
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
||||||
OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name))
|
OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name))
|
||||||
});
|
});
|
||||||
infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Remove")) {
|
infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Remove")) {
|
||||||
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
||||||
OnPressed = e2 => {
|
OnPressed = _ => {
|
||||||
if (map.SelectedPosition == null)
|
if (map.SelectedPosition == null)
|
||||||
return;
|
return;
|
||||||
map.Remove(map.SelectedPosition.Value);
|
map.Remove(map.SelectedPosition.Value);
|
||||||
map.SelectedPosition = null;
|
map.SelectedPosition = null;
|
||||||
},
|
},
|
||||||
OnUpdated = (e2, time) => ((Button) e2).IsDisabled = map.SelectedPosition == null
|
OnUpdated = (e2, _) => ((Button) e2).IsDisabled = map.SelectedPosition == null
|
||||||
});
|
});
|
||||||
// we want this to render below the main ui while it fades away
|
// we want this to render below the main ui while it fades away
|
||||||
this.uiSystem.Add("MapViewInfo", infoUi).Priority = -100;
|
this.uiSystem.Add("MapViewInfo", infoUi).Priority = -100;
|
||||||
|
@ -146,7 +145,7 @@ namespace TouchyTickets {
|
||||||
// buy ui
|
// buy ui
|
||||||
var buyUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var buyUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
OnDrawn = (e, _, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
||||||
};
|
};
|
||||||
buyUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Attractions"), true) {TextScale = 0.15F});
|
buyUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Attractions"), true) {TextScale = 0.15F});
|
||||||
var buyList = buyUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, false) {
|
var buyList = buyUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, false) {
|
||||||
|
@ -159,7 +158,7 @@ namespace TouchyTickets {
|
||||||
var button = buyList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
var button = buyList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) {
|
||||||
ChildPadding = new Padding(4),
|
ChildPadding = new Padding(4),
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
if (this.swipeProgress != 0)
|
if (this.swipeProgress != 0)
|
||||||
return;
|
return;
|
||||||
var map = GameImpl.Instance.Map;
|
var map = GameImpl.Instance.Map;
|
||||||
|
@ -182,14 +181,14 @@ namespace TouchyTickets {
|
||||||
map.PlacingAttraction.Wobble();
|
map.PlacingAttraction.Wobble();
|
||||||
this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name));
|
this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name));
|
||||||
},
|
},
|
||||||
OnUpdated = (e2, time) => ((Button) e2).IsDisabled = !map.CanPlace(map.PlacingPosition, map.PlacingAttraction)
|
OnUpdated = (e2, _) => ((Button) e2).IsDisabled = !map.CanPlace(map.PlacingPosition, map.PlacingAttraction)
|
||||||
});
|
});
|
||||||
// we want this to render below the main ui while it fades away
|
// we want this to render below the main ui while it fades away
|
||||||
this.uiSystem.Add("PlacingYesNo", yesNoUi).Priority = -100;
|
this.uiSystem.Add("PlacingYesNo", yesNoUi).Priority = -100;
|
||||||
|
|
||||||
this.FadeUi(true);
|
this.FadeUi(true);
|
||||||
},
|
},
|
||||||
OnAreaUpdated = e => {
|
OnAreaUpdated = _ => {
|
||||||
// only update the price when the area updates, since it won't change while we're in the buy ui
|
// only update the price when the area updates, since it won't change while we're in the buy ui
|
||||||
attractionAmount = GameImpl.Instance.Map.GetAttractionAmount(attraction.Value);
|
attractionAmount = GameImpl.Instance.Map.GetAttractionAmount(attraction.Value);
|
||||||
// yay compound interest
|
// yay compound interest
|
||||||
|
@ -202,9 +201,9 @@ namespace TouchyTickets {
|
||||||
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1), false) {CanBeMoused = false});
|
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1), false) {CanBeMoused = false});
|
||||||
var name = right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(attraction.Key), true));
|
var name = right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(attraction.Key), true));
|
||||||
var hiddenName = right.AddChild(new Paragraph(Anchor.TopLeft, 1, "?????", true) {TextColor = Color.Gray});
|
var hiddenName = right.AddChild(new Paragraph(Anchor.TopLeft, 1, "?????", true) {TextColor = Color.Gray});
|
||||||
var genRate = right.AddChild(new Paragraph(Anchor.BottomLeft, 1, p => attraction.Value.GetGenerationRate() + "<i ticket>/s", true) {TextScale = 0.08F});
|
var genRate = right.AddChild(new Paragraph(Anchor.BottomLeft, 1, _ => attraction.Value.GetGenerationRate() + "<i ticket>/s", true) {TextScale = 0.08F});
|
||||||
right.AddChild(new Paragraph(Anchor.BottomRight, 1, p => PrettyPrintNumber(price) + "<i ticket>", true));
|
right.AddChild(new Paragraph(Anchor.BottomRight, 1, _ => Ui.PrettyPrintNumber(price) + "<i ticket>", true));
|
||||||
button.OnUpdated += (e, time) => {
|
button.OnUpdated += (_, _) => {
|
||||||
button.IsDisabled = GameImpl.Instance.Tickets < price;
|
button.IsDisabled = GameImpl.Instance.Tickets < price;
|
||||||
// we only want to show the info if we have enough tickets or we've placed the thing before
|
// we only want to show the info if we have enough tickets or we've placed the thing before
|
||||||
var shouldShow = !button.IsDisabled || attractionAmount > 0;
|
var shouldShow = !button.IsDisabled || attractionAmount > 0;
|
||||||
|
@ -219,7 +218,7 @@ namespace TouchyTickets {
|
||||||
// modifier ui
|
// modifier ui
|
||||||
var modifierUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var modifierUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
OnDrawn = (e, _, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
||||||
};
|
};
|
||||||
modifierUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Modifiers"), true) {TextScale = 0.15F});
|
modifierUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Modifiers"), true) {TextScale = 0.15F});
|
||||||
var modifierList = modifierUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, false) {
|
var modifierList = modifierUi.AddChild(new Panel(Anchor.AutoLeft, Vector2.One, Vector2.Zero, false, true, false) {
|
||||||
|
@ -231,19 +230,19 @@ namespace TouchyTickets {
|
||||||
SetHeightBasedOnChildren = true,
|
SetHeightBasedOnChildren = true,
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
ChildPadding = new Padding(4),
|
ChildPadding = new Padding(4),
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
if (this.swipeProgress != 0)
|
if (this.swipeProgress != 0)
|
||||||
return;
|
return;
|
||||||
var map = GameImpl.Instance.Map;
|
var map = GameImpl.Instance.Map;
|
||||||
map.PlacingModifier = modifier;
|
map.PlacingModifier = modifier;
|
||||||
var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false};
|
var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false};
|
||||||
AddSelectedAttractionInfo(infoUi);
|
Ui.AddSelectedAttractionInfo(infoUi);
|
||||||
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
||||||
OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name))
|
OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name))
|
||||||
});
|
});
|
||||||
var addButton = infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), string.Empty) {
|
var addButton = infoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), string.Empty) {
|
||||||
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
ActionSound = new SoundEffectInfo(Assets.PlaceSound),
|
||||||
OnPressed = e2 => {
|
OnPressed = _ => {
|
||||||
if (map.SelectedPosition == null)
|
if (map.SelectedPosition == null)
|
||||||
return;
|
return;
|
||||||
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
||||||
|
@ -263,7 +262,7 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
attraction.Wobble();
|
attraction.Wobble();
|
||||||
},
|
},
|
||||||
OnUpdated = (e2, time) => {
|
OnUpdated = (e2, _) => {
|
||||||
var disabled = map.SelectedPosition == null;
|
var disabled = map.SelectedPosition == null;
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
||||||
|
@ -272,14 +271,14 @@ namespace TouchyTickets {
|
||||||
((Button) e2).IsDisabled = disabled;
|
((Button) e2).IsDisabled = disabled;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addButton.Text.GetTextCallback = p => {
|
addButton.Text.GetTextCallback = _ => {
|
||||||
BigInteger price = map.PlacingModifier.InitialPrice;
|
BigInteger price = map.PlacingModifier.InitialPrice;
|
||||||
if (map.SelectedPosition != null) {
|
if (map.SelectedPosition != null) {
|
||||||
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
||||||
if (attraction != null && map.PlacingModifier.IsAffected(attraction))
|
if (attraction != null && map.PlacingModifier.IsAffected(attraction))
|
||||||
price = attraction.GetModifierPrice(map.PlacingModifier);
|
price = attraction.GetModifierPrice(map.PlacingModifier);
|
||||||
}
|
}
|
||||||
return PrettyPrintNumber(price) + "<i ticket>";
|
return Ui.PrettyPrintNumber(price) + "<i ticket>";
|
||||||
};
|
};
|
||||||
// we want this to render below the main ui while it fades away
|
// we want this to render below the main ui while it fades away
|
||||||
this.uiSystem.Add("ModifierInfo", infoUi).Priority = -100;
|
this.uiSystem.Add("ModifierInfo", infoUi).Priority = -100;
|
||||||
|
@ -294,7 +293,7 @@ namespace TouchyTickets {
|
||||||
var name = right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(modifier.Name), true));
|
var name = right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(modifier.Name), true));
|
||||||
var hiddenName = right.AddChild(new Paragraph(Anchor.TopLeft, 1, "?????", true) {TextColor = Color.Gray});
|
var hiddenName = right.AddChild(new Paragraph(Anchor.TopLeft, 1, "?????", true) {TextColor = Color.Gray});
|
||||||
var desc = right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(modifier.Name + "Description"), true) {TextScale = 0.08F});
|
var desc = right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(modifier.Name + "Description"), true) {TextScale = 0.08F});
|
||||||
right.AddChild(new Paragraph(Anchor.AutoRight, 1, p => PrettyPrintNumber(modifier.InitialPrice) + "<i ticket>", true));
|
right.AddChild(new Paragraph(Anchor.AutoRight, 1, _ => Ui.PrettyPrintNumber(modifier.InitialPrice) + "<i ticket>", true));
|
||||||
var genRate = right.AddChild(new Paragraph(Anchor.BottomLeft, 1, $"x{modifier.Multiplier}<i ticket>", true) {TextScale = 0.08F});
|
var genRate = right.AddChild(new Paragraph(Anchor.BottomLeft, 1, $"x{modifier.Multiplier}<i ticket>", true) {TextScale = 0.08F});
|
||||||
|
|
||||||
var shouldShow = false;
|
var shouldShow = false;
|
||||||
|
@ -303,7 +302,7 @@ namespace TouchyTickets {
|
||||||
shouldShow = GameImpl.Instance.Map.IsAnyAttractionAffected(modifier);
|
shouldShow = GameImpl.Instance.Map.IsAnyAttractionAffected(modifier);
|
||||||
e.SetData("Show", shouldShow);
|
e.SetData("Show", shouldShow);
|
||||||
};
|
};
|
||||||
button.OnUpdated += (e, time) => {
|
button.OnUpdated += (_, _) => {
|
||||||
button.IsDisabled = !shouldShow || GameImpl.Instance.Tickets < modifier.InitialPrice;
|
button.IsDisabled = !shouldShow || GameImpl.Instance.Tickets < modifier.InitialPrice;
|
||||||
image.Color = shouldShow ? Color.White : Color.Black;
|
image.Color = shouldShow ? Color.White : Color.Black;
|
||||||
name.IsHidden = !shouldShow;
|
name.IsHidden = !shouldShow;
|
||||||
|
@ -312,7 +311,7 @@ namespace TouchyTickets {
|
||||||
desc.IsHidden = !shouldShow;
|
desc.IsHidden = !shouldShow;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
modifierList.OnAreaUpdated += e => {
|
modifierList.OnAreaUpdated += _ => {
|
||||||
// sort children by whether they should be shown or not
|
// sort children by whether they should be shown or not
|
||||||
modifierList.ReorderChildren((e1, e2) => Comparer<bool>.Default.Compare(e2.GetData<bool>("Show"), e1.GetData<bool>("Show")));
|
modifierList.ReorderChildren((e1, e2) => Comparer<bool>.Default.Compare(e2.GetData<bool>("Show"), e1.GetData<bool>("Show")));
|
||||||
};
|
};
|
||||||
|
@ -321,16 +320,16 @@ namespace TouchyTickets {
|
||||||
// upgrade ui
|
// upgrade ui
|
||||||
var upgradeUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var upgradeUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
OnDrawn = (e, _, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgb(0x86bccf) * alpha)
|
||||||
};
|
};
|
||||||
var upgradeHeader = upgradeUi.AddChild(new Group(Anchor.AutoLeft, new Vector2(1)));
|
var upgradeHeader = upgradeUi.AddChild(new Group(Anchor.AutoLeft, new Vector2(1)));
|
||||||
upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => GameImpl.Instance.Stars + "<i star>", true) {TextScale = 0.3F});
|
upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => GameImpl.Instance.Stars + "<i star>", true) {TextScale = 0.3F});
|
||||||
upgradeHeader.AddChild(new Button(Anchor.AutoCenter, new Vector2(0.8F, 30), Localization.Get("EarnStar")) {
|
upgradeHeader.AddChild(new Button(Anchor.AutoCenter, new Vector2(0.8F, 30), Localization.Get("EarnStar")) {
|
||||||
PositionOffset = new Vector2(0, 4),
|
PositionOffset = new Vector2(0, 4),
|
||||||
OnUpdated = (e, time) => ((Button) e).IsDisabled = GameImpl.Instance.GetBuyableStars() <= 0,
|
OnUpdated = (e, _) => ((Button) e).IsDisabled = GameImpl.Instance.GetBuyableStars() <= 0,
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnDrawn = (e2, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
OnDrawn = (e2, _, batch, _) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
||||||
};
|
};
|
||||||
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
||||||
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, string.Format(Localization.Get("ReallyEarnStar"), GameImpl.Instance.GetBuyableStars())));
|
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, string.Format(Localization.Get("ReallyEarnStar"), GameImpl.Instance.GetBuyableStars())));
|
||||||
|
@ -355,20 +354,20 @@ namespace TouchyTickets {
|
||||||
this.uiSystem.Add("ReallyEarnStarBox", infoBox);
|
this.uiSystem.Add("ReallyEarnStarBox", infoBox);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => string.Format(Localization.Get("RequiresTickets"), PrettyPrintNumber(GameImpl.Instance.GetStarPrice())), true) {
|
upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => string.Format(Localization.Get("RequiresTickets"), Ui.PrettyPrintNumber(GameImpl.Instance.GetStarPrice())), true) {
|
||||||
PositionOffset = new Vector2(0, 2)
|
PositionOffset = new Vector2(0, 2)
|
||||||
});
|
});
|
||||||
var upgradeList = upgradeUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, false) {
|
var upgradeList = upgradeUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, false) {
|
||||||
ChildPadding = new Padding(5, 15, 5, 5)
|
ChildPadding = new Padding(5, 15, 5, 5)
|
||||||
});
|
});
|
||||||
upgradeHeader.OnAreaUpdated += e => upgradeList.Size = new Vector2(1, (upgradeUi.DisplayArea.Height - upgradeHeader.DisplayArea.Height) / e.Scale);
|
upgradeHeader.OnAreaUpdated += e => upgradeList.Size = new Vector2(1, (upgradeUi.DisplayArea.Height - upgradeHeader.DisplayArea.Height) / e.Scale);
|
||||||
PopulateUpgradeList(upgradeList);
|
Ui.PopulateUpgradeList(upgradeList);
|
||||||
this.uiSystem.Add("Upgrade", upgradeUi);
|
this.uiSystem.Add("Upgrade", upgradeUi);
|
||||||
|
|
||||||
// options ui
|
// options ui
|
||||||
var optionsUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var optionsUi = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgba(0x86bccf) * alpha)
|
OnDrawn = (e, _, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorHelper.FromHexRgba(0x86bccf) * alpha)
|
||||||
};
|
};
|
||||||
optionsUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Options"), true) {TextScale = 0.15F});
|
optionsUi.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("Options"), true) {TextScale = 0.15F});
|
||||||
var optionList = optionsUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, false) {
|
var optionList = optionsUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1), Vector2.Zero, false, true, false) {
|
||||||
|
@ -380,14 +379,14 @@ namespace TouchyTickets {
|
||||||
TextScale = 0.12F
|
TextScale = 0.12F
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("AutoBuyEnabled"), Options.Instance.AutoBuyEnabled) {
|
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("AutoBuyEnabled"), Options.Instance.AutoBuyEnabled) {
|
||||||
OnCheckStateChange = (e, value) => {
|
OnCheckStateChange = (_, value) => {
|
||||||
Options.Instance.AutoBuyEnabled = value;
|
Options.Instance.AutoBuyEnabled = value;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
},
|
},
|
||||||
PositionOffset = new Vector2(0, 1)
|
PositionOffset = new Vector2(0, 1)
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("MinTicketsForAutoBuy") + ":"));
|
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("MinTicketsForAutoBuy") + ":"));
|
||||||
var num = optionList.AddChild(ElementHelper.NumberField(Anchor.AutoLeft, new Vector2(1, 20), Options.Instance.MinTicketsForAutoBuy, 1000, null, (t, value) => {
|
var num = optionList.AddChild(ElementHelper.NumberField(Anchor.AutoLeft, new Vector2(1, 20), Options.Instance.MinTicketsForAutoBuy, 1000, null, (_, value) => {
|
||||||
if (int.TryParse(value, out var ret)) {
|
if (int.TryParse(value, out var ret)) {
|
||||||
Options.Instance.MinTicketsForAutoBuy = ret;
|
Options.Instance.MinTicketsForAutoBuy = ret;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
@ -396,41 +395,41 @@ namespace TouchyTickets {
|
||||||
num.PositionOffset = new Vector2(0, 1);
|
num.PositionOffset = new Vector2(0, 1);
|
||||||
optionList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Achievements")) {
|
optionList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Achievements")) {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
OnPressed = e => GameImpl.Instance.Platform.ShowAchievements()
|
OnPressed = _ => GameImpl.Instance.Platform.ShowAchievements()
|
||||||
});
|
});
|
||||||
|
|
||||||
optionList.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("OtherOptions"), true) {
|
optionList.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get("OtherOptions"), true) {
|
||||||
PositionOffset = new Vector2(0, 10),
|
PositionOffset = new Vector2(0, 10),
|
||||||
TextScale = 0.12F
|
TextScale = 0.12F
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, p => Localization.Get("RainingTicketLimit") + ": " + Options.Instance.RainingTicketLimit));
|
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => Localization.Get("RainingTicketLimit") + ": " + Options.Instance.RainingTicketLimit));
|
||||||
optionList.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 20), 10, 500) {
|
optionList.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 20), 10, 500) {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
CurrentValue = Options.Instance.RainingTicketLimit,
|
CurrentValue = Options.Instance.RainingTicketLimit,
|
||||||
OnValueChanged = (s, v) => {
|
OnValueChanged = (_, v) => {
|
||||||
Options.Instance.RainingTicketLimit = (int) v;
|
Options.Instance.RainingTicketLimit = (int) v;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, p => Localization.Get("SoundVolume") + ": " + (int) (Options.Instance.SoundVolume * 100)));
|
optionList.AddChild(new Paragraph(Anchor.AutoLeft, 1, _ => Localization.Get("SoundVolume") + ": " + (int) (Options.Instance.SoundVolume * 100)));
|
||||||
optionList.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 20), 10, 100) {
|
optionList.AddChild(new Slider(Anchor.AutoLeft, new Vector2(1, 20), 10, 100) {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
CurrentValue = Options.Instance.SoundVolume * 100,
|
CurrentValue = Options.Instance.SoundVolume * 100,
|
||||||
OnValueChanged = (s, v) => {
|
OnValueChanged = (_, v) => {
|
||||||
Options.Instance.SoundVolume = v / 100;
|
Options.Instance.SoundVolume = v / 100;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("WhileYouWereAwayMessage"), Options.Instance.WhileYouWereAwayMessage) {
|
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("WhileYouWereAwayMessage"), Options.Instance.WhileYouWereAwayMessage) {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
OnCheckStateChange = (b, value) => {
|
OnCheckStateChange = (_, value) => {
|
||||||
Options.Instance.WhileYouWereAwayMessage = value;
|
Options.Instance.WhileYouWereAwayMessage = value;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("KeepScreenOn"), Options.Instance.KeepScreenOn) {
|
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("KeepScreenOn"), Options.Instance.KeepScreenOn) {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
OnCheckStateChange = (b, value) => {
|
OnCheckStateChange = (_, value) => {
|
||||||
Options.Instance.KeepScreenOn = value;
|
Options.Instance.KeepScreenOn = value;
|
||||||
Options.Save();
|
Options.Save();
|
||||||
}
|
}
|
||||||
|
@ -444,7 +443,7 @@ namespace TouchyTickets {
|
||||||
PositionOffset = new Vector2(0, 10),
|
PositionOffset = new Vector2(0, 10),
|
||||||
SetWidthBasedOnChildren = true,
|
SetWidthBasedOnChildren = true,
|
||||||
CanBeMoused = false,
|
CanBeMoused = false,
|
||||||
OnUpdated = (e, time) => {
|
OnUpdated = (e, _) => {
|
||||||
if (this.swipeProgress == 0) {
|
if (this.swipeProgress == 0) {
|
||||||
if (swipeTimer > 0) {
|
if (swipeTimer > 0) {
|
||||||
swipeTimer -= 0.04F;
|
swipeTimer -= 0.04F;
|
||||||
|
@ -463,7 +462,7 @@ namespace TouchyTickets {
|
||||||
swipeInfo.AddChild(new Image(Anchor.AutoInlineIgnoreOverflow, new Vector2(12, 6), tex) {
|
swipeInfo.AddChild(new Image(Anchor.AutoInlineIgnoreOverflow, new Vector2(12, 6), tex) {
|
||||||
MaintainImageAspect = false,
|
MaintainImageAspect = false,
|
||||||
Padding = new Padding(1),
|
Padding = new Padding(1),
|
||||||
OnUpdated = (e, time) => ((Image) e).DrawAlpha = this.currentUi == ui ? 1 : 0.35F
|
OnUpdated = (e, _) => ((Image) e).DrawAlpha = this.currentUi == ui ? 1 : 0.35F
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.uiSystem.Add("SwipeInfo", swipeInfo).Priority = 200;
|
this.uiSystem.Add("SwipeInfo", swipeInfo).Priority = 200;
|
||||||
|
@ -537,7 +536,7 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public static IEnumerator<Wait> DisplaySplash(Action loadGame) {
|
public static IEnumerator<Wait> DisplaySplash(Action loadGame) {
|
||||||
var splash = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var splash = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, Color.Black * alpha)
|
OnDrawn = (e, _, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, Color.Black * alpha)
|
||||||
};
|
};
|
||||||
var content = splash.AddChild(new Group(Anchor.TopLeft, Vector2.One, false) {DrawAlpha = 0});
|
var content = splash.AddChild(new Group(Anchor.TopLeft, Vector2.One, false) {DrawAlpha = 0});
|
||||||
var center = content.AddChild(new Group(Anchor.Center, new Vector2(0.5F, 0.5F), false));
|
var center = content.AddChild(new Group(Anchor.Center, new Vector2(0.5F, 0.5F), false));
|
||||||
|
@ -560,7 +559,7 @@ namespace TouchyTickets {
|
||||||
var panel = splash.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
var panel = splash.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
||||||
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("GDPRInfo")));
|
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("GDPRInfo")));
|
||||||
panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Okay")) {
|
panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Okay")) {
|
||||||
OnPressed = e2 => {
|
OnPressed = _ => {
|
||||||
// create the (empty) flag file
|
// create the (empty) flag file
|
||||||
using (analyticsFlag.Create()) {}
|
using (analyticsFlag.Create()) {}
|
||||||
splash.RemoveChild(panel);
|
splash.RemoveChild(panel);
|
||||||
|
@ -588,12 +587,12 @@ namespace TouchyTickets {
|
||||||
if (ticketGen <= 0 && ticketPerSecondGen <= 0)
|
if (ticketGen <= 0 && ticketPerSecondGen <= 0)
|
||||||
return;
|
return;
|
||||||
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnDrawn = (e2, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
OnDrawn = (e2, _, batch, _) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
||||||
};
|
};
|
||||||
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
||||||
var text = string.Format(Localization.Get("WhileYouWereAway"), passed.TotalMinutes.ToString("0.#"));
|
var text = string.Format(Localization.Get("WhileYouWereAway"), passed.TotalMinutes.ToString("0.#"));
|
||||||
if (ticketGen > 0)
|
if (ticketGen > 0)
|
||||||
text += " " + string.Format(Localization.Get("WhileYouWereAwayTickets"), PrettyPrintNumber(ticketGen));
|
text += " " + string.Format(Localization.Get("WhileYouWereAwayTickets"), Ui.PrettyPrintNumber(ticketGen));
|
||||||
if (ticketPerSecondGen > 0)
|
if (ticketPerSecondGen > 0)
|
||||||
text += " " + string.Format(Localization.Get("WhileYouWereAwayTps"), ticketPerSecondGen.ToString("#,0.##"));
|
text += " " + string.Format(Localization.Get("WhileYouWereAwayTps"), ticketPerSecondGen.ToString("#,0.##"));
|
||||||
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, text));
|
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, text));
|
||||||
|
@ -605,7 +604,7 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public static void DisplayRatePlease() {
|
public static void DisplayRatePlease() {
|
||||||
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
|
||||||
OnDrawn = (e2, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
OnDrawn = (e2, _, batch, _) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
|
||||||
};
|
};
|
||||||
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
|
||||||
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, string.Format(Localization.Get("RateInfo"))));
|
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, string.Format(Localization.Get("RateInfo"))));
|
||||||
|
@ -652,13 +651,13 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
private static void AddSelectedAttractionInfo(Element element) {
|
private static void AddSelectedAttractionInfo(Element element) {
|
||||||
var map = GameImpl.Instance.Map;
|
var map = GameImpl.Instance.Map;
|
||||||
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => {
|
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => {
|
||||||
if (map.SelectedPosition == null)
|
if (map.SelectedPosition == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
var attraction = map.GetAttractionAt(map.SelectedPosition.Value);
|
||||||
return string.Join(" ", attraction.Modifiers.Select(m => $"{m.Amount}<i {m.Modifier.Name}>"));
|
return string.Join(" ", attraction.Modifiers.Select(m => $"{m.Amount}<i {m.Modifier.Name}>"));
|
||||||
}, true));
|
}, true));
|
||||||
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => {
|
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => {
|
||||||
if (map.SelectedPosition == null)
|
if (map.SelectedPosition == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
var pos = map.SelectedPosition.Value;
|
var pos = map.SelectedPosition.Value;
|
||||||
|
@ -672,7 +671,7 @@ namespace TouchyTickets {
|
||||||
return multiplier > 1 ? $"<i {u.Name}> x{multiplier}" : null;
|
return multiplier > 1 ? $"<i {u.Name}> x{multiplier}" : null;
|
||||||
}).Where(s => s != null));
|
}).Where(s => s != null));
|
||||||
}, true));
|
}, true));
|
||||||
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => {
|
element.AddChild(new Paragraph(Anchor.AutoCenter, 1, _ => {
|
||||||
if (map.SelectedPosition == null)
|
if (map.SelectedPosition == null)
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
var pos = map.SelectedPosition.Value;
|
var pos = map.SelectedPosition.Value;
|
||||||
|
@ -698,13 +697,13 @@ namespace TouchyTickets {
|
||||||
PositionOffset = new Vector2(0, 1),
|
PositionOffset = new Vector2(0, 1),
|
||||||
ChildPadding = new Padding(4),
|
ChildPadding = new Padding(4),
|
||||||
ActionSound = new SoundEffectInfo(Assets.BuySound),
|
ActionSound = new SoundEffectInfo(Assets.BuySound),
|
||||||
OnPressed = e => {
|
OnPressed = _ => {
|
||||||
GameImpl.Instance.Stars -= upgrade.Price;
|
GameImpl.Instance.Stars -= upgrade.Price;
|
||||||
GameImpl.Instance.Platform.AddResourceEvent(true, "Stars", upgrade.Price, "Upgrade", upgrade.Name);
|
GameImpl.Instance.Platform.AddResourceEvent(true, "Stars", upgrade.Price, "Upgrade", upgrade.Name);
|
||||||
|
|
||||||
GameImpl.Instance.AppliedUpgrades.Add(upgrade);
|
GameImpl.Instance.AppliedUpgrades.Add(upgrade);
|
||||||
upgrade.OnApplied();
|
upgrade.OnApplied();
|
||||||
PopulateUpgradeList(upgradeList);
|
Ui.PopulateUpgradeList(upgradeList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -713,7 +712,7 @@ namespace TouchyTickets {
|
||||||
button.IsDisabled = upgrade.IsActive() || GameImpl.Instance.Stars < upgrade.Price;
|
button.IsDisabled = upgrade.IsActive() || GameImpl.Instance.Stars < upgrade.Price;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.OnUpdated += (e, time) => HideAndDisable();
|
button.OnUpdated += (_, _) => HideAndDisable();
|
||||||
HideAndDisable();
|
HideAndDisable();
|
||||||
|
|
||||||
button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), Assets.UiTexture[upgrade.Texture]) {
|
button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), Assets.UiTexture[upgrade.Texture]) {
|
||||||
|
@ -722,7 +721,7 @@ namespace TouchyTickets {
|
||||||
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1)) {CanBeMoused = false});
|
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1)) {CanBeMoused = false});
|
||||||
right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(upgrade.Name), true));
|
right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(upgrade.Name), true));
|
||||||
if (!reachedActive)
|
if (!reachedActive)
|
||||||
right.AddChild(new Paragraph(Anchor.TopRight, 1, p => upgrade.Price + "<i star>", true));
|
right.AddChild(new Paragraph(Anchor.TopRight, 1, _ => upgrade.Price + "<i star>", true));
|
||||||
right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(upgrade.Name + "Description"), true) {TextScale = 0.08F});
|
right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(upgrade.Name + "Description"), true) {TextScale = 0.08F});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,12 +738,11 @@ namespace TouchyTickets {
|
||||||
|
|
||||||
public static string PrettyPrintNumber(BigInteger number) {
|
public static string PrettyPrintNumber(BigInteger number) {
|
||||||
for (var i = 0; i < Localization.NumberFormat.Count; i++) {
|
for (var i = 0; i < Localization.NumberFormat.Count; i++) {
|
||||||
if (number < ExpoNums[i])
|
if (number < Ui.ExpoNums[i])
|
||||||
return number.ToString(Localization.NumberFormat[i]);
|
return number.ToString(Localization.NumberFormat[i]);
|
||||||
}
|
}
|
||||||
// if the number is too large, just return the highest possible
|
// if the number is too large, just return the highest possible
|
||||||
return number.ToString(Localization.NumberFormat.Last());
|
return number.ToString(Localization.NumberFormat.Last());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
|
|
||||||
namespace TouchyTickets.Upgrades {
|
namespace TouchyTickets.Upgrades;
|
||||||
public class ModifierUpgrade : Upgrade {
|
|
||||||
|
public class ModifierUpgrade : Upgrade {
|
||||||
|
|
||||||
private readonly AttractionFlags requiredFlag;
|
private readonly AttractionFlags requiredFlag;
|
||||||
private readonly float modifier;
|
private readonly float modifier;
|
||||||
|
@ -19,5 +20,4 @@ namespace TouchyTickets.Upgrades {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -2,8 +2,9 @@ using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using TouchyTickets.Attractions;
|
using TouchyTickets.Attractions;
|
||||||
|
|
||||||
namespace TouchyTickets.Upgrades {
|
namespace TouchyTickets.Upgrades;
|
||||||
public class NeighborModifierUpgrade : Upgrade {
|
|
||||||
|
public class NeighborModifierUpgrade : Upgrade {
|
||||||
|
|
||||||
private readonly AttractionType requiredNeighbor;
|
private readonly AttractionType requiredNeighbor;
|
||||||
private readonly AttractionFlags requiredFlag;
|
private readonly AttractionFlags requiredFlag;
|
||||||
|
@ -22,5 +23,4 @@ namespace TouchyTickets.Upgrades {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -3,24 +3,26 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Extensions;
|
using MLEM.Extensions;
|
||||||
|
using TouchyTickets.Attractions;
|
||||||
using static TouchyTickets.Attractions.AttractionFlags;
|
using static TouchyTickets.Attractions.AttractionFlags;
|
||||||
using static TouchyTickets.Attractions.AttractionType;
|
using static TouchyTickets.Attractions.AttractionType;
|
||||||
|
|
||||||
namespace TouchyTickets.Upgrades {
|
namespace TouchyTickets.Upgrades;
|
||||||
public class Upgrade {
|
|
||||||
|
|
||||||
public static readonly Dictionary<string, Upgrade> Upgrades = new Dictionary<string, Upgrade>();
|
public class Upgrade {
|
||||||
public static readonly Upgrade[] MapSize = RegisterTiers("MapSize", 5, 1, 1, new Point(0, 3));
|
|
||||||
public static readonly Upgrade[] TapIncrease = RegisterTiers("TapIncrease", 3, 1, 0.5F, new Point(6, 3));
|
public static readonly Dictionary<string, Upgrade> Upgrades = new();
|
||||||
public static readonly Upgrade[] ModifierIncrease = RegisterTiers("ModifierIncrease", 3, 1, 1.5F, new Point(9, 3));
|
public static readonly Upgrade[] MapSize = Upgrade.RegisterTiers("MapSize", 5, 1, 1, new Point(0, 3));
|
||||||
public static readonly Upgrade[] AutoPlaceModifiers = RegisterTiers("AutoPlaceModifiers", 2, 6, 1, new Point(10, 3));
|
public static readonly Upgrade[] TapIncrease = Upgrade.RegisterTiers("TapIncrease", 3, 1, 0.5F, new Point(6, 3));
|
||||||
public static readonly Upgrade FerrisWheelModifier = Register(new NeighborModifierUpgrade("FerrisWheelModifier", 1, new Point(2, 3), FerrisWheel, 2));
|
public static readonly Upgrade[] ModifierIncrease = Upgrade.RegisterTiers("ModifierIncrease", 3, 1, 1.5F, new Point(9, 3));
|
||||||
public static readonly Upgrade NatureModifier = Register(new ModifierUpgrade("NatureModifier", 1, new Point(8, 3), NonTechnology, 2));
|
public static readonly Upgrade[] AutoPlaceModifiers = Upgrade.RegisterTiers("AutoPlaceModifiers", 2, 6, 1, new Point(10, 3));
|
||||||
public static readonly Upgrade FoodCourtModifier = Register(new NeighborModifierUpgrade("FoodCourtModifier", 2, new Point(1, 3), FoodCourt, 2));
|
public static readonly Upgrade FerrisWheelModifier = Upgrade.Register(new NeighborModifierUpgrade("FerrisWheelModifier", 1, new Point(2, 3), AttractionType.FerrisWheel, 2));
|
||||||
public static readonly Upgrade RollerCoasterModifier = Register(new ModifierUpgrade("RollerCoasterModifier", 2, new Point(3, 3), FastCars, 2));
|
public static readonly Upgrade NatureModifier = Upgrade.Register(new ModifierUpgrade("NatureModifier", 1, new Point(8, 3), AttractionFlags.NonTechnology, 2));
|
||||||
public static readonly Upgrade ManualRideModifier = Register(new ModifierUpgrade("ManualRideModifier", 2, new Point(4, 3), Walking, 3));
|
public static readonly Upgrade FoodCourtModifier = Upgrade.Register(new NeighborModifierUpgrade("FoodCourtModifier", 2, new Point(1, 3), AttractionType.FoodCourt, 2));
|
||||||
public static readonly Upgrade SpiralSlideModifier = Register(new NeighborModifierUpgrade("SpiralSlideModifier", 2, new Point(5, 3), SpiralSlide, 2));
|
public static readonly Upgrade RollerCoasterModifier = Upgrade.Register(new ModifierUpgrade("RollerCoasterModifier", 2, new Point(3, 3), AttractionFlags.FastCars, 2));
|
||||||
public static readonly Upgrade HauntedHouseModifier = Register(new NeighborModifierUpgrade("HauntedHouseModifier", 2, new Point(7, 3), HauntedHouse, 3, Relaxed));
|
public static readonly Upgrade ManualRideModifier = Upgrade.Register(new ModifierUpgrade("ManualRideModifier", 2, new Point(4, 3), AttractionFlags.Walking, 3));
|
||||||
|
public static readonly Upgrade SpiralSlideModifier = Upgrade.Register(new NeighborModifierUpgrade("SpiralSlideModifier", 2, new Point(5, 3), AttractionType.SpiralSlide, 2));
|
||||||
|
public static readonly Upgrade HauntedHouseModifier = Upgrade.Register(new NeighborModifierUpgrade("HauntedHouseModifier", 2, new Point(7, 3), AttractionType.HauntedHouse, 3, AttractionFlags.Relaxed));
|
||||||
|
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
public readonly int Price;
|
public readonly int Price;
|
||||||
|
@ -36,7 +38,7 @@ namespace TouchyTickets.Upgrades {
|
||||||
|
|
||||||
public void OnApplied() {
|
public void OnApplied() {
|
||||||
// map size upgrades
|
// map size upgrades
|
||||||
if (MapSize.Contains(this)) {
|
if (Upgrade.MapSize.Contains(this)) {
|
||||||
var oldMap = GameImpl.Instance.Map;
|
var oldMap = GameImpl.Instance.Map;
|
||||||
GameImpl.Instance.Map = oldMap.Copy(oldMap.Width + 10, oldMap.Height + 10);
|
GameImpl.Instance.Map = oldMap.Copy(oldMap.Width + 10, oldMap.Height + 10);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +49,7 @@ namespace TouchyTickets.Upgrades {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Upgrade Register(Upgrade upgrade) {
|
private static Upgrade Register(Upgrade upgrade) {
|
||||||
Upgrades.Add(upgrade.Name, upgrade);
|
Upgrade.Upgrades.Add(upgrade.Name, upgrade);
|
||||||
return upgrade;
|
return upgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,10 +59,9 @@ namespace TouchyTickets.Upgrades {
|
||||||
// every tier except first depends on last tier
|
// every tier except first depends on last tier
|
||||||
var deps = i == 0 ? Array.Empty<Upgrade>() : new[] {ret[i - 1]};
|
var deps = i == 0 ? Array.Empty<Upgrade>() : new[] {ret[i - 1]};
|
||||||
var price = (startPrice * (1 + i * priceIncrease)).Floor();
|
var price = (startPrice * (1 + i * priceIncrease)).Floor();
|
||||||
Register(ret[i] = new Upgrade(name + (i + 1), price, texture, deps));
|
Upgrade.Register(ret[i] = new Upgrade(name + (i + 1), price, texture, deps));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
BIN
iOS/Default.png
BIN
iOS/Default.png
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
Binary file not shown.
Before Width: | Height: | Size: 729 B |
|
@ -1,37 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>0.1.0</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>Touchy Tickets</string>
|
|
||||||
<key>CFBundleIconFiles</key>
|
|
||||||
<array>
|
|
||||||
<string>GameThumbnail.png</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>Ellpeck.TouchyTickets</string>
|
|
||||||
<key>MinimumOSVersion</key>
|
|
||||||
<string>7.0</string>
|
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
|
||||||
<array>
|
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
|
||||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>TouchyTickets</string>
|
|
||||||
<key>UIRequiresFullScreen</key>
|
|
||||||
<true/>
|
|
||||||
<key>UIStatusBarHidden</key>
|
|
||||||
<true/>
|
|
||||||
<key>UILaunchStoryboardName</key>
|
|
||||||
<string>LaunchScreen</string>
|
|
||||||
<!-- Allow running on iPhones (1) and iPads (2) -->
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>1</integer>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,32 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using TouchyTickets;
|
|
||||||
|
|
||||||
namespace iOS {
|
|
||||||
public class IosPlatform : Platform {
|
|
||||||
|
|
||||||
public override void SetupOnlineInteractions(Dictionary<string, object> analyticsJson) {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void SetKeepScreenOn(bool keep) {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OpenRateLink() {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool GainAchievement(Achievement achievement) {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ShowAchievements() {
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
|
||||||
<dependencies>
|
|
||||||
<deployment identifier="iOS" />
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--View Controller-->
|
|
||||||
<scene sceneID="EHf-IW-A2E">
|
|
||||||
<objects>
|
|
||||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
|
||||||
<layoutGuides>
|
|
||||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
|
||||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
|
||||||
</layoutGuides>
|
|
||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
|
||||||
</view>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="53" y="375" />
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
</document>
|
|
|
@ -1,30 +0,0 @@
|
||||||
using Foundation;
|
|
||||||
using MLEM.Misc;
|
|
||||||
using TouchyTickets;
|
|
||||||
using UIKit;
|
|
||||||
|
|
||||||
namespace iOS {
|
|
||||||
[Register("AppDelegate")]
|
|
||||||
internal class Program : UIApplicationDelegate {
|
|
||||||
|
|
||||||
private static GameImpl game;
|
|
||||||
|
|
||||||
private static void RunGame() {
|
|
||||||
TextInputWrapper.Current = new TextInputWrapper.Mobile();
|
|
||||||
game = new GameImpl(new IosPlatform());
|
|
||||||
game.Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
private static void Main(string[] args) {
|
|
||||||
UIApplication.Main(args, null, "AppDelegate");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void FinishedLaunching(UIApplication app) {
|
|
||||||
RunGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// 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("Touchy Tickets")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Touchy Tickets")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// 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("")]
|
|
146
iOS/iOS.csproj
146
iOS/iOS.csproj
|
@ -1,146 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
|
||||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<ProjectGuid>{CA7AB65C-57DE-412C-AF42-E7E6EDDF2D5F}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<RootNamespace>iOS</RootNamespace>
|
|
||||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
|
||||||
<AssemblyName>iOS</AssemblyName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>i386, x86_64</MtouchArch>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
<MtouchFastDev>true</MtouchFastDev>
|
|
||||||
<MtouchDebug>true</MtouchDebug>
|
|
||||||
<MtouchProfiling>true</MtouchProfiling>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>i386, x86_64</MtouchArch>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
|
|
||||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
|
||||||
<MtouchDebug>true</MtouchDebug>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<MtouchProfiling>true</MtouchProfiling>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>false</ConsolePause>
|
|
||||||
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>True</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>False</ConsolePause>
|
|
||||||
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
<BuildIpa>True</BuildIpa>
|
|
||||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
|
||||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>True</Optimize>
|
|
||||||
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<ConsolePause>False</ConsolePause>
|
|
||||||
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
|
|
||||||
<MtouchUseSGen>true</MtouchUseSGen>
|
|
||||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
|
||||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
|
||||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
|
||||||
<MtouchLink>None</MtouchLink>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="Xamarin.iOS" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="IosPlatform.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Entitlements.plist" />
|
|
||||||
<None Include="Info.plist" />
|
|
||||||
<None Include="..\TouchyTickets\Content\*\**" />
|
|
||||||
<MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb">
|
|
||||||
<Link>Content\Content.mgcb</Link>
|
|
||||||
</MonoGameContentReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BundleResource Include="Default.png" />
|
|
||||||
<BundleResource Include="GameThumbnail.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Contentless" Version="3.0.6" />
|
|
||||||
<PackageReference Include="GameAnalytics.Xamarin.SDK" Version="5.2.3" />
|
|
||||||
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
|
|
||||||
<PackageReference Include="MonoGame.Framework.iOS" Version="3.8.0.1641" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TouchyTickets\TouchyTickets.csproj">
|
|
||||||
<Project>{3df7ae69-f3f0-461a-be98-f31eb576b5e2}</Project>
|
|
||||||
<Name>TouchyTickets</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
|
||||||
</Project>
|
|
Loading…
Reference in a new issue