Exemplo n.º 1
0
    public static List <GameObject> LoadData(List <GameObject> SlotList)
    {
        if (!System.IO.File.Exists(Application.dataPath + "/Resources/InventoryData.xml"))
        {
            return(SlotList);
        }

        XmlDocument XmlDoc = new XmlDocument();

        XmlDoc.Load(Application.dataPath + "/Resources/InventoryData.xml");
        XmlElement XmlEl = XmlDoc["ItemDB"];

        foreach (XmlElement ItemElement in XmlEl.ChildNodes)
        {
            Slot slot = SlotList[System.Convert.ToInt32(ItemElement.GetAttribute("SlotNumber"))].GetComponent <Slot>();

            Item item = new Item();

            string Name     = ItemElement.GetAttribute("Name");
            int    MaxCount = System.Convert.ToInt32(ItemElement.GetAttribute("MaxCount"));
            item.Init(Name, MaxCount);

            int Count = System.Convert.ToInt32(ItemElement.GetAttribute("Count"));

            for (int i = 0; i < Count; ++i)
            {
                slot.AddItem(item);
            }
        }
        return(SlotList);
    }
Exemplo n.º 2
0
        public override Lesson ReadLesson()
        {
            var sco = new Sco
            {
                DataFromLms     = ItemElement.GetAttribute("datafromlms"),
                MaxTimeAllowed  = GetTime(ItemElement.GetAttribute("maxtimeallowed")),
                TimeLimitAction = ItemElement.GetAttribute("timelimitaction"),
                Prerequisites   = ItemElement.GetAttribute("prerequisites"),
                TargetWindow    = ItemElement.GetAttribute("winTarget")
            };

            FillStandardProperties(sco);

            var identifierRef   = ItemElement.GetAttribute("identifierref");
            var resourceElement = GetResourceElement(identifierRef);

            if (resourceElement != null)
            {
                sco.Resource = new ScormResource
                {
                    Base       = resourceElement.GetAttribute("base"),
                    Href       = resourceElement.GetAttribute("href"),
                    Identifier = IdentifierRef,
                    ScormType  = resourceElement.GetAttribute("scormtype"),
                    Type       = resourceElement.GetAttribute("type")
                };
            }
            return(sco);
        }
Exemplo n.º 3
0
    public static List <Note_Item> Read(string filePath)
    {
        TextAsset   textxml  = (TextAsset)Resources.Load(filePath);
        XmlDocument Document = new XmlDocument();

        Document.LoadXml(textxml.text);

        XmlElement ItemListElement = Document["note"];

        List <Note_Item> ItemList = new List <Note_Item>();

        foreach (XmlElement ItemElement in ItemListElement.ChildNodes)
        {
            Note_Item Item = new Note_Item();
            Item.color = ItemElement.GetAttribute("color");
            Item.time  = System.Convert.ToSingle(ItemElement.GetAttribute("time"));
            ItemList.Add(Item);
        }
        return(ItemList);
    }
Exemplo n.º 4
0
    public static List <Block> Read(string filePath)
    {
        List <Block> blockList = new List <Block>();
        XmlDocument  Document  = new XmlDocument();

        Document.Load(filePath);
        XmlElement ItemListElement = Document["MapList"];

        foreach (XmlElement ItemElement in ItemListElement.ChildNodes)
        {
            Block block = new Block
            {
                type = ItemElement.GetAttribute("Type"),
                x    = System.Convert.ToInt32(ItemElement.GetAttribute("X")),
                y    = System.Convert.ToInt32(ItemElement.GetAttribute("Y")),
                z    = System.Convert.ToInt32(ItemElement.GetAttribute("Z"))
            };
            blockList.Add(block);
        }
        return(blockList);
    }
Exemplo n.º 5
0
    public static void LoadData()
    {
        if (!System.IO.File.Exists(Application.dataPath + "/Resources/PlayerData.xml"))
        {
            return;
        }

        XmlDocument XmlDoc = new XmlDocument();

        XmlDoc.Load(Application.dataPath + "/Resources/PlayerData.xml");
        XmlElement XmlEl = XmlDoc["PlayerDB"];

        FSMPlayer player = GameSceneManager.Instance.Player;

        foreach (XmlElement ItemElement in XmlEl.ChildNodes)
        {
            player.Health.HP = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentHP"));
            player.Mana.MP   = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentMP"));
            player.Gold      = System.Convert.ToInt32(ItemElement.GetAttribute("Gold"));
        }
    }