public PopupXBoxThreat getVoteReasonBox(VoteIssue vi, VoteOption vo, Person p) { GameObject obj = Instantiate(xBoxThreat) as GameObject; PopupXBoxThreat specific = obj.GetComponent <PopupXBoxThreat>(); specific.setTo(vi, vo, p); specific.body = "The available vote options and the reasons behind each choice."; return(specific); }
public PopupXBoxThreat getThreatBox(ThreatItem item) { GameObject obj = Instantiate(xBoxThreat) as GameObject; PopupXBoxThreat specific = obj.GetComponent <PopupXBoxThreat>(); specific.setTo(item); specific.body = "The perceived threats and a breakdown of the reasons."; return(specific); }
public PopupXScroll getScrollSetVotes(Person p, VoteIssue vi) { PopupXScroll specific = getInnerXScrollSet(); foreach (VoteOption vo in vi.options) { PopupXBoxThreat box = getVoteReasonBox(vi, vo, p); box.gameObject.transform.SetParent(specific.gameObject.transform); specific.scrollables.Add(box); } return(specific); }
public PopupXScroll getScrollSetThreats(List <ThreatItem> threats) { PopupXScroll specific = getInnerXScrollSet(); List <ThreatItem> dupe = new List <ThreatItem>(); foreach (ThreatItem item in threats) { dupe.Add(item); } List <ThreatItem> ordered = new List <ThreatItem>(); int viewedCount = 0; while (dupe.Count > 0) { ThreatItem best = dupe[0]; foreach (ThreatItem item in dupe) { if (item.threat > best.threat) { best = item; } } if (best.threat < 75 && best.group != null && best.group is Society && viewedCount >= 3) { //Skip it, we don't need to list all minor factions we aren't scared of } else { viewedCount += 1; ordered.Add(best); } dupe.Remove(best); } foreach (ThreatItem item in ordered) { PopupXBoxThreat box = getThreatBox(item); box.gameObject.transform.SetParent(specific.gameObject.transform); specific.scrollables.Add(box); } return(specific); }