private int CalcCanAwakeMaxLv(int awakelv, int awakelvcap, int piece_amount, int element_piece_amount, int common_piece_amount) { int num1 = awakelv; MasterParam masterParam = MonoSingleton <GameManager> .GetInstanceDirect().MasterParam; if (masterParam == null) { return(num1); } int val2 = awakelv; for (int awakeLv = val2; awakeLv < awakelvcap; ++awakeLv) { int awakeNeedPieces = masterParam.GetAwakeNeedPieces(awakeLv); if (piece_amount > 0 && awakeNeedPieces > 0) { int num2 = Math.Min(awakeNeedPieces, piece_amount); awakeNeedPieces -= num2; piece_amount -= num2; } if (element_piece_amount > 0 && awakeNeedPieces > 0) { int num2 = Math.Min(awakeNeedPieces, element_piece_amount); awakeNeedPieces -= num2; element_piece_amount -= num2; } if (common_piece_amount > 0 && awakeNeedPieces > 0) { int num2 = Math.Min(awakeNeedPieces, common_piece_amount); awakeNeedPieces -= num2; common_piece_amount -= num2; } if (awakeNeedPieces == 0) { val2 = awakeLv + 1; } if (piece_amount == 0 && element_piece_amount == 0 && common_piece_amount == 0) { break; } } return(Math.Min(awakelvcap, val2)); }
private int CalcNeedPieceAll(int value) { int num1 = 0; int awakeLv1 = this.mCurrentUnit.AwakeLv; int awakeLevelCap = this.mCurrentUnit.GetAwakeLevelCap(); int num2 = this.mCurrentUnit.AwakeLv + value; if (value == 0 || awakeLv1 >= num2 || num2 > awakeLevelCap) { return(0); } MasterParam masterParam = MonoSingleton <GameManager> .Instance.MasterParam; for (int awakeLv2 = awakeLv1; awakeLv2 < num2; ++awakeLv2) { int awakeNeedPieces = masterParam.GetAwakeNeedPieces(awakeLv2); if (awakeLv2 >= 0) { num1 += awakeNeedPieces; } } return(num1); }