void Start()
{
_initial = InputInitial.ONE;
MasterController.BRAIN.onEnterMenu();
pc = MasterController.BRAIN.pci();
pc.onGesturePerformed += HandlePconGesturePerformed;
_score = MasterController.BRAIN.sm().get_score();
_highScore = MasterController.BRAIN.hsm();
_hsi = MasterController.BRAIN.hsi();
if(_highScore.get_isHighScore()){//if it is a highscore!
_hsi.onSuccessSwipe += Handle_hsionSuccessSwipe;
_state = State.INPUT;
}else{
_state = State.DISPLAY;
_highScore.saveScores();
}
_highScore.set_isHighScore(false);
//Now to the actual gui making!
guiInput = new GUIManager(thisMetalGUISkin);
guiDisplay = new GUIManager(thisMetalGUISkin);
//Input
guiInput.OnClick += HandleGuiInputOnClick;
guiInput.CreateGUIObject(HIGHSCORE,
"HighScore",
new Rect((Screen.width/5),(15*(Screen.height/100)),(3*(Screen.width/5)),(10*(Screen.height/100))),
GUIType.Label,
"box");
guiInput.CreateGUIObject(SCORE,
("SCORE: " + _score),
new Rect((Screen.width/5),(27*(Screen.height/100)),(3*(Screen.width/5)),(10*(Screen.height/100))),
GUIType.Label,
"box");
guiInput.CreateGUIObject(INITIALS,
(_hsi.initials()),
new Rect((Screen.width/5),(45*(Screen.height/100)),(3*(Screen.width/5)),(10*(Screen.height/100))),
GUIType.Label,
"box");
//left most
guiInput.CreateGUIObject(UP1,
" /\\",
new Rect((Screen.width/100)*45, (Screen.height/100)*45,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
guiInput.CreateGUIObject(DOWN1,
" \\/",
new Rect((Screen.width/100)*45, (Screen.height/100)*55,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
//---end left most
//center
guiInput.CreateGUIObject(UP2,
" /\\",
new Rect((Screen.width/100)*50, (Screen.height/100)*45,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
guiInput.CreateGUIObject(DOWN2,
" \\/",
new Rect((Screen.width/100)*50, (Screen.height/100)*55,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
//---end center
//far right
guiInput.CreateGUIObject(UP3,//right up button
" /\\",
new Rect((Screen.width/100)*54, (Screen.height/100)*45,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
guiInput.CreateGUIObject(DOWN3, //right down button
" \\/",
new Rect((Screen.width/100)*54, (Screen.height/100)*55,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button",
false,
0.0f,
0.0f,
0.0f,
false);
//---end far right
guiInput.CreateGUIObject(ENTER,
"ENTER",
new Rect((Screen.width/20) ,(90*(Screen.height/100)) ,(4*(Screen.width/10)) ,(15*(Screen.height/100))),
GUIType.Button,
"box");
guiInput.CreateGUIObject(LEFT,
"<",
new Rect((Screen.width/100)*42, (Screen.height/100)*50,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button");
guiInput.CreateGUIObject(RIGHT,
">",
new Rect((Screen.width/100)*58, (Screen.height/100)*50,(Screen.width/100)*2, (Screen.height/100)*5),
GUIType.Button,
"button");
//Display
guiDisplay.OnClick += HandleGuiDisplayOnClick;
guiDisplay.CreateGUIObject(MAINMENU,
"Main Menu",
new Rect(5*(Screen.width/10) ,(90*(Screen.height/100)) ,(4*(Screen.width/10)) ,(15*(Screen.height/100))),
GUIType.Button,
"box");
guiDisplay.CreateGUIObject(REPLAY,
"Replay",
new Rect((Screen.width/20) ,(90*(Screen.height/100)) ,(4*(Screen.width/10)) ,(15*(Screen.height/100))),
GUIType.Button,
"box");
guiDisplay.CreateGUIObject(GAMEOVER,
"GameOver",
new Rect((Screen.width/5)/2,(3*(Screen.height/100)),(4*(Screen.width/5)),(10*(Screen.height/100))),
GUIType.Label,
"label");
guiDisplay.CreateGUIObject(FINAL_SCORE,
("SCORE: " + _score),
new Rect((Screen.width/5),(47*(Screen.height/100)),(3*(Screen.width/5)),(18*(Screen.height/100))),
GUIType.Label,
"label");
guiInput.connect(UP1,ENTER,UP2,"",DOWN1);
guiInput.connect(UP2,UP1,UP3,"",DOWN2);
guiInput.connect(UP3,UP2,ENTER,"",DOWN3);
guiInput.connect(DOWN1,ENTER,DOWN2,UP1,"");
guiInput.connect(DOWN2,DOWN1,DOWN3,UP2,"");
guiInput.connect(DOWN3,DOWN2,ENTER,UP3,"");
guiInput.connect(ENTER,UP3,UP1,UP1,UP1);
guiInput.pointer = UP1;
guiDisplay.connect(REPLAY,MAINMENU,MAINMENU,"","");
guiDisplay.connect(MAINMENU,REPLAY,REPLAY,"","");
guiDisplay.pointer = REPLAY;
}