Merge pull request 'feature/update-ui' (#283) from feature/update-ui into develop
Reviewed-on: https://git.pthub.vn/Unity/perfect-world-unity/pulls/283
This commit is contained in:
@@ -28,7 +28,7 @@ namespace BrewMonster
|
||||
[SerializeField] private GameObject itemPb;
|
||||
|
||||
[Header("Quantity")]
|
||||
[SerializeField] private List<TextMeshProUGUI> quantityText;
|
||||
[SerializeField] private TextMeshProUGUI quantityText;
|
||||
[SerializeField] private Button quantityIncreaseBtn;
|
||||
[SerializeField] private Button quantityDecreaseBtn;
|
||||
[SerializeField] private Button quantityMaxBtn;
|
||||
@@ -42,7 +42,7 @@ namespace BrewMonster
|
||||
[SerializeField] private List<Transform> materialSlots = new List<Transform>();
|
||||
|
||||
[Header("Result Slot")]
|
||||
[SerializeField] private Transform itemResult;
|
||||
[SerializeField] private Image itemResult;
|
||||
|
||||
[Header("Item Info Panel")]
|
||||
public Transform itemInfoRoot;
|
||||
@@ -56,6 +56,9 @@ namespace BrewMonster
|
||||
[SerializeField] private TextMeshProUGUI weponDescInfoText;
|
||||
[SerializeField] private TextMeshProUGUI weponExtraInfoText;
|
||||
|
||||
[Header("Default")]
|
||||
[SerializeField] private Sprite khung_item;
|
||||
|
||||
private NPC_MAKE_SERVICE? cachedMakeService = null;
|
||||
private int currentTabIndex = 0;
|
||||
private uint selectedRecipeId = 0; // Track the currently selected recipe
|
||||
@@ -79,8 +82,7 @@ namespace BrewMonster
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
quantityText[0].text = currentQuantity.ToString();
|
||||
quantityText[1].text = currentQuantity.ToString();
|
||||
quantityText.text = currentQuantity.ToString();
|
||||
quantityDecreaseBtn.onClick.AddListener(OnClickDecreaseBtn);
|
||||
quantityIncreaseBtn.onClick.AddListener(OnClickIncreaseBtn);
|
||||
quantityMaxBtn.onClick.AddListener(OnClickMaxBtn);
|
||||
@@ -309,8 +311,15 @@ namespace BrewMonster
|
||||
btn.onClick.RemoveAllListeners();
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
ShowItemInfoByRecipe(recipeId);
|
||||
bool isNewRecipe = selectedRecipeId != recipeId;
|
||||
selectedRecipeId = recipeId;
|
||||
if (isNewRecipe)
|
||||
{
|
||||
currentQuantity = 1;
|
||||
UpdateQuantityText(currentQuantity);
|
||||
}
|
||||
ShowRecipeMaterials(recipeId);
|
||||
ShowItemInfoByRecipe(recipeId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -331,14 +340,12 @@ namespace BrewMonster
|
||||
{
|
||||
if (slot == null) continue;
|
||||
|
||||
slot.gameObject.SetActive(false);
|
||||
|
||||
Transform iconTf = slot.Find("item");
|
||||
if (iconTf != null)
|
||||
{
|
||||
Image img = iconTf.GetComponent<Image>();
|
||||
if (img != null)
|
||||
img.sprite = null;
|
||||
img.sprite = khung_item;
|
||||
}
|
||||
|
||||
Transform qtyTf = slot.Find("text_quantity");
|
||||
@@ -352,30 +359,14 @@ namespace BrewMonster
|
||||
|
||||
if (itemResult != null)
|
||||
{
|
||||
itemResult.gameObject.SetActive(false);
|
||||
|
||||
Transform iconTf = itemResult.Find("item");
|
||||
if (iconTf != null)
|
||||
{
|
||||
Image img = iconTf.GetComponent<Image>();
|
||||
if (img != null)
|
||||
img.sprite = null;
|
||||
}
|
||||
|
||||
Transform qtyTf = itemResult.Find("text_quantity");
|
||||
if (qtyTf != null)
|
||||
{
|
||||
TextMeshProUGUI txt = qtyTf.GetComponent<TextMeshProUGUI>();
|
||||
if (txt != null)
|
||||
txt.text = "";
|
||||
}
|
||||
itemResult.sprite = khung_item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ShowRecipeMaterials(uint recipeId)
|
||||
{
|
||||
selectedRecipeId = recipeId; // Track the selected recipe
|
||||
selectedRecipeId = recipeId;
|
||||
ClearMaterialSlots();
|
||||
|
||||
var edm = ElementDataManProvider.GetElementDataMan();
|
||||
@@ -395,32 +386,20 @@ namespace BrewMonster
|
||||
{
|
||||
uint outputItemId = recipe.targets[0].id_to_make;
|
||||
|
||||
itemResult.gameObject.SetActive(true);
|
||||
|
||||
Transform iconTf = itemResult.Find("item");
|
||||
if (iconTf != null)
|
||||
if (itemResult != null)
|
||||
{
|
||||
Image img = iconTf.GetComponent<Image>();
|
||||
if (img != null)
|
||||
if (itemResult != null)
|
||||
{
|
||||
Sprite sp = EC_IvtrItemUtils.Instance.ResolveItemIconSprite((int)outputItemId);
|
||||
if (sp != null)
|
||||
{
|
||||
img.sprite = sp;
|
||||
img.enabled = true;
|
||||
img.preserveAspect = true;
|
||||
itemResult.sprite = sp;
|
||||
itemResult.enabled = true;
|
||||
itemResult.preserveAspect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transform qtyTf = itemResult.Find("text_quantity");
|
||||
if (qtyTf != null)
|
||||
{
|
||||
TextMeshProUGUI txt = qtyTf.GetComponent<TextMeshProUGUI>();
|
||||
if (txt != null)
|
||||
txt.text = "1";
|
||||
}
|
||||
|
||||
Button resultBtn = itemResult.GetComponent<Button>();
|
||||
if (resultBtn == null)
|
||||
{
|
||||
@@ -450,8 +429,11 @@ namespace BrewMonster
|
||||
if (mat.id == 0 || mat.num <= 0)
|
||||
continue;
|
||||
|
||||
// compute required amount for the currently selected quantity
|
||||
int requiredAmount = mat.num * Mathf.Max(1, currentQuantity);
|
||||
|
||||
int owned = GetInventoryItemCount(mat.id);
|
||||
bool enough = owned >= mat.num;
|
||||
bool enough = owned >= requiredAmount;
|
||||
|
||||
if (!enough)
|
||||
allEnough = false;
|
||||
@@ -468,9 +450,9 @@ namespace BrewMonster
|
||||
btn.onClick.RemoveAllListeners();
|
||||
btn.onClick.AddListener(() =>
|
||||
{
|
||||
EC_IvtrItem matItem = EC_IvtrItem.CreateItem((int)mat.id, 0, 1);
|
||||
EC_IvtrItem matItem = EC_IvtrItem.CreateItem((int)capturedMatId, 0, 1);
|
||||
matItem?.GetDetailDataFromLocal();
|
||||
ShowMaterialItemInfo(matItem, mat.id);
|
||||
ShowMaterialItemInfo(matItem, capturedMatId);
|
||||
});
|
||||
|
||||
Transform iconTf = slot.Find("item");
|
||||
@@ -492,12 +474,12 @@ namespace BrewMonster
|
||||
{
|
||||
var tmp = qtyTf.GetComponent<TMPro.TextMeshProUGUI>();
|
||||
if (tmp != null)
|
||||
tmp.text = $"{mat.num}";
|
||||
tmp.text = $"{requiredAmount}/{owned}";
|
||||
else
|
||||
{
|
||||
TextMeshProUGUI txt = qtyTf.GetComponent<TextMeshProUGUI>();
|
||||
if (txt != null)
|
||||
txt.text = $"{mat.num}";
|
||||
txt.text = $"{requiredAmount}/{owned}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,18 +488,10 @@ namespace BrewMonster
|
||||
|
||||
if (itemResult != null)
|
||||
{
|
||||
Transform iconTf = itemResult.Find("item");
|
||||
if (iconTf != null)
|
||||
{
|
||||
Image img = iconTf.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.color = allEnough ? COLOR_ENOUGH : COLOR_NOT_ENOUGH;
|
||||
}
|
||||
}
|
||||
itemResult.color = allEnough ? COLOR_ENOUGH : COLOR_NOT_ENOUGH;
|
||||
}
|
||||
|
||||
if(startProduceBtn != null)
|
||||
if (startProduceBtn != null)
|
||||
{
|
||||
startProduceBtn.interactable = allEnough;
|
||||
}
|
||||
@@ -703,15 +677,24 @@ namespace BrewMonster
|
||||
{
|
||||
if (quantityText != null)
|
||||
{
|
||||
quantityText[0].text = quantity.ToString();
|
||||
quantityText[1].text = quantity.ToString();
|
||||
quantityText.text = quantity.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickIncreaseBtn()
|
||||
{
|
||||
currentQuantity++;
|
||||
|
||||
if (selectedRecipeId != 0)
|
||||
{
|
||||
int max = CalculateMaxProduceCount(selectedRecipeId);
|
||||
if (max > 0 && currentQuantity > max)
|
||||
currentQuantity = max;
|
||||
}
|
||||
|
||||
UpdateQuantityText(currentQuantity);
|
||||
if (selectedRecipeId != 0)
|
||||
ShowRecipeMaterials(selectedRecipeId);
|
||||
}
|
||||
|
||||
private void OnClickDecreaseBtn()
|
||||
@@ -720,6 +703,9 @@ namespace BrewMonster
|
||||
{
|
||||
currentQuantity--;
|
||||
UpdateQuantityText(currentQuantity);
|
||||
|
||||
if(selectedRecipeId != 0)
|
||||
ShowRecipeMaterials(selectedRecipeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ public class NPCShopUIManager : AUIDialog
|
||||
|
||||
[Header("Texts")]
|
||||
public TextMeshProUGUI itemDetailNameText;
|
||||
public TextMeshProUGUI itemDetailPriceText;
|
||||
public TextMeshProUGUI itemsPriceText;
|
||||
public TextOutlet itemDescriptionText;
|
||||
public TextMeshProUGUI itemsBuyAmountText;
|
||||
public TextMeshProUGUI itemsBuyTotalMoneyText;
|
||||
|
||||
[Header("Tabs")]
|
||||
public Transform tabButtonContainer;
|
||||
@@ -74,6 +74,10 @@ public class NPCShopUIManager : AUIDialog
|
||||
private int shopItemIndex;
|
||||
private Color colorUnActive = new Color(1f, 1f, 1f, 0f);
|
||||
private Color colorActive = new Color(1f, 1f, 1f, 1f);
|
||||
private int buyCount = 1;
|
||||
private const int BuyCountMin = 1;
|
||||
private const string BuyUiEmptyValue = "0";
|
||||
private const int BuyCountFallbackMax = 99;
|
||||
|
||||
/// <summary>Current NPC id for this shop session. Send SEVNPC_HELLO with this before buy.</summary>
|
||||
public uint CurrentNPCID => currentNPCID;
|
||||
@@ -354,11 +358,29 @@ public class NPCShopUIManager : AUIDialog
|
||||
// Create GShopItem
|
||||
GShopItem shopItem = CreateShopItemFromGood(good, itemData, itemDataType);
|
||||
|
||||
// Create panel with shop slot index (server expects this in npc_trade_item.index)
|
||||
CreateItemPanel(shopItem, i);
|
||||
// Create panel with absolute shop slot index (server validates npc_trade_item.index against full shop list).
|
||||
int absoluteShopSlotIndex = GetAbsoluteShopSlotIndex(sellService, pageIndex, i);
|
||||
CreateItemPanel(shopItem, absoluteShopSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetAbsoluteShopSlotIndex(NPC_SELL_SERVICE sellService, int pageIndex, int localIndex)
|
||||
{
|
||||
if (pageIndex <= 0)
|
||||
return localIndex;
|
||||
|
||||
int offset = 0;
|
||||
int safePageIndex = Mathf.Clamp(pageIndex, 0, sellService.pages?.Length ?? 0);
|
||||
for (int p = 0; p < safePageIndex; p++)
|
||||
{
|
||||
var goods = sellService.pages[p].goods;
|
||||
if (goods != null)
|
||||
offset += goods.Length;
|
||||
}
|
||||
|
||||
return offset + localIndex;
|
||||
}
|
||||
|
||||
GShopItem CreateShopItemFromGood(NPC_SELL_SERVICE.SellGood good, object itemData, DATA_TYPE itemDataType)
|
||||
{
|
||||
@@ -518,6 +540,15 @@ public class NPCShopUIManager : AUIDialog
|
||||
if (m_btn_buy != null)
|
||||
m_btn_buy.onClick.AddListener(OnBuyButtonClicked);
|
||||
|
||||
if (m_btn_reduce != null)
|
||||
m_btn_reduce.onClick.AddListener(OnReduceBuyCountClicked);
|
||||
|
||||
if (m_btn_incre != null)
|
||||
m_btn_incre.onClick.AddListener(OnIncreaseBuyCountClicked);
|
||||
|
||||
if (m_btn_max != null)
|
||||
m_btn_max.onClick.AddListener(OnMaxBuyCountClicked);
|
||||
|
||||
if (m_btn_sell != null)
|
||||
m_btn_sell.onClick.AddListener(OnSellButtonClicked);
|
||||
|
||||
@@ -542,6 +573,7 @@ public class NPCShopUIManager : AUIDialog
|
||||
if (currentItem.id == 0)
|
||||
{
|
||||
Debug.LogWarning("[NPCShopDetailPanel] Current item ID is 0, skipping display update");
|
||||
ResetBuyUi();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -550,23 +582,8 @@ public class NPCShopUIManager : AUIDialog
|
||||
itemDetailNameText.text = currentItem.name;
|
||||
}
|
||||
|
||||
uint price = 0;
|
||||
if (currentItem.buy != null && currentItem.buy.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < currentItem.buy.Length; i++)
|
||||
{
|
||||
if (currentItem.buy[i].price > 0)
|
||||
{
|
||||
price = currentItem.buy[i].price;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(itemDetailPriceText != null)
|
||||
{
|
||||
itemDetailPriceText.text = price > 0 ? $"Giá: {price}" : "Price: N/A";
|
||||
}
|
||||
buyCount = BuyCountMin;
|
||||
UpdateBuyPriceTexts();
|
||||
|
||||
// Set item description
|
||||
if (itemDescriptionText != null)
|
||||
@@ -585,6 +602,148 @@ public class NPCShopUIManager : AUIDialog
|
||||
}
|
||||
}
|
||||
|
||||
private uint GetCurrentUnitPrice()
|
||||
{
|
||||
if (currentItem.id == 0)
|
||||
return 0;
|
||||
|
||||
if (currentItem.buy == null || currentItem.buy.Length == 0)
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < currentItem.buy.Length; i++)
|
||||
{
|
||||
if (currentItem.buy[i].price > 0)
|
||||
return currentItem.buy[i].price;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GetMaxBuyCountForCurrentItem()
|
||||
{
|
||||
if (currentItem.id == 0)
|
||||
return BuyCountMin;
|
||||
|
||||
int tid = (int)currentItem.id;
|
||||
if (tid <= 0)
|
||||
return BuyCountMin;
|
||||
|
||||
int pileLimit = EC_IvtrItem.GetPileLimit(tid);
|
||||
// In some setups the lightweight lookup returns 1 until the local DB data is loaded.
|
||||
// If it says "1", try to resolve pile limit from a temporary item instance.
|
||||
if (pileLimit <= BuyCountMin)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tmp = EC_IvtrItem.CreateItem(tid, 0, 1);
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.GetDetailDataFromLocal();
|
||||
int instLimit = tmp.GetPileLimitInstance();
|
||||
if (instLimit > pileLimit)
|
||||
pileLimit = instLimit;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Keep the original pileLimit.
|
||||
}
|
||||
}
|
||||
if (pileLimit < BuyCountMin)
|
||||
pileLimit = BuyCountMin;
|
||||
|
||||
return pileLimit;
|
||||
}
|
||||
|
||||
private void SetBuyCount(int newCount)
|
||||
{
|
||||
int max = GetMaxBuyCountForCurrentItem();
|
||||
if (newCount < BuyCountMin) newCount = BuyCountMin;
|
||||
if (newCount > max) newCount = max;
|
||||
|
||||
buyCount = newCount;
|
||||
UpdateBuyPriceTexts();
|
||||
}
|
||||
|
||||
private void UpdateBuyPriceTexts()
|
||||
{
|
||||
// Only update buy UI while buy panel is active.
|
||||
if (contentMidBuy != null && !contentMidBuy.activeInHierarchy)
|
||||
return;
|
||||
|
||||
if (currentItem.id == 0)
|
||||
{
|
||||
ResetBuyUi();
|
||||
return;
|
||||
}
|
||||
|
||||
uint unitPrice = GetCurrentUnitPrice();
|
||||
int max = GetMaxBuyCountForCurrentItem();
|
||||
if (buyCount < BuyCountMin) buyCount = BuyCountMin;
|
||||
if (buyCount > max) buyCount = max;
|
||||
|
||||
// Quantity controls:
|
||||
// - Non-stackable items have max == BuyCountMin, so keep +/-/max disabled.
|
||||
// - Stackable items re-enable controls automatically.
|
||||
bool canChangeQty = max > BuyCountMin;
|
||||
if (m_btn_reduce != null) m_btn_reduce.interactable = canChangeQty && buyCount > BuyCountMin;
|
||||
if (m_btn_incre != null) m_btn_incre.interactable = canChangeQty && buyCount < max;
|
||||
if (m_btn_max != null) m_btn_max.interactable = canChangeQty && buyCount < max;
|
||||
|
||||
long total = unitPrice > 0 ? (long)unitPrice * buyCount : 0;
|
||||
if (total < 0) total = 0;
|
||||
|
||||
if (itemsBuyAmountText != null)
|
||||
{
|
||||
itemsBuyAmountText.text = buyCount.ToString();
|
||||
}
|
||||
|
||||
if (itemsBuyTotalMoneyText != null)
|
||||
{
|
||||
itemsBuyTotalMoneyText.text = total.ToString();
|
||||
}
|
||||
|
||||
if (m_btn_buy != null)
|
||||
{
|
||||
m_btn_buy.interactable = unitPrice > 0 && buyCount >= BuyCountMin;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetBuyUi()
|
||||
{
|
||||
buyCount = BuyCountMin;
|
||||
if (itemsBuyAmountText != null)
|
||||
itemsBuyAmountText.text = BuyUiEmptyValue;
|
||||
if (itemsBuyTotalMoneyText != null)
|
||||
itemsBuyTotalMoneyText.text = BuyUiEmptyValue;
|
||||
if (m_btn_buy != null)
|
||||
m_btn_buy.interactable = false;
|
||||
if (m_btn_reduce != null) m_btn_reduce.interactable = false;
|
||||
if (m_btn_incre != null) m_btn_incre.interactable = false;
|
||||
if (m_btn_max != null) m_btn_max.interactable = false;
|
||||
}
|
||||
|
||||
private void OnReduceBuyCountClicked()
|
||||
{
|
||||
if (currentItem.id == 0)
|
||||
return;
|
||||
SetBuyCount(buyCount - 1);
|
||||
}
|
||||
|
||||
private void OnIncreaseBuyCountClicked()
|
||||
{
|
||||
if (currentItem.id == 0)
|
||||
return;
|
||||
SetBuyCount(buyCount + 1);
|
||||
}
|
||||
|
||||
private void OnMaxBuyCountClicked()
|
||||
{
|
||||
if (currentItem.id == 0)
|
||||
return;
|
||||
SetBuyCount(GetMaxBuyCountForCurrentItem());
|
||||
}
|
||||
|
||||
void LoadItemIcon(Image iconImage, int itemId)
|
||||
{
|
||||
if (itemId <= 0 || iconImage == null)
|
||||
@@ -670,35 +829,35 @@ public class NPCShopUIManager : AUIDialog
|
||||
}
|
||||
|
||||
// Get price from item
|
||||
uint price = 0;
|
||||
if (currentItem.buy != null && currentItem.buy.Length > 0)
|
||||
uint price = GetCurrentUnitPrice();
|
||||
if (price == 0)
|
||||
{
|
||||
for (int i = 0; i < currentItem.buy.Length; i++)
|
||||
{
|
||||
if (currentItem.buy[i].price > 0)
|
||||
{
|
||||
price = currentItem.buy[i].price;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Debug.LogWarning($"[NPCShopDetailPanel] Cannot buy item {currentItem.id} with invalid price");
|
||||
return;
|
||||
}
|
||||
|
||||
int max = GetMaxBuyCountForCurrentItem();
|
||||
if (buyCount < BuyCountMin) buyCount = BuyCountMin;
|
||||
if (buyCount > max) buyCount = max;
|
||||
|
||||
// Server requires SEVNPC_HELLO with NPC id before buy, and the correct shop slot index
|
||||
if (shopManager != null && shopManager.CurrentNPCID != 0)
|
||||
UnityGameSession.c2s_CmdNPCSevHello((int)shopManager.CurrentNPCID);
|
||||
|
||||
// Create npc_trade_item: tid = template ID, index = shop slot (server validates this), count = quantity
|
||||
// Create npc_trade_item: tid = template ID, index = shop slot (server validates this), count = quantity.
|
||||
// For this server, multiple entries with the same index are rejected (ERROR_MESSAGE 15),
|
||||
// so we must send a single entry and put the desired quantity in npc_trade_item.count.
|
||||
npc_trade_item[] items = new npc_trade_item[1];
|
||||
items[0] = new npc_trade_item
|
||||
{
|
||||
tid = (int)currentItem.id,
|
||||
index = (uint)shopItemIndex,
|
||||
count = 1
|
||||
count = (uint)buyCount
|
||||
};
|
||||
|
||||
UnityGameSession.c2s_CmdNPCSevBuy(1, items);
|
||||
UnityGameSession.c2s_CmdNPCSevBuy(items.Length, items);
|
||||
|
||||
Debug.Log($"[NPCShopDetailPanel] Sent buy command for item {currentItem.id}, price {price}");
|
||||
Debug.Log($"[NPCShopDetailPanel] Sent buy command for item {currentItem.id}, unitPrice {price}, count {buyCount}");
|
||||
}
|
||||
|
||||
private void OnSellButtonClicked()
|
||||
@@ -955,6 +1114,15 @@ public class NPCShopUIManager : AUIDialog
|
||||
if (m_btn_buy != null)
|
||||
m_btn_buy.onClick.RemoveListener(OnBuyButtonClicked);
|
||||
|
||||
if (m_btn_reduce != null)
|
||||
m_btn_reduce.onClick.RemoveListener(OnReduceBuyCountClicked);
|
||||
|
||||
if (m_btn_incre != null)
|
||||
m_btn_incre.onClick.RemoveListener(OnIncreaseBuyCountClicked);
|
||||
|
||||
if (m_btn_max != null)
|
||||
m_btn_max.onClick.RemoveListener(OnMaxBuyCountClicked);
|
||||
|
||||
if (m_btn_sell != null)
|
||||
m_btn_sell.onClick.RemoveListener(OnSellButtonClicked);
|
||||
|
||||
@@ -1044,6 +1212,7 @@ public class NPCShopUIManager : AUIDialog
|
||||
contentMidBuy.SetActive(true);
|
||||
contentRight.SetActive(true);
|
||||
contentMidSell.SetActive(false);
|
||||
UpdateBuyPriceTexts();
|
||||
}
|
||||
|
||||
private void OnClickTabButtonSell()
|
||||
@@ -1058,42 +1227,7 @@ public class NPCShopUIManager : AUIDialog
|
||||
|
||||
private void UpdateSellTotalPriceText()
|
||||
{
|
||||
if (itemsPriceText == null)
|
||||
return;
|
||||
|
||||
if (sellSlotToSourceSlot == null || sellSlotToSourceSlot.Count == 0)
|
||||
{
|
||||
itemsPriceText.text = "0";
|
||||
return;
|
||||
}
|
||||
|
||||
var host = CECGameRun.Instance?.GetHostPlayer();
|
||||
var inv = host?.GetInventory(0);
|
||||
if (inv == null)
|
||||
{
|
||||
itemsPriceText.text = "0";
|
||||
return;
|
||||
}
|
||||
|
||||
long total = 0;
|
||||
foreach (var pair in sellSlotToSourceSlot)
|
||||
{
|
||||
int sourceSlot = pair.Value;
|
||||
if (sourceSlot < 0 || sourceSlot >= inv.GetSize())
|
||||
continue;
|
||||
|
||||
var item = inv.GetItem(sourceSlot, false);
|
||||
if (item == null || item.m_iCount <= 0)
|
||||
continue;
|
||||
|
||||
if (!item.IsSellable())
|
||||
continue;
|
||||
|
||||
item.GetDetailDataFromLocal();
|
||||
total += item.GetScaledPrice();
|
||||
}
|
||||
|
||||
if (total < 0) total = 0;
|
||||
itemsPriceText.text = total.ToString();
|
||||
// Sell total text removed from this manager.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static CSNetwork.Common.ExpTypes;
|
||||
@@ -9,6 +10,8 @@ public class ProduceItemPanel : MonoBehaviour
|
||||
{
|
||||
[Header("UI")]
|
||||
public Image icon;
|
||||
public TextMeshProUGUI text_name;
|
||||
public TextMeshProUGUI text_level;
|
||||
|
||||
private uint recipeId;
|
||||
private Coroutine loadIconCoroutine;
|
||||
@@ -90,6 +93,8 @@ public class ProduceItemPanel : MonoBehaviour
|
||||
icon.enabled = true;
|
||||
icon.color = Color.white;
|
||||
icon.preserveAspect = true;
|
||||
text_level.text = $"Cấp {recipe.recipe_level}";
|
||||
text_name.text = EC_IvtrItemUtils.Instance.ResolveItemName((int)outputItemId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3467
-16296
File diff suppressed because it is too large
Load Diff
@@ -1368,7 +1368,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1538965918058098960
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -12969,11 +12969,11 @@ MonoBehaviour:
|
||||
contentMidSell: {fileID: 5285943178504563476}
|
||||
item_info: {fileID: 3637242207861637912}
|
||||
itemDetailNameText: {fileID: 2529529646566217934}
|
||||
itemDetailPriceText: {fileID: 2517942723267868233}
|
||||
itemsPriceText: {fileID: 6499688482604231105}
|
||||
itemDescriptionText:
|
||||
legacy: {fileID: 0}
|
||||
tmp: {fileID: 5329995747664012504}
|
||||
itemsBuyAmountText: {fileID: 1188040176770993507}
|
||||
itemsBuyTotalMoneyText: {fileID: 1958673310957352830}
|
||||
tabButtonContainer: {fileID: 2298715577163083360}
|
||||
tabButtonPrefab: {fileID: 532136160345846687, guid: 548ae6ac061bc9648b093c9f9d203615, type: 3}
|
||||
tabButtonTextComponentName: Text
|
||||
|
||||
@@ -1,5 +1,277 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &851204893380652402
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6386748335874685460}
|
||||
- component: {fileID: 7946999949603485279}
|
||||
- component: {fileID: 2886587176569489585}
|
||||
m_Layer: 0
|
||||
m_Name: text_name
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6386748335874685460
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 851204893380652402}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7551350917878394023}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: 45.674377, y: -24}
|
||||
m_SizeDelta: {x: 417.155, y: 36.8281}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7946999949603485279
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 851204893380652402}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2886587176569489585
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 851204893380652402}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "\u0110\u1EC1 L\xF4 Th\u01B0\u01A1ng"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4284139250
|
||||
m_fontColor: {r: 0.9490197, g: 0.77647066, b: 0.3529412, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 36
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &1424488726156281035
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4178062133704160544}
|
||||
- component: {fileID: 7306123447282167467}
|
||||
- component: {fileID: 4203029938913939562}
|
||||
m_Layer: 0
|
||||
m_Name: text_level
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4178062133704160544
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1424488726156281035}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7551350917878394023}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: -32, y: -62}
|
||||
m_SizeDelta: {x: 261.8062, y: 36.828094}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7306123447282167467
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1424488726156281035}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4203029938913939562
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1424488726156281035}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: "C\u1EA5p 7"
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4291032063
|
||||
m_fontColor: {r: 1, g: 0.95294124, b: 0.76470596, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 36
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_TextWrappingMode: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_EmojiFallbackSupport: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &3478571236783653060
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -11,6 +283,8 @@ GameObject:
|
||||
- component: {fileID: 7551350917878394023}
|
||||
- component: {fileID: 2586856635111866746}
|
||||
- component: {fileID: 3227995981941927}
|
||||
- component: {fileID: 8854345712968641074}
|
||||
- component: {fileID: 5027840373017527106}
|
||||
m_Layer: 0
|
||||
m_Name: itemProduce
|
||||
m_TagString: Untagged
|
||||
@@ -31,12 +305,14 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5438773728966160586}
|
||||
- {fileID: 6386748335874685460}
|
||||
- {fileID: 4178062133704160544}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 42, y: -42}
|
||||
m_SizeDelta: {x: 84, y: 84}
|
||||
m_AnchoredPosition: {x: 266.4845, y: -43.5}
|
||||
m_SizeDelta: {x: 532.969, y: 87}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2586856635111866746
|
||||
MonoBehaviour:
|
||||
@@ -95,6 +371,46 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
icon: {fileID: 7716303670266317094}
|
||||
text_name: {fileID: 2886587176569489585}
|
||||
text_level: {fileID: 4203029938913939562}
|
||||
--- !u!222 &8854345712968641074
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3478571236783653060}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5027840373017527106
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3478571236783653060}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 1155570752, guid: a1097094c53b98a479e5d92364473a8d, type: 3}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &5714852699199745934
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -127,10 +443,10 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7551350917878394023}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -42}
|
||||
m_SizeDelta: {x: 84, y: 84}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 9.6, y: 0}
|
||||
m_SizeDelta: {x: 76.233, y: 74.4407}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &7941037763135429874
|
||||
CanvasRenderer:
|
||||
|
||||
Reference in New Issue
Block a user