Ejemplo n.º 1
0
        private void LoadLife(Wz_Node lifeNode)
        {
            bool isCategory   = lifeNode.Nodes["isCategory"].GetValueEx <int>(0) != 0;
            var  lifeNodeList = !isCategory ? lifeNode.Nodes : lifeNode.Nodes.SelectMany(n => n.Nodes);

            int i = 0;

            foreach (var node in lifeNodeList)
            {
                var item = LifeItem.LoadFromNode(node);
                if (isCategory)
                {
                    item.Name  = $"life_{item.Type}_{node.ParentNode.Text}_{node.Text}";
                    item.Index = i++;
                }
                else
                {
                    item.Name  = $"life_{item.Type}_{node.Text}";
                    item.Index = int.Parse(node.Text);
                }

                //直接绑定foothold
                ContainerNode <FootholdItem> fhNode;
                if (item.Fh != 0 && (fhNode = FindFootholdByID(item.Fh)) != null)
                {
                    fhNode.Slots.Add(item);
                }
                else
                {
                    Scene.Fly.Sky.Slots.Add(item);
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadLife(Wz_Node lifeNode)
        {
            foreach (var node in lifeNode.Nodes)
            {
                var item = LifeItem.LoadFromNode(node);
                item.Name  = $"life_{item.Type}_{node.Text}";
                item.Index = int.Parse(node.Text);

                //直接绑定foothold
                ContainerNode <FootholdItem> fhNode;
                if (item.Fh != 0 && (fhNode = FindFootholdByID(item.Fh)) != null)
                {
                    fhNode.Slots.Add(item);
                }
                else
                {
                    Scene.Fly.Sky.Slots.Add(item);
                }
            }
        }