예제 #1
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        IEnumerator Start()
        {
            _loadingOverlay.SetActive(true);
            // アンドロイドでバックグラウンドプッシュ?スプラッシュから?何かのタイミングで
            //static変数のデータが消え去ってしまうみたいなのでリカバー
            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
            }

            //ユーザーデータの取得。
            new GetUserApi();
            while (GetUserApi._success == false)
            {
                yield return(GetUserApi._success == true);
            }


            if (GetUserApi._httpCatchData.result.review == "false")
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
//有料会員か?
                if (CommonConstants.IS_PREMIUM == false)
                {
                    //_nendAdBanner.Show ();
                }
                else
                {
                    _nendAdBanner.Pause();
                    _nendAdBanner.Hide();
                    Destroy(_nendAdBanner.gameObject);
                }
#endif
            }

            //審査レビューじゃない場合のみ広告表示。
            if (GetUserApi._httpCatchData.result.review == "false")
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                if (CommonConstants.IS_PREMIUM == false)
                {
                    // 広告の取得、表示処理
                    if (CommonConstants.IS_AD_TEST == true)
                    {
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);
                    }
                    else
                    {
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);
                    }
                }
                else
                {
                    IMobileSdkAdsUnityPlugin.stop();
                }
#endif
            }

            //性別が取得出来ていない場合の処理。
            if (GetUserApi._httpCatchData.result.user.sex_cd == "0")
            {
                PanelGenderSelectCommon.Instance.Init();  //性別選択のUIを表示。
                _loadingOverlay.SetActive(false);
                yield break;
            }

            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;
            }

            ///アプリポップアップレビューの立ち上げ処理。
            AppliEventController.Instance.AppliReview();


            //マスターデータの取得
            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;
            }

            LocalFileHandler.Init(LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME);
            if (LocalFileHandler.GetBool(LocalFileConstants.TUTORIAL_MATCHING_KEY) == false)
            {
                _tutorial.SetActive(true);
            }
            else
            {
                _tutorial.SetActive(false);
            }

            _isStart = true;
            _loadingOverlay.SetActive(false);
            yield break;
        }