зеркало из https://github.com/xamarin/ios-samples.git
ButtonTapper3000 ported to 64-bits
This commit is contained in:
Родитель
735b82395d
Коммит
499ac9a98b
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.GameKit;
|
||||
using MonoTouch.UIKit;
|
||||
using Foundation;
|
||||
using GameKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<DefineConstants>DEBUG;XAMCORE_2_0;ARCH_64</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
|
@ -26,6 +26,7 @@
|
|||
<MtouchI18n>
|
||||
</MtouchI18n>
|
||||
<MtouchArch>ARMv7</MtouchArch>
|
||||
<MtouchExtraArgs>--registrar:static --nofastsim --override-abi x86_64</MtouchExtraArgs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
|
@ -85,7 +86,9 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="monotouch" />
|
||||
<Reference Include="Xamarin.iOS">
|
||||
<HintPath>\Developer\MonoTouch\usr\lib\mono\Xamarin.iOS\Xamarin.iOS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
|
@ -154,4 +157,4 @@
|
|||
<ImageAsset Include="Resources\Images.xcassets\LaunchImage.launchimage\Default%402x.png" />
|
||||
<ImageAsset Include="Resources\Images.xcassets\LaunchImage.launchimage\Default-568h%402x.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using MonoTouch.GameKit;
|
||||
using GameKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using MonoTouch.CoreGraphics;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using CoreGraphics;
|
||||
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -13,12 +13,12 @@ namespace ButtonTapper3000 {
|
|||
protected UIColor ButtonColor { get; private set; }
|
||||
protected UIColor InfoColor { get; private set; }
|
||||
|
||||
protected float FrameMidX { get; private set; }
|
||||
protected float FrameMidY { get; private set; }
|
||||
protected nfloat FrameMidX { get; private set; }
|
||||
protected nfloat FrameMidY { get; private set; }
|
||||
|
||||
SKTransition transition;
|
||||
|
||||
public BasicScene (SizeF size) : base (size)
|
||||
public BasicScene (CGSize size) : base (size)
|
||||
{
|
||||
ScaleMode = SKSceneScaleMode.AspectFill;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -13,50 +13,50 @@ namespace ButtonTapper3000 {
|
|||
SKLabelNode startButton;
|
||||
SKLabelNode backButton;
|
||||
|
||||
public GameSetupMenu (SizeF size) : base (size)
|
||||
public GameSetupMenu (CGSize size) : base (size)
|
||||
{
|
||||
SKLabelNode timeLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Time",
|
||||
FontSize = 24,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 70)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 70)
|
||||
};
|
||||
|
||||
SKLabelNode time15Button = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "15",
|
||||
FontSize = 14,
|
||||
FontColor = UnselectedColor,
|
||||
Position = new PointF (FrameMidX - 40, FrameMidY + 40)
|
||||
Position = new CGPoint (FrameMidX - 40, FrameMidY + 40)
|
||||
};
|
||||
SKLabelNode time30Button = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "30",
|
||||
FontSize = 14,
|
||||
FontColor = UnselectedColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 40)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 40)
|
||||
};
|
||||
SKLabelNode time45Button = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "45",
|
||||
FontSize = 14,
|
||||
FontColor = UnselectedColor,
|
||||
Position = new PointF (FrameMidX + 40, FrameMidY + 40)
|
||||
Position = new CGPoint (FrameMidX + 40, FrameMidY + 40)
|
||||
};
|
||||
timeLabels = new SKLabelNode[] { time15Button, time30Button, time45Button };
|
||||
|
||||
SKLabelNode modeLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Mode",
|
||||
FontSize = 24,
|
||||
Position = new PointF (FrameMidX, FrameMidY)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY)
|
||||
};
|
||||
SKLabelNode modeEasyButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Easy",
|
||||
FontSize = 14,
|
||||
FontColor = UnselectedColor,
|
||||
Position = new PointF (FrameMidX - 40, FrameMidY - 40)
|
||||
Position = new CGPoint (FrameMidX - 40, FrameMidY - 40)
|
||||
};
|
||||
SKLabelNode modeHardButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Hard",
|
||||
FontSize = 14,
|
||||
FontColor = UnselectedColor,
|
||||
Position = new PointF (FrameMidX + 40, FrameMidY - 40)
|
||||
Position = new CGPoint (FrameMidX + 40, FrameMidY - 40)
|
||||
};
|
||||
modeLabels = new [] { modeEasyButton, modeHardButton };
|
||||
|
||||
|
@ -64,13 +64,13 @@ namespace ButtonTapper3000 {
|
|||
Text = "Start!",
|
||||
FontSize = 30,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 100)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 100)
|
||||
};
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
timeLabels [(int)GameInfo.GameTime].FontColor = SelectedColor;
|
||||
|
@ -107,7 +107,7 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
|
||||
for (int i = 0; i < (int)GameTime.Max; i++) {
|
||||
if (timeLabels [i].ContainsPoint (location)) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using CoreGraphics;
|
||||
using System.Threading.Tasks;
|
||||
using MonoTouch.CoreText;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.GameKit;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using CoreText;
|
||||
using Foundation;
|
||||
using GameKit;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace ButtonTapper3000 {
|
|||
|
||||
Random rand;
|
||||
|
||||
public MainGame (SizeF size) : base (size)
|
||||
public MainGame (CGSize size) : base (size)
|
||||
{
|
||||
rand = new Random ();
|
||||
|
||||
|
@ -49,19 +49,19 @@ namespace ButtonTapper3000 {
|
|||
Text = "Tap Me!",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY)
|
||||
};
|
||||
|
||||
clicksLabel = new SKLabelNode ("AvenirNext-Bold") {
|
||||
Text = GameInfo.CurrentTaps.ToString (),
|
||||
FontSize = 45,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 120)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 120)
|
||||
};
|
||||
|
||||
timerLabel = new SKLabelNode ("HelveticaNeue-CondensedBlack") {
|
||||
Text = GameInfo.CurrentTicks.ToString (),
|
||||
FontSize = 45,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 120)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 120)
|
||||
};
|
||||
|
||||
AddChild (button);
|
||||
|
@ -80,7 +80,7 @@ namespace ButtonTapper3000 {
|
|||
if (GameInfo.GameMode == GameMode.Hard) {
|
||||
int x = rand.Next (100) - 50;
|
||||
int y = rand.Next (100) - 50;
|
||||
button.Position = new PointF (FrameMidX + x, FrameMidY + y);
|
||||
button.Position = new CGPoint (FrameMidX + x, FrameMidY + y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace ButtonTapper3000 {
|
|||
|
||||
int playedGameTypesBitField;
|
||||
using (NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults) {
|
||||
playedGameTypesBitField = defaults.IntForKey ("playedGameTypes") | (int) gameType;
|
||||
playedGameTypesBitField = (int) defaults.IntForKey ("playedGameTypes") | (int) gameType;
|
||||
defaults.SetInt (playedGameTypesBitField, "playedGameTypes");
|
||||
defaults.Synchronize ();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.GameKit;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using GameKit;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -15,47 +15,47 @@ namespace ButtonTapper3000 {
|
|||
SKLabelNode playChallengeButton;
|
||||
SKLabelNode challengeFriendsButton;
|
||||
|
||||
public MainMenu (SizeF size) : base (size)
|
||||
public MainMenu (CGSize size) : base (size)
|
||||
{
|
||||
var title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Button Tapper",
|
||||
FontSize = 30f,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 60)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 60)
|
||||
};
|
||||
|
||||
startButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Start Game",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY)
|
||||
};
|
||||
|
||||
gameCenterButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Game Center",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 60)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 60)
|
||||
};
|
||||
|
||||
gameStatsButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Game Stats",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 120)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 120)
|
||||
};
|
||||
|
||||
challengeFriendsButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Challenge Friends",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 180)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 180)
|
||||
};
|
||||
|
||||
playChallengeButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Play Challenge",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 240)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 240)
|
||||
};
|
||||
|
||||
SetupChallenge ();
|
||||
|
@ -163,7 +163,7 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
if (startButton.Frame.Contains (location)) {
|
||||
PresentScene (new GameSetupMenu (View.Bounds.Size));
|
||||
} else if (gameCenterButton.Frame.Contains (location)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using CoreGraphics;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -9,28 +9,28 @@ namespace ButtonTapper3000 {
|
|||
|
||||
SKLabelNode doneButton;
|
||||
|
||||
public ResultsScreen (SizeF size) : base (size)
|
||||
public ResultsScreen (CGSize size) : base (size)
|
||||
{
|
||||
var timeLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Time: " + GameInfo.GameTimeInSeconds,
|
||||
FontSize = 24,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 120)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 120)
|
||||
};
|
||||
var modeLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Mode: " + GameInfo.GameMode,
|
||||
FontSize = 24,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 60)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 60)
|
||||
};
|
||||
var scoreLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Score: " + GameInfo.CurrentTaps,
|
||||
FontSize = 30,
|
||||
Position = new PointF (FrameMidX, FrameMidY)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY)
|
||||
};
|
||||
doneButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Done",
|
||||
FontSize = 24,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 90)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 90)
|
||||
};
|
||||
AddChild (timeLabel);
|
||||
AddChild (modeLabel);
|
||||
|
@ -38,10 +38,10 @@ namespace ButtonTapper3000 {
|
|||
AddChild (doneButton);
|
||||
}
|
||||
|
||||
public override void TouchesBegan (MonoTouch.Foundation.NSSet touches, UIEvent evt)
|
||||
public override void TouchesBegan (Foundation.NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
if (doneButton.ContainsPoint (location))
|
||||
PresentScene (new MainMenu (View.Bounds.Size));
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using CoreGraphics;
|
||||
using System.Threading.Tasks;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.GameKit;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using Foundation;
|
||||
using GameKit;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
@ -15,35 +15,35 @@ namespace ButtonTapper3000 {
|
|||
SKLabelNode achievementsButton;
|
||||
SKLabelNode backButton;
|
||||
|
||||
public StatsScreen (SizeF size) : base (size)
|
||||
public StatsScreen (CGSize size) : base (size)
|
||||
{
|
||||
BackgroundColor = UIColor.FromRGBA (0.15f, 0.15f, 0.3f, 1f);
|
||||
|
||||
var title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Stats",
|
||||
FontSize = 30,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 60)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 60)
|
||||
};
|
||||
|
||||
leaderboardsButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Leaderboards",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY)
|
||||
};
|
||||
|
||||
achievementsButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Achievements",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 60)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 60)
|
||||
};
|
||||
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
AddChild (title);
|
||||
|
@ -72,31 +72,31 @@ namespace ButtonTapper3000 {
|
|||
|
||||
SKLabelNode backButton;
|
||||
|
||||
public AchievementsScreen (SizeF size) : base (size)
|
||||
public AchievementsScreen (CGSize size) : base (size)
|
||||
{
|
||||
var title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Achievements",
|
||||
FontSize = 30,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 190)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 190)
|
||||
};
|
||||
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
var incompleteLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Incomplete",
|
||||
FontSize = 18,
|
||||
Position = new PointF (FrameMidX + 75, FrameMidY + 150)
|
||||
Position = new CGPoint (FrameMidX + 75, FrameMidY + 150)
|
||||
};
|
||||
|
||||
var completeLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Complete",
|
||||
FontSize = 18,
|
||||
Position = new PointF (FrameMidX - 75, FrameMidY + 150)
|
||||
Position = new CGPoint (FrameMidX - 75, FrameMidY + 150)
|
||||
};
|
||||
|
||||
if (GKLocalPlayer.LocalPlayer.Authenticated)
|
||||
|
@ -130,15 +130,15 @@ namespace ButtonTapper3000 {
|
|||
var achievementLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = description.Title,
|
||||
FontSize = 10,
|
||||
Position = new PointF (FrameMidX + xOffset, FrameMidY + 50 + yOffset + 25)
|
||||
Position = new CGPoint (FrameMidX + xOffset, FrameMidY + 50 + yOffset + 25)
|
||||
};
|
||||
AddChild (achievementLabel);
|
||||
|
||||
description.LoadImage (delegate (UIImage image, NSError imageError) {
|
||||
if (image == null)
|
||||
image = UIImage.FromFile ("Images/DefaultPlayerPhoto.png");
|
||||
var sprite = SKSpriteNode.FromTexture (SKTexture.FromImage (image), new SizeF (32, 32));
|
||||
sprite.Position = new PointF (FrameMidX + xOffset, FrameMidY + 50 + yOffset + 50);
|
||||
var sprite = SKSpriteNode.FromTexture (SKTexture.FromImage (image), new CGSize (32, 32));
|
||||
sprite.Position = new CGPoint (FrameMidX + xOffset, FrameMidY + 50 + yOffset + 50);
|
||||
AddChild (sprite);
|
||||
});
|
||||
|
||||
|
@ -153,9 +153,9 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
if (backButton.ContainsPoint (location))
|
||||
PresentScene (new StatsScreen (new SizeF (View.Bounds.Size)));
|
||||
PresentScene (new StatsScreen (new CGSize (View.Bounds.Size)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,21 +165,21 @@ namespace ButtonTapper3000 {
|
|||
GKLeaderboardSet[] leaderboardSets;
|
||||
List<SKLabelNode> leaderboardSetButtons;
|
||||
|
||||
public LeaderboardSetsScreen (SizeF size) : base (size)
|
||||
public LeaderboardSetsScreen (CGSize size) : base (size)
|
||||
{
|
||||
leaderboardSetButtons = new List<SKLabelNode> ();
|
||||
|
||||
SKLabelNode title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Leaderboards Sets",
|
||||
FontSize = 30,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 190)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 190)
|
||||
};
|
||||
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
if (GKLocalPlayer.LocalPlayer.Authenticated)
|
||||
|
@ -200,7 +200,7 @@ namespace ButtonTapper3000 {
|
|||
var leaderboardSetButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = leaderboardSet.Title,
|
||||
FontSize = 18,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 125 - offset)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 125 - offset)
|
||||
};
|
||||
offset += 50;
|
||||
|
||||
|
@ -212,7 +212,7 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
|
||||
if (backButton.ContainsPoint (location)) {
|
||||
PresentScene (new StatsScreen (View.Bounds.Size));
|
||||
|
@ -238,21 +238,21 @@ namespace ButtonTapper3000 {
|
|||
GKLeaderboard [] leaderboards;
|
||||
List<SKLabelNode> leaderboardButtons;
|
||||
|
||||
public LeaderboardsScreen (SizeF size) : base (size)
|
||||
public LeaderboardsScreen (CGSize size) : base (size)
|
||||
{
|
||||
leaderboardButtons = new List<SKLabelNode> ();
|
||||
|
||||
var title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Leaderboards",
|
||||
FontSize = 30,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 190)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 190)
|
||||
};
|
||||
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
if (GKLocalPlayer.LocalPlayer.Authenticated)
|
||||
|
@ -270,7 +270,7 @@ namespace ButtonTapper3000 {
|
|||
SKLabelNode leaderboardButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = leaderboard.Title,
|
||||
FontSize = 18,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 125 - offset)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 125 - offset)
|
||||
};
|
||||
offset += 50;
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
|
||||
if (backButton.ContainsPoint (location)) {
|
||||
PresentScene (new StatsScreen (View.Bounds.Size));
|
||||
|
@ -306,22 +306,22 @@ namespace ButtonTapper3000 {
|
|||
|
||||
SKLabelNode backButton;
|
||||
|
||||
public LeaderboardScoresScreen (SizeF size) : base (size)
|
||||
public LeaderboardScoresScreen (CGSize size) : base (size)
|
||||
{
|
||||
SKLabelNode title = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = GameInfo.CurrentLeaderBoard.Title,
|
||||
FontSize = 14,
|
||||
Position = new PointF (FrameMidX, FrameMidY + 190)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY + 190)
|
||||
};
|
||||
|
||||
var podiumSprite = SKSpriteNode.FromTexture (SKTexture.FromImageNamed ("Images/Podium.png"));
|
||||
podiumSprite.Position = new PointF (FrameMidX, FrameMidY + 50);
|
||||
podiumSprite.Position = new CGPoint (FrameMidX, FrameMidY + 50);
|
||||
|
||||
backButton = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = "Back",
|
||||
FontSize = 18,
|
||||
FontColor = ButtonColor,
|
||||
Position = new PointF (FrameMidX, FrameMidY - 200)
|
||||
Position = new CGPoint (FrameMidX, FrameMidY - 200)
|
||||
};
|
||||
|
||||
if (GKLocalPlayer.LocalPlayer.Authenticated)
|
||||
|
@ -334,25 +334,25 @@ namespace ButtonTapper3000 {
|
|||
|
||||
void DisplayScore (GKScore score, int rank, GKPlayer player)
|
||||
{
|
||||
PointF[] podiumPositions = new PointF[] {
|
||||
new PointF (0, 100),
|
||||
new PointF (-84, 75),
|
||||
new PointF (84, 50)
|
||||
CGPoint[] podiumPositions = new CGPoint[] {
|
||||
new CGPoint (0, 100),
|
||||
new CGPoint (-84, 75),
|
||||
new CGPoint (84, 50)
|
||||
};
|
||||
|
||||
PointF currentPoint = podiumPositions [rank];
|
||||
CGPoint currentPoint = podiumPositions [rank];
|
||||
|
||||
SKLabelNode scoreLabel = new SKLabelNode ("GillSans-Bold") {
|
||||
Text = score.FormattedValue,
|
||||
FontSize = 14,
|
||||
Position = new PointF (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y - 32)
|
||||
Position = new CGPoint (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y - 32)
|
||||
};
|
||||
|
||||
player.LoadPhoto (GKPhotoSize.Small, delegate (UIImage photo, NSError error) {
|
||||
if (photo == null)
|
||||
photo = UIImage.FromFile ("Images/DefaultPlayerPhoto.png");
|
||||
var image = SKSpriteNode.FromTexture (SKTexture.FromImage (photo), new SizeF (32, 32));
|
||||
image.Position = new PointF (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y + 16);
|
||||
var image = SKSpriteNode.FromTexture (SKTexture.FromImage (photo), new CGSize (32, 32));
|
||||
image.Position = new CGPoint (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y + 16);
|
||||
AddChild (image);
|
||||
});
|
||||
|
||||
|
@ -380,7 +380,7 @@ namespace ButtonTapper3000 {
|
|||
public override void TouchesBegan (NSSet touches, UIEvent evt)
|
||||
{
|
||||
foreach (var touch in touches) {
|
||||
PointF location = (touch as UITouch).LocationInNode (this);
|
||||
CGPoint location = (touch as UITouch).LocationInNode (this);
|
||||
if (backButton.ContainsPoint (location))
|
||||
PresentScene (new LeaderboardsScreen (View.Bounds.Size));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using MonoTouch.SpriteKit;
|
||||
using MonoTouch.UIKit;
|
||||
using SpriteKit;
|
||||
using UIKit;
|
||||
|
||||
namespace ButtonTapper3000 {
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче