IEnumerator Start() { while (MatchingEventManager.Instance._isStart == false) { yield return(MatchingEventManager.Instance._isStart == true); } if (GetUserApi._httpCatchData.result.review == "true" || CommonConstants.IS_PREMIUM == true) { _panelPopupSuperLikeLimitText.text = ""; _panelPopupRewindText.text = ""; _panelPopupLikeLimitText.text = ""; } _usersCache = new List <UserDataEntity.Basic> (); _loadingOverLay.SetActive(true); _springDirection = new Vector2(0, 0); _tapReleasePosition = new Vector2(0, 0); _nowPosition = new Vector2(0, 0); _rotateBasePosition = new Vector2(0, 300); _cacheTransform = _controlObject.transform.localPosition; //ローカルファイル用の初期化 commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME; LocalFileHandler.Init(commonFileName); _backloadCount = 0; yield return(StartCoroutine(CallRandomUserListApi(_nowPage))); _loadingOverLay.SetActive(false); }
/// <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; }
// <!!> T is any struct or class marked with [Serializable] public static bool Save <T> (string prefKey, T serializableObject) { MemoryStream memoryStream = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(memoryStream, serializableObject); string tmp = System.Convert.ToBase64String(memoryStream.ToArray()); try { LocalFileHandler.SetString(prefKey, tmp); } catch (PlayerPrefsException ex) { Debug.LogError(ex.Message + " e x . M e s s a g e "); return(false); } finally { memoryStream.Close(); } return(true); }
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(); } }
private IEnumerator TinAction(LikeOrNope lNState, bool isButtonAnimation = false, bool isSuperLikePop = false) { if (_controlObject != null && _tinMax >= _tinCounter && _isEventPopUp == false) { _controlObject.GetComponent <BoxCollider2D> ().enabled = false; // ボタン操作の動き if (isButtonAnimation == true) { if (lNState == LikeOrNope.Nope) { _nope.SetActive(true); if (_controlObject != null) { _controlObject.GetComponent <uTweenRotation> ().to = new Vector3(0, 0, 90f); _controlObject.GetComponent <uTweenRotation> ().enabled = true; _controlObject.GetComponent <RectTransform> ().pivot = Vector2.zero; while (_controlObject.GetComponent <RectTransform> ().localEulerAngles.z < 90) { if (_controlObject == null) { yield break; } yield return(_controlObject.GetComponent <RectTransform> ().localEulerAngles.z >= 90); } } } else if (lNState == LikeOrNope.Like) { _like.SetActive(true); if (_tinCounter < _usersCache.Count) { yield return(StartCoroutine(CallSetUserLike(_usersCache [_tinCounter - 1].id, "0"))); } if (_controlObject != null) { _controlObject.GetComponent <uTweenRotation> ().to = new Vector3(0, 0, -90f); _controlObject.GetComponent <uTweenRotation> ().enabled = true; /* * while (_controlObject.GetComponent<RectTransform> ().localEulerAngles.z > -90) * { * if (_controlObject == null) * { * yield break; * } * yield return (_controlObject.GetComponent<RectTransform> ().localEulerAngles.z <= -90); * } */ } } else if (lNState == LikeOrNope.SuperLike) { _superLike.SetActive(true); if (isSuperLikePop == false) { if (LocalFileHandler.GetBool(LocalFileConstants.FIRST_SUPER_LIKE) == false) { MatchingEventManager.Instance.PopUpPanelOpen(_panelPopupSuperLikeLimit.gameObject); //LocalFileHandler.SetBool (LocalFileConstants.FIRST_SUPER_LIKE, true); yield break; } } else { LocalFileHandler.SetBool(LocalFileConstants.FIRST_SUPER_LIKE, false); if (_controlObject != null) { _controlObject.GetComponent <BoxCollider2D> ().enabled = true; } } if (_tinCounter < _usersCache.Count) { //pt 減算通知用リクエスト yield return(StartCoroutine(CallSetUserLike(_usersCache [_tinCounter - 1].id, "1"))); } if (_controlObject != null) { _controlObject.GetComponent <uTweenRotation> ().to = new Vector3(0, 90, 90f); _controlObject.GetComponent <uTweenRotation> ().enabled = true; while (_controlObject.GetComponent <RectTransform> ().localEulerAngles.z < 40) { if (_controlObject == null) { yield break; } yield return(_controlObject.GetComponent <RectTransform> ().localEulerAngles.z >= 40); } } } else if (lNState == LikeOrNope.Back) { if (_controlObject != null) { _controlObject.GetComponent <uTweenRotation> ().to = new Vector3(0, 0, 90f); _controlObject.GetComponent <uTweenRotation> ().enabled = true; _controlObject.GetComponent <RectTransform> ().pivot = Vector2.zero; while (_controlObject.GetComponent <RectTransform> ().localEulerAngles.z < 90) { if (_controlObject == null) { yield break; } yield return(_controlObject.GetComponent <RectTransform> ().localEulerAngles.z >= 90); } } } } Debug.Log(" ボタンアニメーション以外。 ここから"); // タップ操作で引っ張ってからの続き if (lNState == LikeOrNope.Nope) { if (isButtonAnimation) { _controlObject.GetComponent <uTweenPosition> ().from = _controlObject.transform.localPosition; _controlObject.GetComponent <uTweenPosition> ().to = new Vector3(-750f, 0f, 0f); _controlObject.GetComponent <uTweenPosition> ().enabled = true; } else { while (_controlObject.transform.localPosition.x >= -375) { if (_controlObject == null) { yield break; } Vector3 pos = _controlObject.transform.localPosition; pos.x += _releaseDirection.x; pos.y += _releaseDirection.y; _controlObject.transform.localPosition = pos; yield return(_controlObject.transform.localPosition.x >= -750); } } if (_controlObject != null) { Destroy(_controlObject); while (_controlObject != null) { yield return(_controlObject == null); } } } else if (lNState == LikeOrNope.Like) { if (isButtonAnimation == false) { yield return(StartCoroutine(CallSetUserLike(_usersCache [_tinCounter - 1].id, "0"))); } if (isButtonAnimation) { _controlObject.GetComponent <uTweenPosition> ().from = _controlObject.transform.localPosition; _controlObject.GetComponent <uTweenPosition> ().to = new Vector3(750f, 0f, 0f); _controlObject.GetComponent <uTweenPosition> ().enabled = true; while (_controlObject.transform.localPosition.x < 375) { if (_controlObject == null) { yield break; } yield return(_controlObject.transform.localPosition.x >= 375); } } else { while (_controlObject.transform.localPosition.x <= 375) { if (_controlObject == null) { yield break; } Vector3 pos = _controlObject.transform.localPosition; pos.x += _releaseDirection.x; pos.y += _releaseDirection.y; _controlObject.transform.localPosition = pos; yield return(_controlObject.transform.localPosition.x >= 375); } } if (_controlObject != null) { Destroy(_controlObject); while (_controlObject != null) { yield return(_controlObject == null); } } } else if (lNState == LikeOrNope.SuperLike) { if (isSuperLikePop == false) { if (LocalFileHandler.GetBool(LocalFileConstants.FIRST_SUPER_LIKE) == false) { MatchingEventManager.Instance.PopUpPanelOpen(_panelPopupSuperLikeLimit.gameObject); //LocalFileHandler.SetBool (LocalFileConstants.FIRST_SUPER_LIKE, true); yield break; } } else { LocalFileHandler.SetBool(LocalFileConstants.FIRST_SUPER_LIKE, false); if (_controlObject != null) { _controlObject.GetComponent <BoxCollider2D> ().enabled = true; } } if (isButtonAnimation == false && _tinMax > _tinCounter) { if (_tinMax == _tinCounter) { Debug.Log("スーパーいいね前の、_tinCounterの減算している。"); _tinCounter--; } Debug.Log(_usersCache [_tinCounter].id + " < スーパーいいねした時のユーザーのID、確認用 tincounter:" + _tinCounter); yield return(StartCoroutine(CallSetUserLike(_usersCache [_tinCounter - 1].id, "1"))); } if (isButtonAnimation) { _controlObject.GetComponent <uTweenPosition> ().from = _controlObject.transform.localPosition; _controlObject.GetComponent <uTweenPosition> ().to = new Vector3(0f, 1000f, 0f); _controlObject.GetComponent <uTweenPosition> ().enabled = true; } else { while (_controlObject.transform.localPosition.y <= 500) { if (_controlObject == null) { yield break; } Vector3 pos = _controlObject.transform.localPosition; pos.x += _releaseDirection.x; pos.y += _releaseDirection.y; _controlObject.transform.localPosition = pos; yield return(_controlObject.transform.localPosition.y >= 500); } } if (_controlObject != null) { Destroy(_controlObject); while (_controlObject != null) { yield return(_controlObject == null); } } } else if (lNState == LikeOrNope.Back) { if (isButtonAnimation) { _controlObject.GetComponent <uTweenPosition> ().from = _controlObject.transform.localPosition; _controlObject.GetComponent <uTweenPosition> ().to = new Vector3(-750f, 0f, 0f); _controlObject.GetComponent <uTweenPosition> ().enabled = true; } else { while (_controlObject.transform.localPosition.x >= -375) { if (_controlObject == null) { yield break; } yield return(_controlObject.transform.localPosition.x >= -375); } } if (_controlObject != null) { Destroy(_controlObject); while (_controlObject != null) { yield return(_controlObject == null); } } } else if (lNState == LikeOrNope.None) { if (_controlObject == null) { //yield break; } // 少しだけビヨンビヨンする float length = BASEPOSITION_ADJUST; _controlObject.transform.rotation = Quaternion.identity; while (length > 1) { Vector2 nowpos, basepos; nowpos.x = _controlObject.transform.localPosition.x; nowpos.y = _controlObject.transform.localPosition.y; basepos.x = _baseControlObjectPosition.x; basepos.y = _baseControlObjectPosition.y + BASEPOSITION_ADJUST; Vector2 lengthvector = basepos - nowpos; length = lengthvector.magnitude; lengthvector *= 0.5f; Vector3 pos = _controlObject.transform.localPosition; pos.x += lengthvector.x; pos.y += lengthvector.y; _controlObject.transform.localPosition = pos; yield return(length < 1); } _tapReleasePosition = Vector2.zero; _nowPosition = Vector2.zero; _springDirection = Vector2.zero; _isTin = true; _controlObject.GetComponent <RectTransform> ().anchoredPosition = Vector2.zero; _controlObject.transform.localRotation = Quaternion.Euler(Vector3.zero); _controlObject.GetComponent <BoxCollider2D> ().enabled = true; yield break; } if (_tinCounter < _tinMax) { _backloadCount++; _tinCounter++; } if (_tinCounter == _tinMax) { string alertTin = LocalMsgConst.ALERT_TINDER; PopupPanel.Instance.PopMessageInsert( alertTin, LocalMsgConst.OK, AlertOK ); MatchingEventManager.Instance.PanelPopupAnimate(PopupPanel.Instance.gameObject); yield break; } if (_tinCounter < _tinMax) { // 下に控える画像の読み込み GameObject go = Instantiate(Resources.Load(CommonConstants.TINDER_PANEL)) as GameObject; go.GetComponent <TinderImage> ().Init(_usersCache[_tinCounter]); go.transform.SetParent(_imageParent.transform, false); _controlObject = _nextControlObject; _nextControlObject = go; SetObj(_controlObject); _nextControlObject.GetComponent <BoxCollider2D> ().enabled = false; _controlObject.GetComponent <BoxCollider2D> ().enabled = true; } else { _controlObject = _nextControlObject; if (_controlObject != null) { SetObj(_controlObject); _controlObject.GetComponent <BoxCollider2D> ().enabled = true; } } // 描画順から一番したに持って行きたいから if (_controlObject != null) { _controlObject.transform.SetAsLastSibling(); } _tapReleasePosition = Vector2.zero; _nowPosition = Vector2.zero; _springDirection = Vector2.zero; _isTin = true; //追加がある場合 if (lNState != LikeOrNope.Back) { if (_tinCounter == _tinMax - 5) { int nPage = int.Parse(_nowPage) + 1; _nowPage = nPage.ToString(); yield return(StartCoroutine(AddCacheData(nPage.ToString()))); yield break; } } } else { Debug.Log("ここ異常系"); } yield break; }
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; }