Exemplo n.º 1
0
    private void Start()
    {
        // Make a key/sprite dict
        Dictionary <string, Sprite> spriteRef = new Dictionary <string, Sprite>();

        foreach (Sprite cur in EvidenceSprites)
        {
            //print(cur.name);
            spriteRef.Add(cur.name, cur);
        }
        XmlSerializer xmlSer = new XmlSerializer(typeof(EvidenceBaseData));
        string        path   = Path.Combine("DATA", "ItemXML");

        foreach (TextAsset xml in Resources.LoadAll <TextAsset>(path))
        {
            print(xml.text);
            try {
                MemoryStream     xmlStream = new MemoryStream(xml.bytes);
                EvidenceBaseData newItem   = (EvidenceBaseData)xmlSer.Deserialize(xmlStream);
                // Build the gameobject based on the new evidence base
                GameObject newGO = Instantiate(evidencePrefab);
                newGO.name = newItem.ID;
                newGO.GetComponent <SpriteRenderer>().sprite = spriteRef[newItem.Icon];
                newGO.GetComponent <EvidenceBase>().setFromBaseData(newItem);
                newGO.SetActive(false);
                evidence.Add(newItem.ID, newGO);
            } catch {
                // Do nothing
            }
        }
        prepActionDone();
    }
Exemplo n.º 2
0
 public void setFromBaseData(EvidenceBaseData setFrom)
 {
     //print("Setting the evidence base...");
     Name             = (string)setFrom.Name.Clone();
     ID               = (string)setFrom.ID.Clone();
     Icon             = (string)setFrom.Icon.Clone();
     EnlargeID        = (string)setFrom.EnlargeID.Clone();
     HoverTextOptions = setFrom.HoverTextOptions;
     Flags            = setFrom.Flags;
     YarnNodes        = setFrom.YarnNodes;
 }