namespace CodeJay { namespace CodeJayUtility { using CodeJay.Enum; using System.Collections.Generic; public static class Utility { public static bool IsSameMonthCard(ECardType first, ECardType second) { int firstNum = (int)first / 4; int secondNum = (int)second / 4; return firstNum == secondNum; } public static bool IsSameScoreType(ECardType a, ECardType b) { return Converter.CardTypeToScoreType(a) == Converter.CardTypeToScoreType(b); } public static bool IsSameMonthType(ECardType type1, ECardType type2) { return Converter.CardTypeToMonthType(type1) == Converter.CardTypeToMonthType(type2); } public static List GetCombinationTypes(ref List lst) { List result = new List(); HashSet hongdan = new HashSet { ECardType.Jan_Hongdan, ECardType.Feb_Hongdan, ECardType.Mar_Hongdan }; HashSet chungdan = new HashSet { ECardType.Jun_Chungdan, ECardType.Oct_Chungdan, ECardType.Sep_Chungdan }; HashSet chodan = new HashSet { ECardType.Apr_Chodan, ECardType.Jul_Chodan, ECardType.May_Chodan }; HashSet godori = new HashSet { ECardType.Feb_Bird, ECardType.Apr_Bird, ECardType.Aug_Bird }; if (hongdan.IsSubsetOf(lst)) result.Add(ECombinationType.Hongdan); if (chungdan.IsSubsetOf(lst)) result.Add(ECombinationType.Chungdan); if (chodan.IsSubsetOf(lst)) result.Add(ECombinationType.Chodan); if (godori.IsSubsetOf(lst)) result.Add(ECombinationType.Godori); int ghwangCount = 0; bool hasNovGhwang = false; // �ŰԺ����� ���� ī��鿡 ���� ������ ��ȯ�ؾ���. for (int i = 0; i < lst.Count; i++) { if (lst[i] == ECardType.Nov_Ghwang) { hasNovGhwang = true; } if (lst[i] == ECardType.Jan_Ghwang || lst[i] == ECardType.Mar_Ghwang || lst[i] == ECardType.Aug_Ghwang || lst[i] == ECardType.Nov_Ghwang || lst[i] == ECardType.Dec_Ghwang) { ghwangCount++; } } if (hasNovGhwang) { if (ghwangCount == 3) result.Add(ECombinationType.Be_Three_Ghwang); else if (ghwangCount == 4) result.Add(ECombinationType.Four_Ghwang); else if (ghwangCount == 5) result.Add(ECombinationType.Five_Ghwang); } else { if (ghwangCount == 3) result.Add(ECombinationType.Three_Ghwang); else if (ghwangCount == 4) result.Add(ECombinationType.Four_Ghwang); } return result; } public static int GetCombinationScore(ECombinationType type) { switch (type) { case ECombinationType.Hongdan: return 3; case ECombinationType.Chungdan: return 3; case ECombinationType.Chodan: return 3; case ECombinationType.Godori: return 5; case ECombinationType.Be_Three_Ghwang: return 2; case ECombinationType.Three_Ghwang: return 3; case ECombinationType.Four_Ghwang: return 4; case ECombinationType.Five_Ghwang: return 15; default: return 0; } } public static int GetScoreMultiplyValue(EScoreMutiplyType type) { switch (type) { case EScoreMutiplyType.Go: return 2; case EScoreMutiplyType.Gobak: return 2; case EScoreMutiplyType.Peebak: return 2; case EScoreMutiplyType.Gwhangbak: return 2; case EScoreMutiplyType.Shake: return 2; case EScoreMutiplyType.Nagari: return 2; case EScoreMutiplyType.ClickedFromResultPopup: return 2; case EScoreMutiplyType.MeongTeonguri: return 2; case EScoreMutiplyType.MainMission: return GamePanel.Instance.dic_missionRate[GamePanel.Instance.CurMission]; case EScoreMutiplyType.SubMission: return GamePanel.Instance.dic_submisstionRate[GamePanel.Instance.CurSubMission]; default: return 0; } } public static string GetCombinationTypeString(ECombinationType type) { switch (type) { case ECombinationType.Hongdan: return "+홍단3점"; case ECombinationType.Chungdan: return "+청단3점"; case ECombinationType.Chodan: return "+초단3점"; case ECombinationType.Godori: return "+고도리5점"; case ECombinationType.Be_Three_Ghwang: return "+비삼광2점"; case ECombinationType.Three_Ghwang: return "+삼광3점"; case ECombinationType.Four_Ghwang: return "+사광4점"; case ECombinationType.Five_Ghwang: return "+오광15점"; default: return ""; } } public static string GetScoreMultiplyTypeString(EScoreMutiplyType type, int num) { switch (type) { case EScoreMutiplyType.Gobak: return "x고박2배"; case EScoreMutiplyType.Peebak: return "x피박2배"; case EScoreMutiplyType.Gwhangbak: return "x광박2배"; case EScoreMutiplyType.Shake: return $"x흔들기{num * 2}배"; case EScoreMutiplyType.Nagari: return $"x나가리2배"; case EScoreMutiplyType.ClickedFromResultPopup: return $"x이번판2배"; default: return ""; } } public static bool IsDoublePee(ECardType type, bool useSepYulgget_To_pee) { switch (type) { case ECardType.Bonus_1: case ECardType.Bonus_2: case ECardType.Bonus_3: case ECardType.Nov_Double: case ECardType.Dec_Double: return true; case ECardType.Sep_Yulkkeut: return useSepYulgget_To_pee ? true : false; default: return false; } } } public static class Converter { public static readonly string[] Units = new string[4] { "만", "억", "조", "경" }; private const long UNIT_INTERVAL = 10000; private static readonly System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); public static string MoneyToString(long money) { stringBuilder.Clear(); int digit = (int)(System.Math.Log(money, UNIT_INTERVAL)); if (digit > 0) { for (int i = digit - 1; i >= 0; i--) { long temp = money / (long)System.Math.Pow(UNIT_INTERVAL, i + 1); if (temp % UNIT_INTERVAL > 0) { stringBuilder.Append(temp % UNIT_INTERVAL); stringBuilder.Append(Units[i]); } } if (money % UNIT_INTERVAL > 0) stringBuilder.Append(money % UNIT_INTERVAL); } else { stringBuilder.Append(money); } stringBuilder.Append("냥"); return stringBuilder.ToString(); } public static string MoneyToString_withOutline(long money) { return $"{MoneyToString(money)} "; } public static ECardScoreType CardTypeToScoreType(ECardType cardType) { switch (cardType) { case ECardType.Jan_Ghwang: case ECardType.Mar_Ghwang: case ECardType.Aug_Ghwang: case ECardType.Nov_Ghwang: case ECardType.Dec_Ghwang: return ECardScoreType.Ghwang; case ECardType.Jan_Hongdan: case ECardType.Feb_Hongdan: case ECardType.Mar_Hongdan: case ECardType.Apr_Chodan: case ECardType.May_Chodan: case ECardType.Jun_Chungdan: case ECardType.Jul_Chodan: case ECardType.Sep_Chungdan: case ECardType.Oct_Chungdan: case ECardType.Nov_Tee: return ECardScoreType.Tee; case ECardType.Feb_Bird: case ECardType.Apr_Bird: case ECardType.May_Yulkkeut: case ECardType.Jun_Yulkkeut: case ECardType.Jul_Yulkkeut: case ECardType.Aug_Bird: case ECardType.Oct_Yulkkeut: case ECardType.Nov_Yulgget: return ECardScoreType.Yul_ggeut; case ECardType.Jan_Normal_1: case ECardType.Jan_Normal_2: case ECardType.Feb_Normal_2: case ECardType.Feb_Normal_1: case ECardType.Mar_Normal_1: case ECardType.Mar_Normal_2: case ECardType.Apr_Normal_1: case ECardType.Apr_Normal_2: case ECardType.May_Normal_1: case ECardType.May_Normal_2: case ECardType.Jun_Normal_1: case ECardType.Jun_Normal_2: case ECardType.Jul_Normal_1: case ECardType.Jul_Normal_2: case ECardType.Aug_Normal_1: case ECardType.Aug_Normal_2: case ECardType.Sep_Normal_1: case ECardType.Sep_Normal_2: case ECardType.Oct_Normal_1: case ECardType.Oct_Normal_2: case ECardType.Nov_Double: case ECardType.Dec_Double: case ECardType.Dec_Pee_1: case ECardType.Dec_Pee_2: case ECardType.Bonus_1: case ECardType.Bonus_2: case ECardType.Bonus_3: return ECardScoreType.Pee; case ECardType.Sep_Yulkkeut: return GamePanel.Instance.UseSepYulgget_To_Pee ? ECardScoreType.Pee : ECardScoreType.Yul_ggeut; default: return ECardScoreType.Max; } } public static ECardMonthType CardTypeToMonthType(ECardType type) { switch (type) { case ECardType.Jan_Ghwang: case ECardType.Jan_Hongdan: case ECardType.Jan_Normal_1: case ECardType.Jan_Normal_2: return ECardMonthType.Jan; case ECardType.Feb_Bird: case ECardType.Feb_Hongdan: case ECardType.Feb_Normal_1: case ECardType.Feb_Normal_2: return ECardMonthType.Feb; case ECardType.Mar_Ghwang: case ECardType.Mar_Hongdan: case ECardType.Mar_Normal_1: case ECardType.Mar_Normal_2: return ECardMonthType.Mar; case ECardType.Apr_Bird: case ECardType.Apr_Chodan: case ECardType.Apr_Normal_1: case ECardType.Apr_Normal_2: return ECardMonthType.Apr; case ECardType.May_Yulkkeut: case ECardType.May_Chodan: case ECardType.May_Normal_1: case ECardType.May_Normal_2: return ECardMonthType.May; case ECardType.Jun_Yulkkeut: case ECardType.Jun_Chungdan: case ECardType.Jun_Normal_1: case ECardType.Jun_Normal_2: return ECardMonthType.Jun; case ECardType.Jul_Yulkkeut: case ECardType.Jul_Chodan: case ECardType.Jul_Normal_1: case ECardType.Jul_Normal_2: return ECardMonthType.Jul; case ECardType.Aug_Ghwang: case ECardType.Aug_Bird: case ECardType.Aug_Normal_1: case ECardType.Aug_Normal_2: return ECardMonthType.Aug; case ECardType.Sep_Yulkkeut: case ECardType.Sep_Chungdan: case ECardType.Sep_Normal_1: case ECardType.Sep_Normal_2: return ECardMonthType.Sep; case ECardType.Oct_Yulkkeut: case ECardType.Oct_Chungdan: case ECardType.Oct_Normal_1: case ECardType.Oct_Normal_2: return ECardMonthType.Oct; case ECardType.Nov_Ghwang: case ECardType.Nov_Double: case ECardType.Nov_Tee: case ECardType.Nov_Yulgget: return ECardMonthType.Nov; case ECardType.Dec_Ghwang: case ECardType.Dec_Double: case ECardType.Dec_Pee_1: case ECardType.Dec_Pee_2: return ECardMonthType.Dec; default: return ECardMonthType.Max; } } public static EEffectDirectType GuideTypeToDirectType(EGuideType type) { switch (type) { case EGuideType.OnlyMine: case EGuideType.Discardable: return EEffectDirectType.Normal; case EGuideType.Selectable: return EEffectDirectType.Selectable; case EGuideType.Get_Bbug_Own: return EEffectDirectType.GetBbug_Own; case EGuideType.Get_Bbug: return EEffectDirectType.GetBbug; case EGuideType.Bell: return EEffectDirectType.Bell; case EGuideType.Bomb_Triple: return EEffectDirectType.Bomb_Triple; case EGuideType.Bomb_Double: return EEffectDirectType.Bomb_Double; default: return EEffectDirectType.NoneCard; } } } } }