我可以在我的Cocos2D-iPhone游戏中支持VoiceOver吗? [英] Can I support VoiceOver in my Cocos2D-iPhone Game?

查看:151
本文介绍了我可以在我的Cocos2D-iPhone游戏中支持VoiceOver吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个游戏,玩家通过运动反应声音 - 看不到视觉元素不需要玩,许多玩家闭上眼睛,似乎一个耻辱,没有完全VoiceOver兼容。我目前使用Cocos2D-iPhone和CocosDenshion的音频,现在开始考虑我将如何构建我的菜单系统来选择级别和配置控件。

I'm making a game where a player reacts to sounds via motion - seeing as the visual element isn't needed to play it, and many play with their eyes closed, it seems a shame to not be fully VoiceOver compatible. I'm currently using Cocos2D-iPhone and CocosDenshion for audio, and am now starting to think about how I'll be building my menu system to choose levels and configure controls.

在Cocos2D的菜单系统中支持VoiceOver是相当容易的,还是应该在UIKit中尝试创建我没有使用过的菜单?

Is it reasonably easy to support VoiceOver in Cocos2D's menu system, or should I look in to trying to create my menus in UIKit which I have no experience using?

推荐答案

我不知道Cocos的菜单系统是否支持VoiceOver,但如果没有,你可以添加你自己找的功能,而不必深入研究很多 UIKit 工作。所有你需要做的是创建一个 UIView 子类,当您的应用程序启动时,它会添加到您的主窗口。然后使用 UIAccessibilityContainer 协议和 UIAccessibilityPostNotification 调用允许用户通过VoiceOver与您的游戏互动。

I don't know if Cocos' menu system supports VoiceOver, but if it doesn't, you could probably add the functionality you're looking for yourself without having to delve into a lot of UIKit work. All you need to do is create a UIView subclass which gets added to your main window when your app starts up. Then use the UIAccessibilityContainer protocol and UIAccessibilityPostNotification calls to allow users to interact with your game via VoiceOver.

UIAccessibilityContainer 协议可让您通知VoiceOver当前在屏幕上的界面元素,其标签,其特征等。VoiceOver然后使用

The UIAccessibilityContainer protocol lets you inform VoiceOver what interface elements are currently on the screen, their labels, their traits, etc. VoiceOver then uses this information to let users swipe between elements and get feedback on them.

当您的游戏更改状态时,您可以更改协议发回的内容,然后发出

When your game changes state, you can change what that protocol sends back and then issue a


UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification,nil)

UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)

.to通知VoiceOver屏幕布局已更改。只要通过VoiceOver发言,说明你的游戏状态发生了变化,你可以发送不同的通知来说一些文本:

...to inform VoiceOver that the screen layout has changed. And to just speak something via VoiceOver, say when your game state has changed, you can send a different notification to speak some text:


UIAccessibilityPostNotification (UIAccessibilityAnnouncementNotification,@Achievement unlocked!);

UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, @"Achievement unlocked!");

这篇关于我可以在我的Cocos2D-iPhone游戏中支持VoiceOver吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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