a bit more fucking around, removing analytics, still doesn't work on ios though

This commit is contained in:
Ellpeck 2020-06-07 20:43:07 +02:00
parent 9da60f1402
commit eeca5b37e4
11 changed files with 19 additions and 5913 deletions

View file

@ -1,12 +0,0 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.0.1375-develop",
"commands": [
"mgcb"
]
}
}
}

View file

@ -29,7 +29,7 @@ namespace Android {
this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges; this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
TextInputWrapper.Current = new TextInputWrapper.Mobile(); TextInputWrapper.Current = new TextInputWrapper.Mobile();
this.game = new GameImpl(new AndroidAnalytics(this)); this.game = new GameImpl();
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window); this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game.Window);
this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false; this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
this.game.GraphicsDeviceManager.IsFullScreen = true; this.game.GraphicsDeviceManager.IsFullScreen = true;

View file

@ -54,7 +54,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Activity1.cs" /> <Compile Include="Activity1.cs" />
<Compile Include="AndroidAnalytics.cs" />
<Compile Include="Resources\Resource.Designer.cs" /> <Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@ -64,14 +63,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Properties\AndroidManifest.xml" /> <None Include="Properties\AndroidManifest.xml" />
<MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb"> <MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb"/>
<Link>Content\Content.mgcb</Link>
</MonoGameContentReference>
<None Include="..\TouchyTickets\Content\*\**" /> <None Include="..\TouchyTickets\Content\*\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Contentless" Version="2.0.6" /> <PackageReference Include="Contentless" Version="2.0.6" />
<PackageReference Include="GameAnalytics.Xamarin.SDK" Version="4.1.0" />
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" /> <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
<PackageReference Include="MonoGame.Framework.Android" Version="3.7.1.189" /> <PackageReference Include="MonoGame.Framework.Android" Version="3.7.1.189" />
</ItemGroup> </ItemGroup>

View file

@ -1,26 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using Android.App;
using GameAnalyticsSDK;
using GameAnalyticsSDK.Utilities;
using TouchyTickets;
namespace Android {
public class AndroidAnalytics : Analytics {
private readonly Activity activity;
public AndroidAnalytics(Activity activity) {
this.activity = activity;
}
public override void Setup(Dictionary<string, object> json) {
GameAnalytics.Initialize(this.activity, GA_MiniJSON.JsonEncode(new Hashtable(json)));
}
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
GameAnalytics.NewResourceEvent(sink ? GAResourceFlowType.Sink : GAResourceFlowType.Source, currency, amount, itemType, itemId);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
using System.Collections.Generic;
namespace TouchyTickets {
public abstract class Analytics {
public abstract void Setup(Dictionary<string, object> json);
public abstract void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId);
}
}

View file

@ -13,7 +13,6 @@ namespace TouchyTickets {
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>();
public readonly Tutorial Tutorial = new Tutorial(); public readonly Tutorial Tutorial = new Tutorial();
public readonly Analytics Analytics;
public BigInteger Tickets; public BigInteger Tickets;
public int TimesRestarted; public int TimesRestarted;
public int Stars; public int Stars;
@ -24,26 +23,13 @@ namespace TouchyTickets {
public DateTime LastUpdate; public DateTime LastUpdate;
private double saveCounter; private double saveCounter;
public GameImpl(Analytics analytics) { public GameImpl() {
this.Analytics = analytics;
Instance = this; Instance = this;
} }
protected override void LoadContent() { protected override void LoadContent() {
base.LoadContent(); base.LoadContent();
// set up analytics
var settings = new Dictionary<string, object>();
settings["InfoLog"] = true;
settings["VerboseLog"] = true;
settings["SubmitErrors"] = true;
settings["ResourceCurrencies"] = new[] {"Tickets", "Stars"};
settings["ResourceItemTypes"] = new[] {"Attraction", "Restart", "Upgrade"};
// ios comes first, then android. For now they're the same
settings["GameKey"] = new[] {"cc18de06eebbc5d5e987c384fcd28000", "cc18de06eebbc5d5e987c384fcd28000"};
settings["SecretKey"] = new[] {"82ca1a930ee38e2383ffb02db7631e16033b511d", "82ca1a930ee38e2383ffb02db7631e16033b511d"};
this.Analytics.Setup(settings);
if (!SaveHandler.Load(this)) if (!SaveHandler.Load(this))
this.Map = new ParkMap(20, 20); this.Map = new ParkMap(20, 20);

View file

@ -169,8 +169,6 @@ namespace TouchyTickets {
yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Place")) { yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Place")) {
OnPressed = e2 => { OnPressed = e2 => {
GameImpl.Instance.Tickets -= price; GameImpl.Instance.Tickets -= price;
GameImpl.Instance.Analytics.AddResourceEvent(true, "Tickets", (long) price, "Attraction", attraction.Key);
map.Place(map.PlacingPosition, map.PlacingAttraction); map.Place(map.PlacingPosition, map.PlacingAttraction);
this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)); this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name));
}, },
@ -232,9 +230,6 @@ namespace TouchyTickets {
this.uiSystem.Remove(e2.Root.Name); this.uiSystem.Remove(e2.Root.Name);
var game = GameImpl.Instance; var game = GameImpl.Instance;
game.Analytics.AddResourceEvent(true, "Tickets", (long) game.Tickets, "Restart", "Restart" + game.TimesRestarted);
game.Analytics.AddResourceEvent(false, "Stars", (long) game.Tickets, "Restart", "Restart" + game.TimesRestarted);
game.Stars += game.GetBuyableStars(); game.Stars += game.GetBuyableStars();
game.TimesRestarted++; game.TimesRestarted++;
game.Tickets = 0; game.Tickets = 0;
@ -376,8 +371,6 @@ namespace TouchyTickets {
ChildPadding = new Vector2(4), ChildPadding = new Vector2(4),
OnPressed = e => { OnPressed = e => {
GameImpl.Instance.Stars -= upgrade.Price; GameImpl.Instance.Stars -= upgrade.Price;
GameImpl.Instance.Analytics.AddResourceEvent(true, "Stars", upgrade.Price, "Upgrade", upgrade.Name);
GameImpl.Instance.AppliedUpgrades.Add(upgrade); GameImpl.Instance.AppliedUpgrades.Add(upgrade);
upgrade.OnApplied(); upgrade.OnApplied();
PopulateUpgradeList(upgradeList); PopulateUpgradeList(upgradeList);

View file

@ -1,19 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using GameAnalyticsSDK;
using GameAnalyticsSDK.Utilities;
using TouchyTickets;
namespace iOS {
public class IosAnalytics : Analytics {
public override void Setup(Dictionary<string, object> json) {
GameAnalytics.Initialize(GA_MiniJSON.JsonEncode(new Hashtable(json)));
}
public override void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId) {
GameAnalytics.NewResourceEvent(sink ? GAResourceFlowType.Sink : GAResourceFlowType.Source, currency, amount, itemType, itemId);
}
}
}

View file

@ -1,9 +1,5 @@
using System; using Foundation;
using System.Collections.Generic; using MLEM.Misc;
using System.Reflection;
using Foundation;
using GameAnalyticsSDK;
using Newtonsoft.Json;
using TouchyTickets; using TouchyTickets;
using UIKit; using UIKit;
@ -14,7 +10,8 @@ namespace iOS {
private static GameImpl game; private static GameImpl game;
private static void RunGame() { private static void RunGame() {
game = new GameImpl(new IosAnalytics()); TextInputWrapper.Current = new TextInputWrapper.Mobile();
game = new GameImpl();
game.Run(); game.Run();
} }

View file

@ -57,6 +57,7 @@
<MtouchProfiling>true</MtouchProfiling> <MtouchProfiling>true</MtouchProfiling>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<MtouchLink>None</MtouchLink>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType> <DebugType>none</DebugType>
@ -70,6 +71,7 @@
<MtouchUseRefCounting>true</MtouchUseRefCounting> <MtouchUseRefCounting>true</MtouchUseRefCounting>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignKey>iPhone Developer</CodesignKey> <CodesignKey>iPhone Developer</CodesignKey>
<MtouchLink>None</MtouchLink>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType> <DebugType>none</DebugType>
@ -85,6 +87,7 @@
<BuildIpa>True</BuildIpa> <BuildIpa>True</BuildIpa>
<CodesignProvision>Automatic:AdHoc</CodesignProvision> <CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey> <CodesignKey>iPhone Distribution</CodesignKey>
<MtouchLink>None</MtouchLink>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType> <DebugType>none</DebugType>
@ -99,6 +102,7 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>Automatic:AppStore</CodesignProvision> <CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey> <CodesignKey>iPhone Distribution</CodesignKey>
<MtouchLink>None</MtouchLink>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -107,16 +111,13 @@
<Reference Include="Xamarin.iOS" /> <Reference Include="Xamarin.iOS" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="IosAnalytics.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Entitlements.plist" /> <None Include="Entitlements.plist" />
<None Include="Info.plist" /> <None Include="Info.plist" />
<MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb"> <MonoGameContentReference Include="..\TouchyTickets\Content\Content.mgcb" />
<Link>Content\Content.mgcb</Link>
</MonoGameContentReference>
<None Include="..\TouchyTickets\Content\*\**" /> <None Include="..\TouchyTickets\Content\*\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -127,9 +128,9 @@
<InterfaceDefinition Include="LaunchScreen.storyboard" /> <InterfaceDefinition Include="LaunchScreen.storyboard" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GameAnalytics.Xamarin.SDK" Version="4.1.0" /> <PackageReference Include="Contentless" Version="2.0.6" />
<PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" /> <PackageReference Include="MonoGame.Content.Builder" Version="3.7.0.9" />
<PackageReference Include="MonoGame.Framework.iOS" Version="3.7.1.189" /> <PackageReference Include="MonoGame.Framework.iOS" Version="3.8.0.1375-develop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\TouchyTickets\TouchyTickets.csproj"> <ProjectReference Include="..\TouchyTickets\TouchyTickets.csproj">