Exemplo n.º 1
0
    IEnumerator routine_AttendTime(del_NextProcess nextProcess)
    {
        DateTime nowTime   = TimeManager.Instance.Get_nowTime();
        TimeSpan nowSpan   = new TimeSpan(0, nowTime.Hour, nowTime.Minute, nowTime.Second);
        TimeSpan DailySpan = new TimeSpan(24, 0, 0);
        double   totalTime = (DailySpan - nowSpan).TotalSeconds;

        int hour;
        int min;
        int sec;

        while (true)
        {
            if (totalTime <= 0)
            {
                if (nextProcess != null)
                {
                    nextProcess();
                }
                break;
            }
            hour = (int)totalTime / 3600;
            min  = (int)((totalTime % 3600) / 60);
            sec  = (int)totalTime % 60;

            text_AtdLeftTime.text = string.Format("{0}:{1}:{2}", hour.ToString("D2"), min.ToString("D2"), sec.ToString("D2"));

            totalTime -= Time.deltaTime;

            yield return(null);
        }
    }
Exemplo n.º 2
0
    public static void TouchRotateObject(ref TouchPhase touchState, ref Vector3 pos_TouchBegan, ref Vector3 nowPointPos, Touch touch, Transform rotateObj
                                         , float rotataeSensitive, del_NextProcess nxtPrcMoved, del_NextProcess nxtPrcEnded)
    {
        //터치영역에 들어옴
        //Debug.Log("TouchType : " + TouchType);

        if (touchState == TouchPhase.Began)
        {
            touchState = TouchPhase.Moved;
        }
        else if (touchState == TouchPhase.Moved)
        {
#if UNITY_EDITOR
            if (nowPointPos == Input.mousePosition)
            {
                return;
            }

            nowPointPos = Input.mousePosition;
            //Debug.Log("nowMousePos : " + nowMousePos);
#else
            touch = Input.GetTouch(0);
            Vector3 touchPosVector3 = new Vector3(touch.position.x, touch.position.y, 100);
            Vector3 touchPos        = Camera.main.ScreenToWorldPoint(touchPosVector3);
            //Debug.Log("touchPos : " + touchPos);

            if (nowPointPos == touchPos)
            {
                Debug.Log("same nowPos");

                return;
            }
            nowPointPos = touchPos;
#endif

            float dis = nowPointPos.x - pos_TouchBegan.x;
            //Debug.Log("dis : " + dis);
            dis = dis / rotataeSensitive;
            rotateObj.eulerAngles = new Vector3(rotateObj.eulerAngles.x,
                                                rotateObj.eulerAngles.y - dis, rotateObj.eulerAngles.z);


            if (nxtPrcMoved != null)
            {
                nxtPrcMoved();
            }
        }
        else if (touchState == TouchPhase.Ended)
        {
            if (nxtPrcEnded != null)
            {
                nxtPrcEnded();
            }

            touchState = TouchPhase.Canceled;
        }
    }
Exemplo n.º 3
0
    public static IEnumerator routine_waitForInAppProducts(del_NextProcess nextProcess)
    {
        if (InAppPurchaseManager.instance.IsGetQueryInventory == false)
        {
            Loadmanager.instance.LoadingUI(true);
            User.isSelectedCharacter = true;

            float time = 0;
            while (true)
            {
                time += Time.deltaTime;

                if (InAppPurchaseManager.instance.IsGetQueryInventory == true)
                {
                    Loadmanager.instance.LoadingUI(false);
                    User.isSelectedCharacter = false;

                    if (nextProcess != null)
                    {
                        nextProcess();
                    }
                    break;
                }

                if (time > 5)
                {
                    Loadmanager.instance.LoadingUI(false);
                    User.isSelectedCharacter = false;
                    UI_Popup_Notice pop = UI_Manager.Getsingleton.CreatAndGetPopup <UI_Popup_Notice>(UIPOPUP.POPUPNOTICE);
                    pop.Set_PopupTitleMessage("알림");
                    pop.SetPopupMessage("상품 정보를 받아오지 못하였습니다. \n 다시 시도 바랍니다.");
                    break;
                }

                yield return(null);
            }
        }
        else
        {
            if (nextProcess != null)
            {
                nextProcess();
            }
            yield return(null);
        }
    }
Exemplo n.º 4
0
    private Queue <IEnumerator> Que_LoadDataRoutine = new Queue <IEnumerator>();                        //데이터 로딩을 위해 로딩될 코루틴데이터 큐

    // 비동기로 씬 로드 하기
    public static IEnumerator LoadScene(string SceneName, del_NextProcess nextProcess, del_NextProcess nextProcess_2, Slider progressBar)
    {
        async = SceneManager.LoadSceneAsync(SceneName);
        async.allowSceneActivation = false;
        //float barValue = 0;

        while (true)
        {
            if (async.isDone)
            {
                UserEditor.Getsingleton.EditLog("complete load");
                if (progressBar != null)
                {
                    if (progressBar.value < 99f)
                    {
                        progressBar.value = 100f;
                        yield return(null);
                    }
                }

                if (nextProcess != null)
                {
                    nextProcess();
                }
                break;
            }
            if (!async.isDone)
            {
                if (progressBar != null)
                {
                    if (progressBar.value < 60f)
                    {
                        progressBar.value += 10f;
                    }
                }
                float progress = async.progress * 100.0f;

                UserEditor.Getsingleton.EditLog(string.Format(" {0}%\n", progress));
            }
            if (async.progress == 0.90f)
            {
                if (progressBar != null)
                {
                    if (progressBar.value < 100f)
                    {
                        progressBar.value += 10f;
                    }
                    else if (progressBar.value >= 100f)
                    {
                        if (nextProcess_2 != null)
                        {
                            nextProcess_2();
                        }
                    }
                }
                else
                {
                    if (nextProcess_2 != null)
                    {
                        nextProcess_2();
                    }
                }
            }



            yield return(null);
        }
    }