Esempio n. 1
0
        public void OnLoadConfig(ConfigData data)
        {
            int dataID = data.GetInt("DataID");

            m_vConfigDatas.ForceAddList(dataID, data);

            AValueStruct pStruct = GetAValue(dataID, 0, true);

            if (null == pStruct)
            {
                return;
            }

            int nValueID = (int)XWorldGameModule.GetGameManager <AValueDefine>().GetValueID(data.GetString("ValueName"));

            if (nValueID < 0)
            {
                return;
            }
            int   ComputeLevel  = data.GetInt("ComputeLevel");
            int   ComputeMode   = data.GetInt("ComputeMode");
            float AbsoluteValue = data.GetFloat("AbsoluteValue");
            float PercentValue  = data.GetFloat("PercentValue");

            pStruct.SetValueData(nValueID, ComputeLevel, ComputeMode, AbsoluteValue, PercentValue);

            AValueMask pMask = GetAValueMask(dataID, true);

            if (null == pMask)
            {
                pMask.Combine(pStruct);
            }
        }
Esempio n. 2
0
        void Enhance(AValueStruct pVS, AValueMask pMask, bool bLinear) // 将pStruct的属性数值强化给自己
        {
            if (null == pVS)
            {
                return;
            }
            if (null != pMask)
            {
                EnhanceWithMask(pVS, pMask, bLinear);
                return;
            }

            for (int i = 0; i < (int)AValueType.Count; i++)
            {
                AValueData pDstData = GetValueData(i, false);
                if (null != pDstData)
                {
                    // 如果装备属性项不存在,强化属性集无效果
                    AValueData pSrcData = pVS.GetValueData(i, false);
                    if (null != pSrcData)
                    {
                        pDstData.Combine(pSrcData, ref bLinear);
                    }
                }
            }
        }
Esempio n. 3
0
 public void Combine(AValueMask mask)
 {
     for (int i = 0; i < (int)AValueType.Count; i++)
     {
         if (mask.Mask[i])
         {
             Mask[i] = true;
         }
     }
 }
Esempio n. 4
0
        void CalculateOne(RoleAValue result, AValueMask pMask, int valueID, AValueData pData, RoleAValue pTransformAV)
        {
            float extraBase = null == pTransformAV ? 0.0f : pTransformAV.Values[valueID];

            if (null != pData)
            {
                result.Values[valueID] = pData.Calculate(false, extraBase);
            }
            else
            {
                result.Values[valueID] = extraBase;
            }
        }
Esempio n. 5
0
 public AValueMask GetAValueMask(int nDataID, bool bCreate = false)
 {
     if (!m_vMaskMap.ContainsKey(nDataID))
     {
         if (bCreate)
         {
             AValueMask pRes = new AValueMask();
             m_vMaskMap[nDataID] = pRes;
             return(pRes);
         }
         return(null);
     }
     return(m_vMaskMap[nDataID]);
 }
Esempio n. 6
0
 public void Reset(AValueMask pMask)
 {
     if (null == pMask)
     {
         Datas.Clear(); return;
     }
     for (int i = 0; i < pMask.Mask.Length; ++i)
     {
         if (pMask.Mask[i])
         {//重置标脏的属性数据
             Datas.Remove(i);
         }
     }
 }
Esempio n. 7
0
        public void Calculate(RoleAValue result, AValueMask pMask, int groupFlag = (int)AValue_GroupType.AValue_GroupBoth, RoleAValue pTransformAV = null)
        {
            int locali = (int)AValue_GroupType.AValue_GroupExtend;

            locali = (groupFlag & locali);
            if (locali > 0)
            {
                foreach (KeyValuePair <int, AValueData> item in Datas)
                {
                    UnityEngine.Debug.Log("item = " + item);
                    CalculateOne(result, pMask, item.Key, item.Value, pTransformAV);
                }
            }
        }
Esempio n. 8
0
 void CombineWithMask(AValueStruct pVS, AValueMask pMask, bool bLinear) // 将pStruct的属性数值合并给自己
 {
     foreach (KeyValuePair <int, AValueData> item in pVS.Datas)
     {
         if (pMask.Mask[item.Key])
         {
             AValueData pDstData = GetValueData(item.Key, true);
             if (null != pDstData)
             {
                 pDstData.Combine(item.Value, ref bLinear);
             }
         }
     }
 }
Esempio n. 9
0
 void EnhanceWithMask(AValueStruct pVS, AValueMask pMask, bool bLinear)
 {
     for (int i = 0; i < (int)AValueType.Count; i++)
     {
         if (pMask.Mask[i])
         {// 标脏的数值才进行合并
             AValueData pDstData = GetValueData(i, false);
             if (null != pDstData)
             {// 如果装备属性项不存在,强化属性集无效果
                 AValueData pSrcData = pVS.GetValueData(i, false);
                 if (null != pSrcData)
                 {
                     pDstData.Combine(pSrcData, ref bLinear);
                 }
             }
         }
     }
 }
Esempio n. 10
0
 public void Reset(AValueMask pMask)
 {
     if (pMask == null)
     {// 全部复位
         for (int i = 0; i < Values.Length; ++i)
         {
             Values[i] = 0f;
         }
     }
     else
     {
         for (int i = 0; i < (int)AValueType.Count; ++i)
         {
             if (pMask.Mask[i])
             {
                 Values[i] = 0;
             }
         }
     }
 }
Esempio n. 11
0
        public void Combine(AValueStruct pVS, AValueMask pMask, bool bLinear) // 将pStruct的属性数值合并给自己
        {
            if (null == pVS)
            {
                return;
            }

            if (null != pMask)
            {
                CombineWithMask(pVS, pMask, bLinear);
                return;
            }

            foreach (KeyValuePair <int, AValueData> item in pVS.Datas)
            {
                AValueData pDstData = GetValueData(item.Key, true);
                if (null != pDstData)
                {
                    pDstData.Combine(item.Value, ref bLinear);
                }
            }
        }
Esempio n. 12
0
 public void Combine(RoleAValue srcXValue, AValueMask pMask)
 {
     if (srcXValue == null)
     {
         return;
     }
     if (pMask == null)
     {
         for (int i = 0; i < (int)AValueType.Count; ++i)
         {
             Values[i] += srcXValue.Values[i];
         }
     }
     else
     {
         for (int i = 0; i < (int)AValueType.Count; ++i)
         {
             if (pMask.Mask[i])
             {
                 Values[i] += srcXValue.Values[i];
             }
         }
     }
 }
Esempio n. 13
0
 public void CalcOriginResult(AValueStruct vs, AValueMask pMask, ref RoleAValue av)
 {
     av.Reset(pMask);
     vs.Calculate(av, pMask);
 }