void updatePlaying() { if (StateInfo.AllStates.Length < 1) { return; } Gradient g; if (mode == 0) { g = FoundedColors; ModeDisplayText.text = "Sorting by Founding Date"; StateInfo.SortByFounded(); } else if (mode == 1) { g = PopulationColors; ModeDisplayText.text = "Sorting by Population"; StateInfo.SortByPopulation(); } else if (mode == 2) { g = LandAreaColors; ModeDisplayText.text = "Sorting by Total Land Area"; StateInfo.SortByLandArea(); } else { throw new UnityException("Unknown mode=" + mode); } pos = Mathf.Min(1, pos + Time.deltaTime / AnimationTime); for (int i = 0, count = StateInfo.AllStates.Length; i < count; i++) { Color c = DefaultColor; float p = (i / (count - 1f)); if (pos >= p) { c = g.Evaluate(p); } var stateData = TerritoryMgr.GetStateByShortId(StateInfo.AllStates[i].StateId); if (stateData.UiImage.color != c) { stateData.UiImage.color = c; if (c != DefaultColor) { StartCoroutine(scaleAnim(stateData.Object.transform)); } } } if (pos >= 1) { isPaused = true; } }
void Update() { string state = CalloutAnim.StateToCall; if (string.IsNullOrEmpty(state)) { return; } var info = getInfoForId(state); if (info == null) { return; } StateNameDisplay.text = info.StateName + " (" + info.StateId + ")"; CapitolDisplay.text = info.Capitol; FoundedDateDisplay.text = info.Founded.ToShortDateString(); PopulationDisplay.text = info.Population.ToString("N0"); LandAreaDisplay.text = info.TotalArea.ToString("N0") + " sq/mi"; StateInfo.SortByFounded(); FoundedRank.text = getRankString(System.Array.IndexOf(StateInfo.AllStates, info) + 1); StateInfo.SortByPopulation(); PopulationRank.text = getRankString(StateInfo.AllStates.Length - System.Array.IndexOf(StateInfo.AllStates, info)); StateInfo.SortByLandArea(); LandAreaRank.text = getRankString(StateInfo.AllStates.Length - System.Array.IndexOf(StateInfo.AllStates, info)); }