public void setting(GemSellUIElement GemSellUIElement1, GemSellUIElement GemSellUIElement2, GemSellUIElement GemSellUIElement3, GemSellUIElement GemSellUIElement4, Image LayerPoint, Image SellPoint, Transform ElementArea) { UI1 = GemSellUIElement1; UI2 = GemSellUIElement2; UI3 = GemSellUIElement3; UI4 = GemSellUIElement4; mElementArea = ElementArea; mToggle.onValueChanged.AddListener((bOn) => { GemSellUIElement1.gameObject.SetActive(bOn); GemSellUIElement2.gameObject.SetActive(bOn); GemSellUIElement3.gameObject.SetActive(bOn); GemSellUIElement4.gameObject.SetActive(bOn); LayerPoint.gameObject.SetActive(false); if (GameController.Instance.GemSellTutorial == 0) { SellPoint.gameObject.SetActive(bOn); } if (bOn == true) { Invoke("MoveUp", 0.05f); } }); }
private void Load() { for (int i = 0; i < mInfoArr.Length; i++) { if (i % 4 == 0) { LayerButtonUIElement Buttonelement = Instantiate(mLayerButtonPrefab, mElementArea); Buttonelement.Init(i / 4); mButtonElementList.Add(Buttonelement); } mIconArr[i] = mOriginArr[i / 4].GetSprite(i % 4); GemSellUIElement element = Instantiate(mElementPrefab, mElementArea); element.Init(i, mIconArr[i], mTextInfoArr[i].Title, string.Format("가격 : {0} 원", UnitSetter.GetUnitStr(mInfoArr[i].Cost)), SellGem, SellPoint); mElementList.Add(element); mElementList[i].gameObject.SetActive(false); if (i % 4 == 3) { mButtonElementList[mButtonElementList.Count - 1].bToggleIsOn(false); mButtonElementList[mButtonElementList.Count - 1].setting(mElementList[i - 3], mElementList[i - 2], mElementList[i - 1], mElementList[i], LayerPoint, SellPoint, mElementArea); } if (i / 4 <= GameController.Instance.Stage) { mButtonElementList[i / 4].gameObject.SetActive(true); } } mAllSellToggle.onValueChanged.AddListener((bOn) => { GameController.Instance.CheckAllSell = bOn; for (int i = 0; i < mElementList.Count; i++) { if (i % 4 == 0) { if (bOn) { GameController.Instance.CheckAutoSell[i] = bOn; SellGem(i, mElementList[i].GetMaxSellAmount()); mElementList[i].bToggleIsOn(true); } else { GameController.Instance.CheckAutoSell[i] = false; mElementList[i].bToggleIsOn(false); } } } }); mButtonElementList[GameController.Instance.Stage].SetGemSellUI(); SetAllSellToggle(GameController.Instance.CheckAllSell); }