public override bool Load(SecurityElement element) { if (element.Tag != "Items") { return(false); } if (element.Children != null) { foreach (SecurityElement childrenElement in element.Children) { //SeedObject seedObject = SeedObject.Load(childrenElement); TalkObject talkobject = TalkObject.Load(childrenElement); if (!_juryObjectDict.ContainsKey(talkobject.ID)) { _juryObjectDict[talkobject.ID] = talkobject; } /*if (! _juryToIDDict.ContainsKey(talkobject.JuryID)) * { * _juryToIDDict.Add(talkobject.JuryID,new List<int>()); * } * * _juryToIDDict[talkobject.JuryID].Add(talkobject.ID); */ } } return(true); }
public static TalkObject Load(SecurityElement element) { TalkObject talkObject = new TalkObject(); talkObject.ID = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("TalkID"), ""), -1); talkObject.Dialog = StrParser.ParseStr(element.Attribute("Dialogue"), ""); talkObject.JuryID = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("JuryID"), ""), -1); talkObject.TypeID = StrParser.ParseDecInt(StrParser.ParseStr(element.Attribute("JuryType"), ""), -1); return(talkObject); }
public string GetJuryObjectByID(int judgeID, int judgeType) { /*List<int> talkIDList ; * _juryToIDDict.TryGetValue(judgeID,out talkIDList); * * int iter = Random.Range(0,talkIDList.Count); */ int iter = Random.Range(1, 3); int ID = judgeID * 100 + judgeType * 10 + iter; TalkObject talkObj = GetTalkObjectByID(ID); return(talkObj.Dialog); }
// Start() is called before the first frame update private void Start() { // Set the first talkObj // Set the parent, so that location references are calculated properly Transform talkParent = talkObj.transform.parent; // Offset required for distancing moving texts in relation to their buttons Vector2 yOffset = new Vector2(0f, -48f); // Store this instance of talkObj as the first in talkObjs talkObjs.Add(talkObj.GetComponent <TalkObject>()); // Store the first talkObj's position within the TalkMenu canvas Vector2 origTextPosition = talkObjs[0].OrigTextPosition; // Set the text of the first talkObj talkObjs[0].SetText(0, this, origTextPosition); // Create and set up addtional talkObjs for each entry in TalkData for (int i = 1; i < TalkData.MaxTalks; i++) { // If the accessLevel of this TalkData entry > DungeonAccessLevel, break. if (TalkData.AccessLevel[i] <= BattleLoader.DungeonLevelAccess || BattleLoader.GameCompleted) { GameObject newTalkObj = Instantiate <GameObject>(talkObj, talkParent); // create talkObj Vector2 position = newTalkObj.transform.localPosition; position += (yOffset * i); newTalkObj.transform.localPosition = position; // move talkObj TalkObject newTextObject = newTalkObj.GetComponent <TalkObject>(); // get TalkObject newTextObject.SetText(i, this, origTextPosition); // set text of talkObj talkObjs.Add(newTextObject); // add to talkObjs } else { break; } } // BattleLoader.LastTalkingPoint stores what the talkObj was last seen by the user. // If there is a new talkObj that has not been read yet, toggle the next, new talkObj if (BattleLoader.LastTalkingPoint < talkObjs.Count - 1) { BattleLoader.LastTalkingPoint++; } Toggle(BattleLoader.LastTalkingPoint); }