165
public static
string YellowButtonStyleOn
= UIStylesYellowButtonOn
; public
static string
YellowButtonStyleOff =
UIStylesYellowButtonOff ;
public static
string RedButtonStyleOn
= UIStylesRedButtonOn
; public
static string
RedButtonStyleOff =
UIStylesRedButtonOff ;
public static
string GreenButtonStyleOn
= UIStylesGreenButtonOn
; public
static string
GreenButtonStyleOff =
UIStylesGreenButtonOff ;
public static
string BlueButtonStyleOn
= UIStylesBlueButtonOn
; public
static string
BlueButtonStyleOff =
UIStylesBlueButtonOff ;
public static
string AboutTitleForImageTgt =
Image Targets
; public
static string
AboutTitleFoMultiTgt = Multi
Targets ;
public static
string AboutTitleForCylinderTgt =
Cylinder Targets
; public
static string
AboutTitleForFrameMarkers = Frame
Markers ;
public static
string AboutTitleForUDT =
User Defined Targets
; public
static string
AboutTitleForTextReco = Text Reco
; public
static string
AboutTitleForCloudReco = Cloud Reco
; public
static string
AboutTitleForBooks = Books
; public
static string
AboutTitleForVirtualBtns = Virtual
Buttons ;
public static
string AboutTitleForVideoBg =
Background Texture
; public
static string
AboutTitleForVideoPb = Video
Playback ;
public static
string AboutTitleForOcclusionMgt
= Occlusion Management
; }
28. SampleAppUILabel.cs
using UnityEngine;
using System.Collections;
public class
SampleAppUILabel : ISampleAppUIElement
{ public
SampleAppUILabelSampleAppUIRect rect, string
path {
this .mRect = rect;
mStyle = new
GUIStyle; mStyle.normal.background = Resources.Loadpath
as Texture2D;
} public
void Draw
{
166
GUI.LabelmRect.rect, , mStyle;
} private
SampleAppUIRect mRect; private
GUIStyle mStyle; }
29. SampleAppUIRadioButton.cs
using UnityEngine;
using System.Collections;
public class
SampleAppUIRadioButton : ISampleAppUIElement
{ public
event System.
Action int
TappedOnOption; public
SampleAppUIRadioButtonSampleAppUIRect[] rect, int
index, string
[,] path {
if index rect.Length
{ return
; }
this .mRect = rect;
mStyle = new
GUIStyle[rect.Length]; for
int i = 0; i mStyle.Length; i++
{ mStyle[i] =
new GUIStyle;
mStyle[i].normal.background =
Resources.Loadpath[i,0] as
Texture2D; mStyle[i].active.background
= Resources.Loadpath[i,1]
as Texture2D;
mStyle[i].onNormal.background =
Resources.Loadpath[i,1] as
Texture2D; }
mOptionsTapped = new
bool [rect.Length];
mOptionsSelected = new
bool [rect.Length];
mOptionsSelected[index] = true
; }
public void
EnableIndex int
index {
if index mOptionsSelected.Length {
mOptionsSelected[index] = SetToTrue; }
}
private bool
SetToTrue {
for int
i = 0 ; i mOptionsSelected.Length; i++ {
mOptionsSelected[i] = false
; }
return true
;
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