Esempio n. 1
0
 public static void CompleteGuide()
 {
     isGuide    = false;
     indexGuide = -1;
     VariableSystem.guidedLevels[VariableSystem.mission - 1] = true;
     VariableSystem.SaveGuide();
 }
Esempio n. 2
0
    public void BuyButton()
    {
        AudioControl.DPlaySound("Click 1");
        if (VariableSystem.diamond >= price && price != 0)
        {
            VariableSystem.AddDiamond(-price);
            GoogleAnalytics.instance.LogScreen("Buy ShopItem: " + vi_detail[IdItem - 1]);
            gridView.FindChild("" + IdItem).GetComponent <ItemShop>().Price = price;
            gridView.FindChild("" + IdItem).GetComponent <ItemShop>().SetBuy();

            Transform diamond = Instantiate(SubDiamond) as Transform;
            diamond.parent     = this.transform;
            diamond.position   = btBuy.position;
            diamond.localScale = new Vector3(1, 1, 1);
            diamond.FindChild("Count").GetComponent <UILabel>().text = "-" + price;
            LeanTween.moveLocalY(diamond.gameObject, diamond.position.y - 300, 0.5f).setEase(LeanTweenType.easeOutSine).setOnComplete(delegate()
            {
                Destroy(diamond.gameObject);
            });
        }
        else
        {
            Debug.Log("Thieu tien roi");
            DialogInapp.ShowInapp();
        }
    }
Esempio n. 3
0
    public void ButtonGet()
    {
        bool[] dataDailyGift = PlayerPrefsX.GetBoolArray(DialogDailyGift.key_data_daily_gift);
        dataDailyGift[id - 1] = true;
        //Luu lai
        PlayerPrefsX.SetBoolArray(DialogDailyGift.key_data_daily_gift, dataDailyGift);
        SetData(true);
        switch (id)
        {
        case 1:
        default:
            VariableSystem.AddDiamond(1);
            break;

        case 2:    //super seed
            DialogShop.BoughtItem[0] = true;
            break;

        case 3:    //amazing machine
            DialogShop.BoughtItem[2] = true;
            break;

        case 4:
            VariableSystem.AddDiamond(2);
            break;

        case 5:    //radio
            DialogShop.BoughtItem[4] = true;
            break;

        case 6:    //save money
            DialogShop.BoughtItem[5] = true;
            break;

        case 7:    //super hand
            DialogShop.BoughtItem[3] = true;
            break;

        case 8:
            VariableSystem.AddDiamond(4);
            break;

        case 9:    //fill rate meter
            MissionPowerUp.FillRateMeter = true;
            break;

        case 10:    //price drop
            MissionPowerUp.PriceDrop = true;
            break;

        case 11:    //More time
            MissionPowerUp.MoreTime = true;
            break;

        case 12:
            VariableSystem.AddDiamond(8);
            break;
        }
    }
Esempio n. 4
0
 void OnDestroy()
 {
     //Luu lai thoi gian thoat
     //Debug.Log("Luu lai thoi gian " + DString.GetTimeNow());
     //AudioControl.time_add_heart = (DString.GetTimeNow() + AudioControl.max_time_receive_heat);
     //PlayerPrefs.SetString(AudioControl.key_time_add_heart, "" + AudioControl.time_add_heart);
     VariableSystem.SaveData();
     DataCache.SaveAchievementCache();
 }
Esempio n. 5
0
 void Update()
 {
     if (!goMenu)
     {
         VariableSystem.Start();
         DataCache.GetAchievementCacheData();
         goMenu = true;
         LoadingScene.ShowLoadingScene("Menu");
         //      VungleAndroid.init("com.redeye.farmbusiness");
         //     VungleAndroid.setSoundEnabled(true);
     }
 }
Esempio n. 6
0
    /// 初始化静态变量
    public static void              InitStaticMemeber()
    {
        //-------------------------------------------------------------------
        //初始化所有的循环实例
        s_ProcLogIn       = new GamePro_Login();        //!< 登录循环
        s_ProcCharSel     = new GamePro_CharSel();      //!< 人物选择流程
        s_ProcCharCreate  = new GamePro_CharCreate();   //!< 人物创建流程
        s_ProcEnter       = new GamePro_Enter();        //!< 等待进入场景流程
        s_ProcMain        = new GamePro_Main();         //!< 主游戏循环
        s_ProcChangeScene = new GamePro_ChangeScene();  //!< 服务器切换流程

        //////////////////////////////////////////////////////////////////////////
        s_NetManager      = new NetManager();
        s_pTimeSystem     = new TimeSystem();
        s_pWorldManager   = new WorldManager();
        s_pVariableSystem = new VariableSystem();
        s_pGfxSystem      = GFX.GfxSystem.Instance;   //GfxSystem是一个单例
        s_pGameInterface  = GameInterface.Instance;
        s_pObjectManager  = CObjectManager.Instance;  //物体管理器
        s_pDataBaseSystem = CDataBaseSystem.Instance; //数据库
        s_pDataPool       = CDataPool.Instance;
        s_pUIDataPool     = CUIDataPool.Instance;
        s_pInputSystem    = CInputSystem.Instance;
        s_pUISystem       = UISystem.Instance;
        s_random          = new System.Random((int)(UnityEngine.Time.time * 1000));
        s_pEventSystem    = CEventSystem.Instance;
        s_pScriptSystem   = CScriptSvm.Instance;
        /////////////////////////////////////////  /////////////////////////////////
        //initial
        //s_pDataBaseSystem.Initial(DBStruct.s_dbToLoad, DBStruct.GetResources);//初始化数据库,打开所有数据表

        s_NetManager.init((int)PACKET_DEFINE.PACKET_MAX, 30);
        s_pTimeSystem.Initial();
        s_pWorldManager.Initial();
        s_pUISystem.Initial();

        s_pActionSetMgr = CActionSetMgr.Instance;//初始动作集合管理器
        s_pActionSetMgr.Init("Private/ActionSet/");
        s_pGameInterface.Initial();
        s_pDataPool.Initial();
        s_pUIDataPool.Initial();
        s_pScriptSystem.Initial();
        MissionList.Instance.Initial();
        RandomName.Instance.Init();
        OpenFuncSystem.Instance.Initial();
        //////////////////////////////////////////////////////////////////////////
        mainBehaviour = GameObject.Find("MainLoop").GetComponent <MainBehaviour>();

        // 控制打印等级 [2/8/2012 Ivan]
        LogManager.EnableWarning();
    }
Esempio n. 7
0
 public void BuyButton()
 {
     if (VariableSystem.diamond >= price && price != 0)
     {
         VariableSystem.AddDiamond(-price);
         GoogleAnalytics.instance.LogScreen("Buy PowerUpItem: " + IdItem);
         transform.FindChild("Table").FindChild("Item" + IdItem).GetComponent <ItemPowerUp>().Price = price;
         transform.FindChild("Table").FindChild("Item" + IdItem).GetComponent <ItemPowerUp>().SetBuy();
         IdItem = 0;
     }
     else
     {
         DialogInapp.ShowInapp();
     }
 }
Esempio n. 8
0
    private void purchaseSucceededEvent(Purchase purchase)
    {
        Debug.Log("purchaseSucceededEvent: " + purchase);
        _label = "PURCHASED:" + purchase.ToString();
        int diamond = 10;

        switch (purchase.Sku)
        {
        case "package1":
            diamond = quatity[0];
            break;

        case "package2":
            diamond = quatity[1];
            break;

        case "package3":
            diamond = quatity[2];
            break;

        case "package4":
            diamond = quatity[3];
            break;

        case "package5":
            diamond = quatity[4];
            break;

        case "package6":
            diamond = quatity[5];
            break;

        default:
            break;
        }
        Debug.Log("------------------------purchase.Sku " + purchase.Sku + " diamond " + diamond);
        GoogleAnalytics.instance.LogScreen("Buy Inapp: " + diamond + " diamonds!");
        VariableSystem.AddDiamond(diamond);
        //Consume purchase
        OpenIAB.consumeProduct(purchase);
#if UNITY_ANDROID
        MobilePlugin.getInstance().ShowToast("Purchase success! You have got " + diamond);
#endif
    }
Esempio n. 9
0
    public void ButtonRefill()
    {
        Debug.Log("Button refill");
        Transform confirm = Instantiate(DialogConfirm) as Transform;

        confirm.parent = transform;
        HideDialog();
        confirm.GetComponent <DialogConfirm>().ShowDialog(MissionControl.Language["Refill"], MissionControl.Language["refill_heart"], () =>
        {
            if (VariableSystem.diamond >= 3)
            {
                VariableSystem.AddDiamond(-3);
                AudioControl.AddHeart(5 - VariableSystem.heart);
            }
            else
            {
                DialogInapp.ShowInapp();
            }
        });
    }
Esempio n. 10
0
 public void getGift()
 {
     if (timer.CompareTo(timer82) < 0)
     {
         VariableSystem.AddDiamond(50);//add kim cương
     }
     else
     {
         VariableSystem.AddDiamond(10); //add kim cương
     }
     if (timer.DayOfWeek.Equals(DayOfWeek.Saturday))
     {
         PlayerPrefs.SetString("SpecicalGift_Weeken", (timer.Day + 2) + "-" + timer.Month + "-" + timer.Year);
     }
     else
     {
         PlayerPrefs.SetString("SpecicalGift_Weeken", (timer.Day + 1) + "-" + timer.Month + "-" + timer.Year);
     }
     showGift = true;
     HideDialog();
 }
Esempio n. 11
0
 public void SetData(int count, bool add = true)
 {
     if (add)
     {
         transform.FindChild("Count").GetComponent <UILabel>().text = "+" + count;
         LeanTween.moveLocalY(this.gameObject, transform.position.y + 120, 1f).setEase(LeanTweenType.easeOutCirc).setOnComplete(delegate()
         {
             Debug.Log(this.gameObject.name);
             Destroy(this.gameObject);
         });
         VariableSystem.AddDiamond(count);
     }
     else
     {
         transform.FindChild("Count").GetComponent <UILabel>().text = "-" + count;
         LeanTween.moveLocalY(this.gameObject, transform.position.y - 120, 1f).setEase(LeanTweenType.easeOutCirc).setOnComplete(delegate()
         {
             Destroy(this.gameObject);
         });
         VariableSystem.AddDiamond(-count);
     }
 }
Esempio n. 12
0
    public void Update()
    {
        time += Time.deltaTime;
        if (time > 5)
        {
            time = 0;
            if (!GetComponent <UIButton>().enabled)
            {
                GetComponent <UIButton>().enabled = true;
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (CommonObjectScript.isViewPoppup)
            {
                dialogLogin.GetComponent <DialogLogin>().HideDialog(() =>
                {
                });
                CommonObjectScript.isViewPoppup = false;
            }
            else
            {
#if UNITY_ANDROID
                //Application.Quit();
                MobilePlugin.getInstance().ShowExitConfirm(MissionControl.Language["Quit"], MissionControl.Language["Quit_detail"],
                                                           MissionControl.Language["Ok"], MissionControl.Language["Cancel"]);
#endif
            }
        }
        if (Input.GetKeyDown(KeyCode.X))
        {
            print("Reset all data saved by PlayerPrefs");
            PlayerPrefs.DeleteAll();
            VariableSystem.AddDiamond(-(VariableSystem.diamond - 8));
        }
    }
Esempio n. 13
0
    public void LanguageButton()
    {
        if (btnLanguage.value)
        {
            VariableSystem.language = "Vietnamese";
        }
        else
        {
            VariableSystem.language = "English";
        }
        VariableSystem.SaveData();
        ChangeLanguage();

        // HungBV

        if ("Vietnamese".Equals(VariableSystem.language))
        {
            FactoryScenesController.languageHungBV = FactoryScenesController.languageHungBVVI;
        }
        else
        {
            FactoryScenesController.languageHungBV = FactoryScenesController.languageHungBVEN;
        }
    }
Esempio n. 14
0
 void OnDestroy()
 {
     VariableSystem.SaveData();
     DataCache.SaveAchievementCache();
 }
Esempio n. 15
0
 public void AddDiamond(int diamon)
 {
     VariableSystem.AddDiamond(diamon);
 }
Esempio n. 16
0
    public void Show()
    {
        Time.timeScale = 1.0f;
        MissionControl.ResetAllItem();
        LoadingScene.HideLoadingScene();
        CommonObjectScript.isViewPoppup = true;
        //Debug.Log("Show result ----------------------------------");
        missionFail.localScale = new Vector3(8, 8, 1);
        missionFail.gameObject.SetActive(false);
        TweenAlpha.Begin(missionFail.gameObject, 0, 0);
        star = 0;
        if (DialogTask.complete)
        {
            star   = 1;
            reward = MissionData.starMission.reward[0];
            if (CommonObjectScript.dollar >= MissionData.starMission.twoStar)
            {
                reward = MissionData.starMission.reward[1];
                star   = 2;
            }
            if (CommonObjectScript.dollar >= MissionData.starMission.threeStar)
            {
                reward = MissionData.starMission.reward[2];
                star   = 3;
            }
            particleWin.gameObject.SetActive(true);
            ///////////------------------------------------------
            AudioControl.getMonoBehaviour().StartCoroutine(DHS.PostMeCurrentMission(VariableSystem.mission + 1));
            //Cong tim khi thang
            AudioControl.AddHeart(1);

            //Nhac thang
            AudioControl.DPlaySound("Thang");
        }
        else
        {
            //Nhac thua
            AudioControl.DPlaySound("Thua");
        }
        //star = 3;//////////////////////////////////////////////////////
        //particleWin.gameObject.SetActive(true);
        if (Application.loadedLevelName.Equals("Farm"))
        {
            GameObject.Find("UI Root").transform.FindChild("PanelPlant").GetComponent <PlantControlScript>().BG_Click();
        }
        lbReward.text = "0";
        //Test
        //VariableSystem.dollar = 1000;
        //Thay doi ngon ngu
        bgMain.FindChild("Target").GetComponent <UILabel>().text = "" + MissionControl.Language["Require"];
        bgMain.FindChild("Score").GetComponent <UILabel>().text  = "" + MissionControl.Language["Your_Score"];
        bgMain.FindChild("Reward").GetComponent <UILabel>().text = "" + MissionControl.Language["Reward"];
        bgMain.FindChild("Ok").FindChild("Label").GetComponent <UILabel>().text       = "" + MissionControl.Language["Ok"];
        bgMain.FindChild("TryAgain").FindChild("Label").GetComponent <UILabel>().text = "" + MissionControl.Language["Try_Again"];
        bgMain.FindChild("RewardCustomer").GetComponent <UILabel>().text = "" + MissionControl.Language["Bonus_customer_rate"];
        bgMain.FindChild("LbStar1").GetComponent <UILabel>().text        = "" + MissionControl.Language["All_target"];

        lbTitle.text = MissionControl.Language["MISSION"] + " " + VariableSystem.mission;
        bgMain.FindChild("LbStar2").GetComponent <UILabel>().text = DString.ConvertString(MissionData.starMission.twoStar);
        bgMain.FindChild("LbStar3").GetComponent <UILabel>().text = DString.ConvertString(MissionData.starMission.threeStar);
        bgMain.FindChild("Score").FindChild("Label").GetComponent <UILabel>().text = DString.ConvertString(CommonObjectScript.dollar);
        bgBlack.gameObject.SetActive(true);
        LeanTween.delayedCall(1.0f, () =>
        {
            Time.timeScale = 0;
        }).setUseEstimatedTime(true);
        bgMain.gameObject.SetActive(true);
        LeanTween.scale(bgMain.gameObject, new Vector3(1, 1, 1), 0.4f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutBack).setOnComplete(() =>
        {
            star1.localScale = new Vector3(8, 8, 8);
            star2.localScale = new Vector3(8, 8, 8);
            star3.localScale = new Vector3(8, 8, 8);
            //Dieu kien xet sao
            if (star > 0)
            {
                star1.gameObject.SetActive(true);
                LeanTween.scale(star1.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo).setOnComplete(() =>
                {
                    //Check dieu kien de co sao thu 2
                    if (star > 1)
                    {
                        star2.gameObject.SetActive(true);
                        LeanTween.scale(star2.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo).setOnComplete(() =>
                        {
                            //Check dieu kien de co sao thu 3
                            if (star > 2)
                            {
                                star3.gameObject.SetActive(true);
                                LeanTween.scale(star3.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo);
                            }
                        });
                    }
                });
            }
            else
            {
                missionFail.gameObject.SetActive(true);
                LeanTween.scale(missionFail.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeInOutQuart);
                TweenAlpha.Begin(missionFail.gameObject, 0.5f, 1);
            }
        });
        //Them task nhiem vu
        //if (VariableSystem.mission == 1)
        //{
        //    AddItemResult("" + MissionControl.Language["Control_guide"], true, null, false);
        //}
        foreach (Transform tf in dialogTask.FindChild("Grid").GetComponent <UIGrid>().GetChildList())
        {
            AddItemResult(tf.GetComponent <ItemTask>().lbContent.text, tf.GetComponent <ItemTask>().togComplete.value, tf.GetComponent <ItemTask>().item, tf.GetComponent <ItemTask>().typeShow1);
        }
        grid.Reposition();
        transform.FindChild("SpriteBlack").gameObject.SetActive(true);

        //An bang task khi hien thi result
        GameObject task = GameObject.Find("DialogTask").gameObject;

        if (task != null)
        {
            task.GetComponent <DialogTask>().HideButton();
        }

        GameObject inapp = GameObject.Find("DialogInapp").gameObject;

        if (inapp != null)
        {
            inapp.GetComponent <DialogInapp>().HideDialog();
        }

        //Cap nhat lai phan thuong - Neu so sao moi  <= so sao hien tai => thuong 1 kim cuong
        if (star > 0 && star <= DataCache.dataMissionCache[VariableSystem.mission - 1].Star)
        {
            reward = 1;
        }

        VariableSystem.AddDiamond(reward);
        VariableSystem.AddDiamond(CommonObjectScript.rewardCustomerRate);
        Debug.Log("CONG KIM CUONG -------------------- reward " + reward + " CommonObjectScript.rewardCustomerRate " + CommonObjectScript.rewardCustomerRate);
        DataCache.UpdateMissionScore(CommonObjectScript.dollar, star, VariableSystem.mission, 1);
        bool sendToServer = false;

        if (star > 0)
        {
            if (VariableSystem.mission < DataMissionControlNew.MAX_MISSION)
            {
                DataCache.SetMeCurrentMission(VariableSystem.mission + 1);
            }
            sendToServer = true;
        }
        DataCache.SaveMissionDataCache(sendToServer);
        lbReward.text         = "" + reward;
        lbRewardCustomer.text = "" + CommonObjectScript.rewardCustomerRate;
    }