Example #1
0
    public void freshWithCollectionID(int id, Color color)
    {
        WGDataController _dataCtrl = WGDataController.Instance;

        mItemColID  = id;
        labNum.text = _dataCtrl.GetCollectionOwnNum(id).ToString();

        BCObj obj = _dataCtrl.GetBCObj(id);

        if (obj != null)
        {
            GameObject go = Instantiate(obj.goRes, Vector3.zero, Quaternion.Euler(270, 0, 0)) as GameObject;

            Vector3 scale = go.transform.localScale;
            go.transform.parent        = this.transform;
            go.transform.localScale    = Vector3.one * 14.6f;
            go.transform.localPosition = goCollectionPanel.transform.localPosition;
            go.transform.parent        = goCollectionPanel.transform;

            Destroy(go.GetComponent <Rigidbody>());
            Destroy(go.GetComponent <BoxCollider>());
            goCollectionPanel.GetComponent <TweenRotation>().delay = Random.Range(0, 1);
        }

        spBackground.color = color;
        spBottom.color     = color;
    }
Example #2
0
    void freshUIWithBearID(int id)
    {
        BCObj       obj  = _dataCtrl.GetBCObj(id);
        WGBearParam bear = _dataCtrl.GetBearParam(id);

        DataPlayer _dp = DataPlayerController.getInstance().data;

        int curLv = _dp.Level;

        bool isGray = false;


        if (bear.unlock >= 0)
        {
            gemLockView.ESetActive(false);
            if (curLv >= bear.unlock)         //解锁
            {
                isGray = false;
                unLockView.ESetActive(true);
                levelLockView.ESetActive(false);
                WGShowBearController.Instance.ShowMode(0);
            }
            else             //需要到达等级解锁
            {
                isGray = true;
                unLockView.ESetActive(false);
                levelLockView.ESetActive(true);
                WGShowBearController.Instance.ShowMode(2);
            }
        }
        else
        {
            levelLockView.ESetActive(false);
            if (_dp.szPayObjID.Contains(id))           //解锁
            {
                unLockView.ESetActive(true);
                gemLockView.ESetActive(false);
                isGray = false;
                WGShowBearController.Instance.ShowMode(0);
            }
            else             //需要花钻石解锁,没有解锁
            {
                isGray = true;
                unLockView.ESetActive(false);
                gemLockView.ESetActive(true);
                WGShowBearController.Instance.ShowMode(1);
            }
        }

        unLockView.freshWithBearID(obj.Name, bear.des);
        gemLockView.freshWithBearID(obj.Name, bear.des);
        levelLockView.freshWithBearID(obj.Name, bear.des);


        WGShowBearController.Instance.ShowMonsterWithID(id, isGray);
    }
Example #3
0
    public void freshUIWithData(MDAchievement ach)
    {
        preAchievementData = ach;

        WGDataController     _dataCtrl = WGDataController.Instance;
        DataPlayerController dpc       = DataPlayerController.getInstance();


        BCObj rwObj = _dataCtrl.GetBCObj(ach.reward[0]);

        labName.text = ach.name + ":" + ach.des;

        spGoalIcon.spriteName = ach.icon;
        switch (rwObj.BCType)
        {
        case BCGameObjectType.Coin:
            spRewardIcon.spriteName = "coin_105";
            break;

        case BCGameObjectType.Jewel:
            spRewardIcon.spriteName = "gem_104";
            break;
        }
        spRewardIcon.MakePixelPerfect();

        labRewardNum.text = WGStrings.getFormate(1066, ach.reward[1]);

        int got = 0;

        dpc.data.dicGotAchReward.TryGetValue(ach.id, out got);

        if (got == 1)     //到达了
        {
            btnGetReward.gameObject.SetActive(true);
            sdProgress.gameObject.SetActive(false);
            goHaveGot.SetActive(false);
        }
        else if (got == 0)       //还没有到达
        {
            goHaveGot.SetActive(false);
            btnGetReward.gameObject.SetActive(false);
            sdProgress.gameObject.SetActive(true);

            int reachNum = WGAchievementManager.Self.getAchievementProgress(ach);

            labProgress.text = reachNum.ToString() + "/" + ach.goal_num.ToString();
            sdProgress.value = reachNum * 1f / ach.goal_num;
        }
        else if (got == -1)       //已经领取
        {
            goHaveGot.SetActive(true);
            btnGetReward.gameObject.SetActive(false);
            sdProgress.gameObject.SetActive(false);
        }
    }
Example #4
0
    public void FreshUnlockBearView(int id)
    {
        WGDataController _dtCtl = WGDataController.Instance;

        mBearObj = _dtCtl.GetBCObj(id);

//		WGBearParam bp = _dtCtl.GetBearParam(id);

        labName.text = mBearObj.Name;
        ShowOneBear.getInstance();
    }
Example #5
0
    void OnBtnGetReward()
    {
        WGDataController     _dataCtrl = WGDataController.Instance;
        DataPlayerController dpc       = DataPlayerController.getInstance();

        if (dpc.data.dicGotAchReward[preAchievementData.id] != 1)
        {
            WGAlertViewController.Self.showAlertView(1016).alertViewBehavriour = (ab, view) => {
                switch (ab)
                {
                case MDAlertBehaviour.CLICK_OK:
                    view.hiddenView();
                    break;

                case MDAlertBehaviour.DID_HIDDEN:
                    WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                    break;
                }
            };
            return;
        }

        int objID  = preAchievementData.reward[0];
        int gotNum = preAchievementData.reward[1];

        BCObj obj = _dataCtrl.GetBCObj(objID);

        switch (obj.BCType)
        {
        case BCGameObjectType.Item:
            dpc.AddSkillNum(objID, gotNum);
            WGGameUIView.Instance.freshSkillNum();
            break;

        case BCGameObjectType.Collection:
            dpc.addCollectionNum(objID, gotNum);
            break;

        case BCGameObjectType.Coin:
            dpc.data.Coin += gotNum;
            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN);
            break;

        case BCGameObjectType.Jewel:
            dpc.data.Jewel += gotNum;
#if TalkingData
            TDGAVirtualCurrency.OnReward(gotNum, "AchievementReward");
#endif
#if Umeng
            Umeng.GA.Bonus(gotNum, Umeng.GA.BonusSource.Source4);
#endif
            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);
            break;
        }

        dpc.data.dicGotAchReward[preAchievementData.id] = -1;

//		WGAlertViewController.Self.showAlertView(1015).alertViewBehavriour =(ab,view)=>{
//			switch(ab)
//			{
//			case MDAlertBehaviour.CLICK_OK:
//				view.hiddenView();
//				if(curAchViewManager != null)
//				{
//					curAchViewManager.ReloadAchievement();
//				}
//				break;
//			case MDAlertBehaviour.DID_HIDDEN:
//				WGAlertViewController.Self.hiddeAlertView(view.gameObject);
//				break;
//			}
//		};
        if (curAchViewManager != null)
        {
            curAchViewManager.ReloadAchievement();
        }
    }
Example #6
0
    public void WhenBearKilled(int id, Transform tran, bool bMiao = false)
    {
        BCSoundPlayer.Play(MusicEnum.hitBear);



        WGAchievementManager.Self.processAchievement(id, DTAchievementType.KILL_ALL);
        WGAchievementManager.Self.processAchievement(id, DTAchievementType.KILL_ONE);
        WGBearParam mBear = dataCtrl.GetBearParam(id);
        BCObj       mOjb  = dataCtrl.GetBCObj(id);

        _ShareWorld.PlayGetExp(mOjb.Exp);


        if (WGHelpManager.Self != null)
        {
            if (WGHelpManager.Self.enabled)
            {
                if (!WGHelpManager.Self.StatesIsEnd(EMHelpStates.Kill_Energy))
                {
                    WGHelpManager.Self.ShowHelpView(EMHelpStates.Kill_Energy);
                }
                else if (!WGHelpManager.Self.StatesIsEnd(EMHelpStates.Kill_Tiger) && mBear.tiger == 1)
                {
                    WGHelpManager.Self.ShowHelpView(EMHelpStates.Kill_Tiger);
                }
                else if (!WGHelpManager.Self.StatesIsEnd(EMHelpStates.Use_Item))
                {
                    WGHelpManager.Self.ShowHelpView(EMHelpStates.Use_Item);
                }
                else if (!WGHelpManager.Self.StatesIsEnd(EMHelpStates.RegetCoin))
                {
                    WGHelpManager.Self.ShowHelpView(EMHelpStates.RegetCoin);
                }
            }
        }


        BearDead(tran.parent);
        szLiveBearID.Remove(id);
        _curBearNum--;
        if (id == WGDefine.BossID)
        {
            _bearBoss = null;
        }
        if (!bHaiXiaoEffect)
        {
            _dataPlayer.mEnergy += mBear.energy;
        }
        if (_dataPlayer.mEnergy >= _EnergyFull)
        {
            if (!_bShowPowerTip)
            {
                if (_dataPlayer.a1 == 0)
                {
                    if (YeHuoSDK.bShowPoweGift)
                    {
                        _bShowPowerTip = true;
                        D04PowerTipView tip = D04PowerTipView.CreatePowerPayView();
                        Time.timeScale          = 0;
                        tip.alertViewBehavriour = (ab, view) => {
                            if (ab == MDAlertBehaviour.CLICK_OK)
                            {
                                Destroy(view.gameObject);
                                showBuyPowerView();
                            }
                        };
                    }
                    else
                    {
                        _dataPlayer.mEnergy -= _EnergyFull;
                        bHaiXiaoEffect       = true;

                        //DonNotNeedCoin(10+2);
//						WGTsunamiView tv = WGTsunamiView.CreateTsunamiView();
//						tv.alertViewBehavriour =(ab,view)=>{
//							switch(ab)
//							{
//							case MDAlertBehaviour.DID_HIDDEN:
//								Destroy(view.gameObject);
//								break;
//							}
//						};
//						SDK.AddChild(tv.gameObject,_ShareWorld.go2DUIBottom);
//						tv.showTsunamiView(10f);

                        csThrow.showTsunamiEffect(true);
                        pgHaiXiao.value = 1;
                        pgHaiXiaoValue  = 1;
                        InvokeRepeating("HaiXiaoEffect", 2f, 10f / 100);
                    }
                }
                else if (_dataPlayer.a1 == 1)
                {
                    _dataPlayer.mEnergy -= _EnergyFull;
                    bHaiXiaoEffect       = true;

                    DonNotNeedCoin(10 + 2);
                    WGTsunamiView tv = WGTsunamiView.CreateTsunamiView();
                    tv.alertViewBehavriour = (ab, view) => {
                        switch (ab)
                        {
                        case MDAlertBehaviour.DID_HIDDEN:
                            Destroy(view.gameObject);
                            break;
                        }
                    };
                    SDK.AddChild(tv.gameObject, _ShareWorld.go2DUIBottom);
                    tv.showTsunamiView(10f);

                    csThrow.showTsunamiEffect(true);
                    pgHaiXiao.value = 1;
                    pgHaiXiaoValue  = 1;
                    InvokeRepeating("HaiXiaoEffect", 2f, 10f / 100);
                }
            }
        }

        if (!bHaiXiaoEffect)
        {
            pgHaiXiao.value = _dataPlayer.mEnergy * 1.0f / _EnergyFull;
        }



//		//WG.SLog("WhenBearKilled======="+SDK.Serialize(mBear.death_reward));
        for (int i = 0, max = mBear.death_reward.Count; i < max; i++)
        {
            _ShareWorld.AddReward(mBear.death_reward[i]);
        }
        if (bMiao && mBear.additional != null && mBear.additional.Count > 0)
        {
            for (int i = 0, max = mBear.additional.Count; i < max; i++)
            {
                _ShareWorld.AddReward(mBear.additional[i]);
            }
        }

        if (mBear.tiger == 1)
        {
            WGGameTiger.Instance.StartTiger();
        }
    }