Example #1
0
    // Use this for initialization
    void Start()
    {
        contineBtn.GetComponent <Button>().onClick.AddListener(() => {
            transform.parent.gameObject.SetActive(false);

            UIcontroller.getInst().gameContinueBySave();
            //UIcontroller.getInst().gameHalfStart();
        });
        rankBtn.GetComponent <Button>().onClick.AddListener(() => {
        });
        restartBtn.GetComponent <Button>().onClick.AddListener(() => {
            transform.parent.gameObject.SetActive(false);

            UIcontroller.getInst().endLessStart();
        });



        // halfBtn.GetComponent<Button>().onClick.AddListener(()=>{
        //      transform.parent.gameObject.SetActive(false);

        //      UIcontroller.getInst().gameHalfStart();
        //  });

        doStartAni();
    }
Example #2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.transform.localScale.x < transform.localScale.x * eatScaleX)
        {
            Vector3 toScale = collision.transform.localScale * addScale;
            if (transform.localScale.x + toScale.x > maxScale)
            {
                transform.localScale = new Vector3(maxScale, maxScale, 1);
            }
            else
            {
                transform.DOScale(transform.localScale + toScale, 0.3f).SetEase(Ease.OutBack);
            }

            GameMgr.inst().musicControl.playSound(soundType.xiaohui);

            curSmalTime += 0.8f;
            Destroy(collision.gameObject);
        }
        else if (collision.transform.localScale.x > transform.localScale.x * eatedScaleX)
        {
            Time.timeScale = 0;
            gameOver       = true;
            UIcontroller.getInst().dieType = 1;
            UIcontroller.getInst().gameOver(1);
            //  Destroy(gameObject);
        }
    }
Example #3
0
    public void Pay(int id, System.Action <int> buyAction)
    {
        this.buyAction = buyAction;


                        #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
        // ads
        if (id == 1)
        {
            if (isReadUnityOrAdmobAwardAds())
            {
                showAdmobOrUnityRewardAds(buyAction);
            }
            else
            {
                UIcontroller.getInst().gameTip.showAtion(42);
                buyAction(0);
            }
        }
        // 100 diamond
        else
        {
            purchaser.DoIapPurchase(id, buyAction);
        }
                        #else
        buyAction(1);
                        #endif
    }
Example #4
0
 public bool useDiamonds(int num)
 {
     if (diamondNum - num >= 0)
     {
         diamondNum -= num;
         PlayerPrefs.SetInt("diamondNum", diamondNum);
         UIcontroller.getInst().updateDiamondTxt(diamondNum);
         return(true);
     }
     return(false);
 }
Example #5
0
 public void reBuyClick()
 {
     UIcontroller.getInst().showBlockPanel(true, 18);
     PlatformHelper.inst().purchaser.RestorePurchases((int state) => {
         if (state == 1)
         {
             adsSuccessBack = true;
             curType        = 0;
         }
         UIcontroller.getInst().showBlockPanel(false, 18);
     });
 }
Example #6
0
 public void doubleClick()
 {
     if (PlatformHelper.inst().isReadUnityOrAdmobAwardAds())
     {
         PlatformHelper.inst().showAdmobOrUnityRewardAds((int state) => {
             if (state == 1)
             {
                 adsSuccessBack = true;
             }
         });
     }
     else
     {
         UIcontroller.getInst().gameTip.showAtion(42);
     }
 }
Example #7
0
 public void buyBtnClick(int type)
 {
     if (type != 1)
     {
         UIcontroller.getInst().showBlockPanel(true, 18);
     }
     PlatformHelper.inst().Pay(type, (int state) => {
         UIcontroller.getInst().showBlockPanel(false);
         if (state == 1)
         {
             adsSuccessBack = true;
             curType        = type;
         }
         else
         {
             Debug.Log(">>>>>>>>>>>>>>>>pay fail");
         }
     });
 }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        if (!(GameMgr.inst().GetGameState() == gameState.canShoot || GameMgr.inst().GetGameState() == gameState.ballRuning))
        {
            return;
        }

        if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0))
        {
            if (UIcontroller.getInst().IsPointerOverUIObject(Input.mousePosition) && !indrag)
            {
                //	Debug.Log(">>>>>>>>>>>>>>>>>click ui3");
                return;
            }
        }



        if (GameMgr.inst().canAddSpeed&& Input.GetMouseButtonUp(0))
        {
            Time.timeScale = timeScale;
        }

        if (GameMgr.inst().GetGameState() != gameState.canShoot)
        {
            return;
        }

        if (Input.GetMouseButton(0))
        {
            indrag = true;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            indrag = false;
        }
    }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        //if (Input.GetMouseButton(0) || Input.GetMouseButtonUp(0))
        //{
        //    if (UIcontroller.getInst().IsPointerOverUIObject(Input.mousePosition) && !indrag)
        //    {
        //        //	Debug.Log(">>>>>>>>>>>>>>>>>click ui3");
        //        return;
        //    }
        //}



        if (GameMgr.inst().canAddSpeed&& Input.GetMouseButtonUp(0))
        {
        }

        if (gameOver || GameMgr.inst().GetGameState() != gameState.ballRuning)
        {
            return;
        }


        if (Input.GetMouseButton(0))
        {
            indrag = true;

            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            //	Debug.Log(">>>>>>>>>>>>>>GetMouseButton(0)");
            if (mousePos.x < lelfX)
            {
                mousePos.x = lelfX;
            }
            if (mousePos.x > rightX)
            {
                mousePos.x = rightX;
            }
            if (mousePos.y < downY)
            {
                mousePos.y = downY;
            }
            if (mousePos.y > upY)
            {
                mousePos.y = upY;
            }
            transform.position = new Vector3(mousePos.x, mousePos.y + 1.2f, transform.position.z);
        }
        else if (Input.GetMouseButtonUp(0))
        {
            indrag = false;
        }
        curSmalTime -= Time.deltaTime;
        if (curSmalTime <= 0)
        {
            curSmalTime = smalTimeGap;
            Vector3 toScale = transform.localScale * smallSpeed;
            transform.DOScale(toScale, 0.3f).SetEase(Ease.InOutBack);
            if (transform.localScale.x < dieScale)
            {
                Time.timeScale = 0;

                UIcontroller.getInst().dieType = 2;
                gameOver = true;
                UIcontroller.getInst().gameOver(1);
            }
        }
    }
Example #10
0
 public void homeClick()
 {
     UIcontroller.getInst().enterMain();
 }
Example #11
0
 public void languageClick()
 {
     UIcontroller.getInst().languageBtn();
 }
Example #12
0
 public void newClick()
 {
     UIcontroller.getInst().gameReplay();
 }
Example #13
0
    public void playClick()
    {
        gameObject.SetActive(false);

        UIcontroller.getInst().gameReplay();
    }
Example #14
0
 public void homeClick()
 {
     gameObject.SetActive(false);
     UIcontroller.getInst().enterMain();
 }