Skip to content

Commit

Permalink
Start revamping the item menus code
Browse files Browse the repository at this point in the history
  • Loading branch information
CelestialAmber committed Jun 19, 2022
1 parent b5a7238 commit 6f3e907
Show file tree
Hide file tree
Showing 15 changed files with 1,148 additions and 1,807 deletions.
1,404 changes: 319 additions & 1,085 deletions Assets/Scenes/Main.unity

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion Assets/Scripts/ItemSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public enum SlotMode{
Item,
Empty,
Cancel
}

public enum SlotType{
Item,
Shop
}

public class ItemSlot : MonoBehaviour {
public bool isKeyItem;
public CustomText slotNameText, slotQuantityText;
public ItemsEnum item;
//public ItemDataEntry itemData;
public int intquantity;
public int price;
public SlotMode mode;
public SlotType type;

// Use this for initialization
void Awake () {
Expand All @@ -40,10 +45,25 @@ void Update () {
}

if (!isKeyItem && mode == SlotMode.Item) {
slotQuantityText.text = "*" + (intquantity <= 9 ? " ": "") + intquantity.ToString();
if(type == SlotType.Item){
slotQuantityText.text = "*" + (intquantity <= 9 ? " ": "") + intquantity.ToString();
}else{
slotQuantityText.text = "$" + price;
}
} else {

slotQuantityText.text = "";
}
}

public void UpdatePrice()
{
ItemDataEntry itemDataEntry = PokemonData.itemData[(int)item];

if (itemDataEntry.price != 0)
{
price = itemDataEntry.price;
}
else throw new UnityException("A price entry doesn't exist for " + "\"" + name + "\"");
}
}
27 changes: 8 additions & 19 deletions Assets/Scripts/Menus/Badges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,32 @@ public class Badges : MonoBehaviour {
public GameCursor cursor;

// Use this for initialization

public void Init(){
nameText.text = GameData.instance.playerName;
moneyText.text = GameData.instance.money.ToString();
timeText.text = GameData.instance.hours.SpaceFormat(3) + " " + GameData.instance.minutes.ZeroFormat("0x");
for (int i = 0; i < 8; i++)
{

for (int i = 0; i < 8; i++){
if (GameData.instance.hasBadge[i])
{
allbadges[i].sprite = obtainedimages[i];

}
else
{

}else{
allbadges[i].sprite = notobtainedimages[i];
}


}
}
// Update is called once per frame
void Update()
{
if (Inputs.pressed("a"))
{


if (MainMenu.instance.currentmenu == MainMenu.instance.badgesmenu)
{
// Update is called once per frame
void Update(){
if (Inputs.pressed("a")){
if (MainMenu.instance.currentmenu == MainMenu.instance.badgesmenu){
SoundManager.instance.PlayABSound();
MainMenu.instance.currentmenu = MainMenu.instance.thismenu;
Inputs.Enable("start");
cursor.SetActive(true);
this.gameObject.SetActive(false);

}
}
}

}
Loading

0 comments on commit 6f3e907

Please sign in to comment.