167
} public
void Draw
{ for
int i = 0 ; i mRect.Length; i++
{ mOptionsTapped[i]
= GUI.TogglemRect[i].rect,
mOptionsSelected[i], , mStyle[i];
if mOptionsTapped[i] mOptionsSelected[i]
{ mOptionsSelected[i] = SetToTrue;
if this
.TappedOnOption = null
{ this
.TappedOnOptioni; InputController.GUIInput =
true ;
} }
} }
private bool
[] mOptionsTapped; private
bool [] mOptionsSelected;
private SampleAppUIRect[] mRect;
private bool
mTappedOn; private
bool mSelected;
private GUIStyle[] mStyle;
}
30. SampleAppUIRect.cs
using UnityEngine;
using System.Collections;
public class
SampleAppUIRect {
public Rect rect
{ get
{ return
new RectmX
Screen.width, mY
Screen.width, mWidth Screen.width, mHeight Screen.width; }
}
public SampleAppUIRect
float x,
float y,
float W,
float H
{ mX = x;
mY = y; mWidth = W;
mHeight = H; }
private float
mX; private
float mY;
private float
mWidth; private
float mHeight;
}
31. SampleImport.cs
168
using System.IO;
using UnityEditor;
using UnityEngine;
public class
SampleImport : AssetPostprocessor
{ This method is called by Unity whenever assets are
updated deleted, moved or added
public static
void OnPostprocessAllAssets
string []
importedAssets, string
[] deletedAssets,
string []
movedAssets, string
[] movedFromAssetPaths
{ Set the Unity version for internal use
string path
= Path
.CombineApplication.dataPath, StreamingAssetsQCAR
; QCARUnityImpl.SetUnityVersionpath;
} }
32. SceneViewManager.cs
using UnityEngine;
using System.Collections;
public class
SceneViewManager : MonoBehaviour {
public AppManager mAppManager;
void Start
{ mAppManager.InitManager;
}
void Update
{ InputController.UpdateInput;
mAppManager.UpdateManager; }
void OnGUI
{ mAppManager.Draw;
} }
33. SetBGCameraLayerBehaviour.cs
using UnityEngine;
[RequireComponent typeof
Camera] public
class SetBGCameraLayerBehaviour
: SetBGCameraLayerAbstractBehaviour
{
169
}
34. SharpZipLibUnzipper.cs
using System.IO;
using UnityEditor;
[InitializeOnLoad] public
class SharpZipLibUnzipper
: IUnzipper {
static SharpZipLibUnzipper
{ Unzipper.Instance =
new SharpZipLibUnzipper;
} public
Stream UnzipFile
string path,
string fileNameinZip
{ if
EXCLUDE_JAVASCRIPT return
Unzip.Unzippath, fileNameinZip; else
return null; endif
} }
35. SplashScreenView.cs
using UnityEngine;
using System.Collections;
public class
SplashScreenView : ISampleAppUIView
{ region
PRIVATE_MEMBER_VARIABLES private
Texture mAndroidPotrait; private
Texture mWindowsPlayModeTexture; private
Texture mPotraitTextureIPhone; private
Texture mPotraitTextureIPhone5; private
Texture mPotraitTextureIPad; endregion
PRIVATE_MEMBER_VARIABLES region
ISampleAppUIView implementation public
void LoadView
{ mAndroidPotrait
= Resources.Load
SplashScreenAndroidPotrait as
Texture; mWindowsPlayModeTexture
= Resources.Load
SplashScreenWindowsPlayModePotrait as
Texture; mPotraitTextureIPhone
= Resources.Load
SplashScreenPotraitTextureIPhone as
Texture; mPotraitTextureIPhone5
= Resources.Load
SplashScreenPotraitTextureIPhone5 as
Texture; mPotraitTextureIPad
= Resources.Load
SplashScreenPotraitTextureIPad as
Texture; }
public void
UnLoadView {
Resources.UnloadAssetmAndroidPotrait; Resources.UnloadAssetmWindowsPlayModeTexture;
170
Resources.UnloadAssetmPotraitTextureIPhone; Resources.UnloadAssetmPotraitTextureIPhone5;
Resources.UnloadAssetmPotraitTextureIPad; }
public void
UpdateUI bool
tf {
if tf
return ;
if QCARRuntimeUtilities.IsPlayMode
{ GUI.DrawTexture
new Rect0,
0, Screen.width,
Screen.height, mWindowsPlayModeTexture; }
else {
if UNITY_IPHONE
if iPhone.generation
== iPhoneGeneration.iPhone5
{ GUI.DrawTexturenew
Rect0, 0,
Screen.width, Screen.height, mPotraitTextureIPhone5; }
else if
iPhone.generation ==
iPhoneGeneration.iPhone {
GUI.DrawTexturenew Rect0,
0, Screen.width,
Screen.height, mPotraitTextureIPhone,
ScaleMode.ScaleAndCrop; }
else {
GUI.DrawTexturenew
Rect0, 0,
Screen.width, Screen.height,
mPotraitTextureIPad, ScaleMode.ScaleAndCrop;
} else
GUI.DrawTexture new
Rect0, 0, Screen.width, Screen.height, mAndroidPotrait, ScaleMode.ScaleAndCrop;
endif }
} endregion
ISampleAppUIView implementation }
35. TextRecoBehaviour.cs