Beispiel #1
0
    public override void OnBtnOk()
    {
        BCSoundPlayer.Play(MusicEnum.button);

        DataPlayerController dpc       = DataPlayerController.getInstance();
        WGDataController     _dataCtrl = WGDataController.Instance;
        int numleft   = _dataCtrl.GetCollectionOwnNum(itemID1);
        int numMiddle = _dataCtrl.GetCollectionOwnNum(itemID2);
        int numRight  = _dataCtrl.GetCollectionOwnNum(itemID3);

        if (Mathf.Min(numleft, numMiddle, numRight) >= mSellCount)
        {
            _dp.Coin += Mathf.CeilToInt(mGotCoin + 0.5f);

            dpc.addCollectionNum(itemID1, -mSellCount);
            dpc.addCollectionNum(itemID2, -mSellCount);
            dpc.addCollectionNum(itemID3, -mSellCount);
//			Dictionary<string, object> dic = new Dictionary<string, object>();
//			dic.Add("SellNum",mSellCount.ToString());
//			//WG.SLog("=actionId="+WGStrings.getText(9005)+col1.groupdes+"==parameters="+SDK.Serialize(dic));
//
//			TalkingDataGA.OnEvent(WGStrings.getText(9005)+col1.groupdes, dic);
//#endif



            DataPlayerController.getInstance().saveDataPlayer();

            WGGameUIView.Instance.freshPlayerUI(UI_FRESH.COIN);
        }
        WGGameUIView.Instance.freshMenuButton(2);
        base.OnBtnOk();
    }
Beispiel #2
0
    void GetReward(bool bDouble)
    {
        DataPlayerController dpc  = DataPlayerController.getInstance();
        DataPlayer           _dp  = dpc.data;
        BCGameObjectType     type = WGDataController.Instance.GetBCObjType(curReward.reward);
        BCObj obj = WGDataController.Instance.GetBCObj(curReward.reward);

        switch (type)
        {
        case BCGameObjectType.Coin:
            _dp.Coin = _dp.Coin + curReward.got_num;
            if (bDouble)
            {
                _dp.Coin = _dp.Coin + curReward.got_num;
            }
            break;

        case BCGameObjectType.Collection:
            dpc.addCollectionNum(curReward.reward, curReward.got_num);
            if (bDouble)
            {
                dpc.addCollectionNum(curReward.reward, curReward.got_num);
            }
            break;

        case BCGameObjectType.Item:
            dpc.AddSkillNum(curReward.reward, curReward.got_num);
            if (bDouble)
            {
                dpc.AddSkillNum(curReward.reward, curReward.got_num);
            }
            break;

        case BCGameObjectType.Jewel:
            _dp.Jewel += curReward.got_num;
            if (bDouble)
            {
                _dp.Jewel += curReward.got_num;
            }
                        #if TalkingData
            TDGAVirtualCurrency.OnReward(curReward.got_num, "DailyReward");
                        #endif
                        #if Umeng
            Umeng.GA.Bonus(curReward.got_num, Umeng.GA.BonusSource.Source2);
                        #endif
            break;
        }

        _dp.lastDailyRewardTime = Core.now;

        dpc.saveDataPlayer();

        WGGameUIView.Instance.freshPlayerUI(UI_FRESH.BCOIN | UI_FRESH.COIN);
    }
    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();
        }
    }