IEnumerator SendAnswer(string url)
    {
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
        Handheld.StartActivityIndicator();

        var encoding = new System.Text.UTF8Encoding();
        var header   = new Dictionary <string, string>();

        header.Add("Content-Type", "application/json");
        var jsonString = JsonConvert.SerializeObject(activeQuestion);

        WWW request = new WWW(url, encoding.GetBytes(jsonString), header);

        while (!request.isDone)
        {
            yield return(null);
        }

        UpdateScoreBoard(request.text);
        HighlightScoreboard();
        AnswerField.image.color = Color.green;
        Invoke("FixInputColor", 0.5f);
        Number1.text = "00";
        Number2.text = "00";
        ToggleButtons();
        Handheld.StopActivityIndicator();
    }
Esempio n. 2
0
    private void Awake()
    {
        FilePath = pathSettings.RootPath + FilePath;
        if (File.Exists(FilePath))
        {
            objImporter = gameObject.GetComponent <ObjectImporter>();
            if (objImporter == null)
            {
                objImporter = gameObject.AddComponent <ObjectImporter>();
            }

            objImporter.ImportingStart += () => { Handheld.StartActivityIndicator(); };
            objImporter.ImportedModel  += (baseModel, name) =>
            {
                var model  = baseModel.transform.GetChild(0);
                var center = model.GetComponent <MeshFilter>().mesh.bounds.center;
                model.transform.position = -center;
                loadingText.enabled      = false;
                Handheld.StopActivityIndicator();
            };
            objImporter.ImportError += (err) => { Utils.ShowAndroidToastMessage(err); };
        }
        else
        {
            Utils.ShowAndroidToastMessage("path: '" + FilePath + "' not exist");
        }
    }
Esempio n. 3
0
    private void SwitchSceneHelper(EScene newScene, bool allowSameScene)
    {
        if (!allowSameScene && newScene == currentScene_)
        {
            Debug.LogWarning("Request to switch to same scene " + newScene);
        }
        else
        {
            if (isSwitching_)
            {
                Debug.LogWarning("SwitchSceneHelper rejecting request to switch from " + currentScene_ + " to " + newScene + " because it's already switching");
            }
            else
            {
                if (DEBUG_SCENES)
                {
                    Debug.Log("SwitchSceneHelper: from " + currentScene_ + " to " + newScene);
                }
                isSwitching_ = true;

                                #if UNITY_IPHONE
                Handheld.SetActivityIndicatorStyle(iOSActivityIndicatorStyle.WhiteLarge);
                                #elif UNITY_ANDROID
                Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
                                #endif

                Handheld.StartActivityIndicator();

                StartCoroutine(SwitchSceneCR(sceneNames_[newScene]));
            }
        }
    }
        IEnumerator LoadSceneFromFCM()
        {
#if UNITY_ANDROID
            AndroidJavaClass  UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject curActivity = UnityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject curIntent   = curActivity.Call <AndroidJavaObject>("getIntent");
            string            sceneToLoad = curIntent.Call <string>("getStringExtra", "sceneToOpen");
            ChallengeManager.CurrentChallengeId = curIntent.Call <string>("getStringExtra", "challengeId");
            Scene curScene = SceneManager.GetActiveScene();
            if (!string.IsNullOrEmpty(sceneToLoad) && sceneToLoad != curScene.name)
            {
                // If the current scene is different than the intended scene to load,
                // load the intended scene. This is to avoid reloading an already acive
                // scene.
                Debug.Log("Loading Scene: " + sceneToLoad);
                Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
                Handheld.StartActivityIndicator();
                yield return(new WaitForSeconds(0f));

                Debug.LogWarning(sceneToLoad);
                SceneManager.LoadScene(sceneToLoad);
            }
#else
            yield return(null);
#endif
        }
        public IEnumerator wwwRequest(string url, float timeLimit = downloadTimeLimit)
        {
            Handheld.StartActivityIndicator();

            www = new WWW(url);
            if (GPSController.Instance.userLocationStable)
            {
                float downloadTime = 0;

                while (!www.isDone)
                {
                    downloadTime += Time.deltaTime;
                    if (downloadTime >= timeLimit)
                    {
                        break;
                    }

                    yield return(null);
                }
                Debug.Log("WWW transfer from " + url.Substring(8, 40) + ".. @: " + (www.progress * 100) + "% in " + downloadTime + "s / " + timeLimit + "s");

                if (!www.isDone || !string.IsNullOrEmpty(www.error))
                {
                    Debug.LogError("Network error. Load not complete! TERMINATED AT:" + (int)www.progress * 100 + "%");
                    yield break;
                }

                Handheld.StopActivityIndicator();
                yield return(www);
            }
        }
Esempio n. 6
0
        public string level   = ""; // scene name to load

        // Use this for initialization
        void Start()
        {
            UnityEngine.Object.DontDestroyOnLoad(gameObject);     // retain this object through a level load
            Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.Gray);
            Handheld.StartActivityIndicator();
            StartCoroutine(WaitAndLoad());
        }
    public void Show(IndicatorType indicatorType)
    {
        _indicatorType = indicatorType;
        switch (indicatorType)
        {
        case IndicatorType.Default:
            #if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS || UNITY_PSM)
            #if UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
            #elif UNITY_IOS
            Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.WhiteLarge);
            #endif
            Handheld.StartActivityIndicator();
            #else
            _imgDefaultIndicator.enabled = true;
            tween = DOTween.Sequence()
                    .Append(_imgDefaultIndicator.transform
                            .DOLocalRotate(new Vector3(0.0f, 0.0f, -180.0f), 0.5f)
                            .SetEase(Ease.InSine))
                    .Append(_imgDefaultIndicator.transform
                            .DOLocalRotate(new Vector3(0.0f, 0.0f, -360.0f), 0.5f)
                            .SetEase(Ease.OutSine))
                    .SetLoops(-1, LoopType.Restart)
                    .Play();
            #endif
            break;

        default:
            Debug.LogErrorFormat("{0} NotFound {1}", typeof(IndicatorType).Name, indicatorType);
            break;
        }
        _imgMask.enabled = true;
    }
Esempio n. 8
0
        void BuyProductID(string productId)
        {
            Handheld.StartActivityIndicator();
            // If Purchasing has been initialized ...
            if (IsInitialized())
            {
                // ... look up the Product reference with the general product identifier and the Purchasing
                // system's products collection.
                Product product = m_StoreController.products.WithID(productId);

                // If the look up found a product for this device's store and that product is ready to be sold ...
                if (product != null && product.availableToPurchase)
                {
                    Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
                    // ... buy the product. Expect a response either through ProcessPurchase or OnPurchaseFailed
                    // asynchronously.
                    m_StoreController.InitiatePurchase(product);
                }
                // Otherwise ...
                else
                {
                    // ... report the product look-up failure situation
                    Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
                    Handheld.StopActivityIndicator();
                }
            }
            // Otherwise ...
            else
            {
                // ... report the fact Purchasing has not succeeded initializing yet. Consider waiting longer or
                // retrying initiailization.
                Debug.Log("BuyProductID FAIL. Not initialized.");
                Handheld.StopActivityIndicator();
            }
        }
Esempio n. 9
0
        /// <summary>
        /// インジケーターの表示開始
        /// 表示要求しているオブジェクトはあちこちから設定できる。
        /// 全ての要求が終了しない限りは表示を続ける
        /// </summary>
        /// <param name="obj">表示を要求してるオブジェクト</param>

        public void StartIndicator(System.Object obj)
        {
            IncRef(obj);
            if (objList.Count <= 0)
            {
                return;
            }
            if (isStarting)
            {
                return;
            }

            this.gameObject.SetActive(true);
            isStarting = true;
            if (IsDeviceIndicator())
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                Handheld.StartActivityIndicator();
#endif
            }
            else
            {
                InvokeRepeating("RotIcon", 0, animTime);
            }
        }
Esempio n. 10
0
    public static void OnRedeemCodeConfirm(string code)
    {
#if UNITY_IOS || UNITY_ANDROID
        Handheld.StartActivityIndicator();
#endif
        _enteredCode = code.ToUpper();
        ServerManager.Get("redeem/" + code, OnRedeemCodeSucceed, OnRedeemCodeReturnFailed);
    }
Esempio n. 11
0
        /// <summary>
        /// 表示開始
        /// </summary>
        public static void Start(object key)
        {
            Flags[key] = true;
#if UNITY_IPHONE || UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(Style);
            Handheld.StartActivityIndicator();
#endif
        }
Esempio n. 12
0
    internal void StartActivityIndicator()
    {
        if (IsTestType())
        {
            return;
        }
#if UNITY_ANDROID
        Handheld.StartActivityIndicator();
#endif
    }
Esempio n. 13
0
 // ***************************************************************
 private void playLongVideo(string id)
 {
             #if UNITY_IPHONE
     Handheld.SetActivityIndicatorStyle(ActivityIndicatorStyle.Gray);
             #elif UNITY_ANDROID
     Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
             #endif
     Handheld.StartActivityIndicator();
     Handheld.PlayFullScreenMovie(YoutubeVideo.Instance.RequestVideo(id, 360), Color.black, FullScreenMovieControlMode.Full);
 }
Esempio n. 14
0
    IEnumerator Logout()
    {
        // set the indicator to use
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
        Handheld.StartActivityIndicator();

        Debug.Log("Logout was pressed");
        // keep spinning until coroutine finishes
        yield return(StartCoroutine("CheckForSuccessfulLogout"));
    }
Esempio n. 15
0
    static public void ShowIndicator()
    {
#if UNITY_IOS
        Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.WhiteLarge);
#elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
#endif
        Handheld.StartActivityIndicator();

//        MNP.ShowPreloader("HeroCry", "Loading...");
    }
Esempio n. 16
0
    IEnumerator Load()
    {
#if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.Gray);
#elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Small);
#endif

        Handheld.StartActivityIndicator();
        yield return(new WaitForSeconds(0));
    }
Esempio n. 17
0
    /// <summary>
    /// Shows the loading spinner.
    /// </summary>
    public void Show()
    {
        if (!gameObject.activeSelf)
        {
            // Locks the interactions.
            Handheld.StartActivityIndicator();

            // Enables the spinner.
            FadeIn();
        }
    }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < Statements.Length; i++)
     {
         listOfOps.Add(NextStatement);
     }
     anim = GetComponent <Animator>();
     player1.Prepare();
     player1.prepareCompleted += VideoReady;
     Handheld.StartActivityIndicator();
 }
Esempio n. 19
0
    void loadLevel3()
    {
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.InversedLarge);

        Handheld.StartActivityIndicator();
        //startDialog();
        Application.LoadLevel(3);
        //MainUI.SetActive(false);
        // loadingIndicator.SetActive(true);
        //progressBar.SetActive(true);
    }
Esempio n. 20
0
        IEnumerator StartActivityIndicator()
        {
#if UNITY_IPHONE
            Handheld.SetActivityIndicatorStyle(iOSActivityIndicatorStyle.Gray);
#endif
#if UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.InversedLarge);
#endif
            Handheld.StartActivityIndicator();
            yield return(null);
        }
Esempio n. 21
0
 public void Suspend()
 {
     callCounts++;
     IsDisplayed = true;
     gameObject.SetActive(true);
     try { Handheld.StartActivityIndicator(); }
     catch (Exception e)
     {
         Debug.Log("Device not HandHeld, ");
         e.ToString();
     }
 }
Esempio n. 22
0
    IEnumerator Load()
    {
        yield return(new WaitForSeconds(temps));

        SceneManager.LoadScene(Escena);
#if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(iOS.ActivityIndicatorStyle.Gray);
#elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Small);
#endif

        Handheld.StartActivityIndicator();
    }
Esempio n. 23
0
    IEnumerator Load(String nameLevel)
    {
        #if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(iOS.ActivityIndicatorStyle.Gray);
        #elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
        #endif

        Handheld.StartActivityIndicator();
        yield return(new WaitForSeconds(0));

        SceneManager.LoadScene(nameLevel);
    }
Esempio n. 24
0
        /// <summary>
        /// Sets the native loading.
        /// </summary>
        /// <param name="isLoading">If set to <c>true</c> is loading.</param>
        public static void SetNativeLoading(bool isLoading)
        {
#if UNITY_IOS || UNITY_ANDROID
            if (isLoading)
            {
                Handheld.StartActivityIndicator();
            }
            else
            {
                Handheld.StopActivityIndicator();
            }
#endif
        }
Esempio n. 25
0
        IEnumerator StartActivityIndicator()
        {
#if UNITY_IOS
            Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.Gray);
#endif
#if UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.InversedLarge);
#endif
#if UNITY_IOS || UNITY_ANDROID
            Handheld.StartActivityIndicator();
#endif
            yield return(null);
        }
        async UniTask ILoading.OnShow(float defaultDuration)
        {
#if !UNITY_EDITOR && UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Small);
            Handheld.StartActivityIndicator();
#elif !UNITY_EDITOR && UNITY_IOS
            Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.White);
            Handheld.StartActivityIndicator();
#else
            await _canvasGroup
            .DOFade(1.0f, defaultDuration)
            .OnCompleteAsUniTask();
#endif
        }
Esempio n. 27
0
        public string level   = ""; // scene name to load

        // Use this for initialization
        void Start()
        {
            UnityEngine.Object.DontDestroyOnLoad(gameObject);     // retain this object through a level load
                #if UNITY_IOS
            Handheld.SetActivityIndicatorStyle(UnityEngine.iOS.ActivityIndicatorStyle.Gray);
                #endif
                #if UNITY_ANDROID
            Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.InversedLarge);
                #endif
                #if UNITY_IOS || UNITY_ANDROID
            Handheld.StartActivityIndicator();
                #endif
            StartCoroutine(WaitAndLoad());
        }
    private IEnumerator LoadSceneCoroutine(string scene)
    {
        yield return(new WaitForEndOfFrame());

#if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(iOS.ActivityIndicatorStyle.Gray);
#elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
#elif UNITY_TIZEN
        Handheld.SetActivityIndicatorStyle(TizenActivityIndicatorStyle.Small);
#endif
        Handheld.StartActivityIndicator();
        SceneManager.LoadScene(scene);
    }
Esempio n. 29
0
        // Restore purchases previously made by this customer. Some platforms automatically restore purchases, like Google.
        // Apple currently requires explicit purchase restoration for IAP, conditionally displaying a password prompt.
        public void RestorePurchases()
        {
            Handheld.StartActivityIndicator();

            // If Purchasing has not yet been set up ...
            if (!IsInitialized())
            {
                // ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
                Debug.Log("RestorePurchases FAIL. Not initialized.");
                Handheld.StopActivityIndicator();
                return;
            }

            // If we are running on an Apple device ...
            if (Application.platform == RuntimePlatform.IPhonePlayer ||
                Application.platform == RuntimePlatform.OSXPlayer)
            {
                // ... begin restoring purchases
                Debug.Log("RestorePurchases started ...");

                // Fetch the Apple store-specific subsystem.
                var apple = m_StoreExtensionProvider.GetExtension <IAppleExtensions>();
                // Begin the asynchronous process of restoring purchases. Expect a confirmation response in
                // the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
                apple.RestoreTransactions((result) => {
                    // The first phase of restoration. If no more responses are received on ProcessPurchase then
                    // no purchases are available to be restored.
                    Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");

                    // MNPopup popup = new MNPopup ("Restore Complete", "All purchases restored");
                    //     popup.AddAction ("Close", () => {Debug.Log("Ok action callback");});
                    //     popup.AddDismissListener (() => {Debug.Log("dismiss listener");});
                    //     popup.Show ();

                    Handheld.StopActivityIndicator();
                });
            }
            // Otherwise ...
            else
            {
                // We are not running on an Apple device. No work is necessary to restore purchases.
                Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);

                // MNPopup popup = new MNPopup ("Restore Failed", "Please check your internet connection");
                //         popup.AddAction ("Close", () => {Debug.Log("Ok action callback");});
                //         popup.AddDismissListener (() => {Debug.Log("dismiss listener");});
                //         popup.Show ();
            }
        }
Esempio n. 30
0
    public static void ShowActivityIndicator()
    {
    #if UNITY_IPHONE
        Handheld.SetActivityIndicatorStyle(iOS.ActivityIndicatorStyle.Gray);
    #elif UNITY_ANDROID
        Handheld.SetActivityIndicatorStyle(AndroidActivityIndicatorStyle.Large);
    #endif

        Handheld.StartActivityIndicator();

    #if UNITY_ANDROID
        // This must be called after Handheld.StartActivityIndicator() because that
        // method instantiates the ProgressBar widget whose layout params we are modifying.
        UnityActivityIndicator.MoveToCenterOfScreen();
    #endif
    }