12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223 |
- using LitJson;
- using MiniJSON;
- using ScottGarland;
- using DragonBones;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.Events;
- using UnityEngine.Advertisements;
- using System;
- using System.IO;
- using System.Xml;
- using System.Linq;
- using System.Net.Mail;
- using System.Net;
- using System.Text;
- using System.Collections;
- using System.Diagnostics;
- using System.Collections.Generic;
- using System.ComponentModel.Design;
- using System.Security.Cryptography;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Security;
- using System.Text.RegularExpressions;
- using System.Security.Cryptography.Xml;
- using Sfs2X.Entities.Data;
- using Sfs2X.Requests;
- using Debug = UnityEngine.Debug;
- using Random = UnityEngine.Random;
- using Transform = UnityEngine.Transform;
- public enum Unit
- {
- Second
- }
- public class Amount
- {
- public static double 百 = 100;
- public static double 千 = 1000;
- public static double 万 = 10000;
- public static double 十万 = 100000;
- public static double 百万 = 1000000;
- public static double 千万 = 10000000;
- public static double 亿 = 100000000;
- public static double 十亿 = 1000000000;
- public static double 千亿 = 100000000000;
- public static double 兆 = 1000000000000;
- public static double 千兆 = 1000000000000000;
- public static double 京 = 10000000000000000;
- public static double 千京 = 10000000000000000000;
- public static BigInteger 垓 = new BigInteger("100000000000000000000");
- public static BigInteger 千垓 = new BigInteger("100000000000000000000000");
- }
- public class Auxiliary : Regist
- {
- #region Config
- public string String1;
- public string String2;
- public Sprite Sprite;
- public TextAsset TextAsset;
- public Texture2D Texture;
- public Texture2D Texture1;
- public Texture2D Texture2;
- public AnimationClip AnimationClip;
- public Font Font;
- public GameObject Go;
- public List<Sprite> Sprites;
- public List<GameObject> GoList;
- public List<SpriteRenderer> SrList;
- public static bool AnyKeyUp;
- public static bool AnyKeyDown;
- public static Auxiliary Instance;
- public static MD5 MD5
- {
- get
- {
- if (_MD5 == null)
- {
- _MD5 = new MD5CryptoServiceProvider();
- }
- return _MD5;
- }
- set { _MD5 = value; }
- }
- public static DESCryptoServiceProvider Des
- {
- get
- {
- if (_Des == null)
- {
- _Des = new DESCryptoServiceProvider();
- _Des.IV = Encoding.UTF8.GetBytes("19283740");
- _Des.Key = Encoding.UTF8.GetBytes("93287123");
- }
- return _Des;
- }
- set { _Des = value; }
- }
- private static MD5 _MD5;
- private static DESCryptoServiceProvider _Des;
- #endregion
-
- public override bool InitAtOnce()
- {
- if (base.InitAtOnce())
- {
- return true;
- }
-
- enabled = true;
- return false;
- }
- private void Awake()
- {
- Instance = this;
- }
- private void Update()
- {
- #region 调试
- //if (Input.GetKeyDown(KeyCode.Escape))
- //{
- // SFSManager.GardenSmartFox.SmartFox.Disconnect();
- // RobotManager.DeactivateAllRobots(false);
- //}
- //if (Input.GetKeyDown(KeyCode.Space))
- //{
- // Debug.Log(ConfigManager.ConfigRootNode.OuterXml);
- // //DebugManager.ResetGardenLevel(7);
- // //DebugManager.ResetVisitTutorial();
- // //HttpManager.GetThanksGiftInfo(RechargeGiftManager.Init, () => Bubble.Show(null, Language.GetStr(LanguageLabel.UI__GetThanksGiftInfoFailed)));
- //}
- //if (Input.GetKeyDown(KeyCode.A))
- //{
- // DebugManager.ResetGardenLevel(30);
- //}
- //if (Input.GetKeyDown(KeyCode.S))
- //{
- // Manager.Coin = 0;
- // Manager.Diamond = 0;
- //}
- //if (Input.GetKeyDown(KeyCode.D))
- //{
- // Manager.Coin = 100000;
- // Manager.Diamond = 1000;
- //}
- //if (Input.GetKeyDown(KeyCode.Z))
- //{
- // Manager.MinigameCDTimer = 0;
- //}
- //if (Input.GetKeyDown(KeyCode.X))
- //{
- // MiniGameManager.GameTimer = 45;
- //}
- //if (Input.GetKeyDown(KeyCode.C))
- //{
- // DebugManager.ResetAbilityAnim();
- //}
- //if (Input.GetKeyDown(KeyCode.V))
- //{
- // AccountData accountData = new AccountData("测试名字", "1710065808151506837", DateTime.Now.ToString());
- // MessagePanel.OpenPanel(accountData);
- //}
- //if (Input.GetKeyDown(KeyCode.B))
- //{
- // ManaPlayer.Player.PlayAnim("newAnimation3");
- // ManaPlayer.Player.Flip(PlayerDirection.Left);
- // foreach (var VARIABLE in ManaPlayer.CloseUnitDic)
- // {
- // VARIABLE.Value.Unlock();
- // }
- //}
- //if (Input.GetKeyDown(KeyCode.M))
- //{
- // ManaReso.Get(PrefabLabel.G_Flower).SetActive(false);
- // Debug.Log(ManaGarden.Slot);
- //}
- //if (Input.GetKeyDown(KeyCode.N))
- //{
- // ManaCenter.Coin = 0;
- // ManaCenter.Diamond = 0;
- // foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
- // {
- // VARIABLE.Value.Unlock = true;
- // }
- // foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
- // {
- // VARIABLE.Value.Unlock = false;
- // }
- // ManaGarden.FlowerInfoDic.First().Value.Unlock = true;
- //}
- //if (Input.GetKeyDown(KeyCode.P))
- //{
- // ManaData.Level += 20;
- //}
- //if (Input.GetKeyDown(KeyCode.O))
- //{
- // for (int i = 0; i < ManaCenter.CoolList.Count; i++)
- // {
- // ManaCenter.CoolList[i].CoolTimer = 0;
- // }
- //}
- //if (Input.GetKeyDown(KeyCode.I))
- //{
- // ManaCenter.Coin += 1000;
- // ManaCenter.Diamond += 1000;
- //}
- //if (Input.GetKeyDown(KeyCode.U))
- //{
- // Data.SavePlayerConfig();
- // Data.SaveXml();
- //}
- //if (Input.GetKeyDown(KeyCode.Y))
- //{
- // Data.ResetPlayerConfig();
- // Data.SaveXml();
- //}
- //if (Input.GetKeyDown(KeyCode.T))
- //{
- // ManaData.Pause = !ManaData.Pause;
- //}
- #endregion
- #region 输入检测
- if (Input.GetKeyDown(KeyCode.Escape))
- {
- MiniGameManager.Pause = true;
- Bubble.Show(Language.GetStr(LanguageLabel.Common__QuitGame), null, null, null, Application.Quit, () => { MiniGameManager.Pause = false; });
- }
- if (AnyKeyUp)
- {
- if (Input.anyKey == false)
- {
- AnyKeyUp = false;
- }
- }
- if (Input.anyKeyDown)
- {
- AnyKeyDown = true;
- }
-
- if (AnyKeyDown)
- {
- if (Input.anyKey == false)
- {
- AnyKeyUp = true;
- AnyKeyDown = false;
- }
- }
- #endregion
- }
- private static void ResetAllCd()
- {
- for (int i = 0; i < Manager.CoolSkillList.Count; i++)
- {
- Manager.CoolSkillList[i].CoolTimer = 0;
- }
- }
- public static byte[] GetMD5(object obj)
- {
-
- MemoryStream memoryStream = new MemoryStream();
- BinaryFormatter binaryFormatter = new BinaryFormatter();
- binaryFormatter.Serialize(memoryStream, obj);
- byte[] bytes = memoryStream.GetBuffer();
- memoryStream.Dispose();
- return MD5.ComputeHash(bytes);
- }
- public static void EncryptXml(XmlDocument doc)
- {
- EncryptedXml encryptedXml = new EncryptedXml();
- XmlElement xmlElement = doc.DocumentElement;
- byte[] bytes = encryptedXml.EncryptData(xmlElement, Des, false);
- EncryptedData encryptedData = new EncryptedData();
- encryptedData.Type = EncryptedXml.XmlEncElementUrl;
- encryptedData.EncryptionMethod = new EncryptionMethod(EncryptedXml.XmlEncDESUrl);
- encryptedData.CipherData.CipherValue = bytes;
- EncryptedXml.ReplaceElement(xmlElement, encryptedData, false);
- }
- public static void DecryptXml(XmlDocument doc)
- {
- EncryptedXml encryptedXml = new EncryptedXml();
- XmlElement encryptXmlElement = (XmlElement)doc.GetElementsByTagName("EncryptedData")[0];
- EncryptedData encryptedData = new EncryptedData();
-
- encryptedData.LoadXml(encryptXmlElement);
- byte[] bytes = encryptedXml.DecryptData(encryptedData, Des);
- encryptedXml.ReplaceData(encryptXmlElement, bytes);
- }
- public static byte[] Encrypt(string str)
- {
- byte[] bytes = Encoding.UTF8.GetBytes(str);
- byte[] encryptBytes = Des.CreateEncryptor().TransformFinalBlock(bytes, 0, bytes.Length);
- return encryptBytes;
- }
- public static byte[] ToBytes(string str)
- {
- string[] strings = str.Split(' ');
- byte[] bytes = new byte[strings.Length];
- for (int i = 0; i < bytes.Length; i++)
- {
- bytes[i] = byte.Parse(strings[i]);
- }
- return bytes;
- }
- public static string Decrypt(string str)
- {
- byte[] encryptBytes = ToBytes(str);
- byte[] decryptBytes = Des.CreateDecryptor().TransformFinalBlock(encryptBytes, 0, encryptBytes.Length);
- return Encoding.UTF8.GetString(decryptBytes);
- }
- public static string ToString(byte[] bytes)
- {
- StringBuilder strB = new StringBuilder();
- for (int i = 0; i < bytes.Length; i++)
- {
- if (i == bytes.Length - 1)
- {
- strB.Append(bytes[i]);
- }
- else
- {
- strB.Append(bytes[i] + " ");
- }
- }
- return strB.ToString();
- }
- public static void CompileDic(Transform tra, Dictionary<string, Transform> dic, bool enableIgnore = true)
- {
- Transform[] transforms = tra.GetComponentsInChildren<Transform>(true);
- for (int i = 0; i < transforms.Length; i++)
- {
- if (enableIgnore)
- {
- if (transforms[i].GetComponent<IgnoreIndexing>())
- {
- continue;
- }
- }
- if (dic.ContainsKey(transforms[i].name))
- {
- throw new Exception(transforms[i].name);
- }
- else
- {
- dic.Add(transforms[i].name, transforms[i]);
- }
- }
- }
- public static string GetUnit(int value, Unit unit)
- {
- if (unit == Unit.Second)
- {
- if (LanguageManager.CurrentLanguage == CurrentLanguage.English)
- {
- if (value == 0 || value == 1)
- {
- return " Second";
- }
- else
- {
- return " Seconds";
- }
- }
- else if (LanguageManager.CurrentLanguage == CurrentLanguage.ChineseSimplified)
- {
- return "秒";
- }
- else if (LanguageManager.CurrentLanguage == CurrentLanguage.ChineseTraditional)
- {
- return "秒";
- }
- else
- {
- throw new Exception();
- }
- }
- else
- {
- throw new Exception();
- }
- }
- public static string GetStreamPath()
- {
- if (Application.isEditor)
- {
- return "file://" + Application.streamingAssetsPath;
- }
- else if (Application.platform == RuntimePlatform.IPhonePlayer)
- {
- return "file://" + Application.streamingAssetsPath;
- }
- else if (Application.isMobilePlatform)
- {
- return Application.streamingAssetsPath;
- }
- else
- {
- throw new Exception();
- }
- }
- public Coroutine DelayCall(UnityAction function, int frame)
- {
- return StartCoroutine(IDelayCall(function, frame));
- }
- public Coroutine DelayCall(UnityAction function, float time)
- {
- return StartCoroutine(IDelayCall(function, time));
- }
- public static IEnumerator IDelayCall(UnityAction function, int frame)
- {
- int count = 0;
- while (count < frame)
- {
- count++;
- yield return null;
- }
- function.Invoke();
- }
- public static IEnumerator IDelayCall(UnityAction function, float time)
- {
- yield return new WaitForSeconds(time);
- function.Invoke();
- }
- public static string FmlParse1(string str)
- {
- int index = 0;
- int openIndex = 0;
- bool flag = false;
- bool group = false;
-
- for (int i = 0; i < str.Length; i++)
- {
- if (group)
- {
- if (str[i] == '+' || str[i] == '-' || str[i] == '*' || str[i] == '/')
- {
- str = str.Replace(openIndex, i - 1, FmlParse2(str[index], str.Between(openIndex, index - 1), str.Between(index + 1, i - 1)));
-
- i = 0;
- group = false;
- }
- else if (i == str.Length - 1)
- {
- str = str.Replace(openIndex, i, FmlParse2(str[index], str.Between(openIndex, index - 1), str.Between(index + 1, i)));
- break;
- }
- }
- else
- {
- if (str[i] == '+' || str[i] == '-')
- {
- flag = true;
- openIndex = i + 1;
- }
- else if (str[i] == '*' || str[i] == '/')
- {
- index = i;
- group = true;
- if (!flag)
- {
- openIndex = 0;
- }
- }
- }
- }
- group = false;
- for (int i = 0; i < str.Length; i++)
- {
- if (group)
- {
- if (str[i] == '+' || str[i] == '-')
- {
- str = str.Replace(0, i - 1, FmlParse2(str[index], str.Between(0, index - 1), str.Between(index + 1, i - 1)));
- i = -1;
- group = false;
- }
- else if (i == str.Length - 1)
- {
- return FmlParse2(str[index], str.Between(0, index - 1), str.Between(index + 1, i));
- }
- }
- else
- {
- if (str[i] == '+' || str[i] == '-')
- {
- index = i;
- group = true;
- }
- }
- }
- return str;
- }
- public static string FmlParse2(char op, string str1, string str2)
- {
- double var1 = double.Parse(str1);
- double var2 = double.Parse(str2);
- if (op == '+')
- {
- return (var1 + var2).ToString();
- }
- else if (op == '-')
- {
- return (var1 - var2).ToString();
- }
- else if (op == '*')
- {
- return (var1 * var2).ToString();
- }
- else if (op == '/')
- {
- return (var1 / var2).ToString();
- }
- else
- {
- throw new Exception(op.ToString());
- }
- }
- public static double FmlParse(string str, params string[] strings)
- {
- for (int i = 0; i < strings.Length; i += 2)
- {
- if (str.Contains(strings[i]))
- {
- str = str.Replace(strings[i], strings[i + 1]);
- }
- else
- {
- //Debug.Log("No such var " + strings[i + 1]);
- }
- }
-
- int openIndex = 0;
- for (int i = 0; i < str.Length; i++)
- {
- if (str[i] == '(')
- {
- openIndex = i;
- }
- else if (str[i] == ')')
- {
- str = str.Replace(openIndex, i, FmlParse1(str.Between(openIndex + 1, i - 1)));
- i = -1;
- }
- }
- return double.Parse(FmlParse1(str));
- }
- public static string OmitNumberStr(int accuray, string str)
- {
- int index = str.IndexOf('.');
- if (index == -1)
- {
- return str;
- }
- if (accuray == 0)
- {
- return str.Substring(0, index);
- }
- else
- {
- for (int i = index + 1; i < index + accuray + 1; i++)
- {
- if (str[i] != '0')
- {
- return str.Substring(0, index + accuray + 1);
- }
- }
- return str.Substring(0, index);
- }
- }
- public static double ShrinkNumber(double value, int accuracy = 1)
- {
- if (LanguageManager.CurrentLanguage == CurrentLanguage.English)
- {
- if (value < Amount.千)
- {
- return value;
- }
- else if (value < Amount.百万)
- {
- string str = (value / Amount.千).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千;
- }
- else if (value < Amount.十亿)
- {
- string str = (value / Amount.百万).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.百万;
- }
- else if (value < Amount.兆)
- {
- string str = (value / Amount.十亿).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.十亿;
- }
- else if (value < Amount.千兆)
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.兆;
- }
- else
- {
- string str = (value / Amount.千兆).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千兆;
- }
- }
- else if (LanguageManager.CurrentLanguage == CurrentLanguage.ChineseSimplified || LanguageManager.CurrentLanguage == CurrentLanguage.ChineseTraditional)
- {
- if (value < Amount.万)
- {
- return value;
- }
- else if (value < Amount.千万)
- {
- string str = (value / Amount.万).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.万;
- }
- else if (value < Amount.亿)
- {
- string str = (value / Amount.千万).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千万;
- }
- else if (value < Amount.千亿)
- {
- string str = (value / Amount.亿).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.亿;
- }
- else if (value < Amount.兆)
- {
- string str = (value / Amount.千亿).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千亿;
- }
- else if (value < Amount.千兆)
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.兆;
- }
- else if (value < Amount.京)
- {
- string str = (value / Amount.千兆).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千兆;
- }
- else if (value < Amount.千京)
- {
- string str = (value / Amount.京).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.京;
- }
- else if (new BigInteger(value.ToString("0")) < Amount.垓)
- {
- string str = (value / Amount.千京).ToString("F" + (accuracy + 1));
- return double.Parse(OmitNumberStr(accuracy, str)) * Amount.千京;
- }
- else if (new BigInteger(value.ToString("0")) < Amount.千垓)
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.垓).ToString();
- return double.Parse(OmitNumberStr(0, str)) * Amount.千京 * 10;
- }
- else
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.千垓).ToString();
- return double.Parse(OmitNumberStr(0, str)) * Amount.千京 * 10000;
- }
- }
- else
- {
- throw new Exception();
- }
- }
- public static string ShrinkNumberStr(double value, int accuracy = 1)
- {
- if (LanguageManager.CurrentLanguage == CurrentLanguage.English)
- {
- if (value < Amount.千)
- {
- return value.ToString("0");
- }
- else if (value < Amount.百万)
- {
- string str = (value / Amount.千).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "K";
- }
- else if (value < Amount.十亿)
- {
- string str = (value / Amount.百万).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "M";
- }
- else if (value < Amount.兆)
- {
- string str = (value / Amount.十亿).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "B";
- }
- else if (value < Amount.千兆)
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "T";
- }
- else
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "T";
- }
- }
- else if (LanguageManager.CurrentLanguage == CurrentLanguage.ChineseSimplified)
- {
- if (value < Amount.万)
- {
- return value.ToString("0");
- }
- else if (value < Amount.千万)
- {
- string str = (value / Amount.万).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "万";
- }
- else if (value < Amount.亿)
- {
- string str = (value/Amount.千万).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千万";
- }
- else if (value < Amount.千亿)
- {
- string str = (value / Amount.亿).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "亿";
- }
- else if (value < Amount.兆)
- {
- string str = (value / Amount.千亿).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千亿";
- }
- else if (value < Amount.千兆)
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "兆";
- }
- else if (value < Amount.京)
- {
- string str = (value / Amount.千兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千兆";
- }
- else if (value < Amount.千京)
- {
- string str = (value / Amount.京).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "京";
- }
- else if (new BigInteger(value.ToString("0")) < Amount.垓)
- {
- string str = (value / Amount.千京).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千京";
- }
- else if (new BigInteger(value.ToString("0")) < Amount.千垓)
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.垓).ToString();
- return OmitNumberStr(0, str) + "垓";
- }
- else
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.千垓).ToString();
- return OmitNumberStr(0, str) + "千垓";
- }
- }
- else if (LanguageManager.CurrentLanguage == CurrentLanguage.ChineseTraditional)
- {
- if (value < Amount.万)
- {
- return value.ToString("0");
- }
- else if (value < Amount.千万)
- {
- string str = (value / Amount.万).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "萬";
- }
- else if (value < Amount.亿)
- {
- string str = (value / Amount.千万).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千萬";
- }
- else if (value < Amount.千亿)
- {
- string str = (value / Amount.亿).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "億";
- }
- else if (value < Amount.兆)
- {
- string str = (value / Amount.千亿).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千億";
- }
- else if (value < Amount.千兆)
- {
- string str = (value / Amount.兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "兆";
- }
- else if (value < Amount.京)
- {
- string str = (value / Amount.千兆).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千兆";
- }
- else if (value < Amount.千京)
- {
- string str = (value / Amount.京).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "京";
- }
- else if (new BigInteger(value.ToString("0")) < Amount.垓)
- {
- string str = (value / Amount.千京).ToString("F" + (accuracy + 1));
- return OmitNumberStr(accuracy, str) + "千京";
- }
- else if (new BigInteger(value.ToString("0")) < Amount.千垓)
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.垓).ToString();
- return OmitNumberStr(0, str) + "垓";
- }
- else
- {
- string str = (new BigInteger(value.ToString("0")) / Amount.千垓).ToString();
- return OmitNumberStr(0, str) + "千垓";
- }
- }
- else
- {
- throw new Exception();
- }
- }
- public static string ImageParse(Current current)
- {
- if (current == Current.Coin)
- {
- return TransferLabel.CoinSprite;
- }
- else if (current == Current.Diamond)
- {
- return TransferLabel.DiamondSprite;
- }
- else if (current == Current.Cash)
- {
- return Language.GetStr(LanguageLabel.Common__Cash);
- }
- else
- {
- throw new Exception(current.ToString());
- }
- }
- public static Current CurrentParse(string str)
- {
- if (string.IsNullOrEmpty(str))
- {
- return Current.Free;
- }
- else
- {
- int number = int.Parse(str);
- if (number == 1)
- {
- return Current.Coin;
- }
- else if (number == 2)
- {
- return Current.Diamond;
- }
- else if (number == 3)
- {
- return Current.Cash;
- }
- else if (number == 4)
- {
- return Current.Other;
- }
- else if (number == 5)
- {
- return Current.AD;
- }
- else
- {
- throw new Exception(number.ToString());
- }
- }
- }
- public static int StringToInt(string str, int defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- return int.Parse(str);
- }
- }
- public static long StringToLong(string str, long defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- return long.Parse(str);
- }
- }
- public static bool StringToBool(string str, bool defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- return Convert.ToBoolean(int.Parse(str));
- }
- }
- public static float StringToFloat(string str, float defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- return float.Parse(str);
- }
- }
- public static double StringToDouble(string str, double defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- return float.Parse(str);
- }
- }
- public static Vector3 StringToVector(char seperateChar, string str, Vector3 defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- string[] strings = str.Split(seperateChar);
- if (strings.Length == 2)
- {
- Vector2 result = new Vector2();
- result.x = float.Parse(strings[0]);
- result.y = float.Parse(strings[1]);
- return result;
- }
- else if (strings.Length == 3)
- {
- Vector3 result = new Vector3();
- result.x = float.Parse(strings[0]);
- result.y = float.Parse(strings[1]);
- result.z = float.Parse(strings[2]);
- return result;
- }
- else
- {
- Debug.Log(str);
- throw new Exception();
- }
- }
- }
- public static List<int> StringToInts(char seperateChar, string str, List<int> defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- string[] strings = str.Split(seperateChar);
- List<int> list = new List<int>();
- for (int i = 0; i < strings.Length; i++)
- {
- list.Add(int.Parse(strings[i]));
- }
- return list;
- }
- }
- public static List<string> StringToStrings(char seperateChar, string str, List<string> defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- string[] strings = str.Split(seperateChar);
- List<string> list = new List<string>();
- for (int i = 0; i < strings.Length; i++)
- {
- list.Add(strings[i]);
- }
- return list;
- }
- }
- public static List<double> StringToDoubles(char seperateChar, string str, List<double> defaultValue)
- {
- if (string.IsNullOrEmpty(str))
- {
- return defaultValue;
- }
- else
- {
- string[] strings = str.Split(seperateChar);
- List<double> list = new List<double>();
- for (int i = 0; i < strings.Length; i++)
- {
- list.Add(double.Parse(strings[i]));
- }
- return list;
- }
- }
- public static List<int> StartEndIndexToInts(int startIndex, int endIndex)
- {
- List<int> ints = new List<int>();
- for (int i = startIndex; i <= endIndex; i++)
- {
- ints.Add(i);
- }
- return ints;
- }
- public static string IntsToString(List<int> ints)
- {
- StringBuilder stringBuilder = new StringBuilder();
- for (int i = 0; i < ints.Count; i++)
- {
- stringBuilder.Append(ints[i] + " ");
- }
- return stringBuilder.ToString();
- }
- }
|