Ejemplo n.º 1
0
    public void AskSell(Image img, PortionEquipment portionEquipment)
    {
        m_AskSellCountTxt.text = "1";
        m_AskSell.SetActive(true);
        m_BtnObj = m_DicObj[img.sprite];

        m_nPrice = m_DicMoney[img.sprite];
        m_AskSellPriceTxt.text = m_nPrice.ToString();
        m_PortionEquiment      = portionEquipment;
        AudioManager.Instance.PlayEffect(0);
    }
Ejemplo n.º 2
0
    public void SandMake()
    {
        if (m_Inventory.m_Money >= m_DicPortionCount[m_BtnObj] * m_nPrice)
        {
            if (!m_DicPortion.ContainsKey(m_BtnObj))
            {
                GameObject btn   = Instantiate(m_BtnObj);
                GameObject btn_2 = Instantiate(m_BtnObj);

                Text txt   = btn.transform.GetChild(2).gameObject.GetComponent <Text>();
                Text txt_2 = btn_2.transform.GetChild(2).gameObject.GetComponent <Text>();

                PortionEquipment portionEquipment = btn.GetComponent <PortionEquipment>();
                portionEquipment.Init(m_Inventory, btn_2);
                portionEquipment.CopyObj(this, m_BtnObj, btn_2);

                //처음것을 넣어야 밑제거에서 같이 없앤다.
                btn_2.GetComponent <Button>().onClick.AddListener(delegate { AskSell(btn_2.GetComponent <Image>(), portionEquipment); });

                btn.transform.SetParent(m_Inventory.m_PortionScreen.transform);
                btn_2.transform.SetParent(m_InventoryShowScreen.transform);

                btn.transform.localScale = new Vector3(0.14f, 0.15f, 0.14f);
                btn.GetComponent <RectTransform>().pivot = new Vector2(0, 0.79f);

                btn_2.transform.localScale                 = new Vector3(0.14f, 0.20f, 0.14f);
                btn_2.transform.GetChild(1).localScale     = new Vector3(1.1f, 0.8f, 0.14f);
                btn_2.transform.GetChild(0).localScale     = new Vector3(1.1f, 0.8f, 0.14f);
                btn_2.GetComponent <RectTransform>().pivot = new Vector2(0, 1.33f);

                txt.text   = m_DicPortionCount[m_BtnObj].ToString();
                txt_2.text = m_DicPortionCount[m_BtnObj].ToString();

                m_DicPortion.Add(m_BtnObj, m_DicPortionCount[m_BtnObj]);

                m_DicPortionCountText.Add(m_BtnObj, txt);
                m_DicPortionCountText_2.Add(m_BtnObj, txt_2);
            }
            else
            {
                m_DicPortion[m_BtnObj] += m_DicPortionCount[m_BtnObj];
                m_DicPortionCountText[m_BtnObj].text   = m_DicPortion[m_BtnObj].ToString();
                m_DicPortionCountText_2[m_BtnObj].text = m_DicPortion[m_BtnObj].ToString();
            }

            m_Inventory.SetMoney(m_Inventory.m_Money - (m_DicPortionCount[m_BtnObj] * m_nPrice));
            m_InventoryShowMoneyTxt.text = m_Inventory.m_Money.ToString();
            m_Inventory.SetMoney();
            m_BuyMenu.OtherMoney();
            m_AskBuy.SetActive(false);
        }
        AudioManager.Instance.PlayEffect(0);
    }