예제 #1
0
    // Update is called once per frame
    void Update()
    {
        switch (loadingState)
        {
        case LOADING_STATE_LOGO:
            if ((Time.frameCount > nextTime + CDefine.LOGO_SHOWFRAME) || (Input.GetKeyDown(KeyCode.Return)))
            {
                loadingState = LOADING_STATE_NONE;
                GameObject.FindGameObjectWithTag("Logo").SetActive(false);
                nextTime = Time.frameCount;
            }
            break;

        case LOADING_STATE_NONE:
            FaceBook.CallFBInit();
            loadingState = LOADING_STATE_FACEBOOK_INIT;
            break;

        case LOADING_STATE_FACEBOOK_INIT:
            if (FaceBook.IsInit)
            {
                loadingState = LOADING_STATE_FACEBOOK_LOGIN;
                FaceBook.CallFBLogin();
            }
            break;

        case LOADING_STATE_FACEBOOK_LOGIN:
            if (FB.IsLoggedIn)
            {
                //·Î±×ÀÎ
                FbDebug.Log("State To Loading Server");
                loadingState = LOADING_STATE_SERVER;
            }
            break;

        case LOADING_STATE_SERVER:
            //FbDebug.Log("State To Complete");
            if (currentBar >= FOURTH)
            {
                serverConnection.SendLogin();
                loadingState = LOADING_STATE_COMPLETE;
            }
            break;

        case LOADING_STATE_COMPLETE:
            //if ((Time.frameCount > nextTime + CDefine.LOGO_SHOWFRAME) || (Input.GetKeyDown(KeyCode.Return)))
            //{
            //load title scene

            //FaceBook.sendScore(0);

            if (serverConnection.isComplete())
            {
                SceneTitle.first_loading = true;
                Application.LoadLevel("SceneTitle");
            }
            else if (!MainData.ServerConnection)
            {
                loadingState += 1;
            }

            //}
            break;
        }

        //print( Time.frameCount );
        //next scene

        /*
         * if( (Time.frameCount > nextTime + CDefine.LOGO_SHOWFRAME) || ( Input.GetKeyDown (KeyCode.Return) ) ){
         *  //load title scene
         *  Application.LoadLevel( "SceneTitle" );
         * }
         */
    }