Esempio n. 1
0
 public void OnLevel3Btn()
 {
     if (PlayerPrefs.GetInt("Lock3", 0) == 1)
     {
         int level = PlayerPrefs.GetInt("Level", 1);
         if (level != 3)
         {
             MultiHaptic.HapticMedium();
             int       index    = int.Parse((levelPos [level - 1].name.ToString()));
             int       curIndex = int.Parse((levelPos [2].name.ToString()));
             int       v3Count;
             Vector3[] pathV3;
             if (curIndex > index)
             {
                 v3Count = curIndex - index + 1;
                 pathV3  = new Vector3[v3Count];
                 for (int i = 0; i < v3Count; i++)
                 {
                     pathV3 [i] = pathPoint [index + i - 1].position;
                 }
             }
             else
             {
                 v3Count = index - curIndex + 1;
                 pathV3  = new Vector3[v3Count];
                 for (int i = 0; i < v3Count; i++)
                 {
                     pathV3 [i] = pathPoint [index - i].position;
                 }
             }
             Destroy(point.gameObject);
             shipMark.DOPath(pathV3, 1, PathType.Linear, PathMode.TopDown2D, 10, null).OnComplete(() => {
                 PlayerPrefs.SetInt("Level", 3);
                 SceneManager.LoadScene("Level3");
             });
         }
     }
     else
     {
         int cost = 300000000;
         MessageBox.Show("", "It costs " + "$300,000K" + "to unlock", 2);
         MessageBox.confim = () => {
             int gold = PlayerPrefs.GetInt("gold", 0);
             if (gold > cost)
             {
                 gold -= cost;
                 PlayerPrefs.SetInt("gold", gold);
                 UIManager.Instance.goldT.DOText(UIManager.UnitChange(gold), 0.5f, false, ScrambleMode.None, null);
                 Upgrading.Instance.CheckGold();
                 UpgradingOffline.Instance.CheckGold();
                 PlayerPrefs.SetInt("Lock3", 1);
                 transform.Find("Level3").Find("lock").gameObject.SetActive(false);
             }
             else
             {
                 GenerateText(lv4, "Not enough money!");
             }
         };
     }
 }
Esempio n. 2
0
    public void OnDepthClick()
    {
        gold = PlayerPrefs.GetInt("gold", 0);
        if (gold > price)
        {
            MultiHaptic.HapticMedium();
            gold -= price;
            UIManager.Instance.diveDepth -= 7;
            price = (int)(price * 1.35f);

            if (PlayerPrefs.GetInt("Level", 1) == 1)
            {
                PlayerPrefs.SetInt("valueDepth", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth", price);
            }
            else if (PlayerPrefs.GetInt("Level", 1) == 2)
            {
                PlayerPrefs.SetInt("valueDepth2", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth2", price);
            }
            else if (PlayerPrefs.GetInt("Level", 1) == 3)
            {
                PlayerPrefs.SetInt("valueDepth3", UIManager.Instance.diveDepth);
                PlayerPrefs.SetInt("priceDepth3", price);
            }

            PlayerPrefs.SetInt("gold", gold);
            UpdateData(0);
            CheckGold();
        }
    }
Esempio n. 3
0
    public void OnOfflineClick()
    {
        gold = PlayerPrefs.GetInt("gold", 0);
        if (gold > price)
        {
            MultiHaptic.HapticMedium();
            gold -= price;

            if (UIManager.Instance.offlineGold < 400)
            {
                UIManager.Instance.offlineGold += 40;
            }
            else
            {
                UIManager.Instance.offlineGold = (int)(UIManager.Instance.offlineGold * 1.25f);
            }

            price = (int)(price * 1.25f);
            PlayerPrefs.SetInt("valueOffline", UIManager.Instance.offlineGold);
            PlayerPrefs.SetInt("priceOffline", price);
            PlayerPrefs.SetInt("gold", gold);
            UpdateData(0);
            CheckGold();
        }
    }
Esempio n. 4
0
 public void OnButtonClick()
 {
     MultiHaptic.HapticMedium();
     transform.DOScale(1.1f, 0.15f).OnComplete(() => {
         transform.DOScale(1f, 0.15f);
     }).SetEase(Ease.InBack);
 }
Esempio n. 5
0
    //生成分数,还需要生成文字perfect提示
    void ScoreGenerate()
    {
        if (!scoreGenerating)
        {
            scoreGenerating = true;
            Invoke("ResetScoreGenerate", 1);
            //如果没有踩中环,弹出MISS并拳头打飞
            string ringname = CheckRing();
            if (ringname == "normal" && GameState != 0)
            {
                //GameState = 0;
                //rings.Clear ();
                //if (tempText) {
                //	TipPop.GenerateTip ("X1", 0.5f,Color.yellow);
                //	int coinLevel = PlayerPrefs.GetInt ("coinLevel", 1);
                //	Gold.Instance.GetGold ((int)(77*(Mathf.Pow(1.05f,coinLevel))));
                //	MoneyManager.Instance.UpdateGold ();
                Destroy(tempText, 0.5f);
                if (PlayerPrefs.GetInt("vibration", 1) == 1)
                {
                    MultiHaptic.HapticMedium();
                }
                //TipPop.GenerateTip ("MISS", 0.5f);
                GameOverByBoxglove(currentColl);

                FlyGold.Instance.GenerateGoldNoColl(30, transform.position + Vector3.up * 2);
                //TipPop.GenerateTip ("-$"+curGold, 0.5f,Color.yellow);
                //}
                return;
            }
            else
            {
                //踩中环的时候状态变为待机状态,生成对应的分数,删除踩中的环
                GameState = 0;

                Transform ringTrans = Instantiate(currentRing [ringname + "(Clone)"].gameObject).transform;
                ringTrans.DOScale(ringTrans.localScale * 3, 0.5f);
                MeshRenderer ringMesh = ringTrans.GetComponent <MeshRenderer> ();
                ringMesh.material = ringMarDic [ringname];
                ringMesh.material.DOColor(Color.clear, 0.5f).OnComplete(() => {
                    Destroy(ringTrans.gameObject);
                });

                rings.Clear();
                if (PlayerPrefs.GetInt("vibration", 1) == 1)
                {
                    MultiHaptic.HapticMedium();
                }
                if (tempText)
                {
                    TipPop.GenerateTip("X" + scoreDic [ringname], 0.5f, Color.yellow);
                    Destroy(tempText, 0.5f);
                    //int coinLevel = PlayerPrefs.GetInt ("coinLevel", 1);
                    Gold.Instance.GetGold((int)(curGold * scoreDic [ringname]));
                    MoneyManager.Instance.UpdateGold();
                }
                TipPop.GenerateTipPerfect(perfectWord [Random.Range(0, perfectWord.Length)], 1f, Color.yellow);
            }
        }
    }
Esempio n. 6
0
        public static void Double()
        {
            MultiHaptic.HapticMedium();
            if (Messagebox.tag == "PopBG")
            {
                if (doubleR != null)
                {
                    doubleR();
                    GameObject.Destroy(Messagebox);
                }
            }
            if (Messagebox.tag == "PurchasePop")
            {
                if (cancle != null)
                {
                    cancle();
                }
                GameObject.Destroy(Messagebox);
            }
//			Result = 2;
//			GameObject.Destroy(Messagebox);
//			TitleStr = "标题";
//			ContentStr = null;
            //Time.timeScale = 1;
        }
Esempio n. 7
0
 public void OnBackBtnClick()
 {
     if (isShow)
     {
         MultiHaptic.HapticMedium();
         illustration.DOMoveY(illustration.position.y + screenHeight, 0.5f, false);
         isShow = false;
     }
 }
Esempio n. 8
0
 public void OnIllBtnClick()
 {
     if (!isShow)
     {
         MultiHaptic.HapticMedium();
         illustration.DOMoveY(illustration.position.y - screenHeight, 0.5f, false);
         isShow = true;
         illNew.SetActive(false);
         PlayerPrefs.SetInt("illNew", 0);
     }
 }
Esempio n. 9
0
 public static void Sure()
 {
     if (confim != null)
     {
         MultiHaptic.HapticMedium();
         confim();
         GameObject.Destroy(Messagebox);
         TitleStr   = "标题";
         ContentStr = null;
         //Time.timeScale = 1;
     }
 }
Esempio n. 10
0
    public void OnLevel1Btn()
    {
        int level = PlayerPrefs.GetInt("Level", 1);

        if (level != 1)
        {
            MultiHaptic.HapticMedium();
            int       v3Count = int.Parse((levelPos [level - 1].name.ToString()));
            Vector3[] pathV3  = new Vector3[v3Count];
            for (int i = 0; i < v3Count; i++)
            {
                pathV3 [i] = pathPoint [v3Count - i - 1].position;
            }
            Destroy(point.gameObject);
            shipMark.DOPath(pathV3, 1, PathType.Linear, PathMode.TopDown2D, 10, null).OnComplete(() => {
                PlayerPrefs.SetInt("Level", 1);
                SceneManager.LoadScene("Level1");
            });
        }
    }
Esempio n. 11
0
    public void ChangeArea()
    {
        int index = 0;

        if (transform.name == "Area1")
        {
            index = 0;
        }
        if (transform.name == "Area2")
        {
            index = 10;
        }
        if (transform.name == "Area3")
        {
            index = 20;
        }
        Illustration.Instance.fishImage    = fishImage;
        Illustration.Instance.fishName     = fishName;
        Illustration.Instance.unusualImage = unusualImage;
        Illustration.Instance.unLockImage  = unLockImage;
        Illustration.Instance.IllUpdate(index);
        transform.GetComponent <Image> ().color = new Color(0.5f, 0.5f, 0.5f);
        MultiHaptic.HapticMedium();
    }
Esempio n. 12
0
 public void onStartButton()
 {
     MultiHaptic.HapticMedium();
     isRunning = true;
     isReady   = false;
     SubmarineController.Instance.gravityScale = 2;
     if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
     {
         SubmarineController.Instance.moveSpeed = 1;
     }
     else
     {
         SubmarineController.Instance.moveSpeed = 10;
     }
     FishGenerate.Instance.GenerateFish();
     BGmanager.Instance.GenerateWaterF();
     BGmanager.Instance.GenerateParallx();
     BGmanager.Instance.GenerateBubble();
     SubmarineController.Instance.InitProgressSlider();
     HideUI();
     SubmarineController.Instance.progressSlider.gameObject.SetActive(true);
     SubmarineController.Instance.SynDepth();
     PlayerPrefs.SetInt("quitGame", 0);
 }
Esempio n. 13
0
 public void OnMapBtn()
 {
     gameObject.SetActive(true);
     point.DOPunchPosition(new Vector3(0, 10, 0), 1, 5, 1, false).SetLoops(10);
     MultiHaptic.HapticMedium();
 }
Esempio n. 14
0
 public void OnLevel4Btn()
 {
     MultiHaptic.HapticMedium();
     GenerateText(lv4, "当前关卡还未开放!");
 }
Esempio n. 15
0
 public void OnLevel4Btn()
 {
     MultiHaptic.HapticMedium();
     GenerateText(lv4, "To Be Continue...");
 }