/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { KeepSaveData mData = (KeepSaveData)data; if (mData.booleanDic != null) { if (this.booleanDic == null) { return(false); } if (this.booleanDic.size() != mData.booleanDic.size()) { return(false); } IntBooleanMap booleanDicR = mData.booleanDic; if (!this.booleanDic.isEmpty()) { int booleanDicKFreeValue = this.booleanDic.getFreeValue(); int[] booleanDicKKeys = this.booleanDic.getKeys(); bool[] booleanDicVValues = this.booleanDic.getValues(); for (int booleanDicKI = booleanDicKKeys.Length - 1; booleanDicKI >= 0; --booleanDicKI) { int booleanDicK = booleanDicKKeys[booleanDicKI]; if (booleanDicK != booleanDicKFreeValue) { bool booleanDicV = booleanDicVValues[booleanDicKI]; bool booleanDicU = booleanDicR.get(booleanDicK); if (booleanDicV != booleanDicU) { return(false); } } } } } else { if (this.booleanDic != null) { return(false); } } if (mData.intDic != null) { if (this.intDic == null) { return(false); } if (this.intDic.size() != mData.intDic.size()) { return(false); } IntIntMap intDicR = mData.intDic; if (!this.intDic.isEmpty()) { int intDicKFreeValue = this.intDic.getFreeValue(); int[] intDicKKeys = this.intDic.getKeys(); int[] intDicVValues = this.intDic.getValues(); for (int intDicKI = intDicKKeys.Length - 1; intDicKI >= 0; --intDicKI) { int intDicK = intDicKKeys[intDicKI]; if (intDicK != intDicKFreeValue) { int intDicV = intDicVValues[intDicKI]; int intDicU = intDicR.get(intDicK); if (intDicV != intDicU) { return(false); } } } } } else { if (this.intDic != null) { return(false); } } if (mData.longDic != null) { if (this.longDic == null) { return(false); } if (this.longDic.size() != mData.longDic.size()) { return(false); } IntLongMap longDicR = mData.longDic; if (!this.longDic.isEmpty()) { int longDicKFreeValue = this.longDic.getFreeValue(); int[] longDicKKeys = this.longDic.getKeys(); long[] longDicVValues = this.longDic.getValues(); for (int longDicKI = longDicKKeys.Length - 1; longDicKI >= 0; --longDicKI) { int longDicK = longDicKKeys[longDicKI]; if (longDicK != longDicKFreeValue) { long longDicV = longDicVValues[longDicKI]; long longDicU = longDicR.get(longDicK); if (longDicV != longDicU) { return(false); } } } } } else { if (this.longDic != null) { return(false); } } if (mData.stringDic != null) { if (this.stringDic == null) { return(false); } if (this.stringDic.size() != mData.stringDic.size()) { return(false); } SMap <string, string> stringDicR = mData.stringDic; if (!this.stringDic.isEmpty()) { string[] stringDicKKeys = this.stringDic.getKeys(); string[] stringDicVValues = this.stringDic.getValues(); for (int stringDicKI = stringDicKKeys.Length - 1; stringDicKI >= 0; --stringDicKI) { string stringDicK = stringDicKKeys[stringDicKI]; if (stringDicK != null) { string stringDicV = stringDicVValues[stringDicKI]; string stringDicU = stringDicR.get(stringDicK); if (stringDicV != stringDicU) { return(false); } } } } } else { if (this.stringDic != null) { return(false); } } return(true); }
/** 获取目标仇恨切换成本 */ private float getUnitHateSwitchCost(Unit target) { float re = _damageDic.get(target.instanceID) * 1000 / _unit.fight.getAttributeLogic().getHpMax(); return(re * Global.unitHateDamagePercentRatio * Global.unitSwitchHateCost); }