Ejemplo n.º 1
0
 /// <summary>
 /// 传入AbiltiyVariable和对应json,进行数据填充
 /// </summary>
 /// <param name="abilityVariable">被填充的AbilityVariabile</param>
 /// <param name="jsonData">拥有填充数据的jsonData</param>
 private void FullAbilityVariable(AbilityVariable abilityVariable, JsonData jsonData)
 {
     if (jsonData["Range"].ToString() != "")
     {
         abilityVariable.Range = int.Parse(jsonData["Range"].ToString());
     }
     if (jsonData["Damage"].ToString() != "")
     {
         abilityVariable.Damage = int.Parse(jsonData["Damage"].ToString());
     }
     if (jsonData["Amount"].ToString() != "")
     {
         abilityVariable.Amount = int.Parse(jsonData["Amount"].ToString());
     }
     if (jsonData["Draws"].ToString() != "")
     {
         abilityVariable.Draws = int.Parse(jsonData["Draws"].ToString());
     }
     if (jsonData["Turns"].ToString() != "")
     {
         abilityVariable.Turns = int.Parse(jsonData["Turns"].ToString());
     }
     if (jsonData["Area"].ToString() != "")
     {
         string[] area = jsonData["Area"].ToString().Split('*');
         abilityVariable.Area = new Vector2(int.Parse(area[0]), int.Parse(area[1]));
     }
     if (jsonData["Curing"].ToString() != "")
     {
         abilityVariable.Curing = int.Parse(jsonData["Curing"].ToString());
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 从异能数据库加载对应异能的参数
        /// </summary>
        /// <param name="AbilityID">要加载的异能的ID</param>
        protected void InitialAbility(string AbilityID)
        {
            AbilityFormat abilityFormat = AbilityDatabase.GetInstance().GetAbilityFormat(AbilityID);

            //用序列化拷贝AbilityTargetList;
            Stream stream = GameUtility.Serializer.InstanceDataToMemory(abilityFormat.AbilityTargetList);

            stream.Position        = 0;
            this.AbilityTargetList = (List <AbilityTarget>)GameUtility.Serializer.MemoryToInstanceData(stream);
            //用序列化拷贝AbilityVariable
            stream               = GameUtility.Serializer.InstanceDataToMemory(abilityFormat.AbilityVariable);
            stream.Position      = 0;
            this.AbilityVariable = (AbilityVariable)GameUtility.Serializer.MemoryToInstanceData(stream);
            //Debug.Log("Success copy AbilityVariable");
            //拷贝变量
            this.AbilityID   = abilityFormat.AbilityID;
            this.Group       = abilityFormat.Group;
            this.AbilityName = abilityFormat.AbilityName;
            this.Description = abilityFormat.Description;
            this.TriggerID   = abilityFormat.TriggerID;
        }
Ejemplo n.º 3
0
 public AbilityFormat(string _abilityID)
 {
     AbilityID         = _abilityID;
     AbilityTargetList = new List <AbilityTarget>();
     AbilityVariable   = new AbilityVariable();
 }