1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using UnityEngine;
- using System.Collections;
- using System.Xml;
- public class CraftConfigData
- {
- public int id;
- public string name;
- public string description;
- public float hp;
- public float dmg;
- public int attack;
- public int[] equipRcmdArr;
- public int[] powers;
- public string model;
- public CraftConfigData(XmlNode node)
- {
- if(node == null)
- return;
- id = StringUtil.ToInt(node.Attributes["id"].Value);
- name = node.Attributes["name"].Value;
- description = node.Attributes["description"].Value;
- hp = StringUtil.ToFloat(node.Attributes["hp"].Value);
- dmg = StringUtil.ToFloat (node.Attributes["dmg"].Value);
- attack = StringUtil.ToInt(node.Attributes["attack"].Value);
- powers = StringUtil.SplitToInt(node.Attributes["power"].Value, '|');
- model = node.Attributes["model"].Value;
- string equip = node.Attributes ["equip"].Value;
- equipRcmdArr = new int[equip.Length];
- for(int i=0; i<equip.Length; i++)
- {
- equipRcmdArr [i] = StringUtil.ToInt (equip.Substring(i, 1));
- }
- }
- public string GetIcon()
- {
- return "Textures/CraftIcon/"+id;
- }
- public Sprite GetIconSprite()
- {
- return Resources.Load<Sprite>(GetIcon());
- }
- }
|