public void SelectAction(ActionData action) { if (selectedTimeslot != -1) { if (action.actionType == ActionData.ActionType.TradingVotes && levelData.messageEnabled) { isSpeech = true; SpeechUi.SetActive(true); SpeechUi.GetComponentInChildren <Text>().text = "Speech"; Confirm.GetComponent <Button>().interactable = false; } else if (action.actionType == ActionData.ActionType.Research) { isSpeech = false; SpeechUi.SetActive(true); SpeechUi.GetComponentInChildren <Text>().text = "Talk to the Masses"; Confirm.GetComponent <Button>().interactable = false; SpeechContainer.SetActive(false); actionMessageTarget[selectedTimeslot] = -2; } else { currentSchedule[selectedTimeslot] = action; timeslots[selectedTimeslot].GetComponent <TimeSlotter>().SetAction(action); selectedTimeslot = -1; } } }
public List <AEvent> A_Events; // List containing all Ayame events void Awake() { sc = SpeechContainer.Load(path); A_Events = new List <AEvent>(); // Cause the XML is written in event order // Speeches are clustered together by their event int speechIndex = 0; while (speechIndex < sc.speeches.Count) { if (speechIndex == 0 || !sc.speeches[speechIndex].Event.Equals(A_Events[A_Events.Count - 1].name)) { // First speech or Event doesn't already exist AEvent newEvent = new AEvent(); newEvent.name = sc.speeches[speechIndex].Event; newEvent.lines.Add(sc.speeches[speechIndex].Line); newEvent.images.Add(sc.speeches[speechIndex].Image); A_Events.Add(newEvent); } else { // Event already exists A_Events[A_Events.Count - 1].lines.Add(sc.speeches[speechIndex].Line); A_Events[A_Events.Count - 1].images.Add(sc.speeches[speechIndex].Image); } speechIndex++; } Debug.Log(A_Events.Count); }
public List <SpeechContainer> readJSON(TextAsset text) { List <SpeechContainer> toReturn = new List <SpeechContainer>(); JSONObject obj = new JSONObject(asset.text); if (obj.type != JSONObject.Type.OBJECT) { Debug.Log("Incorrect JSON format"); return(null); } JSONObject speechArr = obj.list[0]; foreach (JSONObject j in speechArr.list) { if (j.type != JSONObject.Type.OBJECT) { return(null); } SpeechContainer s = new SpeechContainer(j[0].str, j[1].str); toReturn.Add(s); } return(toReturn); }
public List<SpeechContainer> readJSON(TextAsset text) { List<SpeechContainer> toReturn = new List<SpeechContainer>(); JSONObject obj = new JSONObject(asset.text); if(obj.type != JSONObject.Type.OBJECT) { Debug.Log("Incorrect JSON format"); return null; } JSONObject speechArr = obj.list[0]; foreach(JSONObject j in speechArr.list){ if(j.type != JSONObject.Type.OBJECT) { return null; } SpeechContainer s = new SpeechContainer(j[0].str, j[1].str); toReturn.Add(s); } return toReturn; }
public static SpeechContainer Load(string path) { TextAsset _xml = Resources.Load <TextAsset>(path); XmlSerializer serializer = new XmlSerializer(typeof(SpeechContainer)); StringReader reader = new StringReader(_xml.text); SpeechContainer speeches = serializer.Deserialize(reader) as SpeechContainer; reader.Close(); return(speeches); }
// Start is called before the first frame update public void Close() { isSpeech = Main.GetComponent <Tracker>().isSpeech; if (isSpeech) { Main.GetComponent <Tracker>().SpeechSelectAction(); } else { Main.GetComponent <Tracker>().ResearchSelectAction(); } SpeechContainer.SetActive(true); SpeechUi.SetActive(false); }