/** * Call this at the end of the quarter to setup the peacock view */ public void PreparePeacockSummary() { for (int i = 0; i < PeacockView.transform.childCount; ++i) { GameObject go = PeacockView.transform.GetChild(i).gameObject; if (go.GetComponent <CanvasGroup>() != null) { if (GameData.singleton.quarter < 2) { go.GetComponent <CanvasGroup>().alpha = 0; FancyUIAnimations.PushFadeIn(go); } } } // I assume there's a more proper way to do this, but I'm too lazy to figure it out PeacockView.transform.Find("Date").GetComponent <Text>().text = string.Format("{0}, Year {1}", GameData.singleton.season.GetName(), GameData.singleton.year); PeacockView.transform.Find("FoodReport").GetComponent <Text>().text = GameData.singleton.peacockReportFoodDesc; PeacockView.transform.Find("ActivityReport").GetComponent <Text>().text = GameData.singleton.peacockReportActivityDesc; PeacockView.transform.Find("ExtraReport").GetComponent <Text>().text = GameData.singleton.peacockReportExtraDesc; PeacockView.transform.Find("StatusReport").GetComponent <Text>().text = GameData.singleton.peacockReportGeneralDesc; PeacockView.transform.Find("NextQuarterTitle").GetComponent <Text>().text = string.Format("Plan for the {0}: ", GameData.singleton.season.GetNextSeasonName()); Transform foodPlan = PeacockView.transform.Find("FoodPlan"); for (int i = (int)FoodType.FT_MAX - 1; i >= 0; --i) { FoodType food = ((FoodType)i); Transform button = foodPlan.GetChild(i); button.GetChild(0).GetComponent <Text>().text = food.GetLabel(); bool isActiveFood = (int)GameData.singleton.peacockQuarterlyFoodType == i; if (isActiveFood) { // if we can no longer afford the food we previously bought, force a downgrade int price = food.GetPrice(); if (price > GameData.singleton.money) { isActiveFood = false; GameData.singleton.peacockQuarterlyFoodType = (FoodType)(i - 1); // assumption: the first available food type is free GameData.singleton.peacockQuarterlyFoodCost = GameData.singleton.peacockQuarterlyFoodType.GetPrice(); } } button.GetComponent <Image>().color = new Color(1f, 1f, 1f, isActiveFood ? 1f : PEACOCK_SCREEN_UNSELECTED_ALPHA); } Transform activityPlan = PeacockView.transform.Find("ActivityPlan"); for (int i = 0; i < (int)PeacockActivityType.PA_MAX; ++i) { PeacockActivityType activity = ((PeacockActivityType)i); Transform button = activityPlan.GetChild(i); button.GetChild(0).GetComponent <Text>().text = activity.GetLabel(); if ((int)GameData.singleton.peacockQuarterlyActivity == i) { button.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); } } Transform extraPlan = PeacockView.transform.Find("ExtraPlan"); for (int i = 0; i < (int)PeacockExtraType.ET_MAX; ++i) { PeacockExtraType extra = ((PeacockExtraType)i); Transform button = extraPlan.GetChild(i); button.GetChild(0).GetComponent <Text>().text = extra.GetLabel(); button.GetComponent <Image>().color = new Color(1f, 1f, 1f, Peacock.HasQuarterlyExtra(i) ? 1f : PEACOCK_SCREEN_UNSELECTED_ALPHA); } PeacockView.transform.Find("CostTitle/Cost").GetComponent <Text>().text = Utilities.FormatMoney(GameData.singleton.peacockQuarterlyTotalCost); }