private void RefreshSelectedRecipe(TrinketRecipeItem item) { if (item == null || item.RecipeInfo == null || item.RecipeItemInfo == null) { return; } int count = item.ItemInfos.Count; if (count == 0) { return; } GUIPillageScene.LastSelectRecipe = item.RecipeInfo.ID; this.TrinketQulity.spriteName = Tools.GetItemQualityIcon(item.RecipeItemInfo.Quality); this.TrinketIcon.spriteName = item.RecipeItemInfo.Icon; this.TrinketName.text = item.RecipeItemInfo.Name; this.TrinketName.color = Tools.GetItemQualityColor(item.RecipeItemInfo.Quality); float num = 184f; float num2 = 3.14159274f / (float)count * 2f; float num3 = (float)((count + 1) % 2) * 3.14159274f / (float)count; for (int i = 0; i < count; i++) { ItemInfo itemInfo = item.ItemInfos[i]; if (itemInfo != null) { float f = num2 * (float)i + num3; if (this.TrinketItems[i] == null) { if (this.TrinketItemPrefab == null) { this.TrinketItemPrefab = Res.LoadGUI("GUI/TrinketItem"); } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this.TrinketItemPrefab); gameObject.transform.parent = this.RecipeContent.transform; gameObject.transform.localPosition = new Vector3(num * Mathf.Sin(f), num * Mathf.Cos(f), 0f); gameObject.transform.localScale = Vector3.one; TrinketItem trinketItem = gameObject.AddComponent<TrinketItem>(); trinketItem.Refresh(itemInfo); this.TrinketItems[i] = trinketItem; } else { this.TrinketItems[i].Refresh(itemInfo); this.TrinketItems[i].transform.localPosition = new Vector3(num * Mathf.Sin(f), num * Mathf.Cos(f), 0f); } } } for (int j = count; j < this.TrinketItems.Length; j++) { if (this.TrinketItems[j] != null) { this.TrinketItems[j].gameObject.SetActive(false); } } if (Tools.CanPlay(GameConst.GetInt32(210), true)) { Vector3 localPosition = this.btnComposite.transform.localPosition; localPosition.x = 100f; this.btnComposite.transform.localPosition = localPosition; this.farmBtn.gameObject.SetActive(true); if (Tools.CanPlay(GameConst.GetInt32(211), true)) { this.farmBtn.normalSprite = "btn_n"; this.farmBtn.hoverSprite = "btn_n"; this.farmBtn.pressedSprite = "btn_n"; this.farmBtnLabel.SetState(UIButtonColor.State.Normal, false); } else { this.farmBtn.normalSprite = "btn_d"; this.farmBtn.hoverSprite = "btn_d"; this.farmBtn.pressedSprite = "btn_d"; this.farmBtnLabel.SetState(UIButtonColor.State.Disabled, false); } } else { this.farmBtn.gameObject.SetActive(false); } if (item.isCanComposite) { this.btnComposite.isEnabled = true; this.btnCompositeLabel.SetState(UIButtonColor.State.Normal, false); this.btnCompositeEffect.gameObject.SetActive(true); if (Tools.CanPlay(GameConst.GetInt32(211), true)) { this.farmBtn.isEnabled = false; this.farmBtnLabel.SetState(UIButtonColor.State.Disabled, false); } } else { this.btnComposite.isEnabled = false; this.btnCompositeLabel.SetState(UIButtonColor.State.Disabled, false); this.btnCompositeEffect.gameObject.SetActive(false); if (Tools.CanPlay(GameConst.GetInt32(211), true)) { this.farmBtn.isEnabled = true; this.farmBtnLabel.SetState(UIButtonColor.State.Normal, false); } } }
private void _RefreshRecipeList() { foreach (KeyValuePair<int, TrinketRecipeItem> current in this.RecipeItems) { TrinketRecipeItem value = current.Value; value.RefreshVisible(); if (this.curRecipeSelected == value && !value.gameObject.activeSelf) { this.curRecipeSelected.Selected = false; this.curRecipeSelected = null; } } if (this.curRecipeSelected == null) { this.OnSelectedRecipe(this.GetFirstVisibleRecipe()); this.mRecipeTable.Reposition(); this.mRecipeScrollView.SetDragAmount(0f, 0f, false); } else { this.RefreshSelectedRecipe(this.curRecipeSelected); } this.mRecipeTable.repositionNow = true; this.RefreshRecipeFlag = false; }
private void OnSelectedRecipe(TrinketRecipeItem item) { this.curRecipeSelected = item; if (this.curRecipeSelected == null) { return; } this.curRecipeSelected.Selected = true; for (int i = 0; i < this.RecipeList.Count; i++) { if (this.RecipeList[i].gameObject.activeSelf) { if (this.curRecipeSelected != this.RecipeList[i]) { this.RecipeList[i].Selected = false; } } } this.RefreshSelectedRecipe(this.curRecipeSelected); }