Example #1
0
    void CreateBearWith(int id, Transform t)
    {
        WGBearParam bp = dataCtrl.GetBearParam(id);

//		return;
        if (bp != null)
        {
            _curBearNum++;
            //int a = 5001;
            GameObject bearobj = _ShareObjManager.BCGameObjFactory(id, t.position, t.rotation.eulerAngles, _BearScale);

            bearobj.transform.parent        = t.transform;
            bearobj.transform.localPosition = Vector3.zero;

            GameObject hp   = Instantiate(HP, t.transform.position, t.transform.rotation) as GameObject;
            WGBear     bear = bearobj.GetComponent <WGBear>();


            bear.ID                       = id;
            bear.Blood                    = bp.hp;
            hp.transform.parent           = bearobj.transform;
            hp.transform.localPosition    = new Vector3(0, -0.5f, 3.5f);
            hp.transform.localEulerAngles = new Vector3(0, -180, 0);

            bear.AddHP(hp);

            szLiveBearID.Add(id);
            if (id == WGDefine.BossID)
            {
                _bearBoss = bear;
            }
        }
    }
Example #2
0
    public WGBearParam GetBearParam(int id)
    {
        WGBearParam bp = null;

        dicBearParam.TryGetValue(id, out bp);
        return(bp);
    }
Example #3
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);
    }
    public void ShowMonsterWithID(int id, bool isGray = false)
    {
        mCurBearParam = _dataCtrl.GetBearParam(id);
        mCurBearID    = id;

        int cost = -mCurBearParam.unlock;

        labNeedJewel.text = cost.ToString();

        labNeedLevel.text = WGStrings.getFormate(1004, mCurBearParam.unlock);

        ShowOneBear.getInstance().ShowMonsterWithID(id, isGray);
    }
Example #5
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();
        }
    }
    void OnBtnUnLock()
    {
        BCSoundPlayer.Play(MusicEnum.button);
        WGBearParam bear = _dataCtrl.GetBearParam(mCurBearID);

        if (!_dataPlayer.szPayObjID.Contains(mCurBearID))
        {
            if (_dataPlayer.Jewel > (-bear.unlock))
            {
                _dataPlayer.Jewel += bear.unlock;
                //#if TalkingData
                BCObj ob = _dataCtrl.GetBCObj(mCurBearID);
                //TDGAItem.OnPurchase(ob.Name,1,Mathf.Abs(bear.unlock));
                //#endif
#if Umeng
                Umeng.GA.Buy(mCurBearID.ToString(), 1, bear.unlock);
#endif
                _dataPlayer.szPayObjID.Add(mCurBearID);
                goGemLock.SetActive(false);
//				goCurBear.GetComponent<WGBear>().IsGray(false);

                ShowOneBear.getInstance().IsGray = false;

                WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN);


//				goCurBear.SetActive(false);

                ShowOneBear.getInstance().ShowCurBear = false;
                goGemLock.SetActive(false);
                WGAlertViewController.Self.showAlertView(1001).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();
                        break;

                    case MDAlertBehaviour.DID_HIDDEN:
//						goCurBear.SetActive(true);
                        ShowOneBear.getInstance().ShowCurBear = true;
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        break;
                    }
                };
            }
            else
            {
//				goCurBear.SetActive(false);
                ShowOneBear.getInstance().ShowCurBear = false;
                goGemLock.SetActive(false);
                WGAlertViewController.Self.showAlertView(1003, 1002, 1007).alertViewBehavriour = (ab, view) => {
                    switch (ab)
                    {
                    case MDAlertBehaviour.CLICK_OK:
                        view.hiddenView();

                        WGGameUIView.Instance.CloseCurrentView();
                        break;

                    case MDAlertBehaviour.CLICK_CANCEL:
                        view.hiddenView();
                        break;

                    case MDAlertBehaviour.DID_HIDDEN:

                        ShowOneBear.getInstance().ShowCurBear = true;
                        WGAlertViewController.Self.hiddeAlertView(view.gameObject);
                        if (view.clickIndex == MDBaseAlertView.CLICK_OK)
                        {
                            WGGameUIView.Instance.ViewControllerDoAct(BTN_ACT.SHOP);
                            WGShopView.curShopView.InitWillShowWithTabView(SHOP_TAB_VIEW.JEWEL_SHOP);
                        }
                        else
                        {
                            goGemLock.SetActive(true);
                        }
                        break;
                    }
                };
            }
        }
    }