public void OnUp() { switch (currState) { case State.Buy: currMerchantSetIndex--; if (currMerchantSetIndex < 0) { currMerchantSetIndex = numMerchantSets - 1; } merchantCard.UpdateMerchantItemCards(merchantData.TakeSet(currMerchantSetIndex, 3)); break; case State.Sell: currPlayerSetIndex--; if (currPlayerSetIndex < 0) { currPlayerSetIndex = numPlayerSets - 1; } merchantCard.UpdatePlayerItemCards(PlayerData.Instance.characterList.TakeSet(currPlayerSetIndex, 3)); break; } }
public void Begin(MerchantData merchant) { merchantData = merchant; _currState = State.Buy; numPlayerSets = PlayerData.Instance.characterList.GetNumSets(3); numMerchantSets = Mathf.CeilToInt(merchantData.numItems / 3f); currPlayerSetIndex = 0; currMerchantSetIndex = 0; merchantCard.UpdateHeader(merchantData.name); merchantCard.UpdateMerchantItemCards(merchantData.TakeSet(currMerchantSetIndex, 3)); merchantCard.UpdatePlayerItemCards(PlayerData.Instance.characterList.TakeSet(currPlayerSetIndex, 3)); merchantCard.Show(true); characterCard.Show(true); }