Xcode SpriteKit 游戏 - 如何在应用程序安装期间为多种屏幕尺寸配置 UI [英] Xcode SpriteKit Game - How to configure the UI for multiple screen sizes during App install

查看:20
本文介绍了Xcode SpriteKit 游戏 - 如何在应用程序安装期间为多种屏幕尺寸配置 UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SpriteKit 为 IOS 开发一个基本游戏.iPhone 设备有多种形状和颜色.前者让我有点头疼.不同尺寸的屏幕.

I'm developing a basic game for IOS using SpriteKit. iPhone devices come in many shapes and colours. The former of which is giving me a bit of a headache. Different sized screens.

这是一个由两部分组成的问题.首先

This is a two part question. Firstly

其他人实施了哪些解决方案来实现多种显示尺寸的统一布局?

What solutions have other people implemented to achieve a uniform layout over multiple display sizes?

我正在考虑采用的当前解决方案是找到此处的其中一个解决方案中建议的设备类型适用于所有设备的缩放精灵套件游戏,我将实施这个通过使用 Alessandro Ornano 解决问题如何确定当前 iPhone/设备模型?.然后根据设备类型更改游戏对象的大小和位置.

The current solution I'm looking at adopting is to find the device type as suggested in one of the solutions here Scale sprite kit game for all devices, I'll be implementing this through using Alessandro Ornano solution to the problem How to determine the current iPhone/device model?. Then changing the size and the position of game objects depending on device type.

其次:

是否可以仅在应用程序安装时运行函数/方法.苹果允许这样做吗?如果是这样,我将在哪里调用该方法?

Is it possible to have a function/method run only on application installation. Do apple allow this. If so where would I make the call to the method?

推荐答案

1) 这 100% 取决于实际游戏.您需要问问自己,您希望用户获得什么样的体验.

1) This is 100% dependent on the actual game. You need to ask yourself what do you expect the experience to be for your user.

有时,您可以通过展示更多游戏内容而逃脱惩罚.在这种情况下,您在开发时考虑了方形纵横比.

Sometimes, you can get away with showing more of the game. In this case, you develop with a square aspect ratio in mind.

有时,您可以避免从顶部显示更多内容.在这种情况下,您使用最长的纵横比 (iPhone X) 开发您的游戏,但保持您的可玩性使用的是最短的纵横比 (iPad).

Sometimes, you can get away with showing more from the top. In this case, you develop your game using the longest aspect ratio (iPhone X), but keeping your playable are in your shortest aspect ratio (iPad).

有时,您需要让每个人都拥有相同的体验.在这种情况下,您可以使可播放区域的纵横比最短,并在可播放区域周围提供花哨的边框.

Sometimes, you need for everybody to have the same experience. In this case, you make your playable area the shortest aspect ratio, and you provide a fancy border around the playable area.

无需检测您正在使用的手机.这在开发时实际上是一种糟糕的方法,因为您只关注今天,而不是明天.当 X 出现时,很多人都在踢自己,因为他们不得不进去更新他们的应用程序以适应 X.

There is no need to detect what phone you are using. This is actually a bad approach when developing because you only focus on today, not tomorrow. A lot of people are kicking themselves when the X came out because they had to go in and update their app to accommodate it for the X.

2) 使用应用委托

这篇关于Xcode SpriteKit 游戏 - 如何在应用程序安装期间为多种屏幕尺寸配置 UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆