public void PressPutGoodies() { if (_CurrentGoodies) { CurrentGoodiesData = _CurrentGoodies.Data; Debug.Log(string.Format("Put Goodies {0}", _CurrentGoodies.GetName())); UIManager.Instance.UnloadAllUI(); UIManager.Instance.Open(UIID.Main); /* * if(GameGuideManager.Instance.GetState() == GameGuideManager.GuideState.GotoStorage) { * GameGuideManager.Instance.SetState (GameGuideManager.GuideState.PutCatHouse); * UIManager.Instance.CloseTo (UIID.CatStore, 2); * UIManager.Instance.Open (UIID.Main); * }*/ } }
private void RefreshGoodies() { int count = 1; int beginGoodiesNumber = (_CurrentToggleNumber - 1) * 4; for (int i = beginGoodiesNumber; i < beginGoodiesNumber + 4 && i < _TotalNumberGoodies; i++, count++) { GameObject goodies = transform.FindChild(string.Format("Center/Goodies{0}", count)).gameObject; GoodiesData data = _GoodiesDatas[i]; Goodies goodiesComp = goodies.GetComponent <Goodies>(); goodies.SetActive(true); Button btn = goodies.transform.FindChild("Icon").GetComponent <Button>(); btn.onClick.AddListener(delegate() { this.PressGoodies(goodiesComp); }); ColorBlock colors = new ColorBlock(); colors.colorMultiplier = 1.0f; colors.normalColor = Color.white; colors.disabledColor = Color.gray; colors.pressedColor = new UnityEngine.Color(225.0f / 255.0f, 75.0f / 255.0f, 75.0f / 255.0f, 1.0f); colors.highlightedColor = new UnityEngine.Color(225.0f / 255.0f, 75.0f / 255.0f, 75.0f / 255.0f, 1.0f); btn.colors = colors; goodiesComp.Data = data; goodiesComp.SetName(data.Name); goodiesComp.SetPrice(data.Price); goodiesComp.SetIconPath(data.IconPath); } for (int i = count; i <= 4; i++) { GameObject goodies = transform.FindChild(string.Format("Center/Goodies{0}", i)).gameObject; goodies.SetActive(false); } }