Exemplo n.º 1
0
    private const string VALUE            = "value";            //效果值
    // private const string MULTITARGET = "multitarget";//同时攻击的目标数量
    // private const string RANGE_ATTACK = "range_attack";//是否是范围攻击
    // private const string SPUTTER = "sputter";//攻击造成伤害时的溅射范围
    // private const string CATAPULT = "catapult";//攻击时子弹弹射的数量
    // private const string POISON = "poison";//每秒因中毒的真实伤害值
    // private const string SPEED_DOWN = "speeddown";//速度值减少的值
    // private const string DEFENSE_BREAK = "defense_break";//防御值减少的值
    // private const string STEAL = "steal";//杀死怪物时额外获得的金币数
    // private const string ATTACK_SPEED_UP = "attack_speedup";//己方塔增加的攻击速度
    // private const string ATTACK_DAMAGE_UP = "attack_damageup";//己方塔增加的攻击力

    // Use this for initialization
    void Start()
    {
        AllTower.Clear();
        XMLFileController xml = new XMLFileController();

        xml.Open(TowerDataFile);
        LinkedList <string> list = xml.GetChildren();

        foreach (string name in list)
        {
            xml.BeginParentNode(name);
            //获取塔的基本信息
            Tower temp_t = new Tower(xml.GetValue(NAME), xml.GetValue(DETAIL), int.Parse(xml.GetValue(BUILD_GOLD)),
                                     double.Parse(xml.GetValue(DAMAGE)), int.Parse(xml.GetValue(ATTACK_TYPE)),
                                     double.Parse(xml.GetValue(CRIT_RATE)), double.Parse(xml.GetValue(CRIT_DAMAGE)),
                                     double.Parse(xml.GetValue(ATTACK_RANGE)), long.Parse(xml.GetValue(ATTACK_INTERVAL)),
                                     int.Parse(xml.GetValue(DOMAIN_WITDH)), int.Parse(xml.GetValue(DOMAIN_HEIGHT)));
            //获取塔的效果信息
            long   last_time    = long.Parse(xml.GetValue(EFFECT_LAST_TIME));
            int    features_num = int.Parse(xml.GetValue(FEATURES));
            double value        = double.Parse(xml.GetValue(VALUE));
            temp_t.SetFeatures(features_num, last_time, value);
            AllTower.Add(name, temp_t);
            xml.EndParentNode();
        }
    }
Exemplo n.º 2
0
    static public void ReadFile()
    {
        if (BulletFlySpeed.Count > 0)
        {
            return;
        }
        XMLFileController file = new XMLFileController();

        file.Open(DataFile);
        file.BeginParentNode(FLY_SPEED);
        LinkedList <string> child = file.GetChildren();

        foreach (string temp in child)
        {
            BulletFlySpeed.Add(temp, float.Parse(file.GetValue(temp)));
        }
        file.Close();
    }