void QuitWindow() { float mx = Input.mousePosition.x; float my = Screen.height - Input.mousePosition.y; float width = Screen.width - 400; GUI.DrawTexture(new Rect(180, -50, width + 40, 100), GUImgr.gradDown); GUI.skin.label.alignment = TextAnchor.MiddleCenter; if (my < 25) { if (mx > 200 && mx < 200 + width / 2) { GUI.DrawTexture(new Rect(200, 0, width / 2, 25), GUImgr.gradDown); if (Input.GetMouseButton(0) && !Player.click) { Player.click = true; Application.LoadLevel("Menu"); } } if (mx > 200 + width / 2 && mx < 200 + width) { GUI.DrawTexture(new Rect(200 + width / 2, 0, width / 2, 25), GUImgr.gradDown); if (Input.GetMouseButton(0) && !Player.click) { Player.click = true; currentWindow = MenuWindows.None; } } } GUI.Label(new Rect(200, 0, width / 2, 25), "Quit"); GUI.Label(new Rect(200 + width / 2, 0, width / 2, 25), "Cancel"); GUI.Label(new Rect(200, 25, width, 25), "Are you sure you want to quit?"); PlayerPrefs.Save(); }
void QuitWindow() { float mx = Input.mousePosition.x; float my = Screen.height-Input.mousePosition.y; float width = Screen.width-400; GUI.DrawTexture(new Rect(180,-50,width+40,100), GUImgr.gradDown); GUI.skin.label.alignment = TextAnchor.MiddleCenter; if (my<25){ if (mx>200 && mx<200+width/2){ GUI.DrawTexture(new Rect(200,0,width/2,25), GUImgr.gradDown); if (Input.GetMouseButton(0) && !Player.click){ Player.click = true; Application.LoadLevel("Menu"); } } if (mx>200+width/2 && mx<200+width){ GUI.DrawTexture(new Rect(200+width/2,0,width/2,25), GUImgr.gradDown); if (Input.GetMouseButton(0) && !Player.click){ Player.click = true; currentWindow = MenuWindows.None; } } } GUI.Label(new Rect(200,0,width/2,25), "Quit"); GUI.Label(new Rect(200+width/2,0,width/2,25), "Cancel"); GUI.Label(new Rect(200,25,width,25), "Are you sure you want to quit?"); PlayerPrefs.Save(); }
void OnGUI() { GUI.skin.label.fontSize = 15; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.normal.textColor = Color.black; float mx = Input.mousePosition.x; float my = Screen.height-Input.mousePosition.y; float ypos = 0; if (Dialog.inDialog){ Dialog.GUIWindow(); return; } Dialog.doneDialog = false; //No game logic should be in the interface code if (chatActive){ OpenChatWindow(); } var trainer = Player.trainer; var party = trainer.party; var active = party.GetActivePokemon(); if (party.HasActive()){ //obj.GetComponent<PokemonDomesticated>() BattleGUI(active.obj.GetComponent<PokemonDomesticated>()); return; } if (menuActive){ GUI.skin.label.alignment = TextAnchor.MiddleRight; ypos = 0; GUI.DrawTexture(new Rect(Screen.width-100,0,150,Screen.height), GUImgr.gradLeft); for(int i=0; i<8; i++){ if ((int)currentWindow==i && i>0) GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (mx>Screen.width-200 && my>ypos && my<ypos+25){ GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (Input.GetMouseButton(0) && !Player.click){ Player.click = true; if (i==0) menuActive = false; else currentWindow=(MenuWindows)i; } } if (i==0) GUI.Label(new Rect(Screen.width-210,ypos,200,25), "Close"); else GUI.Label(new Rect(Screen.width-210,ypos,200,25), ((MenuWindows)i).ToString()); ypos+=25; } string timeTxt = TimeMgr.hour.ToString()+":"; if (TimeMgr.minuite<10){ timeTxt+="0"+((int)TimeMgr.minuite).ToString(); }else{ timeTxt+=((int)TimeMgr.minuite).ToString(); } GUI.Label(new Rect(Screen.width-210,Screen.height-25,200,25), timeTxt); GUI.skin.label.alignment = TextAnchor.MiddleLeft; switch(currentWindow){ case MenuWindows.Multiplayer: MultiplayerWindow(); break; case MenuWindows.Pokedex: PokedexWindow(); break; case MenuWindows.Pokemon: PokemonWindow(); break; case MenuWindows.Inventory: InventoryWindow(); break; case MenuWindows.Talents: TalentsWindow(); break; case MenuWindows.Options: OptionsWindow(); break; case MenuWindows.Quit: QuitWindow(); break; } return; } ypos = 0; foreach(var slot in Player.trainer.party.GetSlots()){ var pokemon = slot.pokemon; if (party.IsSelected(pokemon)) GUI.DrawTexture(new Rect(0,ypos+16,100,32), GUImgr.gradRight); GUI.DrawTexture(new Rect(0,ypos,64,64), pokemon.icon); GUI.Label(new Rect(64,ypos,200,25), pokemon.name+" lvl"+pokemon.level.ToString()); GUImgr.DrawBar(new Rect(64,ypos+25,100,5), pokemon.hp, GUImgr.hp); GUImgr.DrawBar(new Rect(64,ypos+35,100,5), pokemon.xp, GUImgr.xp); ypos += 70; } }
void OnGUI() { GUI.skin.label.fontSize = 15; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.normal.textColor = Color.black; float mx = Input.mousePosition.x; float my = Screen.height - Input.mousePosition.y; if (Dialog.inDialog) { Dialog.GUIWindow(); return; } Dialog.doneDialog = false; if (chatActive) { OpenChatWindow(); } if (Player.pokemonActive && Player.pokemon.obj != null) { Player.pokemon.obj.GetComponent <PokemonDomesticated>().BattleGUI(); return; } if (menuActive) { GUI.skin.label.alignment = TextAnchor.MiddleRight; float ypos = 0; GUI.DrawTexture(new Rect(Screen.width - 100, 0, 150, Screen.height), GUImgr.gradLeft); for (int i = 0; i < 8; i++) { if ((int)currentWindow == i && i > 0) { GUI.DrawTexture(new Rect(Screen.width - 120, ypos + 5, 150, 15), GUImgr.gradLeft); } if (mx > Screen.width - 200 && my > ypos && my < ypos + 25) { GUI.DrawTexture(new Rect(Screen.width - 120, ypos + 5, 150, 15), GUImgr.gradLeft); if (Input.GetMouseButton(0) && !Player.click) { Player.click = true; if (i == 0) { menuActive = false; } else { currentWindow = (MenuWindows)i; } } } if (i == 0) { GUI.Label(new Rect(Screen.width - 210, ypos, 200, 25), "Close"); } else { GUI.Label(new Rect(Screen.width - 210, ypos, 200, 25), ((MenuWindows)i).ToString()); } ypos += 25; } string timeTxt = TimeMgr.hour.ToString() + ":"; if (TimeMgr.minuite < 10) { timeTxt += "0" + ((int)TimeMgr.minuite).ToString(); } else { timeTxt += ((int)TimeMgr.minuite).ToString(); } GUI.Label(new Rect(Screen.width - 210, Screen.height - 25, 200, 25), timeTxt); GUI.skin.label.alignment = TextAnchor.MiddleLeft; switch (currentWindow) { case MenuWindows.Multiplayer: MultiplayerWindow(); break; case MenuWindows.Pokedex: PokedexWindow(); break; case MenuWindows.Pokemon: PokemonWindow(); break; case MenuWindows.Inventory: InventoryWindow(); break; case MenuWindows.Talents: TalentsWindow(); break; case MenuWindows.Options: OptionsWindow(); break; case MenuWindows.Quit: QuitWindow(); break; } return; } { float ypos = 0; foreach (Pokemon poke in Player.trainer.pokemon) { if (poke == Player.pokemon) { GUI.DrawTexture(new Rect(0, ypos + 16, 100, 32), GUImgr.gradRight); } GUI.DrawTexture(new Rect(0, ypos, 64, 64), poke.icon); GUI.Label(new Rect(64, ypos, 200, 25), poke.name + " lvl" + poke.level.ToString()); GUImgr.DrawBar(new Rect(64, ypos + 25, 100, 5), poke.hp, GUImgr.hp); GUImgr.DrawBar(new Rect(64, ypos + 35, 100, 5), poke.xp, GUImgr.xp); ypos += 70; } } }
void OnGUI() { GUI.skin.label.fontSize = 15; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.normal.textColor = Color.black; float mx = Input.mousePosition.x; float my = Screen.height-Input.mousePosition.y; if (Player.pokemonActive && Player.pokemonObj!=null){ Player.pokemonObj.GetComponent<PokemonPlayer>().BattleGUI(); return; } if (menuActive){ GUI.skin.label.alignment = TextAnchor.MiddleRight; float ypos = 0; GUI.DrawTexture(new Rect(Screen.width-100,0,150,Screen.height), GUImgr.gradLeft); for(int i=0; i<8; i++){ if ((int)currentWindow==i && i>0) GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (mx>Screen.width-200 && my>ypos && my<ypos+25){ GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (Input.GetMouseButton(0) && !Player.click){ Player.click = true; if (i==0) menuActive = false; else currentWindow=(MenuWindows)i; } } if (i==0) GUI.Label(new Rect(Screen.width-210,ypos,200,25), "Close"); else GUI.Label(new Rect(Screen.width-210,ypos,200,25), ((MenuWindows)i).ToString()); ypos+=25; } string timeTxt = TimeMgr.hour.ToString()+":"; if (TimeMgr.minuite<10){ timeTxt+="0"+((int)TimeMgr.minuite).ToString(); }else{ timeTxt+=((int)TimeMgr.minuite).ToString(); } GUI.Label(new Rect(Screen.width-210,Screen.height-25,200,25), timeTxt); GUI.skin.label.alignment = TextAnchor.MiddleLeft; switch(currentWindow){ case MenuWindows.Multiplayer: MultiplayerWindow(); break; case MenuWindows.Pokedex: PokedexWindow(); break; case MenuWindows.Pokemon: PokemonWindow(); break; case MenuWindows.Inventory: InventoryWindow(); break; case MenuWindows.Talents: TalentsWindow(); break; case MenuWindows.Options: OptionsWindow(); break; case MenuWindows.Quit: QuitWindow(); break; } return; } {float ypos = 0; foreach(Pokemon poke in Pokemon.party){ if (poke==Pokemon.selected) GUI.DrawTexture(new Rect(0,ypos+16,100,32), GUImgr.gradRight); GUI.DrawTexture(new Rect(0,ypos,64,64), poke.icon); GUI.Label(new Rect(64,ypos,200,25), poke.name+" lvl"+poke.level.ToString()); GUImgr.DrawBar(new Rect(64,ypos+25,100,5), poke.hp, GUImgr.hp); GUImgr.DrawBar(new Rect(64,ypos+35,100,5), poke.xp, GUImgr.xp); ypos += 70; }} }
void OnGUI(){ GUI.skin.label.fontSize = 15; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.normal.textColor = Color.black; float mx = Input.mousePosition.x; float my = Screen.height-Input.mousePosition.y; float ypos = 0; if (Dialog.inDialog){ Dialog.GUIWindow(); return; } Dialog.doneDialog = false; if(chatActive){ OpenChatWindow(); } if (fpsWindow) { OpenFpsWindow(); } if (Player.pokemonActive && Player.pokemon.obj!=null){ Player.pokemon.obj.GetComponent<PokemonDomesticated>().BattleGUITmp(); return; } if (menuActive){ GUI.skin.label.alignment = TextAnchor.MiddleRight; ypos = 0; GUI.DrawTexture(new Rect(Screen.width-100,0,150,Screen.height), GUImgr.gradLeft); for(int i=0; i<8; i++){ if ((int)currentWindow==i && i>0) GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (mx>Screen.width-200 && my>ypos && my<ypos+25){ GUI.DrawTexture(new Rect(Screen.width-120,ypos+5,150,15), GUImgr.gradLeft); if (Input.GetMouseButton(0) && !Player.click){ Player.click = true; if (i==0) menuActive = false; else currentWindow=(MenuWindows)i; } } if (i==0) GUI.Label(new Rect(Screen.width-210,ypos,200,25), "Close"); else GUI.Label(new Rect(Screen.width-210,ypos,200,25), ((MenuWindows)i).ToString()); ypos+=25; } string timeTxt = TimeMgr.hour.ToString()+":"; if (TimeMgr.minuite<10){ timeTxt+="0"+((int)TimeMgr.minuite).ToString(); }else{ timeTxt+=((int)TimeMgr.minuite).ToString(); } GUI.Label(new Rect(Screen.width-210,Screen.height-25,200,25), timeTxt); GUI.skin.label.alignment = TextAnchor.MiddleLeft; switch(currentWindow){ case MenuWindows.Multiplayer: MultiplayerWindow(); break; case MenuWindows.Pokedex: PokedexWindow(); break; case MenuWindows.Pokemon: PokemonWindow(); break; case MenuWindows.Inventory: InventoryWindow(); break; case MenuWindows.Talents: TalentsWindow(); break; case MenuWindows.Options: OptionsWindow(); break; case MenuWindows.Quit: QuitWindow(); break; } return; } }