public void Use(UI_Choice_Context _con) { this.Callback = _con.Callback; ClearList(); ResetContent(_con.OptionList.Count); for (int i = 0; i < _con.OptionList.Count; i++) { Option _tempOption = (Instantiate(Templet) as GameObject).GetComponent <Option>(); _tempOption.Rect.SetParent(Content); _tempOption.Rect.localScale = new Vector3(1, 1, 1); _tempOption.Rect.anchoredPosition3D = new Vector3(0, 0, 0); _tempOption.Rect.offsetMin = new Vector2(50, -((i + 1) * 150)); _tempOption.Rect.offsetMax = new Vector2(-50, -((i + 1) * 150) + 100); _tempOption.Message.text = _con.OptionList[i].Name; _tempOption.Name = _con.OptionList[i].Name; _tempOption.ID = _con.OptionList[i].ID; _tempOption.Callback = Choose; _tempOption.OptionState = OptionState.Default; _tempOption.gameObject.SetActive(true); list.Add(_tempOption); } gameObject.SetActive(true); }
public void Load() { UI_Choice ch = UIManager.GetUI<UI_Choice>(); UI_Choice_Context con = new UI_Choice_Context(); con.OptionList = new List<iLabel>(); for (int i = 0; i < GameManager.Save.File.Length; i++) { con.OptionList.Add(new Label() { ID = i, Name = @"["+Writing.Get(100027) + (i + 1) + "]:" + Writing.Get(Libretto.GetNode(GameManager.Save.File[i]).Sentences.First().Value.DialogueID), }); } con.Callback = this.LoadCallbacek; ch.Use(con); ch.SetFront(); }
private void PlayNodeTypeOption(iNode _node) { UIManager.GetUI<UI_Game>().NoNext = true; UI_Choice _c = UIManager.GetUI<UI_Choice>(); _c.SetFront(); UI_Choice_Context con = new UI_Choice_Context(); con.OptionList = new List<iLabel>(); foreach (var item in _node.Sentences) { Label l = new Label() { ID = item.Key, Name = Writing.Get(item.Value.DialogueID) }; con.OptionList.Add(l); } con.Callback = (res, uichoice) => { GameManager.Save.ChoiceResult[_node.ID] = res; uichoice.UseDone(); Libretto.NextNode(); }; _c.Use(con); }