OUYA游戏开发核心技术剖析大学霸内部资料

OUYA游戏开发核心技术剖析大学霸内部资料

试读地址:http://pan.baidu.com/s/1ntuql8t

介绍:本教程是一本进阶级的教材,它可以让读者在了解、熟悉了OUYA设备的基础上,开始全面学习OUYA开发所需的各种技术知识。本书以OUYA官方示例的讲解作为主线,贯穿了OUYA开发所必须掌握的5个知识点的详解:输入检测、游戏内购、安全区域、社区内容和输入显示。其中,一共涉及6个官方示例:StarterKit、Show Products、Safe Area、Community Content和Show Unity Input。

目  录
第1章  OUYA游戏入门示例--StarterKit 1
1.1  获取并运行StarterKit 1
1.1.1  创建游戏项目 1
1.1.2  下载StarterKit 1
1.1.3  导入StarterKit 2
1.1.4  导入OuyaSDK Core包 3
1.1.5  快速配置项目环境 5
1.1.6  查看StarterKit运行效果 6
1.2  StarterKit代码解析 8
1.2.1  SceneInit场景 8
1.2.2  SceneSplash场景 9
1.2.3  SceneMain场景 12
1.2.4  SceneGame场景 18
第2章  OUYA输入检测--官方示例:Virtual Controller 20
2.1  OUYA的输入控制 20
2.1.1  OUYA的输入途径 20
2.1.2  OUYA操纵杆上的各按键 21
2.1.3  输入控制的通用流程 24
2.2  输入控制流程分析 25
2.2.1  确保代码只在Android平台上运行 25
2.2.2  命名空间tv.ouya.console.api 25
2.2.3  检测初始化是否成功 25
2.2.4  检测是否连接了OUYA控制器 25
2.2.5  各按键所对应的整型常量 26
2.2.6  检测摇杆的状态 27
2.2.7  检测按钮的状态 27
2.3  示例项目的创建和运行 28
2.3.1  创建游戏项目 28
2.3.2  下载OuyaSDK-Example 28
2.3.3  导入OuyaSDK-Examples 29
2.3.4  导入OuyaSDK-Core 30
2.3.5  快速配置项目环境 30
2.3.6  查看Virtual Controller运行效果 32
2.4  示例使用资源分析 33
2.4.1  示例游戏场景--VirtualController 33
2.4.2  示例场景游戏对象 33
2.4.3  表示没有任何输入的OUYA控制器 35
2.4.4  表示获取到输入的OUYA控制器 36
2.5  脚本VirtualController代码解析 37
2.5.1  脚本代码 38
2.5.2  指定检测的OUYA控制器 41
2.5.3  输出游戏视图中央的文本 41
2.5.4  自定义方法HelperUpdateSprite() 42
2.5.5  自定义方法RotateInput() 42
2.5.6  脚本代码实现逻辑图 43
2.6  脚本OuyaInputTest代码解析 44
2.6.1  脚本的位置及使用方法 44
2.6.2  示例效果展示 45
2.6.3  脚本代码及说明 46
2.6.4  文本的格式化输出 49
2.6.5  脚本运行逻辑流程图 50
2.6.6  OuyaSDK-Core提供的脚本类--DebugInput 51
2.7  Virtual Controller中使用的输入控制流程 52
2.8  OuyaSDK部分源码解析 53
2.8.1  类OuyaSDK里定义的嵌套类--OuyaInput 54
2.8.2  类OuyaSDK里定义的嵌套类--NdkWrapper 62
2.8.3  #region的应用 64
第3章  OUYA游戏内购--官方示例:Show Products 66
3.1  IAP及其初始化 66
3.1.1  IAP及相关的属性和方法 66
3.1.2  IAP初始化操作 67
3.1.3  IAP的初始化和检测过程 68
3.2  游戏内购的实现步骤 69
3.2.1  发送“请求玩家信息”消息 70
3.2.2  接收“请求玩家信息”响应 73
3.2.3  发送“请求产品信息”消息 78
3.2.4  接收“请求产品信息”响应 81
3.2.5  发送“请求购买”消息 88
3.2.6  接收“请求购买”响应 91
3.2.7  发送“请求接收”消息 95
3.2.8  接收“请求接收”响应 98
3.3  JSON详解 104
3.3.1  讲解JSON的原因 104
3.3.2  JSON的语法、值类型和结构 106
3.3.3  JSONArray和JSONObject的使用方法 107
3.4  存储和获取数据 115
3.4.1  putGameData() 115
3.4.2  getGameData() 115
3.4.3  源码解析 116
3.5  常见事件的监听 119
3.5.1  监听“菜单出现”事件 120
3.5.2  监听“游戏暂停”事件 123
3.5.3  监听“游戏重启”事件 126
3.6  示例项目的运行 129
3.6.1  快速配置项目环境 129
3.6.2  查看Show Products运行效果 130
3.6.3  游戏视图各组成部分 131
3.7  脚本OuyaShowProducts代码解析 133
3.7.1  实现内购功能的准备 134
3.7.2  各种事件的检测 136
3.7.3  存储Product和Receipt数据 139
3.7.4  处理视图文本输出 139
3.7.5  处理视图焦点 145
3.7.6  FocusManager 147
第4章  OUYA安全区域--官方示例:Safe Area 150
4.1  安全区域 150
4.1.1  概述 150
4.1.2  检查“视图裁剪”问题 151
4.1.3  相关API 154
4.1.4  源码解析 155
4.2  示例项目的运行 157
4.2.1  快速配置项目环境 157
4.2.2  查看Safe Area运行效果 158
4.3  脚本OuyaSafeArea代码解析 159
4.3.1  脚本代码 159
4.3.2  滑动条的绘制 161
4.3.3  最大最小值 161
第5章  OUYA社区内容--官方示例:Community Content 163
5.1  社区内容 164
5.1.1  概述 164
5.1.2  玩家下载/发布的社区内容 164
5.1.3  下载社区内容的位置 165
5.1.4  社区内容的应用 166
5.2  入口--OuyaContent 169
5.2.1  示例及流程图 169
5.2.2  获取OuyaContent 170
5.2.3  可用性检测 170
5.2.4  初始化检测 170
5.2.5  源码解析 170
5.3  社区内容本身--OuyaMod 175
5.3.1  创建OuyaMod 175
5.3.2  嵌套类Editor 176
5.3.3  OuyaMod类里各方法的定义 187
5.4  对社区内容的操作--OuyaUnityPlugin 204
5.5  对社区内容操作的监听及响应--接口 215
5.5.1  检测社区内容是否完成初始化 216
5.5.2  删除社区内容 218
5.5.3  下载社区内容 221
5.5.4  搜索已保存的社区内容 223
5.5.5  搜索已发布的社区内容 226
5.5.6  发布社区内容 228
5.5.7  保存社区内容 231
5.5.8  未发布社区内容 233
5.6  事件消息的转发--OuyaGameObject 235
5.7  辅助类--Bitmap 243
5.7.1  嵌套类CompressFormat 244
5.7.2  Bitmap里各属性、方法的定义 246
5.8  其它辅助类 249
5.8.1  OuyaModScreenshot 249
5.8.2  BitmapFactory 254
5.8.3  OutputStream 257
5.8.4  InputStream 261
5.8.5  ByteArrayOutputStream 265
5.9  示例项目的运行 271
5.9.1  快速配置项目环境 271
5.9.2  查看Community Content运行效果 271
5.10  脚本OuyaCommunityContent代码解析 273
5.10.1  实现社区内容功能前的准备 274
5.10.2  消息的处理 277
5.10.3  游戏视图的绘制 281
5.10.4  各按钮对应功能的实现 291
5.10.5  集中处理社区内容的各属性--AddWidgets()方法 296
5.10.6  视图焦点的处理 301
5.10.7  FocusManager 302
第6章  OUYA显示输入--官方示例:Show Unity Input 305
6.1  OuyaController 305
6.1.1  嵌套类--ButtonData 306
6.1.2  OuyaController里各属性、方法的定义 310
6.2  辅助类 315
6.2.1  OuyaUnityActivity 315
6.2.2  UnityPlayer 319
6.2.3  BitmapDrawable 321
6.2.4  Drawable 325
6.3  事件及检测 325
6.3.1  游戏操纵杆校准事件 326
6.3.2  检测游戏是否运行在OUYA支持的硬件上 330
6.4  示例项目的运行 333
6.4.1  快速配置项目环境 333
6.4.2  查看Show Unity Input运行效果 334
6.4.3  游戏视图各组成部分 334
6.5  脚本OuyaShowUnityInput代码解析 338
6.5.1  实现功能前的准备 340
6.5.2  检测OUYA操纵杆上摇杆的值与按钮的状态 344
6.5.3  游戏视图的绘制 347
6.5.4  其它自定义方法 356
6.6  示例定义的其它脚本类 368
6.6.1  OuyaPlotFPS 368
6.6.2  OuyaPlotAxisButton 373
6.6.3  OuyaPlotMeshThumbstick 379
第7章  OUYA API总览 388
7.1  OuyaGameObject 388
7.1.1  OuyaGameObject对象 389
7.1.2  脚本OuyaGameObject.cs解析 390
7.2  OuyaSDK 407
7.2.1  嵌套类OuyaInput 408
7.2.2  公有方法 408
7.2.3  公有属性 409
7.2.4  事件相关接口和方法 409
7.3  其它作为辅助的脚本类 416
7.3.1  Bitmap 416
7.3.2  BitmapDrawable 416
7.3.3  BitmapFactory 417
7.3.4  ByteArrayOutputStream 417
7.3.5  DebugInput 417
7.3.6  Drawable 417
7.3.7  InputStream 417
7.3.8  JSONArray 418
7.3.9  JSONObject 418
7.3.10  OutputStream 419
7.3.11  OuyaContent 419
7.3.12  OuyaController 419
7.3.13  OuyaMod 420
7.3.14  OuyaModScreenshot 421
7.3.15  OuyaUnityActivity 421
7.3.16  OuyaUnityPlugin 421
7.3.17  UnityPlayer 422
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29597077/viewspace-1416900/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29597077/viewspace-1416900/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用 Kivy 打包 APK,您需要遵循以下步骤: 1. 安装 Kivy 和 Buildozer 您需要运行以下命令来安装 Kivy 和 Buildozer: ``` pip install kivy pip install buildozer ``` 2. 创建一个 Kivy 应用程序 创建一个 Kivy 应用程序,并确保它可以在本地计算机上运行。 3. 配置 buildozer.spec 文件 在您的 Kivy 应用程序目录中创建一个名为 buildozer.spec 的文件,并配置以下选项: ``` [app] # (str) Title of your application title = My Application # (str) Package name package.name = myapp # (str) Package domain (needed for android/ios packaging) package.domain = org.test # (str) Source code where the main.py live source.dir = . # (list) Source files to include (let empty to include all the files) source.include_exts = py,png,jpg,kv,atlas # (list) List of inclusions using pattern matching #source.include_patterns = assets/*,images/*.png # (list) Source files to exclude (let empty to not exclude anything) #source.exclude_exts = spec # (list) List of directory to exclude #source.exclude_dirs = tests, bin # (list) List of exclusions using pattern matching #source.exclude_patterns = license,images/*/*.jpg # (str) Application versioning (method 1) version = 0.1 # (str) Application versioning (method 2) # version.regex = __version__ = ['"](.*)['"] # version.filename = %(source.dir)s/main.py # (list) Application requirements requirements = kivy # (str) Custom source folders for requirements # (it's relative to the current directory) #source.custom_kivy = ../kivy # (list) Permissions android.permissions = INTERNET # (str) Android logcat filters to use android.logcat_filters = *:S python:D # (str) Android entry point android.entrypoint = org.test.myapp.myapp # (int) Target Android API, should be as high as possible. #android.api = 27 # (int) Minimum API your APK will support. android.minapi = 21 # (int) Android SDK version to use android.sdk = 20 # (str) Android NDK version to use #android.ndk = 19b # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = True # (str) Android NDK directory (if empty, it will be automatically downloaded.) #android.ndk_path = # (str) Android SDK directory (if empty, it will be automatically downloaded.) #android.sdk_path = # (str) python-for-android git clone directory (if empty, it will be automatically cloned from github) #android.p4a_dir = # (list) python-for-android whitelist #android.whitelist = # (str) OUYA Console category. Should be one of GAME or APP # If you leave this blank, OUYA will classify your app as "unknown". #android.ouya.category = GAME # (str) Filename of OUYA Console icon. It must be a 732x412 png image. #android.ouya.icon.filename = %(source.dir)s/data/icon-ouya-console.png # (str) XML file to include as an intent filters in <activity> tag #android.manifest.intent_filters = # (list) Android additionnal libraries #android.add_libs = libs/android/*.so # (list) Add Java jars #android.add_jars = foo.jar,bar.jar # (str) JNI directory containing the Android.mk file to use #android.jni_directory = None # (str) java directory containing the Android.mk file to use #android.java_directory = None # (bool) Use --bootstrap when building the Android app #android.bootstrap = False # (str) Path to a custom AndroidManifest.xml #android.manifest.custom = # (str) If you need to insert variables into your AndroidManifest.xml file, # you can do so with the manifestPlaceholders property. # See: https://developer.android.com/studio/build/manifest-build-variables.html #android.manifest.placeholders = # (str) Path to a custom build.py file #android.build.custom_dir = # (str) Path to a custom __init__.py file to use as __init__.py for the whole build #android.build.source_init = # (list) List of Java classes to add to the build process (can be java or aars) #android.add_classpaths = foo.jar,bar.jar # (list) List of Java classes to add to the build process (can be java or aars) #android.add_aars = foo.jar,bar.jar # (list) Gradle dependencies to add (currently works only with sdl2 bootstrap) #android.gradle_dependencies = # (str) Set the gradle version (default is 2.2.0) #android.gradle_version = 2.2.0 # (bool) If True, attempt to run the app on the device via adb #android.try_build_ext = False # (str) iOS bundle identifier #ios.bundle_identifier = org.test.myapp # (str) iOS App Store ID #ios.app_store_id = # (str) iOS SDK to use #ios.sdk = 10.1 # (str) The name of the certificate to use for signing the debug version of the app # Get a list of available identities: buildozer ios list_identities #ios.codesign.debug = "iPhone Developer" # (str) The name of the certificate to use for signing the release version of the app #ios.codesign.release = %(ios.codesign.debug)s # (str) The path to the provisioning profile to use for the debug version of the app # Get a list of available provisioning profiles: buildozer ios list_profiles #ios.provisioning_profile_debug = # (str) The path to the provisioning profile to use for the release version of the app #ios.provisioning_profile_release = # (bool) Compile with the SaleorSDK #ios.use_salesforce_mobile_sdk = False # (list) Icon files #icon.filename = %(source.dir)s/data/icon.png #icon.filename = %(source.dir)s/data/icon-256.png #icon.filename = %(source.dir)s/data/icon-512.png #icon.filename = %(source.dir)s/data/icon-1024.png # (str) Keystore location (if you want to enable signing with a custom keystore) #android.sign.keystore = # (str) Keystore alias (if you want to enable signing with a custom keystore) #android.sign.alias = # (str) Keystore password (if you want to enable signing with a custom keystore) #android.sign.keystore_password = # (str) Key password (if you want to enable signing with a custom keystore) #android.sign.key_password = # (int) Number of permissions to prompt in the ``Permissions`` popup #android.max_permissions = 5 # (str) Bootstrap to use. Choices: sdl2, pygame #p4a.bootstrap = sdl2 # (int) Number of times to retry retrieving the Android SDK before giving up #android.sdk_retry = 0 # (bool) Stop on first error encountered when compiling/building the python part of the project. #stop_on_first_error = False # (bool) Log output of p4a to files #log_level = 2 #log_dir = logs #log_name = p4a_build.log # (list) List of package names to be included in the final package. # Some android app store require this. #android.add_packages = # (list) Used to copy files into the App (useful to copy obb data, licensing stuff, etc.) Must be a list of tuples #android.add_files = # (list) List of Java classes to add to the build process #android.add_java_classes = # (list) List of Java files to add to the build process #android.add_javas = # (str) Path to a custom AndroidManifest.xml (template to generate the actual AndroidManifest.xml) #android.manifest.template = # (str) Path to a custom toolchain .zip file (can be used to use a pre-built library) #android.toolchain = # (str) Path to a custom obb file #android.obb.filename = # (str) Path to a custom obb file that should be put into the assets directory. This file will be read by the app at runtime. #android.obb.main = # (str) Path to a custom obb file that should be put into the assets directory. This file will be read by the app at runtime. #android.obb.patch = # (bool) Enables Android App Bundle format #android.bundle.enable = False # (str) Specifies the format to use for the Android App Bundle. Choices are: # universal: generates a fat APK that works on all devices # split: generates an APK per ABI and on that only contains the resources for that ABI. #android.bundle.mode = universal # (list) List of split options to apply # android.bundle.split_config = abi # (list) List of obfuscation options to apply #android.obfuscation = # (str) Path to the python for android git checkout to use for the build #p4a.source_dir = # (str) Path to the android ndk to use for the build #android.ndk_path = # (str) Path to the android sdk to use for the build #android.sdk_path = # (str) Path to the ant directory for the build #android.ant_path = # (str) Path to the android build tools directory #android.build_tools_path = # (bool) If True, automatically accept SDK license #android.accept_sdk_license = False # (bool) If True, no other SDK packages will be downloaded #android.no_sdk_packages = False # (str) Android theme to use for the app #android.theme = # (bool) Copy library instead of making a libpymodules.so #android.copy_libs = False # (bool) Use a black background #ios.black_background = False # (str) URL scheme to use for the iOS app #ios.url_scheme = # (str) Bundle name for the iOS app #ios.bundle_name = # (str) The entitlements file to use #ios.entitlements = # (str) The entitlements file to use for the debug version of the app #ios.entitlements.debug = # (str) The entitlements file to use for the release version of the app #ios.entitlements.release = # (str) The path to the entitlements file to use #ios.entitlements.path = # (str) The development team to use for signing the app #ios.development_team = # (str) The development team to use for signing the debug version of the app #ios.development_team.debug = # (str) The development team to use for signing the release version of the app #ios.development_team.release = # (str) The provisioning profile to use for the debug version of the app #ios.provisioning_profile_debug = # (str) The provisioning profile to use for the release version of the app #ios.provisioning_profile_release = # (list) URL Schemes to use for the app #ios.url_schemes = # (list) iOS frameworks to link against #ios.frameworks = # (list) iOS frameworks to weakly link against #ios.frameworks.weak = # (list) iOS libraries to link against #ios.libraries = # (list) iOS libraries to weakly link against #ios.libraries.weak = # (bool) Enable bitcode support #ios.enable_bitcode = False # (str) The path to the entitlements file to use for the watch extension #ios.watch_extension_entitlements = # (str) The path to the provisioning profile to use for the watch extension #ios.watch_extension_provisioning_profile = # (list) iOS icon files to be used #ios.icons = # (str) The background color of the application's icon #ios.icon_background_color = # (str) The mask to use for the application's icon #ios.icon_mask = # (list) iOS assets to include #ios.assets_directory = # (str) iCloud entitlements file to use for the project #ios.icloud_entitlements = # (bool) Whether the app should be uploaded to TestFlight on build #ios.testflight.upload = False # (str) API Key for TestFlight #ios.testflight.api_token = # (str) Team Token for TestFlight #ios.testflight.team_token = # (str) Distribution lists for TestFlight #ios.testflight.distribution_lists = # (list) Any other custom Xcode build settings to use #ios.pbxproj_variables = ``` 您需要根据您的应用程序进行相应的更改。 4. 创建一个虚拟环境 在您的项目目录中创建一个虚拟环境: ``` python3 -m venv myenv ``` 5. 激活虚拟环境 激活虚拟环境: ``` source myenv/bin/activate ``` 6. 初始化 buildozer 初始化 buildozer: ``` buildozer init ``` 7. 编辑 buildozer.spec 文件 编辑 buildozer.spec 文件,并确保您已经配置了正确的选项。 8. 打包 APK 运行以下命令来打包 APK: ``` buildozer -v android debug ``` 这将创建一个名为 myapp-0.1-debug.apk 的 APK 文件。 注意:在打包 APK 之前,请确保您已经按照 Kivy 官方文档中的说明正确地配置了 Android SDK 和 NDK。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值