/// <summary> /// Applis the review coroutine. /// </summary> /// <returns>The review coroutine.</returns> private IEnumerator AppliReviewCoroutine() { //まず、「アプリレビュー」条件に該当するか? while (GetUserApi._httpCatchData == null) { yield return(GetUserApi._httpCatchData != null); } //ポップアップに表示するテキストと、アプリレビューのスキームリンクが返り値で返ってきているか? if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.appli_review.url) == true || string.IsNullOrEmpty(GetUserApi._httpCatchData.result.appli_review.text) == true) { yield break; } //ローカルファイル - Init string commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(commonFileName); //ファイルが作成されるまでポーリングして処理待ち while (System.IO.File.Exists(commonFileName) == false) { yield return(System.IO.File.Exists(commonFileName) == true); } //ここでアプリレビュー用の処理を実行して良いか確認。 if (string.IsNullOrEmpty(LocalFileHandler.GetString(LocalFileConstants.APPLI_REVIEW_POPUP_SHOW)) == true) { if (_mainCanvas != null) { GameObject go = Instantiate(Resources.Load(CommonConstants.APPLI_REVIEW_POPUP_PANEL)) as GameObject; while (go == null) { yield return(go != null); } go.transform.SetParent(_mainCanvas, false); //表示を最前面に go.transform.SetAsLastSibling(); go.name = CommonConstants.APPLI_REVIEW_POPUP_PANEL; go.GetComponent <PopupAppliReView> ().Init(GetUserApi._httpCatchData.result.appli_review.url, GetUserApi._httpCatchData.result.appli_review.text); PanelPopupAnimate(go); } } else { //次回表示をオンにしているため、何の処理もしない yield break; } yield break; }
public static T Load <T> (string prefKey) { if (!LocalFileHandler.HasKey(prefKey)) { return(default(T)); } BinaryFormatter bf = new BinaryFormatter(); string serializedData = LocalFileHandler.GetString(prefKey); MemoryStream dataStream = new MemoryStream(System.Convert.FromBase64String(serializedData)); try { T deserializedObject = (T)bf.Deserialize(dataStream); return(deserializedObject); } catch (SerializationException ex) { Debug.LogWarning("Error" + ex.Message); return(default(T)); } finally { dataStream.Close(); } }
IEnumerator Start() { _loadingOverlay.SetActive(true); if (string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == true) { //サーバーにイベント通知用Api(インストール時に一回のみ) ---------------------- string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(_commonFileName); //ファイルが作成されるまでポーリングして処理待ち while (System.IO.File.Exists(_commonFileName) == false) { yield return(System.IO.File.Exists(_commonFileName) == true); } //ここでユーザーキーを取得 AppStartLoadBalanceManager._userKey = LocalFileHandler.GetString(LocalFileConstants.USER_KEY); #if UNITY_ANDROID //ステータスバーを表示 //Android用 ApplicationChrome.statusBarState = ApplicationChrome.States.VisibleOverContent; #endif } while (string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == true) { yield return(string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == false); } //ユーザーデータ取得。 new GetUserApi(); while (GetUserApi._success == false) { yield return(GetUserApi._success == true); } AppStartLoadBalanceManager._gender = GetUserApi._httpCatchData.result.user.sex_cd; //メンテナンスの場合、処理を止める。 if (AppliEventController.Instance.MaintenanceCheck() == true) { _loadingOverlay.SetActive(false); yield break; } //ユーザーのステータスをチェックする処理。 AppliEventController.Instance.UserStatusProblem(); //強制アップデートの場合、処理を止める。 if (AppliEventController.Instance.ForceUpdateCheck() == true) { _loadingOverlay.SetActive(false); yield break; } if (GetUserApi._httpCatchData.result.reject == "true") { WebviewIntroductionOpen(); yield break; } //マスターデータ取得 if (InitDataApi._httpCatchData == null) { new InitDataApi(); while (InitDataApi._success == false) { yield return(InitDataApi._success == true); } } //基本プロフィールを作成しているかどうかの判定。念の為、もう一回判定。 if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.name) == false && string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.pref) == false && string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.city_id) == false && string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.birth_date) == false) { //基本プロフィールを作成している。 AppStartLoadBalanceManager._isBaseProfile = true; } else { //まだ、基本プロフィールを作成していない。 AppStartLoadBalanceManager._isBaseProfile = false; } Helper.LocalFileHandler.Init(LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME); string fromScene = Helper.LocalFileHandler.GetString(LocalFileConstants.FROM_MYPAGE_SCENE); if (string.IsNullOrEmpty(fromScene) == false && fromScene == CommonConstants.MYPAGE_SCENE) { _backSwipe.EventMessageTarget = _panelPurchase.gameObject; HeaderPanel.Instance.BackButtonSwitch(true, BackMypageScene); } if (SceneManager.GetActiveScene().name == CommonConstants.PURCHASE_SCENE) { while (string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == true) { yield return(string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == false); } new PurchaseItemListApi(); while (PurchaseItemListApi._success == false) { yield return(PurchaseItemListApi._success == true); } //if (m_Controller == null) { // //基本は定形 (購入の内部もカスタマイズしたりも出来る) // var builder = ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ()); // var items = PurchaseItemListApi._httpCatchData.result.purchase_items; // foreach (var item in items) { // builder.AddProduct (item.product_id, // ProductType.Consumable, // new IDs { // { item.product_id, AppleAppStore.Name }, // { item.product_id, GooglePlay.Name } // } // ); // } // UnityPurchasing.Initialize (this, builder); // //見本 ↓↓↓↓↓↓↓↓↓↓↓↓ // //builder.AddProduct ("chat.test.0113.120", ProductType.Consumable, new IDs {{"chat.test.0113.120", AppleAppStore.Name},{"chat.test.0113.120", GooglePlay.Name}}); // //builder.AddProduct ("chat.test.0113.360", ProductType.Consumable, new IDs {{"chat.test.0113.360", AppleAppStore.Name},{"chat.test.0113.360", GooglePlay.Name}}); //} _loadingOverlay.SetActive(false); } if (SceneManager.GetActiveScene().name == CommonConstants.PURCHASE_SCENE) { if (_tmpText != null) { _tmpText.text = LocalMsgConst.TITLE_PURCHASE; } new GetUserApi(); while (GetUserApi._success == true) { yield return(GetUserApi._success == false); } if (GetUserApi._httpCatchData != null) { int poInt = int.Parse(GetUserApi._httpCatchData.result.user.current_point); string poText = string.Format("{0:#,0}", poInt); _point.text = String.Format(LocalMsgConst.USE_POINT_TEXT + " {0:#,0} ", "<size=50>" + poText + "</size>") + LocalMsgConst.PT_TEXT; } yield return(StartCoroutine(PurchaseItemSet())); } yield break; }