void Awake() { Dictionary <String, Material> colors = new Dictionary <String, Material>(); colors.Add("Kids", kids); colors.Add("Armchair Athletes", armchairAthletes); colors.Add("Hopeless Romantics", hopelessRomantics); colors.Add("Conspiracy Theorists", conspiracyTheorists); foreach (Timeslot t in Enum.GetValues(typeof(Timeslot))) { Text label = Instantiate(timeslotPrefab); label.text = t.ToString(); label.GetComponent <RectTransform>().SetParent(this.transform); GameObject horizontal = buildHorizontalLayoutGroup(t.ToString() + "Group"); Instantiate(spacer).GetComponent <RectTransform>().SetParent(horizontal.transform); ShowAvatar avatar = Instantiate(avatarPrefab); avatar.GetComponent <RectTransform>().SetParent(horizontal.transform); avatars.Add(t, avatar); Instantiate(spacer).GetComponent <RectTransform>().SetParent(horizontal.transform); foreach (Demographic d in GameState.current.population) { data.AddData(t, d, 0); String key = t.ToString() + "-" + d.name; Image bar = Instantiate(graphImagePrefab); bar.material = colors[d.name]; bar.name = d.name; bars.Add(key, bar); bar.GetComponent <RectTransform>().sizeDelta = new Vector2(data[t][d], barFixedWidth); bar.GetComponent <RectTransform>().SetParent(horizontal.transform); } Instantiate(spacer).GetComponent <RectTransform>().SetParent(horizontal.transform); ShowAvatar adAvatar = Instantiate(adAvatarPrefab); adAvatar.GetComponent <RectTransform>().SetParent(horizontal.transform); adAvatars.Add(t, adAvatar); Text revenue = Instantiate(timeslotPrefab); revenue.GetComponent <RectTransform>().SetParent(horizontal.transform); revenueTags.Add(t, revenue); } }
/// <summary> /// return a hash code /// </summary> /// <returns>hashcode as <see cref="int" /></returns> public override int GetHashCode() { var hashCode = -2087474320; hashCode = hashCode * -1521134295 + HeaderFullWidth.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderFullHeight.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderFocusWidth.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderFocusHeight.GetHashCode(); hashCode = hashCode * -1521134295 + AvatarShape.GetHashCode(); #if NETSTANDARD2_0 hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode(); #else hashCode = hashCode * -1521134295 + BackgroundColor.GetHashCode(); #endif hashCode = hashCode * -1521134295 + BodyFont.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderBounds.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderImage.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderImageFocused.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderImageScaled.GetHashCode(); hashCode = hashCode * -1521134295 + HeaderStretch.GetHashCode(); #if NETSTANDARD2_0 hashCode = hashCode * -1521134295 + LinkColor.GetHashCode(); #else hashCode = hashCode * -1521134295 + LinkColor.GetHashCode(); #endif hashCode = hashCode * -1521134295 + ShowAvatar.GetHashCode(); hashCode = hashCode * -1521134295 + ShowDescription.GetHashCode(); hashCode = hashCode * -1521134295 + ShowHeaderImage.GetHashCode(); hashCode = hashCode * -1521134295 + ShowTitle.GetHashCode(); #if NETSTANDARD2_0 hashCode = hashCode * -1521134295 + TitleColor.GetHashCode(); #else hashCode = hashCode * -1521134295 + TitleColor.GetHashCode(); #endif hashCode = hashCode * -1521134295 + TitleFont.GetHashCode(); hashCode = hashCode * -1521134295 + TitleFontWeight.GetHashCode(); return(hashCode); }