예제 #1
0
    public void showMe()
    {
        initView();

        if (GameData.getInstance().coin >= 60)
        {
            panelNotEnough.SetActive(false);
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 40, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));

            //disable some UI;
        }
        else
        {
            if (gachaButton)
            {
                gachaButton.SetActive(false);
            }

            panelNotEnough.SetActive(true);

            panelNotEnough.GetComponent <PanelNotEnough> ().showMe();

            gameObject.SetActive(false);
        }
        GameData.getInstance().lockGame(true);
    }
예제 #2
0
    public void showMe()
    {
        initView();



        if (GameData.getInstance().coin >= 20)
        {
            panelNotEnough.SetActive(false);
            if (!GameData.getInstance().cLvShowedTip)
            {
                ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 40, "time", .7f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));
            }
            else
            {
                ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
                panelDisplayTip.SetActive(true);
                panelDisplayTip.GetComponent <PanelDisplayTip> ().showMe();
                gameObject.SetActive(false);
            }
            //disable some UI;
        }
        else
        {
            panelNotEnough.SetActive(true);
//						GameObject panelNotEnough_ = panelNotEnough.transform.Find ("panel").gameObject;
            panelNotEnough.GetComponent <PanelNotEnough> ().showMe();
//						ATween.MoveTo (panelNotEnough_, ATween.Hash ("ignoretimescale",true,"islocal", true, "y", 40, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));
            gameObject.SetActive(false);
        }
        GameData.getInstance().lockGame(true);
    }
예제 #3
0
 public void showMe()
 {
     panel = transform.Find("panel").gameObject;
     initView();
     GameData.getInstance().lockGame(true);
     ATween.MoveTo(panel, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 40, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));
 }
예제 #4
0
    public void showHidePanel(int nStarGet = 0)
    {
        if (!canShow)
        {
            return;
        }

        // Add event handler code here
        if (!isShowed)
        {
//			if (showTween) {
//				showTween.Play ();
            ATween.MoveTo(gameObject, ATween.Hash("islocal", true, "y", 53, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));

//				gameObject.transform.DOLocalMoveY(53,.3f).OnComplete(OnShowCompleted);
            GameObject.Find("btnRetryB").GetComponent <Button> ().interactable = false;
            canShow = false;

            GameObject starScore = gameObject.transform.Find("star" + nStarGet.ToString()).gameObject;
            starScore.GetComponent <Image>().enabled = true;

//			}
        }
        else
        {
//			if (hideTween) {
//				hideTween.Play();
//				gameObject.transform.DOLocalMoveY(419,.3f).OnComplete(OnHideCompleted);
            ATween.MoveTo(gameObject, ATween.Hash("islocal", true, "y", 419, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
            canShow = false;
//			}
        }
    }
예제 #5
0
//	public void OnClick( dfControl control, dfMouseEventArgs mouseEvent )
//	{
//		// Add event handler code here
//		switch (control.name) {
//		case "btnDisplayOK":
//			GameManager.getInstance ().playSfx ("click");
//			gameObject.GetComponent<dfPanel> ().IsVisible  = false;
//			GameData.getInstance().isLock = false;
//			Time.timeScale = 1;
//			break;
//		}
//	}
    public void close()
    {
        ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 500, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
        if (gachaButton)
        {
            gachaButton.SetActive(true);
        }
    }
예제 #6
0
    /// <summary>
    /// Clicks the dot. For turn page
    /// </summary>
    /// <param name="tdot">Tdot.</param>
    public void clickDot(GameObject tdot)
    {
        int tdotIndex = int.Parse(tdot.transform.parent.name.Substring(4, tdot.transform.parent.name.Length - 4));

        page    = tdotIndex;
        canmove = false;


        ATween.MoveTo(gContainer[0].transform.parent.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "x", -gContainer[page].transform.localPosition.x, "time", .3f, "easeType", "easeOutExpo", "oncomplete", "dotclicked", "oncompletetarget", this.gameObject));
    }
예제 #7
0
    void playmove(Object[] param)
    {
        if (ismove)
        {
            return;
        }

        bread.transform.parent = cups [1].transform;
        bread.GetComponent <SpriteRenderer> ().enabled = false;
        ismove = true;
        for (int i = 0; i < moveround.Length; i++)
        {
            moveround[i] = (int)Random.Range(0, 3);
            int tdes = (int)Random.Range(0, 3);
            while (tdes == moveround[i])
            {
                tdes = (int)Random.Range(0, 3);
            }
            desround[i] = tdes;
        }



        //				Sequence seq1 = DOTween.Sequence ();
        //				Sequence seq2 = DOTween.Sequence ();
        moveroundNo = 0;

        //				for (int i=0; i< moveround.Length; i++) {
        GameObject tcup    = GameObject.Find("cup" + moveround[moveroundNo]);
        GameObject tdescup = GameObject.Find("cup" + desround[moveroundNo]);

        tcup.name    = "cup" + desround [moveroundNo];
        tdescup.name = "cup" + moveround [moveroundNo];
        if (moveround [moveroundNo] == breadpos)
        {
            breadpos = desround [moveroundNo];
        }


        //						if (i == 0) {
        ATween.MoveTo(tcup, ATween.Hash("x", pos3 [desround [moveroundNo]].x, "y", pos3 [desround [moveroundNo]].y, "easetype", "linear", "time", .4f, "oncomplete", "cupmove1", "oncompletetarget", this.gameObject));
        ATween.MoveTo(tdescup, ATween.Hash("x", tcup.transform.position.x, "y", tcup.transform.position.y, "easetype", "linear", "time", .4f));
        //						}

        //						seq1.Append(tcup.transform.DOMove(pos3[desround[i]],.4f));
        //						seq2.Append(tdescup.transform.DOMove(pos3[moveround[i]],.4f));

        //				}



        //				seq1.OnComplete (moveover);
    }
예제 #8
0
    public void OnClick(GameObject g)
    {
        // Add event handler code here
        switch (g.name)
        {
        case "btnCancel":
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));

            break;

        case "btnYes":
            if (SceneManager.GetActiveScene().name == "ShopMenu" && GameData.getInstance().coin >= 120)
            {
                GameData.getInstance().coin -= 120;
                PlayerPrefs.SetInt("coin", GameData.getInstance().coin);
                ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
                GameData.getInstance().main.txtCoin.text = GameData.getInstance().coin.ToString();
                //gacha animation
                if (gachaButton)
                {
                    gachaButton.GetComponent <Animator>().SetTrigger("spin");
                    GameManager.getInstance().playSfx("win");
                    //get result from it
                    Invoke("dispalySpinResult", 1f);
                }
            }
            else
            {
                if (gachaButton)
                {
                    gachaButton.SetActive(false);
                }

                panelNotEnough.SetActive(true);

                panelNotEnough.GetComponent <PanelNotEnough>().showMe();

                gameObject.SetActive(false);
            }
            if (SceneManager.GetActiveScene().name != "ShopMenu")
            {
                GameData.getInstance().coin -= 60;
                PlayerPrefs.SetInt("coin", GameData.getInstance().coin);
                ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
                GameData.getInstance().main.txtCoin.text = GameData.getInstance().coin.ToString();
                GameData.getInstance().main.nextLevelSkip();
            }
            break;
        }
    }
예제 #9
0
    public void showMe()
    {
//		GetComponent<dfPanel> ().IsVisible = isVis;
        //show tip freely during level if once displayed.
        panel = transform.Find("panel");

        initView();

        GameData.getInstance().cLvShowedTip = true;

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

        GameData.getInstance().lockGame(true);
    }
예제 #10
0
    /// <summary>
    /// page goes left.
    /// </summary>
    public void GoLeft()
    {
        if (!canmove)
        {
            return;
        }
        if (page > 0)
        {
            page--;
            canmove = false;


            ATween.MoveTo(gContainer[0].transform.parent.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "x", -gContainer[page].transform.localPosition.x, "time", .3f, "easeType", "easeOutExpo", "oncomplete", "dotclicked", "oncompletetarget", this.gameObject));
        }
    }
예제 #11
0
    IEnumerator fail()
    {
        yield return(new WaitForSeconds(1));

        panelFail.SetActive(true);
        Transform panelFail_ = panelFail.transform.Find("panel");

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

        panelFail_.transform.Find("failTitle").GetComponent <Text> ().text          = Localization.Instance.GetString("failtitle");
        panelFail_.transform.Find("btnTitle").GetComponentInChildren <Text> ().text = Localization.Instance.GetString("btnTitle");
        panelFail_.transform.Find("btnRetry").GetComponentInChildren <Text> ().text = Localization.Instance.GetString("btnRetry");

        disableAll();
    }
예제 #12
0
    IEnumerator wait2()
    {
        yield return(new  WaitForSeconds(2));

        int tn = 0;

        foreach (GameObject tcup in cups)
        {
            //						tcup.transform.DOMoveY(tcup.transform.position.y-.6f,1).OnComplete(playmove);
            Object[] tparam = { tcup };
            ATween.MoveTo(tcup, ATween.Hash("ignoretimescale", true, "islocal", false, "y", tcup.transform.position.y - .6f, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "playmove", "oncompleteparams", tparam, "oncompletetarget", this.gameObject));

            pos3[tn] = tcup.transform.position + new Vector3(0, -.6f, 0);
            tn++;
        }
    }
예제 #13
0
 void FixedUpdate()
 {
     print(onTouching);
     if (GameData.getInstance().isWin || GameData.getInstance().isFail)                          //if is win or fail,the game
     {
         return;
     }
     if (!started)
     {
         return;
     }
     if (mouse.transform.position.x > bread.transform.position.x)
     {
         if (!onTouching || isCatch)                                    //if not touching,the mouse keep close
         {
             mouse.transform.Translate(-.01f, 0, 0);
             holdtime = 0;
         }
         if (!isCatch)
         {
             idlesp.enabled = onTouching;                                   //if is not touching,the mouse dont idle.
             runsp.enabled  = !onTouching;                                  //if is touching,the mouse dont move.
             if (onTouching)                                                //if is touching,count time.
             {
                 holdtime++;
                 if (holdtime == 200)                                                            //touching enough time,the mosue run away,you win.
                 {
                     started = false;
                     GameData.getInstance().main.gameWin();
                     idlesp.enabled = false;
                     runsp.enabled  = true;
                     ATween.MoveTo(mouse, ATween.Hash("x", transform.position.x + 3, "time", 3));
                     mouse.transform.localScale = (new Vector3(-1, 1, 1));
                 }
             }
             else
             {
                 holdtime = 0;                                                            //if you released the finger,restart time count.
             }
         }
     }
     if (bread.transform.position.x < -3)                          //if the mouse close enough,you fail
     {
         GameData.getInstance().main.gameFailed();
     }
 }
예제 #14
0
    bool canmove = true;            //can not enter a level and can not move when moving
    /// <summary>
    /// page Goes right.
    /// </summary>
    public void GoRight()
    {
        if (!canmove)
        {
            return;
        }
        if (page < pages)
        {
            page++;
            canmove = false;


            ATween.MoveTo(gContainer[0].transform.parent.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "x", -gContainer[page].transform.localPosition.x, "time", .3f, "easeType", "easeOutExpo", "oncomplete", "dotclicked", "oncompletetarget", this.gameObject));

            GameManager.getInstance().playSfx("push");
        }
    }
예제 #15
0
    /// <summary>
    /// page turn left
    /// </summary>
    public void GoLeft()
    {
        if (!canmove)
        {
            return;
        }
        if (page > 0)
        {
            page--;
            canmove = false;

//						gContainer[0].transform.parent.DOLocalMoveX (-gContainer[page].transform.localPosition.x,.3f).OnComplete(()=>{
//								canmove = true;
//								setpageDot ();
//						});
            ATween.MoveTo(gContainer[0].transform.parent.gameObject, ATween.Hash("islocal", true, "x", -gContainer[page].transform.localPosition.x, "time", .3f, "easeType", "easeOutExpo", "oncomplete", "dotclicked", "oncompletetarget", this.gameObject));
        }
    }
예제 #16
0
    public void OnClick(GameObject g)
    {
        // Add event handler code here
        switch (g.name)
        {
        case "btnCancel":
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
            break;

        case "btnYes":
            GameData.getInstance().coin -= 20;
            PlayerPrefs.SetInt("coin", GameData.getInstance().coin);
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
            GameData.getInstance().main.txtCoin.text = GameData.getInstance().coin.ToString();
            panelDisplayTip.SetActive(true);
            panelDisplayTip.GetComponent <PanelDisplayTip> ().showMe();
            break;
        }
    }
예제 #17
0
    public void showMe()
    {
        panel.transform.Find("tiptitle").GetComponent <Text> ().text   = Localization.Instance.GetString("notEnoughTitle");
        panel.transform.Find("tipcosttip").GetComponent <Text> ().text = Localization.Instance.GetString("notEnoughHit");
        if (SceneManager.GetActiveScene().name == "ShopMenu")
        {
            panel.transform.Find("tipcosttip").GetComponent <Text>().text = "Spin for new Skin cost 120 coins.";
        }
        panel.transform.Find("btnBuyCoin").GetComponentInChildren <Text> ().text = Localization.Instance.GetString("btnBuy");
        panel.transform.Find("btnCancel").GetComponentInChildren <Text> ().text  = Localization.Instance.GetString("btnCancel");

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

        GameData.getInstance().lockGame(true);
//						} else {
//						ATween.MoveTo (panel.gameObject, ATween.Hash ("ignoretimescale",true,"islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
//						}
    }
예제 #18
0
    public void OnClick(GameObject g)
    {
        switch (g.name)
        {
        case "btnBuyCoin":
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted2", "oncompletetarget", this.gameObject));

            panelBuyCoin.SetActive(true);
            panelBuyCoin.GetComponent <PanelBuyCoin> ().showMe();
            break;

        case "btnCancel":
            ATween.MoveTo(panel.gameObject, ATween.Hash("ignoretimescale", true, "islocal", true, "y", 460, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));
            if (gachaButton)
            {
                gachaButton.SetActive(true);
            }
            break;
        }
    }
예제 #19
0
    void tap(TapGesture gesture)
    {
        if (GameData.getInstance().isLock)
        {
            return;
        }
        if (gesture != null && gesture.Selection == bread)
        {
            if (touched)
            {
                return;
            }
            touched = true;

            if (!mouseScared)
            {
                mouse.SetActive(true);
//								mouse.transform.DOMoveX (transform.position.x - 3, 5).OnComplete(failed);
                ATween.MoveTo(mouse, ATween.Hash("x", mouse.transform.position.x - 5, "time", 5, "easetype", "linear", "oncomplete", "failed", "oncompletetarget", this.gameObject));
            }
            else
            {
                Destroy(bread);

                GameData.getInstance().main.gameWin();
            }
        }


        if (gesture != null && gesture.Selection == hole)
        {
            if (!touched)
            {
                mouseScared = true;
                mouse.SetActive(true);
                mouse.transform.localScale = new Vector3(-1, 1, 1);
//								mouse.transform.DOMoveX (mouse.transform.position.x + 3, 3);
                ATween.MoveTo(mouse, ATween.Hash("x", mouse.transform.position.x + 3, "time", 3, "easetype", "linear"));
            }
        }
    }
예제 #20
0
    public void OnClick2(GameObject g)
    {
        switch (g.name)
        {
        case "btnBuyCoin":
            GameManager.getInstance().playSfx("select");

            int tindex = int.Parse(g.transform.parent.name.Substring(3, 1));
            print(tindex);
            //add coin and dispaly
            //GameData.getInstance().coin += 60;
            //PlayerPrefs.SetInt("coin", GameData.getInstance().coin);
            //GameData.getInstance().main.txtCoin.text = GameData.getInstance().coin.ToString();
            //GameManager.getInstance().buy(tindex);
            break;

        case "btnClose":

            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"));
            break;
        }
    }
예제 #21
0
    public void gameover(GameObject showcup)
    {
        bread.GetComponent <SpriteRenderer> ().enabled = true;
        if (showcup.transform.Find("bread") != null)
        {
            GameData.getInstance().main.gameWin();
        }
        else
        {
            GameData.getInstance().main.gameFailed();
        }
        bread.transform.parent = null;
        int tn = 0;

        foreach (GameObject tcup in cups)
        {
            //						tcup.transform.DOMoveY(tcup.transform.position.y+.6f,1);
            ATween.MoveTo(tcup, ATween.Hash("y", tcup.transform.position.y + .6f, "time", 1));

            tn++;
        }
        isshowedup = true;
    }
예제 #22
0
    public void showOrHideTipPanel()
    {
        if (!canShow)
        {
            return;
        }
        GameData.getInstance().tickStartTime = PlayerPrefs.GetString("tipStart", "0");
        // Add event handler code here
        if (!isShowed)
        {
//			if (showTween) {
//				showTween.Play ();
//				gameObject.transform.DOLocalMoveY(53,.3f).OnComplete(OnShowCompleted);
            ATween.MoveTo(gameObject, ATween.Hash("islocal", true, "y", 53, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnShowCompleted", "oncompletetarget", this.gameObject));

            //


            canShow = false;
            GameData.getInstance().isLock = true;
            //disable some UI;
            checkUI();
//			}
//			if(FadeOutTween)FadeOutTween.Play();
        }
        else
        {
//			if (hideTween) {
//				hideTween.Play();
            canShow = false;
//			}
            ATween.MoveTo(gameObject, ATween.Hash("islocal", true, "y", 419, "time", 1f, "easeType", "easeOutExpo", "oncomplete", "OnHideCompleted", "oncompletetarget", this.gameObject));

//						gameObject.transform.DOLocalMoveY(419,.3f).OnComplete(OnHideCompleted);
//			if(FadeInTween)FadeInTween.Play();
        }
    }
예제 #23
0
    void cupmove1()
    {
        if (moveroundNo < moveround.Length - 1)
        {
            GameObject tcup    = GameObject.Find("cup" + moveround [moveroundNo]);
            GameObject tdescup = GameObject.Find("cup" + desround [moveroundNo]);

            tcup.name    = "cup" + desround [moveroundNo];
            tdescup.name = "cup" + moveround [moveroundNo];
            if (moveround [moveroundNo] == breadpos)
            {
                breadpos = desround [moveroundNo];
            }


            ATween.MoveTo(tcup, ATween.Hash("x", pos3 [desround [moveroundNo]].x, "y", pos3 [desround [moveroundNo]].y, "time", .4f, "oncomplete", "cupmove1", "easetype", "linear", "oncompletetarget", this.gameObject));
            ATween.MoveTo(tdescup, ATween.Hash("x", tcup.transform.position.x, "y", tcup.transform.position.y, "easetype", "linear", "time", .4f));
            moveroundNo++;
        }
        else
        {
            moveover();
        }
    }
예제 #24
0
    void OnTap(TapGesture gesture)
    {
        if (GameData.getInstance().isLock)
        {
            return;
        }
        if (gesture != null && gesture.Selection == touchArea)
        {
            if (locker)
            {
                return;
            }
            locker = true;
//						Sequence seq = DOTween.Sequence ();
//						seq.Append(hand.transform.DOMoveX (hand.transform.position.x - 2,.2f,false));
//						seq.Append(hand.transform.DOMoveX(hand.transform.position.x,1f,false).OnComplete(over));
//						if (!isdrop) {
//								//			StopCoroutine("wait3");
//								StartCoroutine("wait1");
//						}
            //test f*****g idiot
            ATween.MoveTo(hand, ATween.Hash("x", hand.transform.position.x - 2, "time", .2f, "oncomplete", "handout", "oncompletetarget", this.gameObject));
        }
    }
예제 #25
0
 void handout()
 {
     ATween.MoveTo(hand, ATween.Hash("x", hand.transform.position.x + 2, "time", 1f, "oncomplete", "over", "oncompletetarget", this.gameObject));
 }
예제 #26
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++)
                {
                }
            }
        }
    }
예제 #27
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));
 }