IEnumerator InsertPicturePathFile(string path)
    {
        if (csUserSaveNLoad.pictureFlag == false)
        {
            //Debug.Log ("b");
            WWW www = new WWW(path);
            yield return(www);

            testM.mainTexture         = www.texture;
            user.userInfo.picturePath = path;
            user.SaveTest();
        }
        else
        {
            //Debug.Log ("a");
            WWW www = new WWW(user.userInfo.picturePath);
            yield return(www);

            if (user.userInfo.picturePath == "" || user.userInfo.picturePath == null)
            {
                //Debug.Log ("c");
                testM.mainTexture = Resources.Load("TestImage/character_test") as Texture;
            }
            else
            {
                testM.mainTexture = www.texture;
                //Debug.Log ("d");
            }
            switchCount++;
            if (switchCount == 2)
            {
                csUserSaveNLoad.pictureFlag = false;
            }
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (state == STATE.IDLE)
        {
            gameTimer += Time.deltaTime * playSpeed;
        }
        switch (state)
        {
        case STATE.BEFORE:
            break;

        case STATE.INIT:
            testMoveCount = 0;
            break;

        case STATE.IDLE:
            MapShowBlur.SetActive(false);
            Main.currentSceneNumber = 3;
            Main.currentGameStage   = stageNumber;           // Sound Setting
            TestMove();
            break;

        case STATE.TOWER:
            TestMove();             // UNITY TOUCH
            break;

        case STATE.TOWERINFO:
            break;

        case STATE.OPTION:
            break;

        case STATE.SHOWMAP:
            MapShowBlur.SetActive(true);
            Main.currentSceneNumber = 3;
            Main.currentGameStage   = stageNumber;           // Sound Setting

            mapShowTimer += Time.deltaTime;
            if (mapShowTimer <= mapShowTime / 2)
            {
                tkCamera.transform.position = new Vector3((mapShowTimer / mapShowTime) * 1320, 0, 0);
            }
            else if (mapShowTimer >= mapShowTime / 2)
            {
                tkCamera.transform.position = new Vector3(1320 - (mapShowTimer / mapShowTime) * 1320, 0, 0);
            }

            if (mapShowTimer >= mapShowTime)
            {
                MapShowBlur.SetActive(false);
                state        = STATE.IDLE;
                mapShowTimer = 0;
            }
            break;

        case STATE.GAMEOVER:
            Main.currentGameStage = 0;
            SoundManager.BGM_DEFEAT_ON();

            gameOverTimer += Time.deltaTime;
            gameOver.SetActive(true);
            if (gameOverTimer >= 1.5f)
            {
                gameOverMenu.SetActive(true);
                gameOverTimer = 0;
                state         = STATE.BEFORE;
            }

            break;

        case STATE.GAMEFINISH:
            Main.currentGameStage = 0;
            SoundManager.BGM_WIN_ON();
            gameClearTimer += Time.deltaTime;

            gameFinish.SetActive(true);

            if (gameClearTimer >= 1.5f)
            {
                incomeGold          = user.userInfo.inPlaySilver / 100;
                user.userInfo.gold += (int)incomeGold;
                gameFinishMenu.SetActive(true);
                gameClearTimer = 0;

                state = STATE.BEFORE;
                if (stageNumber < stageDB.mapList[mapNumber - 1].stageList.Count)
                {
                    if (stageNumber > user.userInfo.maxClearStage)
                    {
                        user.userInfo.maxClearStage = stageNumber;
                    }
                }
                if (user.userInfo.stageClearInfo[stageNumber - 1] == 0)
                {
                    user.userInfo.stat.remainPoint++;
                }
                user.userInfo.stageClearInfo[stageNumber - 1] += 1;


                user.userInfo.achieveInfo.stageClearCount++;
                user.SaveTest();
            }
            break;

        case STATE.PAUSE:
            break;

        case STATE.RESTART:
            state = STATE.INIT;
            break;

        case STATE.NEXTSTAGE:
            initInfo(mapNumber, stageNumber + 1);
            state = PlayScene.STATE.INIT;
            break;
        }
    }