From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/UI/UiUtility.cs | 2850 +++++++++++++++++++++ 1 file changed, 2850 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/UiUtility.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/UiUtility.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/UiUtility.cs b/Client/Assets/Scripts/XMainClient/UI/UiUtility.cs new file mode 100644 index 00000000..0cf27e63 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/UiUtility.cs @@ -0,0 +1,2850 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using KKSG; +using MiniJSON; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUpdater; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + public class UiUtility : XSingleton, IUiUtility, IXInterface + { + public bool Deprecated { get; set; } + + private StringBuilder _Timebuilder = new StringBuilder(); + + private int[] TimeDuaration = new int[] + { + 2592000, + 86400, + 3600, + 60, + 1 + }; + + private string[] TimeDuarationName = new string[] + { + "MONTH_DUARATION", + "DAY_DUARATION", + "HOUR_DUARATION", + "MINUTE_DUARATION", + "SECOND_DUARATION" + }; + + private string[] TimeName = new string[] + { + "MONTH_DUARATION", + "DAY_DUARATION", + "HOUR_DUARATION", + "MINUTE_TIME", + "SECOND_DUARATION" + }; + + private string[] NumberSeparatorNames = null; + + private string wifiBtn; + + private uint wifi_green = 0u; + + private uint wifi_yellow = 0u; + + private bool wifi_forward = true; + + private float wifi_duration = 1f; + + private float wifi_cur = 0f; + + public List ComSpriteStr = new List(); + + private bool FatalErrorButtonCallback(IXUIButton go) + { + DlgBase.singleton.SetVisible(false, true); + XSingleton.singleton.Pause = false; + XSingleton.singleton.OnFatalErrorCallback(); + return true; + } + + public void OnFatalErrorClosed(ErrorCode code) + { + XSingleton.singleton.StopTutorial(); + XSingleton.singleton.Pause = true; + string @string = XStringDefineProxy.GetString(code); + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(true); + this._ShowModalDialog(@string, XStringDefineProxy.GetString(XStringDefine.COMMON_OK), "-", new ButtonClickEventHandler(this.FatalErrorButtonCallback), 300, ""); + } + + public void OnFatalErrorClosed(string text) + { + XSingleton.singleton.StopTutorial(); + XSingleton.singleton.Pause = true; + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(true); + this._ShowModalDialog(text, XStringDefineProxy.GetString(XStringDefine.COMMON_OK), "-", new ButtonClickEventHandler(this.FatalErrorButtonCallback), 300, ""); + } + + public void ShowErrorCode(ErrorCode code) + { + string @string = XStringDefineProxy.GetString(code); + this.ShowModalDialog(@string, XStringDefineProxy.GetString(XStringDefine.COMMON_OK)); + } + + internal string GetEquipName(ItemList.RowData data, XItem instanceData = null, uint profession = 0u) + { + bool flag = instanceData != null && instanceData.Type == ItemType.EQUIP; + if (flag) + { + XEquipItem xequipItem = instanceData as XEquipItem; + bool flag2 = xequipItem.enhanceInfo.EnhanceLevel > 0u; + if (flag2) + { + return string.Format("{0}+{1}", XSingleton.singleton.ChooseProfString(data.ItemName, profession), xequipItem.enhanceInfo.EnhanceLevel.ToString()); + } + } + return XSingleton.singleton.ChooseProfString(data.ItemName, profession); + } + + internal void ShowTooltipDialogWithSearchingCompare(XItem mainItem, IXUISprite icon = null, bool bShowButtons = true, uint profession = 0u) + { + bool flag = mainItem == null; + if (!flag) + { + XItem compareItem = null; + bool flag2 = mainItem.type == 1u; + if (flag2) + { + EquipList.RowData equipConf = XBagDocument.GetEquipConf(mainItem.itemID); + bool flag3 = equipConf == null; + if (flag3) + { + XSingleton.singleton.AddErrorLog("Cannot find equip config for id: ", mainItem.itemID.ToString(), null, null, null, null); + return; + } + compareItem = XSingleton.singleton.Doc.XBagDoc.EquipBag[(int)equipConf.EquipPos]; + } + else + { + bool flag4 = mainItem.type == 6u; + if (flag4) + { + compareItem = XEmblemDocument.CheckEquipedEmblemsAttrs(XSingleton.singleton.Doc.XBagDoc.EmblemBag, mainItem); + } + else + { + bool flag5 = mainItem.type == 31u; + if (flag5) + { + ArtifactListTable.RowData artifactListRowData = ArtifactDocument.GetArtifactListRowData((uint)mainItem.itemID); + bool flag6 = artifactListRowData == null; + if (flag6) + { + XSingleton.singleton.AddErrorLog("Cannot find artifact config for id: ", mainItem.itemID.ToString(), null, null, null, null); + return; + } + compareItem = XSingleton.singleton.Doc.XBagDoc.ArtifactBag[(int)artifactListRowData.ArtifactPos]; + } + } + } + this.ShowTooltipDialog(mainItem, compareItem, icon, bShowButtons, profession); + } + } + + internal void ShowTooltipDialog(XItem mainItem, XItem compareItem, IXUISprite icon = null, bool bShowButtons = true, uint profession = 0u) + { + bool flag = mainItem == null; + if (!flag) + { + bool flag2 = compareItem != null && compareItem.itemID != 0 && mainItem.Type != compareItem.Type; + if (flag2) + { + XSingleton.singleton.AddErrorLog("mainItem.Type != compareItem.Type", null, null, null, null, null); + } + else + { + XFashionDocument specificDocument = XDocuments.GetSpecificDocument(XFashionDocument.uuID); + bool flag3 = DlgBase.singleton.IsLoaded(); + if (flag3) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag4 = DlgBase.singleton.IsLoaded(); + if (flag4) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag5 = DlgBase.singleton.IsLoaded(); + if (flag5) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag6 = DlgBase.singleton.IsLoaded(); + if (flag6) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag7 = DlgBase.singleton.IsLoaded(); + if (flag7) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag8 = DlgBase.singleton.IsLoaded(); + if (flag8) + { + DlgBase.singleton.HideToolTip(true); + } + bool flag9 = DlgBase.singleton.IsLoaded(); + if (flag9) + { + DlgBase.singleton.HideToolTip(true); + } + ITooltipDlg tooltipDlg = mainItem.Description.TooltipDlg; + tooltipDlg.ShowToolTip(mainItem, compareItem, bShowButtons, profession); + tooltipDlg.ItemSelector.Select(icon); + tooltipDlg.SetPosition(icon); + XSingleton.singleton.Reset(); + } + } + } + + public void PushBarrage(string nick, string content) + { + DlgBase.singleton.Push(nick, content); + } + + public void StartBroadcast(bool start) + { + if (start) + { + DlgBase.singleton.isBroadcast = true; + DlgBase.singleton.Show(true); + } + else + { + DlgBase.singleton.isBroadcast = false; + DlgBase.singleton.Show(false); + } + } + + public void ShowDetailTooltip(int itemID, GameObject icon = null) + { + XItem mainItem = XBagDocument.MakeXItem(itemID, false); + this.ShowTooltipDialog(mainItem, null, icon.GetComponent("XUISprite") as IXUISprite, false, 0u); + } + + public void ParseHeadIcon(List setid, IXUISprite spr) + { + bool flag = setid == null; + if (flag) + { + spr.SetVisible(false); + } + else + { + string text = XPrerogativeDocument.ConvertTypeToPreContent(PrerogativeType.PreHeadPortrait, setid); + string text2 = string.Empty; + bool flag2 = !string.IsNullOrEmpty(text); + if (flag2) + { + string[] array = text.Split(new char[] + { + '=' + }); + bool flag3 = array.Length >= 2; + if (flag3) + { + text2 = array[1]; + } + } + bool flag4 = !string.IsNullOrEmpty(text2); + if (flag4) + { + spr.SetVisible(true); + spr.SetSprite(text2); + } + else + { + spr.SetVisible(false); + } + } + } + + public void ShowTooltipDialog(int itemID, GameObject icon = null) + { + ItemList.RowData itemConf = XBagDocument.GetItemConf(itemID); + bool flag = itemConf == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("rowData == null: ", itemID.ToString(), null, null, null, null); + } + else + { + IXUISprite ixuisprite = null; + bool flag2 = null != icon; + if (flag2) + { + ixuisprite = (icon.GetComponent("XUISprite") as IXUISprite); + } + bool flag3 = itemConf.ItemType == 5; + if (flag3) + { + XItem mainItem = XBagDocument.MakeXItem(itemID, false); + XSingleton.singleton.ShowTooltipDialog(mainItem, null, ixuisprite, false, 0u); + } + else + { + itemID = XBagDocument.ConvertTemplate(itemConf); + DlgBase.singleton.ShowToolTip(itemID, 0u); + DlgBase.singleton.ItemSelector.Select(icon); + DlgBase.singleton.SetPosition(ixuisprite); + XSingleton.singleton.Reset(); + } + } + } + + internal void ShowOutLookDialog(XItem item, IXUISprite icon = null, uint proferssion = 0u) + { + bool flag = item == null; + if (!flag) + { + bool flag2 = item.Type == ItemType.FASHION; + if (flag2) + { + FashionList.RowData fashionConf = XBagDocument.GetFashionConf(item.itemID); + bool flag3 = fashionConf != null && (int)fashionConf.EquipPos == XFastEnumIntEqualityComparer.ToInt(FashionPosition.Hair); + if (flag3) + { + DlgBase.singleton.ShowToolTip(item, null, true, proferssion); + DlgBase.singleton.ItemSelector.Select(icon); + DlgBase.singleton.SetPosition(icon); + } + else + { + DlgBase.singleton.ShowToolTip(item, null, true, proferssion); + DlgBase.singleton.ItemSelector.Select(icon); + DlgBase.singleton.SetPosition(icon); + } + XSingleton.singleton.Reset(); + } + else + { + bool flag4 = item.Type == ItemType.EQUIP; + if (flag4) + { + DlgBase.singleton.ShowToolTip(item, null, true, proferssion); + DlgBase.singleton.ItemSelector.Select(icon); + DlgBase.singleton.SetPosition(icon); + XSingleton.singleton.Reset(); + } + } + } + } + + public void ShowTooltipDialog(int itemID, IXUISprite icon = null, uint profession = 0u) + { + ItemList.RowData itemConf = XBagDocument.GetItemConf(itemID); + bool flag = itemConf == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("rowData == null: ", itemID.ToString(), null, null, null, null); + } + else + { + bool flag2 = itemConf.ItemType == 5; + if (flag2) + { + XItem mainItem = XBagDocument.MakeXItem(itemID, false); + XSingleton.singleton.ShowTooltipDialog(mainItem, null, icon, false, 0u); + } + else + { + itemID = XBagDocument.ConvertTemplate(itemConf); + DlgBase.singleton.ShowToolTip(itemID, profession); + DlgBase.singleton.ItemSelector.Select(icon); + DlgBase.singleton.SetPosition(icon); + XSingleton.singleton.Reset(); + } + } + } + + public void ShowTooltipDialogByUID(string strUID, GameObject icon = null) + { + ulong uid = 0UL; + bool flag = ulong.TryParse(strUID, out uid); + if (flag) + { + XItem xitem = XSingleton.singleton.Doc.XBagDoc.GetItemByUID(uid); + bool flag2 = xitem == null; + if (flag2) + { + XFashionDocument xfashionDocument = XSingleton.singleton.Doc.GetXComponent(XFashionDocument.uuID) as XFashionDocument; + ClientFashionData clientFashionData = xfashionDocument.FindFashion(uid); + bool flag3 = clientFashionData != null; + if (flag3) + { + xitem = xfashionDocument.MakeXItem(clientFashionData); + } + } + bool flag4 = xitem != null; + if (flag4) + { + IXUISprite icon2 = null; + bool flag5 = null != icon; + if (flag5) + { + icon2 = (icon.GetComponent("XUISprite") as IXUISprite); + } + this.ShowTooltipDialog(xitem, null, icon2, false, 0u); + } + } + } + + public void ShowSystemHelp(string main, string title, string label) + { + DlgBase.singleton.Load(); + this._ShowSystemHelp(main, title, label, 50); + } + + public void ShowModalDialogWithTitle(string title, string label, string firstBtn, ButtonClickEventHandler handler = null, int depth = 50) + { + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(true); + DlgBase.singleton.SetCloseButtonVisible(false); + this._ShowModalDialog(label, firstBtn, "-", handler, depth, title); + } + + public void ShowModalDialog(string label, string firstBtn) + { + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(true); + this._ShowModalDialog(label, firstBtn, "-", null, 50, ""); + } + + public void ShowModalDialog(string label, string firstBtn, ButtonClickEventHandler handler = null, int depth = 50) + { + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(true); + this._ShowModalDialog(label, firstBtn, "-", handler, depth, ""); + } + + public void ShowModalDialog(string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler = null) + { + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(false); + this._ShowModalDialog(label, firstBtn, secondBtn, handler, 50, ""); + } + + public void ShowModalDialog(string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler = null, int depth = 50) + { + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(false); + this._ShowModalDialog(label, firstBtn, secondBtn, handler, depth, ""); + } + + public void ShowModalDialog(string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler, ButtonClickEventHandler handler2, bool showCloseBtn = false, XTempTipDefine showNoTip = XTempTipDefine.OD_START, int depth = 50) + { + DlgBase.singleton.StartTip = showNoTip; + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(false); + DlgBase.singleton.SetCloseButtonVisible(showCloseBtn); + this._ShowModalDialog(label, firstBtn, secondBtn, handler, handler2, depth); + } + + public void ShowModalDialog(string title, string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler, ButtonClickEventHandler handler2, bool showCloseBtn = false, XTempTipDefine showNoTip = XTempTipDefine.OD_START, int depth = 50) + { + DlgBase.singleton.StartTip = showNoTip; + DlgBase.singleton.Load(); + DlgBase.singleton.SetSingleButtonMode(false); + DlgBase.singleton.SetCloseButtonVisible(showCloseBtn); + DlgBase.singleton.SetTitle(title); + this._ShowModalDialog(label, firstBtn, secondBtn, handler, handler2, depth); + } + + public void ShowModalDialog(string message, ButtonClickEventHandler handler) + { + string @string = XStringDefineProxy.GetString("COMMON_OK"); + string string2 = XStringDefineProxy.GetString("COMMON_CANCEL"); + this.ShowModalDialog(message, @string, string2, handler); + } + + protected void _ShowModalDialog(string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler, ButtonClickEventHandler handler2, int depth = 50) + { + DlgBase.singleton.SetPanelDepth(depth); + DlgBase.singleton._bHasGrey = false; + DlgBase.singleton.SetVisible(false, true); + DlgBase.singleton.SetLabelsWithSymbols(label, firstBtn, secondBtn); + DlgBase.singleton.SetModalCallback(handler, handler2); + DlgBase.singleton.SetTweenTargetAndPlay(DlgBase.singleton.uiBehaviour.gameObject); + } + + protected void _ShowModalDialog(string label, string firstBtn, string secondBtn, ButtonClickEventHandler handler = null, int depth = 50, string title = "") + { + DlgBase.singleton.SetPanelDepth(depth); + DlgBase.singleton._bHasGrey = false; + DlgBase.singleton.SetVisible(false, true); + DlgBase.singleton.SetTitle(title); + DlgBase.singleton.SetLabelsWithSymbols(label, firstBtn, secondBtn); + bool flag = handler == null; + if (flag) + { + DlgBase.singleton.SetModalCallback(new ButtonClickEventHandler(this.FrButtonCallback), null); + } + else + { + DlgBase.singleton.SetModalCallback(handler, null); + } + DlgBase.singleton.SetTweenTargetAndPlay(DlgBase.singleton.uiBehaviour.gameObject); + } + + protected void _ShowSystemHelp(string main, string title, string label, int depth = 50) + { + DlgBase.singleton.SetPanelDepth(depth); + DlgBase.singleton._bHasGrey = false; + DlgBase.singleton.SetVisible(false, true); + DlgBase.singleton.SetLabels(main, title, label); + DlgBase.singleton.SetTweenTargetAndPlay(DlgBase.singleton.uiBehaviour.gameObject); + } + + public void ShowLeaveTeamModalDialog(ButtonClickEventHandler handler, string tips = "") + { + bool flag = tips == ""; + string label; + if (flag) + { + label = XStringDefineProxy.GetString("TEAM_SHOULD_LEAVE_TEAM_CONFIRM"); + } + else + { + label = tips; + } + string @string = XStringDefineProxy.GetString("COMMON_OK"); + string string2 = XStringDefineProxy.GetString("COMMON_CANCEL"); + XSingleton.singleton.ShowModalDialog(label, @string, string2, handler); + } + + public void CloseHelp() + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.SetVisible(false, true); + } + } + + public void CloseModalDlg() + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.SetVisible(false, true); + } + } + + private bool FrButtonCallback(IXUIButton go) + { + DlgBase.singleton.SetVisible(false, true); + XSingleton.singleton.Pause = false; + return true; + } + + public string RoleTypeToString(RoleType type) + { + return "UnknownProf"; + } + + private Vector3 GetScreenPointMin() + { + Vector2 vector; + vector= new Vector3((float)(-(float)XSingleton.singleton.Base_UI_Width / 2), (float)(XSingleton.singleton.Base_UI_Height / 2)); + Vector3 vector2 = XSingleton.singleton.UIRoot.TransformPoint(vector); + return XSingleton.singleton.UICamera.WorldToScreenPoint(vector2); + } + + private Vector3 GetScreenPointMax() + { + Vector2 vector; + vector= new Vector3((float)(XSingleton.singleton.Base_UI_Width / 2), (float)(-(float)XSingleton.singleton.Base_UI_Height / 2)); + Vector3 vector2 = XSingleton.singleton.UIRoot.TransformPoint(vector); + return XSingleton.singleton.UICamera.WorldToScreenPoint(vector2); + } + + public string GetColorStr(Color color) + { + return string.Format("{0:X2}{1:X2}{2:X2}", (uint)(color.r * 255f), (uint)(color.g * 255f), (uint)(color.b * 255f)); + } + + public Color GetColor(float[] rgb) + { + bool flag = rgb == null; + Color result; + if (flag) + { + result = Color.white; + } + else + { + bool flag2 = rgb.Length > 3; + if (flag2) + { + result = new Color(rgb[0] / 255f, rgb[1] / 255f, rgb[2] / 255f, rgb[3] / 100f); + } + else + { + bool flag3 = rgb.Length > 2; + if (flag3) + { + result = new Color(rgb[0] / 255f, rgb[1] / 255f, rgb[2] / 255f); + } + else + { + bool flag4 = rgb.Length > 1; + if (flag4) + { + result = new Color(rgb[0] / 255f, rgb[1] / 255f, 1f); + } + else + { + bool flag5 = rgb.Length != 0; + if (flag5) + { + result = new Color(rgb[0] / 255f, 1f, 1f); + } + else + { + result = Color.white; + } + } + } + } + } + return result; + } + + public string GetItemQualityFrame(int quality, int type) + { + string result; + switch (quality) + { + case 0: + result = "kuang_dj_0"; + break; + case 1: + result = "kuang_dj_1"; + break; + case 2: + result = "kuang_dj_2"; + break; + case 3: + result = "kuang_dj_3"; + break; + case 4: + result = "kuang_dj_4"; + break; + case 5: + result = "kuang_dj_5"; + break; + default: + result = "kuang_dj_0"; + break; + } + return result; + } + + public string GetItemQualityRGB(int quality) + { + string value; + switch (quality) + { + case 0: + value = XSingleton.singleton.GetValue("Quality0Color"); + break; + case 1: + value = XSingleton.singleton.GetValue("Quality1Color"); + break; + case 2: + value = XSingleton.singleton.GetValue("Quality2Color"); + break; + case 3: + value = XSingleton.singleton.GetValue("Quality3Color"); + break; + case 4: + value = XSingleton.singleton.GetValue("Quality4Color"); + break; + case 5: + value = XSingleton.singleton.GetValue("Quality5Color"); + break; + default: + value = XSingleton.singleton.GetValue("Quality0Color"); + break; + } + return value; + } + + public Color GetItemQualityColor(int quality) + { + string itemQualityColorStr = this.GetItemQualityColorStr(quality); + bool flag = string.IsNullOrEmpty(itemQualityColorStr); + Color result; + if (flag) + { + result = Color.white; + } + else + { + result = new Color32(Convert.ToByte(itemQualityColorStr.Substring(0, 2), 16), Convert.ToByte(itemQualityColorStr.Substring(2, 2), 16), Convert.ToByte(itemQualityColorStr.Substring(4, 2), 16), byte.MaxValue); + } + return result; + } + + public Color ConvertRGBStringToColor(string c) + { + return new Color32(Convert.ToByte(c.Substring(0, 2), 16), Convert.ToByte(c.Substring(2, 2), 16), Convert.ToByte(c.Substring(4, 2), 16), byte.MaxValue); + } + + public string GetItemQualityColorStr(int quality) + { + string result = ""; + switch (quality) + { + case 0: + result = XSingleton.singleton.GetValue("Quality0Color"); + break; + case 1: + result = XSingleton.singleton.GetValue("Quality1Color"); + break; + case 2: + result = XSingleton.singleton.GetValue("Quality2Color"); + break; + case 3: + result = XSingleton.singleton.GetValue("Quality3Color"); + break; + case 4: + result = XSingleton.singleton.GetValue("Quality4Color"); + break; + case 5: + result = XSingleton.singleton.GetValue("Quality5Color"); + break; + } + return result; + } + + public string GetItemQualityIcon(int quality) + { + string result; + switch (quality) + { + case 0: + result = "icondjdj_0"; + break; + case 1: + result = "icondjdj_1"; + break; + case 2: + result = "icondjdj_2"; + break; + case 3: + result = "icondjdj_3"; + break; + case 4: + result = "icondjdj_4"; + break; + case 5: + result = "icondjdj_5"; + break; + default: + result = "null"; + break; + } + return result; + } + + public string GetItemQualityName(int quality) + { + string result; + switch (quality) + { + case 0: + result = "D"; + break; + case 1: + result = "C"; + break; + case 2: + result = "B"; + break; + case 3: + result = "A"; + break; + case 4: + result = "S"; + break; + case 5: + result = "L"; + break; + default: + result = string.Empty; + break; + } + return result; + } + + public string GetScorePic(int score) + { + string result; + switch (score) + { + case 1: + result = "F-S"; + break; + case 2: + result = "F-SS"; + break; + case 3: + result = "F-SSS"; + break; + default: + result = ""; + break; + } + return result; + } + + public string GetEquipFusionIconName(int fusionLevel) + { + string result = string.Empty; + switch (fusionLevel) + { + case 1: + result = "equip_0_00000"; + break; + case 2: + result = "equip_1_00000"; + break; + case 3: + result = "equip_2_00000"; + break; + case 4: + result = "equip_3_00000"; + break; + case 5: + result = "equip_4_00000"; + break; + default: + result = "equip_0_00000"; + break; + } + return result; + } + + internal string GetEquipPartName(EquipPosition part, bool bPrefix = true) + { + string result; + switch (part) + { + case EquipPosition.EQUIP_START: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_HEAD); + break; + case EquipPosition.Upperbody: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_UPPERBODY); + break; + case EquipPosition.Lowerbody: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_LOWERBODY); + break; + case EquipPosition.Gloves: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_GLOVES); + break; + case EquipPosition.Boots: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_BOOTS); + break; + case EquipPosition.Mainweapon: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_MAINWEAPON); + break; + case EquipPosition.Secondaryweapon: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_SECWEAPON); + break; + case EquipPosition.Necklace: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_NECKLACE); + break; + case EquipPosition.Earrings: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_EARRING); + break; + case EquipPosition.Rings: + result = XStringDefineProxy.GetString(XStringDefine.ITEM_PART_RING1); + break; + default: + result = ""; + break; + } + return result; + } + + internal string GetFashionPartName(FashionPosition part, bool bPrefix = true) + { + switch (part) + { + case FashionPosition.FASHION_START: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_HEAD); + case FashionPosition.FashionUpperBody: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_UPPERBODY); + case FashionPosition.FashionLowerBody: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_LOWERBODY); + case FashionPosition.FashionGloves: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_GLOVES); + case FashionPosition.FashionBoots: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_BOOTS); + case FashionPosition.FashionMainWeapon: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_MAINWEAPON); + case FashionPosition.FashionSecondaryWeapon: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_SECWEAPON); + case FashionPosition.FashionWings: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_WINGS); + case FashionPosition.FashionTail: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_TAIL); + case FashionPosition.FashionDecal: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_DECAL); + case FashionPosition.Hair: + return (bPrefix ? XStringDefineProxy.GetString(XStringDefine.FASHION_PREFIX) : "") + XStringDefineProxy.GetString(XStringDefine.FASHION_HAIR); + } + return ""; + } + + internal string GetArtifactPartName(ArtifactPosition part, bool bPrefix = true) + { + string result; + switch (part) + { + case ArtifactPosition.ARTIFACT_START: + result = XStringDefineProxy.GetString(XStringDefine.ARTIFACT_ANSAB); + break; + case ArtifactPosition.Grail: + result = XStringDefineProxy.GetString(XStringDefine.ARTIFACT_GRAIL); + break; + case ArtifactPosition.Battleheart: + result = XStringDefineProxy.GetString(XStringDefine.ARTIFACT_BATTLEHEART); + break; + case ArtifactPosition.DragonHorn: + result = XStringDefineProxy.GetString(XStringDefine.ARTIFACT_DRAGONHORN); + break; + default: + result = ""; + break; + } + return result; + } + + public string ChooseProfString(List ProfStringList, uint basicTypeId = 0u) + { + bool flag = ProfStringList.Count == 1; + string result; + if (flag) + { + result = ProfStringList[0]; + } + else + { + bool flag2 = ProfStringList.Count == 0; + if (flag2) + { + result = ""; + } + else + { + bool flag3 = basicTypeId <= 0u; + if (flag3) + { + basicTypeId = XItemDrawerParam.DefaultProfession; + } + int index = (int)(basicTypeId - 1u); + result = ProfStringList[index]; + } + } + return result; + } + + public string ChooseProfString(string[] ProfStringList, uint basicTypeId = 0u) + { + bool flag = ProfStringList == null || ProfStringList.Length == 0; + string result; + if (flag) + { + result = ""; + } + else + { + bool flag2 = ProfStringList.Length == 1; + if (flag2) + { + result = ProfStringList[0]; + } + else + { + bool flag3 = basicTypeId <= 0u; + if (flag3) + { + basicTypeId = XItemDrawerParam.DefaultProfession; + } + int num = (int)(basicTypeId - 1u); + bool flag4 = num < 0 || num >= ProfStringList.Length; + if (flag4) + { + XSingleton.singleton.AddErrorLog("There's no data for prof ", basicTypeId.ToString(), ", data: {", string.Join(", ", ProfStringList), "}", null); + result = string.Empty; + } + else + { + result = ProfStringList[num]; + } + } + } + return result; + } + + internal T ChooseProfData(List ProfDataList, uint basicTypeId = 0u) + { + bool flag = ProfDataList == null || ProfDataList.Count == 0; + T result; + if (flag) + { + result = default(T); + } + else + { + bool flag2 = ProfDataList.Count == 1; + if (flag2) + { + result = ProfDataList[0]; + } + else + { + bool flag3 = basicTypeId <= 0u; + if (flag3) + { + basicTypeId = XItemDrawerParam.DefaultProfession; + } + int num = (int)(basicTypeId - 1u); + bool flag4 = num < 0 || num >= ProfDataList.Count; + if (flag4) + { + XSingleton.singleton.shareSB.Length = 0; + for (int i = 0; i < ProfDataList.Count; i++) + { + bool flag5 = i != 0; + if (flag5) + { + XSingleton.singleton.shareSB.Append(", "); + } + StringBuilder shareSB = XSingleton.singleton.shareSB; + T t = ProfDataList[i]; + shareSB.Append(t.ToString()); + } + XSingleton.singleton.AddErrorLog("There's no data for prof ", basicTypeId.ToString(), ", data: {", XSingleton.singleton.shareSB.ToString(), "}", null); + result = default(T); + } + else + { + result = ProfDataList[num]; + } + } + } + return result; + } + + internal T ChooseProfData(T[] ProfDataList, uint basicTypeId = 0u) + { + bool flag = ProfDataList == null || ProfDataList.Length == 0; + T result; + if (flag) + { + result = default(T); + } + else + { + bool flag2 = ProfDataList.Length == 1; + if (flag2) + { + result = ProfDataList[0]; + } + else + { + bool flag3 = basicTypeId == 0u; + if (flag3) + { + basicTypeId = XItemDrawerParam.DefaultProfession; + } + int num = (int)(basicTypeId - 1u); + bool flag4 = num < 0 || num >= ProfDataList.Length; + if (flag4) + { + XSingleton.singleton.shareSB.Length = 0; + for (int i = 0; i < ProfDataList.Length; i++) + { + bool flag5 = i != 0; + if (flag5) + { + XSingleton.singleton.shareSB.Append(", "); + } + XSingleton.singleton.shareSB.Append(ProfDataList[i].ToString()); + } + XSingleton.singleton.AddErrorLog("There's no data for prof ", basicTypeId.ToString(), ", data: {", XSingleton.singleton.shareSB.ToString(), "}", null); + result = default(T); + } + else + { + result = ProfDataList[num]; + } + } + } + return result; + } + + internal T ChooseProfData(ref SeqListRef ProfDataList, uint basicTypeId = 0u, int index = 0) + { + bool flag = ProfDataList.Count == 0; + T result; + if (flag) + { + result = default(T); + } + else + { + bool flag2 = ProfDataList.Count == 1; + if (flag2) + { + result = ProfDataList[0, index]; + } + else + { + bool flag3 = basicTypeId == 0u; + if (flag3) + { + basicTypeId = XItemDrawerParam.DefaultProfession; + } + int num = (int)(basicTypeId - 1u); + bool flag4 = num < 0 || num >= ProfDataList.Count; + if (flag4) + { + XSingleton.singleton.shareSB.Length = 0; + for (int i = 0; i < ProfDataList.Count; i++) + { + bool flag5 = i != 0; + if (flag5) + { + XSingleton.singleton.shareSB.Append(", "); + } + StringBuilder shareSB = XSingleton.singleton.shareSB; + T t = ProfDataList[i, index]; + shareSB.Append(t.ToString()); + } + XSingleton.singleton.AddErrorLog("There's no data for prof ", basicTypeId.ToString(), ", data: {", XSingleton.singleton.shareSB.ToString(), "}", null); + result = default(T); + } + else + { + result = ProfDataList[num, index]; + } + } + } + return result; + } + + internal string ReplaceReturn(string s) + { + return s.Replace("{n}", "\n"); + } + + public void AddChild(Transform parent, Transform child) + { + child.parent = parent; + child.localPosition = Vector3.zero; + child.localRotation = Quaternion.identity; + child.localScale = Vector3.one; + XSingleton.singleton.m_uiTool.MarkParentAsChanged(child.gameObject); + } + + public void AddChild(GameObject parent, GameObject child) + { + child.transform.parent = parent.transform; + child.transform.localPosition = Vector3.zero; + child.transform.localRotation = Quaternion.identity; + child.transform.localScale = Vector3.one; + XSingleton.singleton.m_uiTool.MarkParentAsChanged(child.gameObject); + } + + public void AddChildNoMark(GameObject parent, GameObject child) + { + child.transform.parent = parent.transform; + child.transform.localPosition = Vector3.zero; + child.transform.localRotation = Quaternion.identity; + child.transform.localScale = Vector3.one; + } + + public void AddChild(IUIRect parent, GameObject child, IXUIPanel panel) + { + child.transform.parent = parent.transform; + child.transform.localPosition = Vector3.zero; + child.transform.localRotation = Quaternion.identity; + child.transform.localScale = Vector3.one; + bool flag = XSingleton.singleton.m_uiTool != null; + if (flag) + { + XSingleton.singleton.m_uiTool.ChangePanel(child, parent, panel); + } + } + + public long GetTimeStamp() + { + return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000L) / 10000000L; + } + + public string TimeFormatSince1970(int elapsedSeconds, string format, bool isCountTimeZone = false) + { + return this.TimeNow((double)elapsedSeconds, isCountTimeZone).ToString(format); + } + + public DateTime TimeNow(double elapsedSeconds, bool isCountTimeZone = false) + { + int num = 0; + if (isCountTimeZone) + { + num = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours; + } + DateTime result = new DateTime(1970, 1, 1, 0, 0, 0); + elapsedSeconds = Math.Max(0.0, elapsedSeconds); + result = result.AddSeconds(elapsedSeconds + (double)(num * 3600)); + return result; + } + + public double TimeFormatLastTime(double elapsedSeconds, bool isCountTimeZone = false) + { + return (this.TimeNow(elapsedSeconds, isCountTimeZone) - DateTime.Now).TotalSeconds; + } + + public string TimeFormatString(int totalSecond, int lowCount = 0, int upCount = 3, int minUnit = 4, bool isCarry = false, bool needPadLeft = true) + { + this._Timebuilder.Length = 0; + upCount = Math.Min(3, upCount); + int num = 2 + (3 - upCount); + if (isCarry) + { + totalSecond = (int)Math.Ceiling((double)totalSecond / (double)this.TimeDuaration[minUnit]) * this.TimeDuaration[minUnit]; + } + int i = num; + while (i < 5) + { + int num2 = totalSecond / this.TimeDuaration[i]; + totalSecond %= this.TimeDuaration[i]; + bool flag = 5 - i > 4 - minUnit + lowCount && this._Timebuilder.Length == 0; + if (!flag) + { + goto IL_96; + } + bool flag2 = num2 == 0; + if (!flag2) + { + goto IL_96; + } + IL_118: + i++; + continue; + IL_96: + bool flag3 = this._Timebuilder.Length != 0; + if (flag3) + { + this._Timebuilder.Append(":"); + } + bool flag4 = i == 2 || !needPadLeft; + if (flag4) + { + this._Timebuilder.Append(num2.ToString()); + } + else + { + this._Timebuilder.Append(num2.ToString().PadLeft(2, '0')); + } + bool flag5 = i == minUnit; + if (flag5) + { + return this._Timebuilder.ToString(); + } + goto IL_118; + } + return this._Timebuilder.ToString(); + } + + public string TimeFormatString(float totalSecondFloat, int lowCount = 0, int upCount = 3, int minUnit = 4, bool isCarry = false) + { + this.TimeFormatString((int)totalSecondFloat, lowCount, upCount, minUnit, isCarry, true); + totalSecondFloat %= 1f; + totalSecondFloat *= 100f; + this._Timebuilder.Append(string.Format(".{0}", ((int)totalSecondFloat).ToString().PadLeft(2, '0'))); + return this._Timebuilder.ToString(); + } + + public string TimeAgoFormatString(int totalSecond) + { + bool flag = totalSecond < 0; + string @string; + if (flag) + { + @string = XStringDefineProxy.GetString("ONLINE"); + } + else + { + for (int i = 0; i < 5; i++) + { + int num = this.TimeDuaration[i]; + int num2 = totalSecond / num; + bool flag2 = num2 > 0; + if (flag2) + { + return string.Format("{0}{1}{2}", num2.ToString(), XStringDefineProxy.GetString(this.TimeDuarationName[i]), XStringDefineProxy.GetString("AGO")); + } + } + @string = XStringDefineProxy.GetString("JUSTNOW"); + } + return @string; + } + + public string TimeOnOrOutFromString(int totalSecond) + { + bool flag = totalSecond < 0; + string @string; + if (flag) + { + @string = XStringDefineProxy.GetString("ONLINE"); + } + else + { + @string = XStringDefineProxy.GetString("OUTLINE"); + } + return @string; + } + + public string TimeAccFormatString(int totalSecond, int minTime, int maxTime = 0) + { + bool flag = totalSecond < 0; + string @string; + if (flag) + { + @string = XStringDefineProxy.GetString("ONLINE"); + } + else + { + for (int i = maxTime; i < 5; i++) + { + int num = this.TimeDuaration[i]; + int num2 = totalSecond / num; + bool flag2 = num2 > 0 || i == minTime; + if (flag2) + { + return string.Format("{0}{1}", ((num2 > 0) ? num2 : 1).ToString(), XStringDefineProxy.GetString(this.TimeDuarationName[i])); + } + } + @string = XStringDefineProxy.GetString("JUSTNOW"); + } + return @string; + } + + public string TimeDuarationFormatString(int totalSecond, int minTime = 5) + { + StringBuilder stringBuilder = new StringBuilder(); + bool flag = false; + bool flag2 = totalSecond <= 0; + if (flag2) + { + stringBuilder.Append(0).Append(XStringDefineProxy.GetString("SECOND_DUARATION")); + } + else + { + for (int i = 0; i < minTime; i++) + { + int num = this.TimeDuaration[i]; + int num2 = totalSecond / num; + bool flag3 = num2 > 0; + if (flag3) + { + flag = true; + } + bool flag4 = flag; + if (flag4) + { + stringBuilder.Append(num2).Append(XStringDefineProxy.GetString(this.TimeName[i])); + } + totalSecond -= num2 * num; + bool flag5 = totalSecond == 0; + if (flag5) + { + break; + } + } + } + return stringBuilder.ToString(); + } + + public string TimeDuarationFormatSizeString(int totalSecond, int size = 5, int start = 0) + { + StringBuilder stringBuilder = new StringBuilder(); + bool flag = false; + int num = 0; + bool flag2 = totalSecond <= 0; + if (flag2) + { + stringBuilder.Append(0).Append(XStringDefineProxy.GetString("SECOND_DUARATION")); + } + else + { + for (int i = start; i < 5; i++) + { + int num2 = this.TimeDuaration[i]; + int num3 = totalSecond / num2; + bool flag3 = num3 > 0; + if (flag3) + { + flag = true; + } + bool flag4 = flag; + if (flag4) + { + num++; + stringBuilder.Append(num3).Append(XStringDefineProxy.GetString(this.TimeName[i])); + } + totalSecond -= num3 * num2; + bool flag5 = totalSecond == 0 || num >= size; + if (flag5) + { + break; + } + } + } + return stringBuilder.ToString(); + } + + public string TimeDurationBackFormatString(int totalSecond, int minTime = 5) + { + StringBuilder stringBuilder = new StringBuilder(); + bool flag = false; + bool flag2 = totalSecond <= 0; + if (flag2) + { + stringBuilder.Append(0).Append(XStringDefineProxy.GetString("SECOND_DUARATION")); + } + else + { + for (int i = 0; i < minTime; i++) + { + int num = this.TimeDuaration[i]; + int num2 = totalSecond / num; + bool flag3 = num2 > 0; + if (flag3) + { + flag = true; + } + bool flag4 = flag; + if (flag4) + { + stringBuilder.Append(num2).Append(XStringDefineProxy.GetString(this.TimeName[i])); + } + totalSecond -= num2 * num; + bool flag5 = totalSecond == 0; + if (flag5) + { + break; + } + } + } + return stringBuilder.ToString(); + } + + public string NumberFormat(int number) + { + bool flag = number < 0; + number = Math.Abs(number); + bool flag2 = number < 10000; + string text; + if (flag2) + { + text = number.ToString(); + } + else + { + number /= 10000; + text = number.ToString() + "W"; + } + bool flag3 = flag; + if (flag3) + { + text = "-" + text; + } + return text; + } + + public string NumberFormat(ulong number) + { + bool flag = number < XSingleton.singleton.MinSeparateNum; + string result; + if (flag) + { + result = number.ToString(); + } + else + { + ulong[] numberSeparators = XSingleton.singleton.NumberSeparators; + int num = -1; + for (int i = 0; i < numberSeparators.Length; i++) + { + bool flag2 = numberSeparators[i] <= number; + if (!flag2) + { + break; + } + num = i; + } + bool flag3 = num == -1; + if (flag3) + { + result = number.ToString(); + } + else + { + bool flag4 = this.NumberSeparatorNames == null; + if (flag4) + { + this.NumberSeparatorNames = new string[numberSeparators.Length]; + for (int j = 0; j < numberSeparators.Length; j++) + { + this.NumberSeparatorNames[j] = "NumberSeparator" + j.ToString(); + } + } + result = string.Format("{0}{1}", (number / numberSeparators[num]).ToString(), XStringDefineProxy.GetString(this.NumberSeparatorNames[num])); + } + } + return result; + } + + public string NumberFormatBillion(ulong number) + { + double num = 100000000.0; + bool flag = number > num; + string result; + if (flag) + { + double num2 = number / num; + ulong num3 = (ulong)(num2 * 100.0); + double num4 = num3 / 100.0; + result = string.Format("{0}{1}", num4, XStringDefineProxy.GetString("NumberSeparator1")); + } + else + { + result = this.NumberFormat(number); + } + return result; + } + + public string GetBagExpandFullTips(BagType type) + { + string result; + switch (type) + { + case BagType.EquipBag: + result = XSingleton.singleton.GetString("ExpandEquipBagFull"); + break; + case BagType.EmblemBag: + result = XSingleton.singleton.GetString("ExpandEmbleBagFull"); + break; + case BagType.ArtifactBag: + result = XSingleton.singleton.GetString("ExpandArtifactBagFull"); + break; + case BagType.ItemBag: + result = XSingleton.singleton.GetString("ExpandItemBagFull"); + break; + default: + result = string.Empty; + break; + } + return result; + } + + public Transform FindChild(Transform dlg, string childName) + { + string text = childName; + bool flag = childName.Contains("?profession?"); + if (flag) + { + int num = XFastEnumIntEqualityComparer.ToInt(XSingleton.singleton.XPlayerData.Profession) % 10; + childName = childName.Replace("?profession?", num.ToString()); + text = text.Replace("?profession?", num.ToString()); + } + bool flag2 = childName.Contains("?profession1turn?"); + if (flag2) + { + int num2 = XFastEnumIntEqualityComparer.ToInt(XSingleton.singleton.XPlayerData.Profession); + bool flag3 = num2 >= 10; + if (flag3) + { + int num3 = num2 % 100 / 10 + num2 % 10 * 2 - 2; + childName = childName.Replace("?profession1turn?", num3.ToString("d2")); + text = text.Replace("?profession1turn?", num3.ToString("d2")); + } + } + bool flag4 = childName.Contains("{"); + Transform result; + if (flag4) + { + int num4 = childName.IndexOf("{"); + int num5 = childName.IndexOf("}"); + int num6 = int.Parse(childName.Substring(num4 + 1, num5 - num4 - 1)) - 1; + string text2 = childName.Substring(0, num4 - 1); + string text3 = childName.Substring(num5 + 1); + Transform transform = dlg.Find(text2); + bool flag5 = transform == null; + if (flag5) + { + result = null; + } + else + { + bool flag6 = num6 >= transform.childCount; + if (flag6) + { + result = null; + } + else + { + Transform transform2 = null; + int num7 = -1; + for (int i = 0; i < transform.childCount; i++) + { + transform2 = transform.GetChild(i); + bool activeSelf = transform2.gameObject.activeSelf; + if (activeSelf) + { + num7++; + } + bool flag7 = num6 == num7; + if (flag7) + { + break; + } + } + bool flag8 = text3 != ""; + if (flag8) + { + result = transform2.Find(text3.Substring(1)); + } + else + { + result = transform2; + } + } + } + } + else + { + Transform transform3 = dlg.Find(text); + result = transform3; + } + return result; + } + + public int GetItemCount(int itemID) + { + return XSingleton.singleton.Doc.XBagDoc.ItemBag.GetItemCount(itemID); + } + + public bool IsMaxBuyPowerCnt() + { + return this.IsMaxBuyCnt(ItemEnum.FATIGUE); + } + + public bool IsMaxBuyCnt(ItemEnum type) + { + int level = (int)XSingleton.singleton.XPlayerData.Level; + XRechargeDocument specificDocument = XDocuments.GetSpecificDocument(XRechargeDocument.uuID); + int vipLevel = (int)specificDocument.VipLevel; + XPurchaseDocument specificDocument2 = XDocuments.GetSpecificDocument(XPurchaseDocument.uuID); + XPurchaseInfo purchaseInfo = specificDocument2.GetPurchaseInfo(level, vipLevel, type); + return purchaseInfo.totalBuyNum <= purchaseInfo.curBuyNum; + } + + public bool CanEnterBattleScene(uint sceneID) + { + return this.CanEnterBattleScene(sceneID, 1); + } + + public bool CanEnterBattleScene(uint sceneID, int cnt) + { + SceneTable.RowData sceneData = XSingleton.singleton.GetSceneData(sceneID); + bool flag = sceneData == null; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = true; + for (int i = 0; i < sceneData.FatigueCost.Count; i++) + { + int num = 0; + bool flag3 = sceneData.FatigueCost[i, 0] <= 50; + if (flag3) + { + num = (int)XSingleton.singleton.Doc.XBagDoc.GetVirtualItemCount((ItemEnum)sceneData.FatigueCost[i, 0]); + } + else + { + int num2 = -1; + XSingleton.singleton.Doc.XBagDoc.ItemBag.FindItem((ulong)((long)sceneData.FatigueCost[i, 0]), out num2); + bool flag4 = num2 >= 0; + if (flag4) + { + XItem xitem = XSingleton.singleton.Doc.XBagDoc.ItemBag[num2]; + num = xitem.itemCount; + } + } + bool flag5 = num < sceneData.FatigueCost[i, 1]; + if (flag5) + { + flag2 = false; + break; + } + } + result = flag2; + } + return result; + } + + public void ShowLoginTip(string text) + { + DlgBase.singleton.ShowTips(text); + } + + public void StopLoginTip() + { + DlgBase.singleton.StopTips(); + } + + public void ShowSystemTip(string text, string rgb = "fece00") + { + XSystemTipDocument specificDocument = XDocuments.GetSpecificDocument(XSystemTipDocument.uuID); + bool flag = specificDocument != null; + if (flag) + { + specificDocument.ShowTip(text, rgb); + } + } + + public void ShowSystemTip(int errcode, string rgb = "fece00") + { + XSystemTipDocument specificDocument = XDocuments.GetSpecificDocument(XSystemTipDocument.uuID); + bool flag = specificDocument != null; + if (flag) + { + specificDocument.ShowTip(XStringDefineProxy.GetString((ErrorCode)errcode), rgb); + } + } + + public void ShowSystemTip(ErrorCode errcode, string rgb = "fece00") + { + XSystemTipDocument specificDocument = XDocuments.GetSpecificDocument(XSystemTipDocument.uuID); + bool flag = specificDocument != null; + if (flag) + { + specificDocument.ShowTip(this.ReplaceReturn(XStringDefineProxy.GetString(errcode)), rgb); + } + } + + public void OnGetInvalidRequest(string name) + { + XSingleton.singleton.AddErrorLog("GetInvalidRequest: ", name, null, null, null, null); + } + + public uint ShowSystemNoticeTip(string text) + { + XShowGetItemDocument specificDocument = XDocuments.GetSpecificDocument(XShowGetItemDocument.uuID); + return specificDocument.AddTip(text); + } + + public void EditSystemNoticeTip(string text, uint id) + { + XShowGetItemDocument specificDocument = XDocuments.GetSpecificDocument(XShowGetItemDocument.uuID); + specificDocument.EditTip(text, id); + } + + public int GetRowCount(int count, int columnCount) + { + bool flag = count <= 0; + int result; + if (flag) + { + result = 0; + } + else + { + result = (count - 1) / columnCount + 1; + } + return result; + } + + public void SetVirtualItem(XNumberTween numTween, ulong num, bool bAnim = true, string postfix = "") + { + numTween.SetNumberWithTween(num, postfix, !bAnim, true); + bool flag = !bAnim; + if (!flag) + { + IXUITweenTool iconTween = numTween.IconTween; + bool flag2 = iconTween != null; + if (flag2) + { + iconTween.PlayTween(true, -1f); + } + } + } + + public void ShowItemAccess(int itemid, AccessCallback callback = null) + { + ItemList.RowData itemConf = XBagDocument.GetItemConf(itemid); + bool flag = itemConf != null && itemConf.Access.Count > 0; + if (flag) + { + List list = new List(); + List list2 = new List(); + for (int i = 0; i < itemConf.Access.Count; i++) + { + list.Add(itemConf.Access[i, 0]); + list2.Add(itemConf.Access[i, 1]); + } + DlgBase.singleton.ShowAccess(itemid, list, list2, callback); + } + } + + public void OnItemClick(IXUISprite sp) + { + int itemID = (int)sp.ID; + this.ShowTooltipDialog(itemID, sp, 0u); + } + + public void OnBindItemClick(IXUISprite sp) + { + int itemID = (int)sp.ID; + XSingleton.singleton.bBinded = true; + this.ShowTooltipDialog(itemID, sp, 0u); + } + + public void SetUIDepthDelta(GameObject go, int delta) + { + IXUITool uiTool = XSingleton.singleton.m_uiTool; + uiTool.SetUIDepthDelta(go, delta); + } + + public void UpdateWifi(IXUIButton btn, IXUISprite spr) + { + bool flag = this.wifi_green == 0u || this.wifi_yellow == 0u; + if (flag) + { + this.wifi_green = uint.Parse(XSingleton.singleton.GetValue("WIFI_GREEN")); + this.wifi_yellow = uint.Parse(XSingleton.singleton.GetValue("WIFI_YELO")); + } + long delay = XSingleton.singleton.GetDelay(); + bool flag2 = delay <= (long)((ulong)this.wifi_green); + if (flag2) + { + this.wifiBtn = "xh_2"; + bool flag3 = btn != null; + if (flag3) + { + btn.SetAlpha(1f); + } + bool flag4 = spr != null; + if (flag4) + { + spr.SetAlpha(1f); + } + } + else + { + bool flag5 = delay <= (long)((ulong)this.wifi_yellow); + if (flag5) + { + this.wifiBtn = "xh_1"; + bool flag6 = btn != null; + if (flag6) + { + btn.SetAlpha(1f); + } + bool flag7 = spr != null; + if (flag7) + { + spr.SetAlpha(1f); + } + } + else + { + this.wifiBtn = "xh_0"; + bool flag8 = btn != null; + if (flag8) + { + btn.SetAlpha(1f); + } + bool flag9 = spr != null; + if (flag9) + { + spr.SetAlpha(1f); + } + } + } + bool flag10 = btn != null; + if (flag10) + { + btn.SetSprites(this.wifiBtn, this.wifiBtn, this.wifiBtn); + } + bool flag11 = spr != null; + if (flag11) + { + spr.SetSprite(this.wifiBtn); + } + bool flag12 = delay >= XServerTimeMgr.SyncTimeOut; + if (flag12) + { + bool flag13 = this.wifi_cur >= 1f && this.wifi_forward; + if (flag13) + { + this.wifi_forward = false; + } + bool flag14 = this.wifi_cur <= 0f && !this.wifi_forward; + if (flag14) + { + this.wifi_forward = true; + } + this.wifi_cur = (this.wifi_forward ? (Time.time % this.wifi_duration / this.wifi_duration) : (1f - Time.time % this.wifi_duration / this.wifi_duration)); + bool flag15 = btn != null; + if (flag15) + { + btn.SetAlpha(this.wifi_cur); + } + bool flag16 = spr != null; + if (flag16) + { + spr.SetAlpha(this.wifi_cur); + } + } + } + + public bool IsWeakNetwork() + { + uint num = uint.Parse(XSingleton.singleton.GetValue("WIFI_GREEN")); + uint num2 = uint.Parse(XSingleton.singleton.GetValue("WIFI_YELO")); + long delay = XSingleton.singleton.GetDelay(); + bool flag = delay <= (long)((ulong)num) || delay <= (long)((ulong)num2); + return !flag; + } + + public void RefreshPing(IXUILabel _time, IXUISlider _slider, IXUILabel _free) + { + string batteryLevel = XSingleton.singleton.XPlatform.GetBatteryLevel(); + string text = DateTime.Now.ToString("HH:mm"); + bool flag = _time != null; + if (flag) + { + _time.SetText(text); + } + int num = 100; + int.TryParse(batteryLevel, out num); + bool flag2 = _slider != null; + if (flag2) + { + _slider.Value = (float)num / 100f; + } + bool flag3 = _free != null; + if (flag3) + { + _free.Alpha = (float)(XSingleton.singleton.freeflow ? 1 : 0); + } + } + + public bool IsSystemExpress(string txt) + { + byte[] bytes = Encoding.UTF8.GetBytes(txt); + bool flag = bytes == null || bytes.Length <= 1; + return !flag && bytes[0] == 240; + } + + public string StripInvalidUnicodeCharacters(string str) + { + return str; + } + + public void ShowAfterLoginAnnouncement(PlatNotice announcement) + { + bool flag = announcement == null; + if (!flag) + { + bool isopen = announcement.isopen; + if (isopen) + { + DlgBase.singleton.ShowAnnouncement(announcement.content); + } + } + } + + public void ShowPatface() + { + DlgBase.singleton.bShow = true; + RpcC2M_FetchPlatNotice rpcC2M_FetchPlatNotice = new RpcC2M_FetchPlatNotice(); + rpcC2M_FetchPlatNotice.oArg.type = XSingleton.singleton.AccountType; + RuntimePlatform platform = Application.platform; + if ((int)platform != 8) + { + if ((int)platform == 11) + { + rpcC2M_FetchPlatNotice.oArg.platid = PlatType.PLAT_ANDROID; + } + } + else + { + rpcC2M_FetchPlatNotice.oArg.platid = PlatType.PLAT_IOS; + } + XSingleton.singleton.Send(rpcC2M_FetchPlatNotice); + } + + public string GlobalConfigGetValue(string cfgName) + { + return XSingleton.singleton.GetValue(cfgName); + } + + public Color StringToColor(string str) + { + bool flag = string.IsNullOrEmpty(str); + Color result; + if (flag) + { + result = Color.white; + } + else + { + int num = int.Parse(str, NumberStyles.AllowHexSpecifier); + float num2 = (float)(num / 65536); + float num3 = (float)(num / 256 % 256); + float num4 = (float)(num % 256); + result = new Color(num2 / 255f, num3 / 255f, num4 / 255f); + } + return result; + } + + public string GetChatDesignation(uint desID, string specDesi, string name = "") + { + XDesignationDocument specificDocument = XDocuments.GetSpecificDocument(XDesignationDocument.uuID); + DesignationTable.RowData byID = specificDocument._DesignationTable.GetByID((int)desID); + bool flag = byID == null || !byID.ShowInChat; + string result; + if (flag) + { + result = name; + } + else + { + bool flag2 = byID.Effect != ""; + if (flag2) + { + result = string.Format("{0}{1}", XLabelSymbolHelper.FormatDesignation(byID.Atlas, byID.Effect, 16), name); + } + else + { + bool flag3 = name != ""; + if (flag3) + { + name = string.Format(" {0}", name); + } + bool special = byID.Special; + if (special) + { + result = string.Format("{0}{1}[-]{2}", byID.Color, specDesi, name); + } + else + { + result = string.Format("{0}{1}[-]{2}", byID.Color, byID.Designation, name); + } + } + } + return result; + } + + public string SetChatCoverDesignation(string name, uint desID, bool justPicDesc = false) + { + XDesignationDocument specificDocument = XDocuments.GetSpecificDocument(XDesignationDocument.uuID); + DesignationTable.RowData byID = specificDocument._DesignationTable.GetByID((int)desID); + string text = string.Format("{0}{1}", XSingleton.singleton.GetValue("XUILabelSymbolNameColor"), name); + bool flag = byID == null || byID.Effect != ""; + if (flag) + { + bool flag2 = byID != null; + if (flag2) + { + text = string.Format("{0}{1}", XLabelSymbolHelper.FormatDesignation(byID.Atlas, byID.Effect, 16), text); + } + } + else + { + bool flag3 = !justPicDesc; + if (flag3) + { + text = string.Format("{0}{1} {2}", XSingleton.singleton.GetValue("XUILabelSymbolDesignationColor"), byID.Designation, text); + } + } + return text; + } + + public Color ParseColor(string text, int offset) + { + int num = this.HexToDecimal(text[offset]) << 4 | this.HexToDecimal(text[offset + 1]); + int num2 = this.HexToDecimal(text[offset + 2]) << 4 | this.HexToDecimal(text[offset + 3]); + int num3 = this.HexToDecimal(text[offset + 4]) << 4 | this.HexToDecimal(text[offset + 5]); + float num4 = 0.003921569f; + return new Color(num4 * (float)num, num4 * (float)num2, num4 * (float)num3); + } + + public int HexToDecimal(char ch) + { + switch (ch) + { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + case ':': + case ';': + case '<': + case '=': + case '>': + case '?': + case '@': + goto IL_D4; + case 'A': + break; + case 'B': + goto IL_BB; + case 'C': + goto IL_C0; + case 'D': + goto IL_C5; + case 'E': + goto IL_CA; + case 'F': + goto IL_CF; + default: + switch (ch) + { + case 'a': + break; + case 'b': + goto IL_BB; + case 'c': + goto IL_C0; + case 'd': + goto IL_C5; + case 'e': + goto IL_CA; + case 'f': + goto IL_CF; + default: + goto IL_D4; + } + break; + } + return 10; + IL_BB: + return 11; + IL_C0: + return 12; + IL_C5: + return 13; + IL_CA: + return 14; + IL_CF: + return 15; + IL_D4: + return 15; + } + + public void ShowFatigueSureDlg(ButtonClickEventHandler handler) + { + string label = string.Format(XStringDefineProxy.GetString("FATIGUEOVERFLOWTIPS"), XSingleton.singleton.GetValue("MaxFatigue")); + string @string = XStringDefineProxy.GetString("COMMON_OK"); + string string2 = XStringDefineProxy.GetString("COMMON_CANCEL"); + XSingleton.singleton.ShowModalDialog(label, @string, string2, handler, 100); + } + + public void ShowRank(IXUISprite sp, IXUILabel label, int rank) + { + bool flag = 1 <= rank && rank <= 3; + if (flag) + { + sp.gameObject.SetActive(true); + label.gameObject.SetActive(false); + bool flag2 = rank == 1; + if (flag2) + { + sp.SetSprite("N1"); + } + bool flag3 = rank == 2; + if (flag3) + { + sp.SetSprite("N2"); + } + bool flag4 = rank == 3; + if (flag4) + { + sp.SetSprite("N3"); + } + } + else + { + sp.gameObject.SetActive(false); + label.gameObject.SetActive(true); + bool flag5 = rank <= 0; + if (flag5) + { + label.SetText(XStringDefineProxy.GetString("NoRank")); + } + else + { + label.SetText(rank.ToString()); + } + } + } + + public void DestroyTextureInActivePool(XUIPool pool, string path) + { + List list = ListPool.Get(); + pool.GetActiveList(list); + for (int i = 0; i < list.Count; i++) + { + GameObject gameObject = list[i]; + IXUITexture ixuitexture = gameObject.transform.Find("path").GetComponent("XUITexture") as IXUITexture; + bool flag = ixuitexture != null; + if (flag) + { + ixuitexture.SetTexturePath(""); + } + } + ListPool.Release(list); + } + + public void SetMiniMapOpponentStatus(bool hide) + { + BattleIndicateHandler.SetMiniMapOpponentStatus(hide); + } + + public string GetItemTypeStr(ItemType type) + { + return this.GetItemTypeStr(XFastEnumIntEqualityComparer.ToInt(type)); + } + + public string GetItemTypeStr(int type) + { + return XStringDefineProxy.GetString(XSingleton.singleton.StringCombine("ItemType", type.ToString())); + } + + public void OnPayCallback(string msg) + { + XRechargeDocument specificDocument = XDocuments.GetSpecificDocument(XRechargeDocument.uuID); + specificDocument.OnPayCallback(msg); + } + + public void SDKPandoraBuyGoods(string json) + { + XRechargeDocument specificDocument = XDocuments.GetSpecificDocument(XRechargeDocument.uuID); + specificDocument.SDKPandoraBuyGoods(json); + } + + public void OnQQVipPayCallback(string msg) + { + XPlatformAbilityDocument specificDocument = XDocuments.GetSpecificDocument(XPlatformAbilityDocument.uuID); + specificDocument.OnQQVipPayCallback(msg); + } + + public void OnGameCenterWakeUp(int type) + { + XSingleton.singleton.AddLog("[OnGameCenterWakeUp] StartUpType = " + type, null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = (type == 2 && XSingleton.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ) || (type == 3 && XSingleton.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat); + if (flag) + { + XSingleton.singleton.AddLog("[OnGameCenterWakeUp] PtcC2N_UpdateStartUpTypeNtf type = " + type, null, null, null, null, null, XDebugColor.XDebug_None); + PtcC2N_UpdateStartUpTypeNtf ptcC2N_UpdateStartUpTypeNtf = new PtcC2N_UpdateStartUpTypeNtf(); + ptcC2N_UpdateStartUpTypeNtf.Data.type = (StartUpType)type; + XSingleton.singleton.Send(ptcC2N_UpdateStartUpTypeNtf); + DlgBase.singleton.RefreshGameCenterInfo(); + } + } + + public void OnGetPlatFriendsInfo() + { + XSingleton.singleton.AddLog("[UiUtility] OnGetPlatFriendsInfo", null, null, null, null, null, XDebugColor.XDebug_None); + XFriendsDocument.Doc.SyncPlatFriendsInfo(); + XSingleton.singleton.SetFriendServerIcon(); + XSingleton.singleton.XPlatform.SendGameExData("QuerySelf", ""); + bool flag = XSingleton.singleton.playerInfo != null; + if (flag) + { + string pictureLarge = XSingleton.singleton.playerInfo.data.pictureLarge; + XSingleton.singleton.SetMainIcon(pictureLarge); + } + } + + public void SerialHandle3DTouch(string msg) + { + XSingleton.singleton.OnProcess3DTouch(msg); + } + + public void SerialHandleScreenLock(string msg) + { + } + + public void OnPayMarketingInfo(List listInfo) + { + XRechargeDocument specificDocument = XDocuments.GetSpecificDocument(XRechargeDocument.uuID); + specificDocument.OnGetPayMarketingInfo(listInfo); + } + + public void ShowSettingNumberDialog(uint itemID, string title, uint min, uint max, uint step, ModalSettingNumberDlg.GetInputNumber handler, int depth = 50) + { + DlgBase.singleton.Load(); + DlgBase.singleton.MaxNumber = max; + DlgBase.singleton.MinNumber = min; + DlgBase.singleton.Title = title; + DlgBase.singleton.step = step; + DlgBase.singleton.ItemID = itemID; + DlgBase.singleton.SetModalInfo(handler); + DlgBase.singleton.SetVisible(true, true); + } + + public string GetPartitionId() + { + return XSingleton.singleton.ServerID.ToString(); + } + + public string GetRoleId() + { + bool flag = XSingleton.singleton.Player != null; + string result; + if (flag) + { + result = XSingleton.singleton.Player.Attributes.RoleID.ToString(); + } + else + { + result = "0"; + } + return result; + } + + public void OnReplayStart() + { + bool flag = !DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.isPlaying = true; + DlgBase.singleton.Show(true); + } + } + + public void OnSetBg(bool on) + { + XSingleton.singleton.SetBackMusicOn(on); + } + + public void OpenHtmlUrl(string key) + { + Dictionary dictionary = new Dictionary(); + dictionary["url"] = XSingleton.singleton.GetValue(key); + dictionary["screendir"] = "SENSOR"; + XSingleton.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary)); + } + + public void CloseSysAndNoticeServer(uint sysID) + { + PtcC2G_CloseHintNtf ptcC2G_CloseHintNtf = new PtcC2G_CloseHintNtf(); + ptcC2G_CloseHintNtf.Data.systemid = sysID; + XSingleton.singleton.Send(ptcC2G_CloseHintNtf); + XSingleton.singleton.SetSysRedPointState((XSysDefine)sysID, false); + XSingleton.singleton.RecalculateRedPointState((XSysDefine)sysID, true); + } + + public void OpenUrl(string url, bool landscape) + { + Dictionary dictionary = new Dictionary(); + dictionary["url"] = url; + dictionary["screendir"] = (landscape ? "LANDSCAPE" : "SENSOR"); + XSingleton.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary)); + } + + public void Shuffle(ref List list) + { + for (int i = list.Count - 1; i > 0; i--) + { + int num = XSingleton.singleton.RandomInt(0, i + 1); + bool flag = num != i; + if (flag) + { + T value = list[i]; + list[i] = list[num]; + list[num] = value; + } + } + } + + public void OnSetWebViewMenu(int menutype) + { + DlgBase.singleton.OnSetWebViewMenu(menutype); + } + + public void OnWebViewBackGame(int backtype) + { + DlgBase.singleton.OnWebViewBackGame(backtype); + } + + public void OnWebViewRefershRefPoint(string jsonstr) + { + DlgBase.singleton.OnWebViewRefershRefPoint(jsonstr); + } + + public void OnWebViewSetheaderInfo(string jsonstr) + { + DlgBase.singleton.OnWebViewSetheaderInfo(jsonstr); + } + + public void OnWebViewCloseLoading(int show) + { + DlgBase.singleton.OnWebViewCloseLoading(show); + } + + public void OnWebViewShowReconnect(int show) + { + DlgBase.singleton.OnWebViewShowReconnect(show); + } + + public void OnWebViewClose() + { + bool flag = DlgBase.singleton.IsLoaded(); + if (flag) + { + DlgBase.singleton.SetVisible(false, true); + } + } + + public void OnWebViewLiveTab() + { + bool flag = DlgBase.singleton.IsLoaded(); + if (flag) + { + DlgBase.singleton.OnTabLive(); + } + } + + public void ShowPandoraPopView(bool bShow) + { + bool flag = bShow && XSingleton.singleton.GameCamera != null && XSingleton.singleton.GameCamera.UnityCamera != null && !XSingleton.singleton.GameCamera.UnityCamera.enabled; + if (flag) + { + XSingleton.singleton.GameCamera.UnityCamera.enabled = true; + } + XSingleton.singleton.AddGreenLog("Pandora UiUtiliy ShowPandoraPopView bShow = " + bShow.ToString(), null, null, null, null, null); + DlgBase.singleton.SetVisible(bShow, true); + } + + public void OnWXGroupResult(string apiId, string result, int error, WXGroupCallBackType type) + { + if (type != WXGroupCallBackType.DragonGuild) + { + if (type == WXGroupCallBackType.Guild) + { + DlgBase.singleton.GuildGroupResult(apiId, result, error); + } + } + else + { + XSingleton.singleton.wxGroupCallbackType = WXGroupCallBackType.Guild; + XDragonGuildDocument.Doc.View.DragonGuildGroupResult(apiId, result, error); + } + } + + public void RefreshWXGroupBtn(WXGroupCallBackType type) + { + if (type != WXGroupCallBackType.DragonGuild) + { + if (type == WXGroupCallBackType.Guild) + { + DlgBase.singleton.RefreshWXGroupBtn(); + } + } + else + { + XSingleton.singleton.wxGroupCallbackType = WXGroupCallBackType.Guild; + XDragonGuildDocument.Doc.RefreshWXGroupBtn(); + } + } + + public void NoticeShareResult(string result, ShareCallBackType type) + { + XSingleton.singleton.AddLog("NoticeShareResult " + result + ", type = " + type.ToString(), null, null, null, null, null, XDebugColor.XDebug_None); + bool flag = type != ShareCallBackType.AddQQFriend; + if (flag) + { + this.ShowSystemTip((result == "Success") ? XSingleton.singleton.GetString("GUILD_GROUP_SHARE_SUC") : XSingleton.singleton.GetString("GUILD_GROUP_SHARE_FAIL"), "fece00"); + } + else + { + this.ShowSystemTip((result == "Success") ? XSingleton.singleton.GetString("FRIEND_ADD_QQ_FRIEND_SEND_SUC") : XSingleton.singleton.GetString("FRIEND_ADD_QQ_FRIEND_SEND_FAIL"), "fece00"); + } + switch (type) + { + case ShareCallBackType.Normal: + XSingleton.singleton.NoticePandoraShareResult(result); + break; + case ShareCallBackType.GloryPic: + { + XAchievementDocument specificDocument = XDocuments.GetSpecificDocument(XAchievementDocument.uuID); + bool flag2 = result.Contains("Success"); + if (flag2) + { + specificDocument.SendWeekShareSuccess(0u); + } + break; + } + case ShareCallBackType.DungeonShare: + { + XSingleton.singleton.AddLog("DungeonShare " + result, null, null, null, null, null, XDebugColor.XDebug_None); + XAchievementDocument specificDocument2 = XDocuments.GetSpecificDocument(XAchievementDocument.uuID); + bool flag3 = result.Contains("Success"); + if (flag3) + { + specificDocument2.SendWeekShareSuccess(specificDocument2.FirstPassSceneID); + } + specificDocument2.FirstPassSceneID = 0u; + bool flag4 = DlgBase.singleton.IsVisible(); + if (flag4) + { + DlgBase.singleton.SetVisibleWithAnimation(false, null); + } + break; + } + case ShareCallBackType.WeekShare: + { + XAchievementDocument specificDocument3 = XDocuments.GetSpecificDocument(XAchievementDocument.uuID); + bool flag5 = result.Contains("Success"); + if (flag5) + { + specificDocument3.SendWeekShareSuccess(0u); + } + break; + } + } + } + + public bool CheckWXInstalled() + { + bool flag = XSingleton.singleton.XPlatform.CheckStatus("Weixin_Installed", ""); + bool flag2 = !flag; + bool result; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("ERR_WECHAT_NOT_INSTALLED"), "fece00"); + result = false; + } + else + { + result = true; + } + return result; + } + + public bool CheckQQInstalled() + { + bool flag = XSingleton.singleton.XPlatform.CheckStatus("QQ_Installed", ""); + bool flag2 = !flag; + bool result; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("ERR_QQ_NOT_INSTALLED"), "fece00"); + result = false; + } + else + { + result = true; + } + return result; + } + + public void UpdatePandoraSDKRedPoint(int pandoraSysID, bool showRedPoint, string module) + { + if (showRedPoint) + { + bool flag = XSingleton.singleton.IsActivityTabShow(pandoraSysID); + if (flag) + { + XSingleton.singleton.ForceUpdateSysRedPointImmediately(pandoraSysID, showRedPoint); + } + } + else + { + XSingleton.singleton.ForceUpdateSysRedPointImmediately(pandoraSysID, showRedPoint); + } + bool flag2 = module == "action"; + if (flag2) + { + XOperatingActivityDocument specificDocument = XDocuments.GetSpecificDocument(XOperatingActivityDocument.uuID); + specificDocument.RefreshRedPoints(); + } + else + { + bool flag3 = module == "callBack"; + if (flag3) + { + ILuaEngine xluaEngine = XSingleton.singleton.XLuaEngine; + xluaEngine.hotfixMgr.CallLuaFunc("LuaBackflowDocument", "RefreshPandoraTabRedpoint"); + } + } + } + + public void AttachPandoraSDKRedPoint(int sysID, string module) + { + bool flag = module == "action"; + if (flag) + { + XOperatingActivityDocument specificDocument = XDocuments.GetSpecificDocument(XOperatingActivityDocument.uuID); + specificDocument.AttachPandoraRedPoint(sysID); + } + else + { + bool flag2 = module == "callBack"; + if (flag2) + { + XBackFlowDocument specificDocument2 = XDocuments.GetSpecificDocument(XBackFlowDocument.uuID); + specificDocument2.AttachPandoraRedPoint(sysID); + } + } + } + + public void ResetAllPopPLParent() + { + XSingleton.singleton.ResetAllPopPLParent(); + } + + public void BillBoardCommonSetSpriteStr(params string[] strs) + { + this.ComSpriteStr.Clear(); + for (int i = 0; i < strs.Length; i++) + { + this.ComSpriteStr.Add(strs[i]); + } + } + + public double GetMachineTime() + { + return (double)(DateTime.Now.Ticks / 10000000L); + } + + public int GetMachineTimeFrom1970() + { + return (int)((DateTime.Now - new DateTime(1970, 1, 1)).Ticks / 10000000L); + } + + public string Decrypt(string CipherText) + { + byte[] bytes = Encoding.BigEndianUnicode.GetBytes(CipherText); + int num = bytes.Length; + byte[] array = new byte[num / 2]; + for (int i = 0; i < num; i += 4) + { + byte b = bytes[i + 1]; + byte b2 = bytes[i + 3]; + int num2 = (int)(b & 15) << 4; + int num3 = (int)(b & 240); + int num4 = (int)(b2 & 15); + int num5 = (b2 & 240) >> 4; + array[i / 2] = Convert.ToByte(num2 | num5); + array[i / 2 + 1] = Convert.ToByte(num3 | num4); + } + return Encoding.BigEndianUnicode.GetString(array, 0, array.Length); + } + + public bool CheckPlatfomStatus() + { + bool flag = XSingleton.singleton.Channel == XAuthorizationChannel.XAuthorization_QQ; + if (flag) + { + bool flag2 = !this.CheckQQInstalled(); + if (flag2) + { + return false; + } + } + bool flag3 = XSingleton.singleton.Channel == XAuthorizationChannel.XAuthorization_WeChat; + if (flag3) + { + bool flag4 = !this.CheckWXInstalled(); + if (flag4) + { + return false; + } + } + return true; + } + + public bool IsOppositeSex(int one, int two) + { + one %= 10; + two %= 10; + List intList = XSingleton.singleton.GetIntList("MaleTypeList"); + List intList2 = XSingleton.singleton.GetIntList("FemaleTypeList"); + return (intList.Contains(one) && intList2.Contains(two)) || (intList.Contains(two) && intList2.Contains(one)); + } + + public void ShareToWXFriendBackEnd(string openID, string title, string desc, string tag) + { + Dictionary dictionary = new Dictionary(); + dictionary["openId"] = openID; + dictionary["title"] = title; + dictionary["description"] = desc; + dictionary["thumbMediaId"] = ""; + dictionary["mediaTagName"] = tag; + dictionary["messageExt"] = "ShareWithWeixin"; + string text = Json.Serialize(dictionary); + XSingleton.singleton.AddLog("ShareToWXFriend paramStr = " + text, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPlatform.SendExtDara("share_send_to_friend_wx", text); + } + + public void ShareToQQFreindBackEnd(string openID, string title, string desc, string tag, string targetUrl, string imageUrl, string previewText) + { + Dictionary dictionary = new Dictionary(); + dictionary["act"] = 1; + dictionary["openId"] = openID; + dictionary["title"] = title; + dictionary["summary"] = desc; + dictionary["targetUrl"] = targetUrl; + dictionary["imageUrl"] = imageUrl; + dictionary["previewText"] = previewText; + dictionary["gameTag"] = tag; + string text = Json.Serialize(dictionary); + XSingleton.singleton.AddLog("SharePkToQQFriend paramStr = " + text, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPlatform.SendExtDara("share_send_to_friend_qq", text); + } + + public void PandoraPicShare(string accountType, string scene, string objPath) + { + XSingleton.singleton.AddLog(string.Concat(new string[] + { + "UiUtility PandoraPicShare : accountType = ", + accountType, + ",scene = ", + scene, + ",objPath = ", + objPath + }), null, null, null, null, null, XDebugColor.XDebug_None); + GameObject gameObject = GameObject.Find(objPath); + bool flag = gameObject != null; + if (flag) + { + XSingleton.singleton.AddLog("UiUtility PandoraPicShare find obj", null, null, null, null, null, XDebugColor.XDebug_None); + Bounds boundsIncludesChildren = XSingleton.singleton.XPandoraManager.GetBoundsIncludesChildren(gameObject.transform); + Vector3 vector = XSingleton.singleton.UICamera.WorldToScreenPoint(boundsIncludesChildren.min); + Vector3 vector2 = XSingleton.singleton.UICamera.WorldToScreenPoint(boundsIncludesChildren.max); + Rect rect; + rect= new Rect(vector.x, vector.y, vector2.x - vector.x, vector2.y - vector.y); + XSingleton.singleton.PartCaptureScreen(rect, accountType, scene); + } + } + + public void OneKeyAddQQFriend(string openID, string friendName) + { + bool flag = (int)Application.platform == 8; + if (flag) + { + XSingleton.singleton.shareCallbackType = ShareCallBackType.AddQQFriend; + } + string name = XSingleton.singleton.XPlayerData.Name; + string @string = XStringDefineProxy.GetString("FRIEND_ADD_QQ_FRIEND_REMARK", new object[] + { + friendName + }); + string string2 = XStringDefineProxy.GetString("FRIEND_ADD_QQ_FRIEND", new object[] + { + name + }); + Dictionary dictionary = new Dictionary(); + dictionary["openId"] = openID; + dictionary["desc"] = @string; + dictionary["verifyMsg"] = string2; + string text = Json.Serialize(dictionary); + XSingleton.singleton.AddLog("AddQQFriend paramStr = " + text, null, null, null, null, null, XDebugColor.XDebug_None); + XSingleton.singleton.XPlatform.SendExtDara("add_game_qq_friend", text); + } + + public void ShowPressToolTips(bool pressed, string content, Vector3 pos, Vector3 offset) + { + DlgBase.singleton.Setup(pressed, content, pos, offset); + } + + public bool ToDownLoadCorrectPackage(IXUIButton button) + { + RuntimePlatform platform = Application.platform; + if ((int)platform != 8) + { + if ((int)platform == 11) + { + string @string = XSingleton.singleton.GetString("XUPDATE_ERROR_VERSIONNOTMATCH_ANDROID_URL"); + XSingleton.singleton.AddLog("AndroidAppStore Url: ", @string, null, null, null, null, XDebugColor.XDebug_None); + Application.OpenURL(@string); + } + } + else + { + string string2 = XSingleton.singleton.GetString("XUPDATE_ERROR_VERSIONNOTMATCH_URL"); + XSingleton.singleton.AddLog("AppStore Url: ", string2, null, null, null, null, XDebugColor.XDebug_None); + Application.OpenURL(string2); + } + return true; + } + + public bool ToDownLoadCorrectPackagePre(IXUIButton button) + { + RuntimePlatform platform = Application.platform; + if ((int)platform != 8) + { + if ((int)platform == 11) + { + string @string = XSingleton.singleton.GetString("XUPDATE_ERROR_VERSIONNOTMATCH_ANDROID_PRE_URL"); + XSingleton.singleton.AddLog("AndroidAppStore Url: ", @string, null, null, null, null, XDebugColor.XDebug_None); + Application.OpenURL(@string); + } + } + else + { + string string2 = XSingleton.singleton.GetString("XUPDATE_ERROR_VERSIONNOTMATCH_URL"); + XSingleton.singleton.AddLog("AppStore Url: ", string2, null, null, null, null, XDebugColor.XDebug_None); + Application.OpenURL(string2); + } + return true; + } + } +} -- cgit v1.1-26-g67d0