using LitJson; using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using System; using System.IO; using System.Net; using System.Xml; using System.Text; using System.Linq; using System.Net.Mail; using System.Collections; using System.Collections.Generic; using Random = UnityEngine.Random; public class MailItemLabel { public static string Title = "Title"; public static string Icon1 = "Icon1"; public static string Icon2 = "Icon2"; public static string Icon3 = "Icon3"; } public class ResultCode { public static string Error = "error"; public static string NoError = "{\"error\":0}"; public static int FriendFullSelf = 1011; public static int FriendFullOther = 1012; } public class MyCredentials : ICredentialsByHost { public NetworkCredential NetworkCredential; public NetworkCredential GetCredential(string host, int port, string authType) { return NetworkCredential.GetCredential(new Uri("http://" + host + ":" + port), authType); } public MyCredentials(string username, string password) { NetworkCredential = new NetworkCredential(username, password); } } public enum CommentType { Garden = 0, PrivateMessage = 1, } public class HttpManager : Regist { public class MailReward { public string ID; public string Key; public string Value; public MailReward(string id, string key, string value) { ID = id; Key = key; Value = value; } } #region Config public static Action OnConnect; public static Action OnConnectionLost; public static bool IsConnect { get { if (isConnect) { return true; } else { return TutorialManager.ConnectExempt; } } set { isConnect = value; } } public static bool isConnect; public static bool BuyPackLimitFlag { get { return buyPackLimitFlag; } set { buyPackLimitFlag = value; foreach (var kv in Manager.SkillDictionary) { if (kv.Value is Pack) { ((Pack) kv.Value).SetActive(); } } } } public static bool buyPackLimitFlag; public static int MaxReconnectAmt = 4; public static int ReconnectCounter; public static float ReconnectTime = 2f; public static float ReconnectTimeTimer; public static int PraiseAmt; public static int MaxFriend; public static bool IsRankDataReady; public static List RankDatas; public static int AnnounceIndex = -1; public static bool IsAnnounceReady; public static string AnnounceContent; public static Sprite AnnounceSpite; public static Button WifiButton; public static int ReplayVersion; public static bool Inited; public static bool FirstTimeConnectFlag = true; public static string ID = PlayerConfigLabel.DefaultID; public static string SerialNumber = PlayerConfigLabel.DefaultSerialNumber; public static string ReportIssueContent; public static JsonData LoginCallbackData; public static DateTime CurrentDateTime = DateTime.Now; public static string MailXmlStr; public static List MailRewardList = new List(); public static string BaseURL = "https://garden.dashgame.com/index.php/home"; public static string NewBaseURL = "https://garden.dashgame.com/index.php/newhome"; public static string NicknameURL = NewBaseURL + "/user/nickname"; public static string RankURL = NewBaseURL + "/user/look"; public static string PraiseURL = NewBaseURL + "/praise/click"; public static string TargetURL = NewBaseURL + "/praise/target"; public static string AddCommentURL = NewBaseURL + "/comment/comment"; public static string GetCommentURL = NewBaseURL + "/comment/index"; public static string IndexURL = NewBaseURL + "/index/index"; public static string GetProductIDURL = NewBaseURL + "/pay/pay"; public static string LoginURL = NewBaseURL + "/user/login"; public static string SaveURL = NewBaseURL + "/user/save"; public static string OtherURL = NewBaseURL + "/user/other"; public static string DownloadURL = NewBaseURL + "/user/load"; public static string RandomURL = NewBaseURL + "/user/rand"; public static string ThanksGiftInfoURL = NewBaseURL + "/index/gift"; public static string GetApplicantListURL = NewBaseURL + "/buddy/blist"; public static string GetBuddyListURL = NewBaseURL + "/buddy/index"; public static string ApplyBuddyURL = NewBaseURL + "/buddy/apply"; public static string DeleteBuddyURL = NewBaseURL + "/buddy/remove"; public static string AcceptApplicantURL = NewBaseURL + "/buddy/agree"; public static string GetRecommendBuddyListURL = NewBaseURL + "/buddy/recommend"; public static string SearchBuddyURL = NewBaseURL + "/buddy/like"; public static string GetPrivateMessageURL = NewBaseURL + "/comment/find"; public static string ReportMailAddress = "bug@dashgame.com"; #endregion public void Awake() { //台式机 1709207727231988804 //笔记本 1710065808151506837 //阔达的网络 1709110751808885702 //顺心的树叶1712223993774478213 //SendPrivateMessage("1710065808151506837", "回复", (str0, str1) => { Debug.Log("s"); }, () => { Debug.Log("f"); }, "1709110751808885702"); //SendPrivateMessage("1709110751808885702", "第2条", (str0, str1) => { Debug.Log("s"); }, () => { Debug.Log("f"); }, "1710065808151506837"); //SendPrivateMessage("1710065808151506837", "第3条", (str0, str1) => { Debug.Log("s"); }, () => { Debug.Log("f"); }, "1710065808151506837"); //SendPrivateMessage("1710065808151506837", "第4条", (str0, str1) => { Debug.Log("s"); }, () => { Debug.Log("f"); }, "1710065808151506837"); //GetPrivateMessage("1709110751808885702", "0", (str0, str1, strings) => { Debug.Log(strings.Count); }, () => { Debug.Log("f"); }, "1710065808151506837"); //GetPrivateMessage("1710065808151506837", "0", (str0, str1, strings) => { Debug.Log(strings.Count); }, () => { Debug.Log("f"); }, "1709110751808885702"); //GetPrivateMessage("1709110836214653948 ", "0", (str0, str1, strings) => { Debug.Log(strings.Count); }, () => { Debug.Log("f"); }, "1709110751808885702"); } public void Update() { if (!Manager.Inited && !Inited) { ReconnectTimeTimer += Time.deltaTime; if (ReconnectTimeTimer >= ReconnectTime) { ReconnectTimeTimer = 0; ReconnectCounter++; if (ReconnectCounter > MaxReconnectAmt) { Inited = true; Manager.FirstTimeLoginCallback(new JsonData()); } else { Login(Manager.FirstTimeLoginCallback); GetAlipayFlag(); } } } } public override bool InitAtOnce() { if (base.InitAtOnce()) { return true; } enabled = true; return false; } public override void FirstInit() { ReplayVersion = ConfigManager.GetIntFormConfig(PlayerConfigLabel.ReplayVersion); } public override void RegistReference() { WifiButton = ResourceManager.Get