void UpdateBuyScreen() { if (currentBagPosition == 0) { offscreenindexup = -1; offscreenindexdown = 3; } for (int i = 0; i < 4; i++) { int currentItem = offscreenindexup + 1 + i; if (currentItem > offscreenindexup && currentItem < martlist.Count) { ItemsToBuy[i].mode = SlotMode.Item; ItemsToBuy[i].name = martlist[currentItem]; } else if (currentItem == martlist.Count) { ItemsToBuy[i].mode = SlotMode.Cancel; } else { ItemsToBuy[i].mode = SlotMode.Empty; } ItemsToBuy[i].UpdatePrice(); } if (offscreenindexdown < martlist.Count) { indicator.SetActive(true); } else { indicator.SetActive(false); } cursor.SetPosition(40, 104 - 16 * (currentBagPosition - offscreenindexup - 1)); }
public void Init() { GameData.instance.atTitleScreen = true; tutanim.SetTrigger("reset"); cursor.SetActive(false); MathE.Clamp(ref selectedOption, 0, 3); cursor.SetPosition(8, 120 - 16 * selectedOption); }
public void UpdateBagScreen() { if (currentBagPosition == 0) { offscreenindexup = -1; offscreenindexdown = 3; } for (int i = 0; i < 4; i++) { int currentItem = offscreenindexup + 1 + i; if (currentItem > offscreenindexup && currentItem < Items.instance.items.Count) { itemSlots[i].mode = SlotMode.Item; itemSlots[i].Name = Items.instance.items[currentItem].name; itemSlots[i].intquantity = Items.instance.items[currentItem].quantity; itemSlots[i].isKeyItem = Items.instance.items[currentItem].isKeyItem; } else if (currentItem == Items.instance.items.Count) { itemSlots[i].mode = SlotMode.Cancel; } else { itemSlots[i].mode = SlotMode.Empty; } } cursor.SetPosition(40, 104 - 16 * (currentBagPosition - offscreenindexup - 1)); if (offscreenindexdown < Items.instance.items.Count) { indicator.SetActive(true); } else { indicator.SetActive(false); } if (switching) { selectCursor.anchoredPosition = new Vector2(40, 104 - 16 * (selectBag - offscreenindexup - 1)) + new Vector2(4, 4); if (selectCursor.anchoredPosition.y > 112 || selectCursor.anchoredPosition.y < 50) { selectCursor.gameObject.SetActive(false); } else { selectCursor.gameObject.SetActive(true); } } }
void UpdateCursorPosition() { switch (selectedOption) { case 0: if (GameData.instance.textChoice == 2) { cursor.SetPosition(112, 112); } else if (GameData.instance.textChoice == 1) { cursor.SetPosition(56, 112); } else { cursor.SetPosition(8, 112); } textSpeedArrow.anchoredPosition = cursor.rectTransform.anchoredPosition + new Vector2(4, 4); break; case 1: cursor.SetPosition(8 + (9 * GameData.instance.animationChoice) * 8, 72); battleAnimationArrow.anchoredPosition = cursor.rectTransform.anchoredPosition + new Vector2(4, 4); break; case 2: cursor.SetPosition(8 + (9 * GameData.instance.battleChoice) * 8, 32); battleStyleArrow.anchoredPosition = cursor.rectTransform.anchoredPosition + new Vector2(4, 4); break; case 3: cursor.SetPosition(8, 8); break; } }
// Use this for initialization // Update is called once per frame void Update() { if (isLowerCase) { nameselectscreen.sprite = lowercase; } else { nameselectscreen.sprite = uppercase; } displaytext.text = futureName; if (BeginHandler.instance.givingRedAName || BeginHandler.instance.givingGaryAName) { maxNameSize = 7; } else { maxNameSize = 10; } if (currentYselection == 5) { currentXselection = 0; } cursor.SetPosition(8 + 16 * currentXselection, 96 - 16 * currentYselection); if (Inputs.pressed("right")) { if (currentYselection != 5) { currentXselection++; } } if (Inputs.pressed("left")) { if (currentYselection != 5) { currentXselection--; } } if (Inputs.pressed("up")) { currentYselection--; } if (Inputs.pressed("down")) { currentYselection++; } MathE.Wrap(ref currentXselection, 0, 8); MathE.Wrap(ref currentYselection, 0, 5); if (Inputs.pressed("b")) { if (futureName.Length > 0) { futureName = futureName.Remove(futureName.Length - 1); } } if (Inputs.pressed("start")) { if (futureName.Length != 0) { if (BeginHandler.instance.givingRedAName) { GameData.instance.playerName = futureName; BeginHandler.instance.tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; BeginHandler.instance.givingRedAName = false; this.gameObject.SetActive(false); } if (BeginHandler.instance.givingGaryAName) { GameData.instance.rivalName = futureName; BeginHandler.instance.tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; BeginHandler.instance.givingGaryAName = false; this.gameObject.SetActive(false); } BeginHandler.instance.currentmenu = null; } } if (Inputs.pressed("a")) { if (currentXselection == 8 && currentYselection == 4) { if (futureName.Length != 0) { if (BeginHandler.instance.givingRedAName) { GameData.instance.playerName = futureName; BeginHandler.instance.tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; BeginHandler.instance.givingRedAName = false; cursor.SetActive(false); this.gameObject.SetActive(false); } if (BeginHandler.instance.givingGaryAName) { GameData.instance.rivalName = futureName; BeginHandler.instance.tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; BeginHandler.instance.givingGaryAName = false; cursor.SetActive(false); this.gameObject.SetActive(false); } BeginHandler.instance.currentmenu = null; } } else { if (currentXselection == 0 && currentYselection == 5) { isLowerCase = !isLowerCase; } else if (futureName.Length == maxNameSize) { return; } else { futureName += currentYselection < 3 && isLowerCase ? characters[currentYselection, currentXselection].ToLower() : characters[currentYselection, currentXselection]; } } } }
// Use this for initialization // Update is called once per frame void Update() { if (deactivated && !Player.disabled) { Player.disabled = true; } buycoinstext [0].text = GameData.instance.money.ToString(); buycoinstext [1].text = GameData.instance.coins.ToString(); if (!finishedThePrompt) { if (Inputs.pressed("a")) { finishedThePrompt = true; StopAllCoroutines(); Inputs.dialogueCheck = false; dialoguetext.text = ""; cursor.SetActive(false); } if (Inputs.pressed("b")) { switch (taskType) { case 0: selectedOption = 1; break; case 1: selectedOption = 3; break; } StopAllCoroutines(); Inputs.dialogueCheck = false; dialoguetext.text = ""; cursor.SetActive(false); finishedThePrompt = true; } if (Inputs.pressed("down")) { selectedOption++; switch (taskType) { case 0: MathE.Clamp(ref selectedOption, 0, 1); cursor.SetPosition(120, 72 - 16 * selectedOption); break; case 1: MathE.Clamp(ref selectedOption, 0, 2); cursor.SetPosition(120, 40 - 16 * selectedOption); break; } } if (Inputs.pressed("up")) { selectedOption--; switch (taskType) { case 0: MathE.Clamp(ref selectedOption, 0, 1); cursor.SetPosition(120, 72 - 16 * selectedOption); break; case 1: MathE.Clamp(ref selectedOption, 0, 2); cursor.SetPosition(120, 40 - 16 * selectedOption); break; } } } if (GameData.instance.textChoice == 2) { scrollequation = 3 * 0.016f; } if (GameData.instance.textChoice == 1) { scrollequation = 2f * 0.016f; } if (GameData.instance.textChoice == 0) { scrollequation = 1f * 0.016f; } }
void UpdateBagScreen() { numberOfItems = ItemMode == 2 ? Items.instance.items.Count : Items.instance.pcItems.Count; if (currentBagPosition == 0) { offscreenindexup = -1; offscreenindexdown = 3; } if (ItemMode == 2) { for (int i = 0; i < 4; i++) { int currentItem = offscreenindexup + 1 + i; if (currentItem > offscreenindexup && currentItem < numberOfItems) { itemSlots[i].mode = SlotMode.Item; itemSlots[i].Name = Items.instance.items[currentItem].name; itemSlots[i].intquantity = Items.instance.items[currentItem].quantity; itemSlots[i].isKeyItem = Items.instance.items[currentItem].isKeyItem; } else if (currentItem == numberOfItems) { itemSlots[i].mode = SlotMode.Cancel; } else { itemSlots[i].mode = SlotMode.Empty; } } } if (ItemMode == 1 || ItemMode == 3) { for (int i = 0; i < 4; i++) { int currentItem = offscreenindexup + 1 + i; if (currentItem > offscreenindexup && currentItem < numberOfItems) { itemSlots[i].mode = SlotMode.Item; itemSlots[i].Name = Items.instance.pcItems[currentItem].name; itemSlots[i].intquantity = Items.instance.pcItems[currentItem].quantity; itemSlots[i].isKeyItem = Items.instance.pcItems[currentItem].isKeyItem; } else if (currentItem == numberOfItems) { itemSlots[i].mode = SlotMode.Cancel; } else { itemSlots[i].mode = SlotMode.Empty; } } } if (currentBagPosition != numberOfItems && itemSlots[currentBagPosition - offscreenindexup - 1].mode == SlotMode.Item) { maximumItem = itemSlots[currentBagPosition - offscreenindexup - 1].intquantity; } else { maximumItem = 0; } if (offscreenindexdown < numberOfItems) { indicator.SetActive(true); } else { indicator.SetActive(false); } cursor.SetPosition(40, 104 - 16 * (currentBagPosition - offscreenindexup - 1)); if (switching) { selectCursor.anchoredPosition = new Vector2(40, 104 - 16 * (selectBag - offscreenindexup - 1)) + new Vector2(4, 4); if (selectCursor.anchoredPosition.y > 112 || selectCursor.anchoredPosition.y < 50) { selectCursor.gameObject.SetActive(false); } else { selectCursor.gameObject.SetActive(true); } } }
// Update is called once per frame void Update() { if (!animationsFinished) { return; } if (currentMenu == nodatamenu || currentMenu == datamenu) { int limit = (currentMenu == nodatamenu ? 1 : 2); if (Inputs.pressed("down")) { selectedOption++; } if (Inputs.pressed("up")) { selectedOption--; } if (selectedOption < 0) { selectedOption = 0; } if (selectedOption > limit) { selectedOption = limit; } cursor.SetPosition(8, 120 - selectedOption * 16); } if (Inputs.pressed("a") || Inputs.pressed("start")) { if (currentMenu == null && !titlePokemon.isMoving) { StartCoroutine("GotoStart"); } } if (Inputs.pressed("a")) { if (currentMenu == nodatamenu) { if (selectedOption == 0) { tutorialmanager.SetActive(true); OakIntroCutsceneHandler.instance.Init(); SoundManager.instance.PlaySong(15); startmenu.SetActive(false); this.gameObject.SetActive(false); } else if (selectedOption == 1) { Options.instance.Init(); options.SetActive(true); currentMenu = options; } } if (currentMenu == datamenu && selectedOption == 2) { Options.instance.Init(); options.SetActive(true); currentMenu = options; } } if (Inputs.pressed("b") && startmenu.activeInHierarchy) { if ((currentMenu == nodatamenu || currentMenu == datamenu)) { startmenu.SetActive(false); currentMenu = null; inStartMenu = false; ChosenPokemon = 0; ChangePokemon(); cursor.SetActive(false); animationsFinished = false; titleAnimTimer = 0; pokemonAnim.enabled = true; pokemonAnim.Play("titlePokemonIdle"); titleanim.Play("titleAnim", 0, 0); } if (currentMenu == options) { currentMenu = nodatamenu; selectedOption = 0; } } foreach (GameObject menu in startmenus) { if (menu != currentMenu) { menu.SetActive(false); } else { menu.SetActive(true); } } if (!switchingPokemon && !inStartMenu) { titleAnimTimer += Time.deltaTime; } if (titleAnimTimer >= 3.33f) { TitleAnim(); titleAnimTimer = 0; } }
public void UpdateSwitch() { cursor.SetPosition(96 - 16 * switchMenuOffsetX, 40 - 16 * selectedOption + switchMenuOffset * 16); UpdateMenus(); }
// Update is called once per frame void Update() { if (currentmenu == null) { cursor.SetActive(false); } else if (currentmenu == thismenu) { playername.text = GameData.instance.playerName; cursor.SetPosition(88, 120 - 16 * selectedOption); if (Inputs.pressed("down")) { selectedOption++; } if (Inputs.pressed("up")) { selectedOption--; } if (selectedOption < 0) { selectedOption = slotNumber - 1; } if (selectedOption == slotNumber) { selectedOption = 0; } } if (Inputs.pressed("start")) { if (currentmenu == thismenu) { Close(); } } if (Inputs.pressed("a")) { if (currentmenu == thismenu) { SoundManager.instance.PlayABSound(); if (selectedOption == 0) { currentmenu = pokedexmenu; pokedexmenu.SetActive(true); Inputs.Disable("start"); pokedex.Init(); } if (selectedOption == 1) { currentmenu = pokemonmenu; pokemonMenu.currentMenu = pokemonMenu.mainwindow; Inputs.Disable("start"); pokemonMenu.selectedOption = 0; pokemonmenu.SetActive(true); pokemonMenu.Initialize(); } if (selectedOption == 2) { bag.Initialize(); bag.selectBag = -1; currentmenu = Bagmenu; cursor.SetActive(true); Bagmenu.SetActive(true); Inputs.Disable("start"); } if (selectedOption == 3) { currentmenu = badgesmenu; cursor.SetActive(false); Inputs.Disable("start"); badgesmenu.GetComponent <Badges>().Init(); badgesmenu.SetActive(true); } if (selectedOption == 4) { } if (selectedOption == 5) { options.Init(); optionsmenu.SetActive(true); Inputs.Disable("start"); currentmenu = optionsmenu; } if (selectedOption == 6) { Close(); } } } if (Inputs.pressed("b")) { if (currentmenu == thismenu) { SoundManager.instance.PlayABSound(); Close(); } } }
// Update is called once per frame void Update() { UpdateMenus(); if (battleState == BattleState.PlayerTurn && Dialogue.instance.finishedText) { UpdateStatsUI(); if (currentmenu == battlemenu) { cursor.SetPosition(48 * (selectedOption % 2) + 72, -16 * Mathf.FloorToInt((float)selectedOption / 2f) + 24); if (Inputs.pressed("left")) { if (selectedOption == 1) { selectedOption = 0; return; } if (selectedOption == 3) { selectedOption = 2; return; } } if (Inputs.pressed("right")) { if (selectedOption == 0) { selectedOption = 1; return; } if (selectedOption == 2) { selectedOption = 3; return; } } if (Inputs.pressed("up")) { if (selectedOption == 2) { selectedOption = 0; return; } if (selectedOption == 3) { selectedOption = 1; return; } } if (Inputs.pressed("down")) { if (selectedOption == 0) { selectedOption = 2; return; } if (selectedOption == 1) { selectedOption = 3; return; } } if (Inputs.pressed("a")) { if (selectedOption == 3) { currentmenu = null; cursor.SetActive(false); SoundManager.instance.sfx.PlayOneShot(runClip); Player.instance.RunFromBattle(); UpdateMenus(); } } } } else { currentmenu = null; } }
// Update is called once per frame void Update() { if (currentmenu == null && currentmenu != nameselectionmenu) { if (Inputs.pressed("down")) { selectedOption++; MathE.Clamp(ref selectedOption, 0, 3); cursor.SetPosition(8, 120 - 16 * selectedOption); } if (Inputs.pressed("up")) { selectedOption--; MathE.Clamp(ref selectedOption, 0, 3); cursor.SetPosition(8, 120 - 16 * selectedOption); } } foreach (GameObject menu in allmenus) { if (menu != currentmenu) { menu.SetActive(false); } else { menu.SetActive(true); } } if (Inputs.pressed("a")) { if (currentmenu == rednamemenu) { if (selectedOption == 0) { currentmenu = nameselectionmenu; nameselectionmenu.SetActive(true); names.futureName = ""; } else { currentmenu = null; switch (VersionManager.instance.version) { case Version.Red: switch (selectedOption) { case 1: GameData.instance.playerName = "RED"; break; case 2: GameData.instance.playerName = "ASH"; break; case 3: GameData.instance.playerName = "JACK"; break; } break; case Version.Blue: switch (selectedOption) { case 1: GameData.instance.playerName = "BLUE"; break; case 2: GameData.instance.playerName = "GARY"; break; case 3: GameData.instance.playerName = "JOHN"; break; } break; } tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; givingRedAName = false; cursor.SetActive(false); } } if (currentmenu == garynamemenu) { if (selectedOption == 0) { currentmenu = nameselectionmenu; nameselectionmenu.SetActive(true); names.futureName = ""; } else { currentmenu = null; switch (GameData.instance.version) { case Version.Blue: switch (selectedOption) { case 1: GameData.instance.rivalName = "RED"; break; case 2: GameData.instance.rivalName = "ASH"; break; case 3: GameData.instance.rivalName = "JACK"; break; } break; case Version.Red: switch (selectedOption) { case 1: GameData.instance.rivalName = "BLUE"; break; case 2: GameData.instance.rivalName = "GARY"; break; case 3: GameData.instance.rivalName = "JOHN"; break; } break; } tutanim.SetTrigger("transition"); Dialogue.instance.enabled = true; givingRedAName = false; cursor.SetActive(false); } } } }
// Update is called once per frame void Update() { if (!selectingMon) { cursor.SetPosition(0, 112 - 16 * selectedSlot); } if (!cursor.isActive) { cursor.SetActive(true); } if (bio.displayingbio) { cursor.SetActive(false); } if (mainMenu.currentmenu == mainMenu.pokedexmenu) { if (Inputs.pressed("b") && !bio.displayingbio) { SoundManager.instance.PlayABSound(); if (Player.disabled) { Player.disabled = false; } if (selectingMon) { selectingMon = false; } else { Inputs.Enable("start"); mainMenu.currentmenu = mainMenu.thismenu; gameObject.SetActive(false); } } if (Inputs.pressed("a") && !bio.displayingbio) { SoundManager.instance.PlayABSound(); if (!selectingMon && GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen) { selectingMon = true; cursor.SetPosition(120, 56); } else if (GameData.instance.pokedexlist[topSlotIndex + selectedSlot - 1].seen) { StartCoroutine(bio.DisplayABio(topSlotIndex + selectedSlot)); } } if (Inputs.pressed("down")) { if (!selectingMon) { selectedSlot++; if (selectedSlot > 6) { selectedSlot = 6; if (topSlotIndex < GameData.instance.pokedexlist.Count - 6) { topSlotIndex += 1; } UpdateScreen(); } } } if (Inputs.pressed("up")) { if (!selectingMon) { selectedSlot--; if (selectedSlot < 0) { selectedSlot = 0; if (topSlotIndex > 1) { topSlotIndex -= 1; } UpdateScreen(); } } } if (Inputs.pressed("right")) { if (!selectingMon) { topSlotIndex += 10; if (topSlotIndex > GameData.instance.pokedexlist.Count - 6) { topSlotIndex = GameData.instance.pokedexlist.Count - 6; } UpdateScreen(); } } if (Inputs.pressed("left")) { if (!selectingMon) { topSlotIndex -= 10; if (topSlotIndex < 1) { topSlotIndex = 1; } UpdateScreen(); } } } }