public static void ClearLog() { if (StoreGame.Contains(StoreGame.EType.DEBUG_LOG)) { PlayerPrefs.SetString(GetKeyName(StoreGame.EType.DEBUG_LOG), ""); } }
public void OnResponseMessageHandler() { string username = StoreGame.LoadString(StoreGame.EType.SEND_FRIEND_MESSAGE); if (StoreGame.Contains(StoreGame.EType.SEND_FRIEND_MESSAGE) && !string.IsNullOrEmpty(username) && GameManager.Instance.mInfo.messages.Find(m => m.receiver_name == username) == null) { Messages mess = new Messages(); mess.sender_name = GameManager.Instance.mInfo.username; mess.receiver_avatar = 0; mess.time_sent = System.DateTime.Now; mess.receiver_name = username; mess.content = ""; mess.read = true; GameManager.Instance.mInfo.messages.Add(mess); createListMessageFriend(GameManager.Instance.mInfo.messages, controller.selectedIndex); } else { createListMessageFriend(GameManager.Instance.mInfo.messages, controller.selectedIndex); } if (!string.IsNullOrEmpty(username)) { StartCoroutine(FindFriendWhenSelect(username)); } if (GameManager.Instance.ListMessageSystem.Count > 0) { createListMessageSystem(); } }
public override void OnSelectTabbarAtIndex(int index) { if (tabbarPanel [index].gameObject.GetComponent <ProfileTabInfo> () != null) { tabbarPanel [index].gameObject.GetComponent <ProfileTabInfo> ().initUserInfo(); } else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabSettingView> () != null) { tabbarPanel [index].gameObject.GetComponent <ProfileTabSettingView> ().initInformation(); } else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabMessageView> () != null) { tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridMessageSystem.Reposition(); tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridInvited.Reposition(); tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().gridFriend.Reposition(); if (!hadRequestMessage && GameManager.Instance.mInfo.messages.Count == 0) { WaitingView.Show("Đang tải dữ liệu"); if (!hadRequestMessage) { GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_MESSAGE); hadRequestMessage = true; } if (!hadRequestBuddies) { hadRequestBuddies = true; GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_BUDDIES); } } else { if (StoreGame.Contains(StoreGame.EType.SEND_FRIEND_MESSAGE)) { tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().OnResponseMessageHandler(); } else { tabbarPanel[index].gameObject.GetComponent <ProfileTabMessageView>().reLoadListMessageFriendWhenSelectTabMessage(); } } numberTabMessage.gameObject.SetActive(index != 1); } else if (tabbarPanel [index].gameObject.GetComponent <ProfileTabFriend> () != null) { tabbarPanel[index].gameObject.GetComponent <ProfileTabFriend>().tableFriend.Reposition(); if (!hadRequestBuddies && GameManager.Instance.mInfo.buddies.Count == 0) { WaitingView.Show("Đang tải dữ liệu"); hadRequestBuddies = true; GameManager.Server.DoRequestCommand(Fields.REQUEST.GET_BUDDIES); } } }
public static void SaveLog(EType _type, string _value) { if (_type == EType.DEBUG_LOG) { if (StoreGame.Contains(StoreGame.EType.DEBUG_LOG)) { _value = StoreGame.LoadString(StoreGame.EType.DEBUG_LOG) + "\n\n" + _value; PlayerPrefs.SetString(GetKeyName(_type), _value); } } }
public static void SaveLogToFile() { StoreGame.ClearLog(); for (int i = 0; i < entriesConsole.Count; i++) { StoreGame.SaveLog(StoreGame.EType.DEBUG_LOG, entriesConsole[i].message); } if (StoreGame.Contains(StoreGame.EType.DEBUG_LOG)) { SaveAndLoadFile.Save(StoreGame.LoadString(StoreGame.EType.DEBUG_LOG)); } }
/// <summary> /// Khởi tạo thông tin cài đặt /// </summary> public void Init() { Platform = new PlatformSetting(); if (StoreGame.Contains(StoreGame.EType.FULL_SCREEN)) { IsFullScreen = StoreGame.LoadInt(StoreGame.EType.FULL_SCREEN) == (int)StoreGame.EToggle.ON; } if (StoreGame.Contains(StoreGame.EType.LOCK_SCREEN)) { AllowLockScreen = StoreGame.LoadInt(StoreGame.EType.LOCK_SCREEN) == (int)StoreGame.EToggle.ON; } }
public static void SaveDeviceWhenJoinGame() { string str = ""; if (StoreGame.Contains(StoreGame.EType.PLAY_THE_SAME_DEVICE)) { str = StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE) + DATA_ROW; } str += GameManager.Instance.mInfo.username + DATA_SAPCE + GameManager.Instance.selectedLobby.gameId; Debug.LogWarning("IsCanJoinGameplay SAVED: " + str); StoreGame.SaveString(StoreGame.EType.PLAY_THE_SAME_DEVICE, str); StoreGame.Save(); }
System.Collections.IEnumerator _CheckWhenStart() { if (StoreGame.Contains(StoreGame.EType.SEND_FRIEND_MESSAGE)) { yield return(new WaitForEndOfFrame()); controller.OnSelectTabbar(1); } else if (StoreGame.Contains(StoreGame.EType.CHANGE_INFORMATION)) { controller.OnSelectTabbar(5); panelSettings.ShowEditGeneral(); StoreGame.Remove(StoreGame.EType.CHANGE_INFORMATION); } }
/// <summary> /// Load tin nhắn hệ thống từ cache của game và kiểm tra tin nhắn mới từ database /// </summary> public static void DownloadOrLoadCache() { GameManager.Instance.ListMessageSystem.Clear(); if (StoreGame.Contains(StoreGame.EType.CACHE_MESSAGE_SYSTEM)) { ArrayList cacheMessageSystem = (ArrayList)JSON.JsonDecode(StoreGame.LoadString(StoreGame.EType.CACHE_MESSAGE_SYSTEM)); foreach (Hashtable hash in cacheMessageSystem) { GameManager.Instance.ListMessageSystem.Add(new Messages(hash)); } GameManager.Instance.ListMessageSystem.Sort((x, y) => x.time_sent.CompareTo(y.time_sent)); } #region DOWNLOAD WWWForm formMessageSystem = new WWWForm(); formMessageSystem.AddField("sender", 0); formMessageSystem.AddField("receiver", GameManager.Instance.mInfo.id); formMessageSystem.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier); if (GameManager.Instance.ListMessageSystem.Count > 0) { DateTime time_send = GameManager.Instance.ListMessageSystem[GameManager.Instance.ListMessageSystem.Count - 1].time_sent; formMessageSystem.AddField("time", string.Format("{0:yyyy-MM-dd HH:mm:ss}", time_send)); //Debug.Log(ServerWeb.URL_GETINFO_MESSAGE + "?sender=0&receiver=" + GameManager.Instance.mInfo.id + "&time=" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", time_send)); } ServerWeb.StartThread(ServerWeb.URL_GETINFO_MESSAGE, formMessageSystem, delegate(bool isDone, WWW response, IDictionary json) { var x = json; if (isDone && json["code"].ToString() == "1") { ArrayList downloadMessageSystem = (ArrayList)json["item"]; List <Hashtable> lst = new List <Hashtable>(); foreach (Hashtable hash in downloadMessageSystem) { lst.Add(hash); } SaveCache(lst.ToArray()); if (EventResponseMessageSystem != null) { EventResponseMessageSystem(); } } }); #endregion }
public static void ClearCache() { if (!Application.isWebPlayer) { return; } if (GameManager.CurrentScene == ESceneName.GameplayChan) { return; } if (StoreGame.Contains(StoreGame.EType.PLAY_THE_SAME_DEVICE)) { string newValue = ""; string[] arrays = StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE).Split(DATA_ROW.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); Debug.LogWarning(StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE) + "\n" + arrays.Length); foreach (string str in arrays) { string[] arr = str.Split(DATA_SAPCE.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arr[0] == GameManager.Instance.mInfo.username) { Debug.LogWarning("IsCanJoinGameplay Remove: " + str); continue; } newValue += str + DATA_ROW; } if (newValue != StoreGame.LoadString(StoreGame.EType.PLAY_THE_SAME_DEVICE)) { if (string.IsNullOrEmpty(newValue)) { StoreGame.Remove(StoreGame.EType.PLAY_THE_SAME_DEVICE); } else { StoreGame.SaveString(StoreGame.EType.PLAY_THE_SAME_DEVICE, newValue); } StoreGame.Save(); } } }
public ApplicationStart() { #region CLEAR CACHE WITH OLD VERSION if (!StoreGame.Contains(StoreGame.EType.VERSION) || (StoreGame.LoadString(StoreGame.EType.VERSION) != GameSettings.CurrentVersion)) { StoreGame.ClearCache(); StoreGame.SaveString(StoreGame.EType.VERSION, GameSettings.CurrentVersion); } #endregion #region KIỂM TRA CẤU HÌNH CÁC CONFIGURATION CỦA SERVER GameManager.Instance.StartCoroutine(DoRequestAllConfiguration("Kiểm tra kết nối đến server")); #endregion #region KIỂM TRA THÔNG TIN HỖ TRỢ (1) if (!StoreGame.Contains(StoreGame.EType.CACHE_HELP)) { GameManager.Instance.StartCoroutine(DoRequest_AllHelp()); } else { GameManager.Instance.StartCoroutine(onProcessGetInfoRule(StoreGame.LoadString(StoreGame.EType.CACHE_HELP), true)); } #endregion #region KIỂM TRA THÔNG TIN ĐIỀU KHOẢN SỬ DỤNG (1) //if (!StoreGame.Contains(StoreGame.EType.CACHE_POLICY)) // GameManager.Instance.StartCoroutine(DoRequest_Policy()); //else // GameManager.Instance.StartCoroutine(onProcessGetInfoRule(StoreGame.LoadString(StoreGame.EType.CACHE_POLICY), true)); #endregion #region REQUEST CHECK VERSION GameManager.Instance.StartCoroutine(DoRequestVersion()); #endregion #region REQUEST GET ADS GameManager.Instance.StartCoroutine(DoRequestAds()); #endregion #region REQUEST RECHARGE GameManager.Instance.StartCoroutine(DoRequestRecharge()); #endregion }
IEnumerator Start() { Debug.Log(GameManager.Setting.IsMustUpdate); if (!Common.IsRelease) { CServer.HOST_NAME = StoreGame.LoadString(StoreGame.EType.SAVE_SERVER); } if (!string.IsNullOrEmpty(GameManager.Setting.IsMustUpdate)) { NotificationView.ShowConfirm("Thông báo", "Có bản cập nhật quan trọng. Bạn có muốn tải về?", OnOkUpdateVersion, OnCancelUpdateVersion); yield break; } else { if (Common.IsRelease && GameManager.Instance.currentRoom != null) { #if UNITY_WEBPLAYER switch (GameSettings.Instance.TypeBuildFor) { case GameSettings.EBuildType.esimo: case GameSettings.EBuildType.web_esimo: //UpdateCookieString(); //StartCoroutine(_LoginInWebPlayer()); break; case GameSettings.EBuildType.web_facebook: while (string.IsNullOrEmpty(CServer.HOST_NAME)) { yield return(new WaitForEndOfFrame()); } WaitingView.Show("Đang lấy thông tin"); SocialCommon.Instance.LoginFaceBook(cbSavePass.value); break; } #endif GameManager.Instance.userNameLogin = StoreGame.Contains(StoreGame.EType.SAVE_USERNAME) ? StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME) : ""; GameManager.Instance.passwordLogin = StoreGame.Contains(StoreGame.EType.SAVE_PASSWORD) ? StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD) : ""; if (!string.IsNullOrEmpty(GameManager.Instance.userNameLogin) && !string.IsNullOrEmpty(GameManager.Instance.passwordLogin)) { while (string.IsNullOrEmpty(CServer.HOST_NAME)) { yield return(new WaitForEndOfFrame()); } yield return(new WaitForSeconds(0.1f)); WaitingView.Show("Đang đăng nhập"); GameManager.Server.DoLogin(); } } else if (Common.IsRelease) { if (StoreGame.Contains(StoreGame.EType.SAVE_USERNAME) && StoreGame.Contains(StoreGame.EType.SAVE_PASSWORD)) { if (!string.IsNullOrEmpty(StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME)) && !string.IsNullOrEmpty(StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD))) { lableUsername.value = StoreGame.LoadString(StoreGame.EType.SAVE_USERNAME); lablePassword.value = StoreGame.LoadString(StoreGame.EType.SAVE_PASSWORD); } } } } AudioManager.Instance.PlayBackground(); }