Exemplo n.º 1
0
 public TowerInfo(int indexId, CharacterPrototype proto)
 {
     this.Id        = indexId;
     this.charId    = proto.charId;
     this.towerData = J_Tower.GetData(charId);
     this.towerBase = towerData._towerBase;
     this.shooter   = towerData._Shooter;
     this.towerType = towerData._towerType;
     InitAttr(proto);
 }
Exemplo n.º 2
0
 public TowerInfo(int indexId, int towerId)
 {
     this.Id        = indexId;
     this.charId    = towerId;
     this.towerData = J_Tower.GetData(towerId);
     this.towerBase = towerData._towerBase;
     this.shooter   = towerData._Shooter;
     this.towerType = towerData._towerType;
     InitAttr(towerId);
 }
Exemplo n.º 3
0
    private void InitTowerAttr(int _charId)
    {
        D_Tower towerData = J_Tower.GetData(_charId);

        this.towerType = towerData._towerType;
        SetAttr(CharAttr.AttackSpeed, 2);
        SetAttr(CharAttr.AttackSpeedPer, 0);
        SetAttr(CharAttr.AttackDamage, 20);
        SetAttr(CharAttr.AttackDamagePer, 0);
    }
Exemplo n.º 4
0
    /// <summary>
    /// 通过key获取数据
    /// </summary>
    /// <param name="_id">字典key</param>
    /// <returns></returns>
    public static D_Tower GetData(int _id)
    {
        D_Tower data = null;

        if (infoDict.ContainsKey(_id))
        {
            data = infoDict[_id];
        }
        else
        {
            Debug.Log(">>>>>table:" + tableName + " id:" + _id + " is null<<<<<\n");
        }
        return(data);
    }
Exemplo n.º 5
0
    private static void Init(string _info)
    {
        List <object> jsonObjects = MiniJSON.Json.Deserialize(_info) as List <object>;

        for (int i = 0; i < jsonObjects.Count; i++)
        {
            D_Tower info = new D_Tower();
            Dictionary <string, object> jsonObject = jsonObjects[i] as Dictionary <string, object>;

            if (jsonObject["id"] != null)
            {
                info._id = int.Parse(jsonObject["id"].ToString());
            }
            else
            {
                info._id = 0;
            }
            if (jsonObject["name"] != null)
            {
                info._name = jsonObject["name"].ToString();
            }
            else
            {
                info._name = "";
            }
            if (jsonObject["modelId"] != null)
            {
                info._modelId = int.Parse(jsonObject["modelId"].ToString());
            }
            else
            {
                info._modelId = 0;
            }
            if (jsonObject["towerType"] != null)
            {
                info._towerType = int.Parse(jsonObject["towerType"].ToString());
            }
            else
            {
                info._towerType = 0;
            }
            if (jsonObject["towerBase"] != null)
            {
                info._towerBase = jsonObject["towerBase"].ToString();
            }
            else
            {
                info._towerBase = "";
            }
            if (jsonObject["Shooter"] != null)
            {
                info._Shooter = jsonObject["Shooter"].ToString();
            }
            else
            {
                info._Shooter = "";
            }
            if (jsonObject["level"] != null)
            {
                info._level = int.Parse(jsonObject["level"].ToString());
            }
            else
            {
                info._level = 0;
            }
            if (jsonObject["attackSpeed"] != null)
            {
                info._attackSpeed = int.Parse(jsonObject["attackSpeed"].ToString());
            }
            else
            {
                info._attackSpeed = 0;
            }
            if (jsonObject["attackDamage"] != null)
            {
                info._attackDamage = int.Parse(jsonObject["attackDamage"].ToString());
            }
            else
            {
                info._attackDamage = 0;
            }
            if (jsonObject["attackRange"] != null)
            {
                info._attackRange = int.Parse(jsonObject["attackRange"].ToString());
            }
            else
            {
                info._attackRange = 0;
            }
            if (jsonObject["description"] != null)
            {
                info._description = jsonObject["description"].ToString();
            }
            else
            {
                info._description = "";
            }
            if (jsonObject["attackId"] != null)
            {
                info._attackId = int.Parse(jsonObject["attackId"].ToString());
            }
            else
            {
                info._attackId = 0;
            }
            if (jsonObject["soliderId"] != null)
            {
                info._soliderId = int.Parse(jsonObject["soliderId"].ToString());
            }
            else
            {
                info._soliderId = 0;
            }
            if (jsonObject["skill1"] != null)
            {
                info._skill1 = int.Parse(jsonObject["skill1"].ToString());
            }
            else
            {
                info._skill1 = 0;
            }
            if (jsonObject["skill2"] != null)
            {
                info._skill2 = int.Parse(jsonObject["skill2"].ToString());
            }
            else
            {
                info._skill2 = 0;
            }
            if (jsonObject["skill3"] != null)
            {
                info._skill3 = int.Parse(jsonObject["skill3"].ToString());
            }
            else
            {
                info._skill3 = 0;
            }
            if (jsonObject["skill4"] != null)
            {
                info._skill4 = int.Parse(jsonObject["skill4"].ToString());
            }
            else
            {
                info._skill4 = 0;
            }
            if (jsonObject["nextlevel"] != null)
            {
                info._nextlevel = GetIntArray(jsonObject["nextlevel"].ToString());
            }

            infoDict.Add(info._id, info);
        }

        /*
         * foreach (KeyValuePair<int, D_Tower> info in infoDict)
         * {
         *  Debug.Log(">>>>>"+info.Value._id+":"+info.Value._name+":"+info.Value._desc+":"+info.Value._point+":"+info.Value._label+":"+info.Value._type+":"+info.Value._number+":"+info.Value._function+":"+info.Value._para+":"+info.Value._reward+":"+"<<<<<\n");
         * }
         */
    }