Exemplo n.º 1
0
        void Start()
        {
            GameManager.getInstance().init();
            //		GameManager.getInstance ().hideBanner (true);
            //GameData.getInstance().cLevel = -1;
            fadeOut();

            GameObject.Find("maintitle").GetComponent <Text>().text = Localization.Instance.GetString("mainTitle");

            //fix position bug
            all_mainMenu.transform.parent.GetComponent <RectTransform>().GetLocalCorners(corners);
            moveX = (corners[3] - corners[0]).x;

            toggleMusic.isOn = GameData.getInstance().isSoundOn == 1 ? true : false;//0 is on
            toggleSFX.isOn   = GameData.getInstance().isSfxOn == 1 ? true : false;

            //GameObject.Find ("btnStart").GetComponentInChildren<Text> ().text = Localization.Instance.GetString ("btnStart");
            //GameObject.Find ("btnMore").GetComponentInChildren<Text> ().text = Localization.Instance.GetString ("btnMore");
            //GameObject.Find ("btnReview").GetComponentInChildren<Text> ().text = Localization.Instance.GetString ("btnReview");

            //title.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("graphic/sprites/" + Localization.Instance.GetString ("titleImageName"));

            //GameManager.getInstance ().hideBanner (true);


            if (all_level != null)
            {
                return;
            }
            SceneManager.LoadScene("InGame");
        }
Exemplo n.º 2
0
 void initLevels()
 {
     initView();
     GameData.getInstance().currentScene = 1;//1 is levelmenu
     groups = new List <GameObject>();
     mainContainer.SetActive(true);
 }
Exemplo n.º 3
0
 public void initSingleMode()
 {
     GameData.getInstance().resetData();
     crispTemplate = GameObject.Find("crisp");
     StartCoroutine("nextframe");
     initGame();
 }
Exemplo n.º 4
0
        Dictionary <string, int> sfxdic = new Dictionary <string, int>(); //check and scan existing sound fx.
        /// <summary>
        /// Play the music effects
        /// </summary>
        /// <returns>The sfx.</returns>
        /// <param name="str">String.</param>
        public AudioSource playSfx(string str)
        {
            AudioSource sfxSound = null;

            if (!music)
            {
                return(null);
            }
            AudioClip clip = (AudioClip)Resources.Load("sound/" + str, typeof(AudioClip));

            if (GameData.getInstance().isSfxOn == 0)
            {
                sfxSound = music.GetComponent <musicScript>().PlayAudioClip(clip);
                if (sfxSound != null)
                {
                    if (sfxdic.ContainsKey(str) == false || sfxdic[str] != 1)
                    {
                        currentSFX.Add(sfxSound);
                        sfxdic[str] = 1;
                    }
                }
            }

            return(sfxSound);
        }
Exemplo n.º 5
0
        public void showOrHideTipPanel()
        {
            if (!canShow)
            {
                return;
            }
            gameObject.SetActive(true);
            GameData.getInstance().tickStartTime = PlayerPrefs.GetString("tipStart", "0");
            // Add event handler code here
            if (!isShowed)
            {
                bg.DOMoveX(0, .2f).SetEase(Ease.Linear).OnComplete(OnShowCompleted);
                //
                startX = bg.transform.position.x;

                canShow = false;
                GameData.getInstance().isLock = true;
                //disable some UI;
                checkUI();
            }
            else
            {
                canShow = false;

                transform.Find("bg").DOMoveX(startX, .2f).SetEase(Ease.Linear).OnComplete(OnHideCompleted);
            }
        }
Exemplo n.º 6
0
        public void OnClick2(GameObject g)
        {
            GameManager.getInstance().playSfx("click");
            switch (g.name)
            {
            case "btnBuyCoin":
                GameManager.getInstance().playSfx("click");

                int tindex = int.Parse(g.transform.parent.name.Substring(3, 1));

                if (tindex < 3)
                {
                    GameManager.getInstance().buy(tindex);
                }
                else
                {
                    GameManager.getInstance().buy(tindex);
                }
                break;

            case "btnClose":
                GameManager.getInstance().playSfx("click");
                gameObject.SetActive(false);
                GameData.instance.isLock = false;
                //panel = transform.Find("panel").gameObject;
                //ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 600, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject, "oncompleteparams", "buyClose"));
                GameData.getInstance().isUILock = false;
                break;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// touch the continue to Continues your last level.not used
        /// </summary>
        public void continueLevel()
        {
            int tLastLevel = GameData.getInstance().levelPassed;

            if (tLastLevel < GameData.totalLevel[GameData.difficulty])
            {
                GameData.getInstance().cLevel = tLastLevel;
            }
            else
            {
                GameData.getInstance().cLevel = GameData.totalLevel[GameData.difficulty];
            }

            string tstr = "game";// + GameData.getInstance ().cLevel;


            if (GameData.instance.mode == 1)//this is always for test because you may not start from the initiate window.
            {
                fadeIn(tstr);
            }
            else
            {
                GameData.getInstance().isLock = true;
                all_level.transform.DOMoveX(all_level.transform.position.x - Screen.width, 1f).SetEase(Ease.OutBounce).OnComplete(() => {
                    all_game.transform.parent.GetComponent <MainScript>().init();
                    GameData.instance.isLock = false;
                });
                all_game = GameObject.Find("all_game");
                if (all_game != null)
                {
                    all_game.transform.DOMoveX(0, 1f).SetEase(Ease.OutBounce);
                    GameData.instance.isLock = false;
                }
            }
        }
Exemplo n.º 8
0
 void initLocalize()
 {
     //int localize
     if (Localization.Instance != null)
     {
         Localization.Instance.SetLanguage(GameData.getInstance().GetSystemLaguage());
     }
 }
Exemplo n.º 9
0
        //public void CacheVideo()
        //{
        //    Chartboost.cacheRewardedVideo(CBLocation.Default);
        //}

        //bool isfirst = true;//show interestital on start
        //void cbInterestitialReady(CBLocation location)
        //{
        //    if (isfirst)
        //    {
        //        Chartboost.showInterstitial(CBLocation.Default);
        //        isfirst = false;
        //    }
        //}

        //void didFailToLoadRewardedVideo(CBLocation location, CBImpressionError error)
        //{
        //    Debug.Log(string.Format("didFailToLoadRewardedVideo: {0} at location {1}", error, location));
        //}

        //void didDismissRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("didDismissRewardedVideo: " + location);
        //}

        //void didCloseRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("didCloseRewardedVideo: " + location);
        //}

        //void didClickRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("didClickRewardedVideo: " + location);
        //}
        //public bool isCachedVideo = false;
        //void didCacheRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("didCacheRewardedVideo: " + location);
        //    isCachedVideo = true;
        //}

        //bool shouldDisplayRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("shouldDisplayRewardedVideo: " + location);
        //    return true;
        //}

        //void didCompleteRewardedVideo(CBLocation location, int reward)
        //{
        //    Debug.Log(string.Format("didCompleteRewardedVideo: reward {0} at location {1}", reward, location));


        //    makeReward();

        //}

        //void didDisplayRewardedVideo(CBLocation location)
        //{
        //    Debug.Log("didDisplayRewardedVideo: " + location);
        //}

        //free tip
        void makeReward()
        {
            GameData.getInstance().tipRemain += 2;
            PlayerPrefs.SetInt("tipRemain", GameData.instance.tipRemain);
            GameData.instance.main.refreshView();

            PlayerPrefs.Save();
        }
Exemplo n.º 10
0
        void Update()
        {
            if (n < 20)
            {
                n++;
                return;
            }
            else
            {
                n = 0;
            }

            if (!canTick)
            {
                return;
            }


            if (GameData.instance.tipRemain > 0)
            {
                lb_notip.text = Localization.Instance.GetString("tipRemain") + GameData.instance.tipRemain;
            }
            else
            {
                lb_notip.text = Localization.Instance.GetString("buyTip");
            }

            return;

            if (GameData.getInstance().tipRemain == 0)
            {
                //			DateTime tnow = System.DateTime.Now;
                TimeSpan ts     = new TimeSpan(50, 0, 0, 0);
                DateTime dt2    = DateTime.Now.Subtract(ts);
                long     tcTime = dt2.Ticks / 10000000;



                int tTimeLasts = (int)(tcTime - long.Parse(GameData.getInstance().tickStartTime));


                int secondRemain = 300 - tTimeLasts;
                if (secondRemain <= 0)
                {
                    secondRemain = 0;
                    //count of;
                    PlayerPrefs.SetInt("tipRemain", 1);
                    PlayerPrefs.SetString("tipStart", "0");
                    GameData.getInstance().tipRemain     = 1;
                    GameData.getInstance().tickStartTime = "0";
                    GameData.getInstance().main.refreshView();
                    checkUI();
                    print("startrefresh");
                }

                //lb_notip.text = Localization.Instance.GetString("nextTip") + (secondRemain).ToString() + " seconds";
            }
        }
Exemplo n.º 11
0
        public void init()
        {
            GameData.getInstance().currentScene = 2;

            GameObject.Find("Tangram").GetComponent <Tangram>().initGame();
            //GameManager.getInstance().CacheVideo();
            refreshView();
            StartCoroutine("waitaframe1");
        }
Exemplo n.º 12
0
        public void noHandler()
        {
            GameData.getInstance().isLock = true;
            GameManager.getInstance().playSfx("click");

            notUnlock = false;

            showOrHideTipPanel();
        }
Exemplo n.º 13
0
        void Start()
        {
            GameManager.getInstance().init();
            GameData.getInstance().resetData();

            crispTemplate = GameObject.Find("crisp");

            StartCoroutine("nextframe");
            //initGame();
        }
Exemplo n.º 14
0
        IEnumerator waitaframe()
        {
            yield return(new WaitForEndOfFrame());

            GameData.getInstance().isLock = false;
            if (!notUnlock)//unlockUI when not using shop
            {
                GameData.getInstance().isUILock = false;
            }
        }
Exemplo n.º 15
0
 void OnHideCompleted(string str)
 {
     switch (str)
     {
     case "buyClose":
         gameObject.SetActive(false);
         GameData.getInstance().isLock = false;    //.lockGame(false);
         break;
     }
 }
Exemplo n.º 16
0
 public void OnHideCompleted()
 {
     isShowed = false;
     gameObject.SetActive(false);
     canShow = true;
     if (GameData.getInstance().isWin)
     {
         GameObject.Find("Tangram").GetComponent <Tangram>().clear(true);
         GameObject.Find("all_game").transform.parent.GetComponent <MainScript>().refreshView();
     }
 }
Exemplo n.º 17
0
        /// <summary>
        /// Clicks the level button.
        /// </summary>
        /// <param name="tbtn">Tbtn.</param>
        void clickLevel(GameObject tbtn)
        {
            if (GameData.instance.isLock)
            {
                return;
            }
            GameManager.getInstance().playSfx("click");
            int cText = int.Parse(tbtn.GetComponentInChildren <Text>().text) - 1;

            if (enableLock)
            {
                if (cText >= GameData.instance.levelPass[GameData.difficulty] + 1)
                {
                    return;                                                               //locked level
                }
            }
            GameData.getInstance().cLevel = cText; //start from 0

            if (GameData.instance.mode == 1)       //the fade transition for test only
            {
                if (!isMoving)
                {
                    fadeIn("game");
                }
            }
            else//load level
            {
                GameData.instance.isLock = true;
                all_game = GameObject.Find("all_game");



                //fix postion bug
                Vector3 fixedPosition1 = new Vector3(0, all_game.transform.localPosition.y, 0);
                Vector3 fixedPosition2 = new Vector3(-moveX, all_level.transform.localPosition.y, 0);

                all_game.transform.parent.GetComponent <MainScript>().refreshView();//some ui must active before anim finishes;
                all_level.transform.DOLocalMove(fixedPosition2, 1f).SetEase(Ease.OutBounce).OnComplete(() =>
                {
                    all_game.transform.parent.GetComponent <MainScript>().init();
                    //fix position bug
                    all_game.transform.localPosition  = fixedPosition1;
                    all_level.transform.localPosition = fixedPosition2;
                    GameData.getInstance().isLock     = false;
                });

                if (all_game != null)
                {
                    all_game.transform.DOMove(fixedPosition1, 1f).SetEase(Ease.OutBounce);
                }
            }
        }
Exemplo n.º 18
0
        public void showTipPanel()
        {
            GameManager.getInstance().playSfx("click");

            if (GameData.instance.isLock)
            {
                return;
            }

            GameData.getInstance().isUILock = true;
            showOrHideTipPanel();
            //GetComponent<Image>().raycastTarget = true;
        }
Exemplo n.º 19
0
        /// <summary>
        /// check if win every second
        /// </summary>
        /// <returns>The asecond.</returns>
        IEnumerator waitAsecond()
        {
            yield return(new WaitForSeconds(1));

            if (timeCount > 0)
            {
                if (GameData.getInstance().isWin == false)
                {
                    timeCount--;
                    StartCoroutine("waitAsecond");
                    timeTxt.text = timeCount.ToString();
                }
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// Submits the score to game center.
 /// </summary>
 public void submitGameCenter()
 {
     if (!isAuthored)
     {
         //Debug.Log("authenticating...");
         //initGameCenter();
     }
     else
     {
         Debug.Log("submitting score...");
         //			int totalScore = getAllScore();
         int bestScore = GameData.getInstance().bestScore;
         ReportScore(Const.LEADER_BOARD_ID, bestScore);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// This will be called when a purchase completes.
        /// </summary>
        ///
        public void purchansedCallback(string id)
        {
            bool buyenough = false;

            switch (id)
            {
            case "pack0":
                buyenough = true;
                //GameData.getInstance().coin += 120;
                GameData.getInstance().tipRemain += 20;


                break;

            case "pack1":
                buyenough = true;
                //GameData.getInstance().coin += 300;
                GameData.getInstance().tipRemain += 50;
                break;

            case "pack2":
                buyenough = true;
                //GameData.getInstance().coin += 500;
                GameData.getInstance().tipRemain += 100;
                break;

            case "pack3":
                //this for video reward
                ShowRewardedAd();

                break;
            }

            PlayerPrefs.SetInt("tipRemain", GameData.instance.tipRemain);
            GameData.instance.main.refreshView();
            //PlayerPrefs.SetInt("coin", GameData.getInstance().coin);
            //GameObject txtCoin = GameObject.Find("txtCoin");
            //if (txtCoin != null)
            //{
            //    txtCoin.GetComponent<Text>().text = GameData.getInstance().coin.ToString();
            //}
            if (buyenough && !test)
            {
                GameData.isAds = false;
                PlayerPrefs.SetInt("noAds", 1);
            }
        }
Exemplo n.º 22
0
        //continue
        public void OnContinueEventHandler()
        {
            if (!isShowed)
            {
                return;
            }
            GameManager.getInstance().playSfx("click");
            showHidePanel();

            if (GameData.getInstance().cLevel < GameData.totalLevel[GameData.difficulty] - 1)
            {
                GameData.getInstance().cLevel++;
            }
            else
            {
                GameData.getInstance().cLevel = 0;
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Refreshs the view.
        /// </summary>
        public void refreshView()
        {
            GameObject.Find("btnTip").GetComponentInChildren <Text>().text = GameData.getInstance().tipRemain.ToString();
            //		print (GameData.getInstance ().tipRemain.ToString ());
            GameObject.Find("lb_level").GetComponent <Text>().text = (GameData.getInstance().cLevel + 1).ToString();


            timeTxt = GameObject.Find("timeTxt").GetComponent <Text>();


            GameObject tIns = GameObject.Find("lb_ins");

            if (tIns != null)
            {
                tIns.GetComponent <Text>().text = Localization.Instance.GetString("lb_ins");
            }
            //GameObject.Find ("btnRetryB").GetComponentInChildren<Text> ().text = Localization.Instance.GetString ("btnRetry");
            //GameObject.Find ("btnMain").GetComponentInChildren<Text> ().text = Localization.Instance.GetString ("btnReturn");
        }
Exemplo n.º 24
0
        public void OnToggle(Toggle toggle)
        {
            switch (toggle.gameObject.name)
            {
            case "ToggleMusic":

                GameData.getInstance().isSoundOn = toggle.isOn ? 1 : 0;


                if (toggle.isOn)
                {
                    GameManager.getInstance().stopBGMusic();
                }
                else
                {
                    GameManager.getInstance().playMusic("bgmusic");
                }
                PlayerPrefs.SetInt("sound", GameData.getInstance().isSoundOn);

                break;

            case "ToggleSfx":



                GameData.getInstance().isSfxOn = toggle.isOn ? 1 : 0;
                if (toggle.isOn)
                {
                    GameManager.getInstance().stopAllSFX();
                }


                PlayerPrefs.SetInt("sfx", GameData.getInstance().isSfxOn);

                if (sfxInited)
                {
                    GameManager.getInstance().playSfx("click");
                }
                sfxInited = true;

                break;
            }
        }
Exemplo n.º 25
0
        void Start()
        {
            GameManager.getInstance().init();
            GameData.getInstance().resetData();
            Localization.Instance.SetLanguage(GameData.getInstance().GetSystemLaguage());



            GameData.getInstance().currentScene = 1;

            GameObject.Find("btneasy").GetComponentInChildren <Text>().text     = Localization.Instance.GetString("btneasy");
            GameObject.Find("btnmedium").GetComponentInChildren <Text>().text   = Localization.Instance.GetString("btnmedium");
            GameObject.Find("btnadvanced").GetComponentInChildren <Text>().text = Localization.Instance.GetString("btnadvanced");
            GameObject.Find("btnhard").GetComponentInChildren <Text>().text     = Localization.Instance.GetString("btnhard");
            GameObject.Find("btnexpert").GetComponentInChildren <Text>().text   = Localization.Instance.GetString("btnexpert");

            GameObject.Find("txttitle").GetComponent <Text>().text = Localization.Instance.GetString("levelTitle");

            initLevels();
        }
Exemplo n.º 26
0
        bool notUnlock = false;//if open shop ,not unlock UI
        public void yesHandler()
        {
            if (!isShowed)
            {
                return;
            }
            notUnlock = false;
            GameData.getInstance().isUILock = false;
            GameManager.getInstance().playSfx("click");
            showOrHideTipPanel();

            if (GameData.instance.tipRemain > 0)
            {
                showTip();
            }
            else
            {
                //buy tip
                print("open store");
                isOpenStore = true;
                notUnlock   = true;
                GameData.getInstance().isUILock = true;
            }
        }
Exemplo n.º 27
0
        GameObject music;//a instance for play music
        /// <summary>
        /// Plaies the music.
        /// </summary>
        /// <param name="str">String.</param>
        /// <param name="isforce">If set to <c>true</c> isforce.</param>
        public void playMusic(string str, bool isforce = false)
        {
            //do not play the same music again
            if (!isforce)
            {
                if (bgMusic != null && musicName == str)
                {
                    return;
                }
            }


            if (!music)
            {
                return;
            }


            AudioSource tmusic = null;

            AudioClip clip = (AudioClip)Resources.Load("sound/" + str, typeof(AudioClip));

            if (GameData.getInstance().isSoundOn == 0)
            {
                if (bgMusic)
                {
                    bgMusic.Stop();
                }
                tmusic = music.GetComponent <musicScript>().PlayAudioClip(clip, true);
                if (str.Substring(0, 2) == "bg")
                {
                    musicName = str;
                    bgMusic   = tmusic;
                }
            }
        }
Exemplo n.º 28
0
 void Start()
 {
     panel = transform.Find("panel").gameObject;
     initView();
     GameData.getInstance().isLock = true; //.lockGame(true);
 }
Exemplo n.º 29
0
        public static bool inited;//check if inited
        /// <summary>
        /// Init this controller instance.only once.
        /// </summary>
        public void init()
        {
            //get data
            if (inited)
            {
                return;
            }

            initLocalize();

            int allScore = 0;

            //stars not use for this game
            //for(int i = 0;i<GameData.totalLevel[GameData.difficulty];i++){
            //	int tScore = PlayerPrefs.GetInt("levelScore_"+i.ToString(),0);
            //	allScore += tScore;
            //	//save star state to gameobject
            //	int tStar = PlayerPrefs.GetInt("levelStar_"+i.ToString(),0);
            //	GameData.getInstance().lvStar.Add(tStar);
            //}

            GameData.getInstance().levelPass = new List <int>();
            for (int i = 0; i < GameData.totalLevel.Length; i++)
            {
                int tDiffLevelPassed = PlayerPrefs.GetInt("levelPassed" + i);
                GameData.instance.levelPass.Add(tDiffLevelPassed);
            }

            GameData.getInstance().levelStates = new List <List <int> >();
            for (int i = 0; i < GameData.totalLevel.Length; i++)
            {
                GameData.instance.levelStates.Add(new List <int>());
                for (int j = 0; j < GameData.totalLevel[i]; j++)
                {
                    int tState = PlayerPrefs.GetInt("PolyPuzzle_" + i + "_" + j, 0);
                    GameData.instance.levelStates[i].Add(tState);
                    GameData.getInstance().levelStates[i][j] = tState;


                    if (tState == 1)
                    {
                        allScore++;
                    }
                }
            }

            GameData.instance.bestScore = allScore;

            Debug.Log("bestScore is:" + allScore);
            //GameData.getInstance ().levelPassed = PlayerPrefs.GetInt("levelPassed",0);
            //Debug.Log ("current passed level = " + GameData.getInstance ().levelPassed);

            //for continue,set default to lastest level
            //GameData.getInstance ().cLevel = GameData.getInstance ().levelPassed;



            GameData.getInstance().bestScore = allScore;
            GameData.getInstance().isSoundOn = (int)PlayerPrefs.GetInt("sound", 0);
            GameData.getInstance().isSfxOn   = (int)PlayerPrefs.GetInt("sfx", 0);


            initAds();
            initPurchase();
            initGameCenter();
            inited = true;
        }
Exemplo n.º 30
0
        public void gameWin()
        {
            //fire win event

            GameManager.getInstance().playSfx("win");
            if (GameData.getInstance().cLevel % 5 == 0 && GameData.getInstance().cLevel > 0)
            {
                //			musicScript.showCB();
            }

            GameManager.getInstance().showInterestitial();

            GameData.getInstance().isWin = true;
            int threeStar = 10;             // (int)(levelData [1].Count/2/1.2f)+2;//one line per second
            int twoStar   = threeStar + 5;  //
            int oneStar   = threeStar + 20; //

            int starGet = 0;

            if ((120 - timeCount) <= threeStar)
            {
                starGet = 3;
            }
            else if ((120 - timeCount) > threeStar && (120 - timeCount) <= twoStar)
            {
                starGet = 2;
            }
            else if ((120 - timeCount) > twoStar && (120 - timeCount) <= oneStar)
            {
                starGet = 1;
            }
            else
            {
                starGet = 0;
            }

            crispcontainer.SetActive(false);
            StartCoroutine(DecreaseAlpha());
            Invoke("TurnOnWinPanel", 2.0f);

            //winpanel = panelWin.GetComponent<WinPanel>();
            //winpanel.showHidePanel(starGet);
            //		GameObject.Find ("btnTip").GetComponent<Button> ().interactable = false;

            //save as this game unlock all level automatically,not use
            //int saveLevel = 0;
            //if (GameData.getInstance().cLevel < GameData.totalLevel[GameData.difficulty] - 1)
            //{
            //    saveLevel = GameData.getInstance().cLevel + 1;
            //}

            //if (GameData.getInstance().levelPassed < saveLevel)
            //{
            //    PlayerPrefs.SetInt("levelPassed", saveLevel);
            //    GameData.getInstance().levelPassed = saveLevel;
            //}

            if (GameData.instance.cLevel >= GameData.instance.levelPass[GameData.difficulty])
            {
                PlayerPrefs.SetInt("levelPassed" + GameData.difficulty, GameData.instance.cLevel + 1);
                GameData.instance.levelPass[GameData.difficulty] = GameData.instance.cLevel + 1;
            }


            if (GameData.instance.levelStates != null)
            {
                GameData.instance.levelStates[GameData.difficulty][GameData.instance.cLevel] = 1;
                PlayerPrefs.SetInt("PolyPuzzle_" + GameData.difficulty + "_" + GameData.instance.cLevel, 1);


                //save score
                int tallScore = 0;
                for (int i = 0; i < GameData.totalLevel.Length; i++)
                {
                    for (int j = 0; j < GameData.totalLevel[i]; j++)
                    {
                        if (GameData.instance.levelStates[i][j] == 1)
                        {
                            tallScore++;
                        }
                    }
                }


                GameData.getInstance().bestScore = tallScore;
            }
            GameManager.getInstance().submitGameCenter();



            //not use this mode

            /*
             * int cLvScore = PlayerPrefs.GetInt("levelScore_" + GameData.getInstance().cLevel, 0);
             * //		print (cLvScore + "_" + timeCount);
             * if (cLvScore < timeCount)
             * {
             *  PlayerPrefs.SetInt("levelScore_" + GameData.getInstance().cLevel, timeCount);
             *  PlayerPrefs.SetInt("levelStar_" + GameData.getInstance().cLevel, starGet);
             *  //save to GameData instantlly
             *  if (GameData.getInstance().lvStar.Count > GameData.getInstance().cLevel)
             *      GameData.getInstance().lvStar[GameData.getInstance().cLevel] = starGet;
             *  //			print ("save new score"+cLvScore+"_"+timeCount);
             *
             *
             *  //submitscore
             *  int tallScore = 0;
             *  for (int i = 0; i < GameData.totalLevel[GameData.difficulty]; i++)
             *  {
             *      int tScore = PlayerPrefs.GetInt("levelScore_" + i.ToString(), 0);
             *      tallScore += tScore;
             *  }
             *  GameData.getInstance().bestScore = tallScore;
             *  GameManager.getInstance().submitGameCenter();
             *
             * }
             */
        }