Example #1
0
 void handout()
 {
     ATween.MoveTo(hand, ATween.Hash("x", hand.transform.position.x + 2, "time", 1f, "oncomplete", "over", "oncompletetarget", this.gameObject));
 }
Example #2
0
 void fadeOut()
 {
     mask.gameObject.SetActive(true);
     mask.color = Color.black;
     ATween.ValueTo(mask.gameObject, ATween.Hash("from", 1, "to", 0, "time", 1, "onupdate", "OnUpdateTween", "onupdatetarget", this.gameObject, "oncomplete", "fadeOutOver", "oncompletetarget", this.gameObject));
 }
Example #3
0
 /// <summary>
 /// Returns the page to its origin place.
 /// </summary>
 void returnPage()
 {
     canmove = false;
     ATween.MoveTo(gContainer[page].transform.parent.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "x", -gContainer[page].transform.localPosition.x, "time", .3f, "easeType", "easeOutExpo", "oncomplete", "dotclicked", "oncompletetarget", this.gameObject));
 }
Example #4
0
    IEnumerator win()
    {
        yield return(new WaitForSeconds(1));


        if (GameData.getInstance().cLevel < GameData.totalLevel)
        {
            panelWin.transform.Find("panel").transform.Find("btnTitle").gameObject.SetActive(false);
        }
        else
        {
            panelWin.transform.Find("panel").transform.Find("btnNext").gameObject.SetActive(false);
        }

        GameData.getInstance().isWin = true;
        int tclv = int.Parse(SceneManager.GetActiveScene().name.
                             Substring(5, SceneManager.GetActiveScene().name.Length - 5));

        //if (tclv % 3 == 1 && tclv > 6) {
        //	GameManager.getInstance ().ShowInterestitial ();
        //}


        panelWin.SetActive(true);
        Transform panelWin_ = panelWin.transform.Find("panel");

        ATween.MoveTo(panelWin_.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 40, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));

        panelWin_.transform.Find("wintitle").GetComponent <Text> ().text = Localization.Instance.GetString("wintitle");

        panelWin_.transform.Find("btnTitle").GetComponentInChildren <Text> ().text = Localization.Instance.GetString("btnTitle");

        disableAll();



        int tScore = 600 - timeCount;                      //600 - timeCount - (myStep + myUndo - minStep)*2;

        if (tScore < 0)
        {
            tScore = 0;
        }
        //		lbScore.Text = LanguageManager.Instance.GetTextValue("GAME_SCORE") +": " + tScore;

        panelWin_.transform.Find("levelscore").GetComponent <Text> ().text = Localization.Instance.GetString("levelscore") + " " + tScore;
        int tbestScore = GameData.getInstance().getLevelBestScore();
        int nStar      = 0;

        //				print (timeCount);
        if (timeCount <= tbestScore)
        {
            nStar = 3;
        }
        else if (timeCount <= tbestScore + 3)
        {
            nStar = 2;
        }
        else if (timeCount <= tbestScore + 5)
        {
            nStar = 1;
        }
        else
        {
            nStar = 0;
        }



        for (int i = 1; i <= 3; i++)
        {
            GameObject tstar = GameObject.Find("star" + i);
            if (i <= nStar)
            {
                tstar.GetComponent <Image>().enabled = true;
            }
            else
            {
                tstar.GetComponent <Image>().enabled = false;
            }
        }

        //save
        int saveLevel = 0;

        if (GameData.getInstance().cLevel < GameData.totalLevel)
        {
            saveLevel = GameData.getInstance().cLevel + 1;
        }
        else
        {
        }
        //		print (GameData.getInstance ().levelPassed);
        if (GameData.getInstance().levelPassed < saveLevel)
        {
            print("saving..");
            PlayerPrefs.SetInt("levelPassed", saveLevel);
            GameData.getInstance().levelPassed = saveLevel;
            //reward for pass level
            PlayerPrefs.SetInt("coin", PlayerPrefs.GetInt("coin") + 20);
            txtCoin.text = PlayerPrefs.GetInt("coin") + "";
            PlayerPrefs.SetInt("tipRemain", GameData.getInstance().tipRemain);
            PlayerPrefs.Save();
        }


        //save score
        int cLvScore = PlayerPrefs.GetInt("levelScore_" + GameData.getInstance().cLevel, 0);

        //		print (cLvScore + "_" + timeCount);
        if (cLvScore < tScore)
        {
            PlayerPrefs.SetInt("levelScore_" + GameData.getInstance().cLevel, tScore);
            print(tScore + "tallscore " + GameData.getInstance().cLevel);
            //save to GameData instantlly
            //			print(GameData.getInstance().lvStar.Count+"    "+GameData.getInstance().cLevel);
            if (GameData.getInstance().lvStar.Count != 0)
            {
                GameData.getInstance().lvStar[GameData.getInstance().cLevel] = nStar;
                //			print ("save new score"+cLvScore+"_"+timeCount);


                //submitscore
                int tallScore = 0;
                for (int i = 0; i < GameData.totalLevel; i++)
                {
                    int tlvScore = PlayerPrefs.GetInt("levelScore_" + i.ToString(), 0);
                    tallScore += tlvScore;
                }

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

            //check star
            int cLvStar = PlayerPrefs.GetInt("levelStar_" + GameData.getInstance().cLevel, 0);
            //		print ("getstar"+cLvStar+"   "+nStar);
            if (cLvStar < nStar)
            {
                PlayerPrefs.SetInt("levelStar_" + GameData.getInstance().cLevel, nStar);
                for (int i = 1; i <= nStar; i++)
                {
                }
            }
        }
    }