AndroidManifest.xml
先从AndroidManifest.xml看看Replica Island的Activity有哪些:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.replica.replicaisland"
android:installLocation="preferExternal"
android:versionCode="14"
android:versionName="1.4" >
优先装到SD Card上
<application
<span style="color:#FF0000;">android:debuggable="false"</span>
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
Replica Island简单的使用Android的Theme隐藏掉了Title Bar,并将应用全屏了。新版本的Android SDK已经舍弃了 android:debuggable 的设置,所以那一行应该删掉。
<activity
android:name=".MainMenuActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
入口Activity,固定为landscape方向,屏蔽掉键盘隐藏事件和屏幕旋转事件。其他的Activity也都使用了这样的配置。
<activity
android:name="AndouKun"
android:configChanges="keyboardHidden|orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape" />
游戏主Activity:创建OpenGL surface view、启动游戏引擎、管理UI事件、管理游戏进度等。用Google翻译得出 Andou Kun 是“安藤坤”的意思,难道是 Chris Pruett 的本名?
<activity
android:name="LevelSelectActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
关卡选择Activity。
<activity
android:name="ConversationDialogActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape"
android:theme="@style/Theme.ConversationDialog" />
NPC对话框Activity。
<activity
android:name="DiaryActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
日记Activity?
<activity
android:name="SetPreferencesActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
游戏设置(OPTIONS)Activity。
<activity
android:name="AnimationPlayerActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
播放过场动画的Activity?
<activity
android:name="ExtrasMenuActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
附加菜单Activity。
<activity
android:name="DifficultyMenuActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
难度菜单Activity。
<activity
android:name="GameOverActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape" />
挂了的Activity。
</application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.INTERNET" />
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="8" />
<!--
Actually, this game works fine on small screens, but the only one out
right now has no 3D acceleration, so it's slow and unplayable.
-->
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false" />
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> -->
</manifest>
代码继承关系
Replica Island的代码全都在包com.replica.replicaisland下,以下是这些类的继承关系:
- AllocationGuard
├BaseObject
│├InputSystem
│├ObjectManager
││└GameObjectManager
│├ObjectRegistry
│├TouchFilter
││└SingleTouchFilter
││└MultiTouchFilter
│└VibrationSystem
├DrawableObject
│└DrawableBitmap
│└ScrollableBitmap
│└TiledBackgroundVertexGrid
└Game
- ConversationUtils
- ConversationUtils.Conversation
- ConversationUtils.ConversationPage
- DebugLog
- GLSurfaceView
- GLSurfaceView.GLWrapper
└GLErrorLogger - GLSurfaceView.Renderer
└GameRenderer - GLSurfaceView.EGLContextFactory
└GLSurfaceView.DefaultContextFactory - GLSurfaceView.EGLWindowSurfaceFactory
└GLSurfaceView.DefaultWindowSurfaceFactory - GLSurfaceView.EGLConfigChooser
└GLSurfaceView.BaseConfigChooser
└GLSurfaceView.ComponentSizeChooser
└GLSurfaceView.SimpleEGLConfigChooser - GLSurfaceView.EglHelper
- GLSurfaceView.GLThread
- GLSurfaceView.LogWriter
- GLSurfaceView.GLThreadManager
- LevelTree
- LevelTree.LevelGroup
- LevelTree.Level
- LevelTree.DialogEntry
- UIConstants