i get no resault from last faunction…
var gSkin:GUISkin;
var gSkinEmpty:GUISkin;
var backGround :Texture2D;
var qMark :Texture2D;
var questions:String[];
private var oldScreenWidthSize:int;
private var oldScreenHeightSize:int;
//var backGround :Texture2D;
private var nextQuestionOffset=0;
function Awake()
{
if(!gSkin)
Debug.Log("StartMenuGUI: GUI Skin Object Missing !");
//Reset GUI Position and depth by vectors to zero (we use pixel to set setting)
transform.position=Vector3(0,0,5);
//Hide GUI on Begining
this.GetComponent("GUITexture").enabled=false;
//set old Screen Width and Height to check for Reset() later
oldScreenWidthSize=Screen.width;
oldScreenHeightSize=Screen.height;
//call for reset with 'true' it will work any way
ResetGUIOnScreen(true);
}
function OnGUI ()
{
//If state is Total Freeze : we are inside Station
if(GlobalStates.GAME_STATE==GameStates.ControllerTotalFreeze)
{
ResetGUIOnScreen(false);
if (this.GetComponent("GUITexture").enabled!=true)
{
this.GetComponent("GUITexture").enabled=true;
}
DrawButtons();
DrawQuestions();
}
else
{
if (this.GetComponent("GUITexture").enabled!=false)
{
this.GetComponent("GUITexture").enabled=false;
}
}
}
function ResetGUIOnScreen(doAnyWay:boolean)
{
if((Screen.width!=oldScreenWidthSize || Screen.height!=oldScreenHeightSize) || doAnyWay)
{
if(this.GetComponent("GUITexture").pixelInset.x!=0)
{
this.GetComponent("GUITexture").pixelInset.x=0;
}
if(this.GetComponent("GUITexture").pixelInset.y!=
(Screen.height>this.GetComponent("GUITexture").pixelInset.height)?Screen.height/2-(this.GetComponent("GUITexture").pixelInset.height/2):0)
{
this.GetComponent("GUITexture").pixelInset.y=
(Screen.height>this.GetComponent("GUITexture").pixelInset.height)?Screen.height/2-(this.GetComponent("GUITexture").pixelInset.height/2):0;
}
}
}
function DrawButtons()
{
GUI.skin.button=gSkin.customStyles[0];
if (GUI.Button(Rect(this.GetComponent("GUITexture").pixelInset.x+this.GetComponent("GUITexture").pixelInset.width-90,this.GetComponent("GUITexture").pixelInset.y+this.GetComponent("GUITexture").pixelInset.height-28,80,23),""))
{
GlobalStates.GAME_STATE=GameStates.Running;
}
GUI.skin.button=gSkin.customStyles[1];
if (GUI.Button(Rect(this.GetComponent("GUITexture").pixelInset.x+this.GetComponent("GUITexture").pixelInset.width-32,this.GetComponent("GUITexture").pixelInset.y+19,30,22),""))
{
GlobalStates.GAME_STATE=GameStates.Running;
}
}
function DrawQuestions()
{
print(questions.Length+"");
GUI.skin=gSkinEmpty;
var i=0;
for(i=0;i<questions.Length;i++)
{
nextQuestionOffset=i*20;
GUI.Button(Rect(this.GetComponent("GUITexture").pixelInset.x+this.GetComponent("GUITexture").pixelInset.width-65,this.GetComponent("GUITexture").pixelInset.y+100+nextQuestionOffset,15,18),qMark);
}
}