Example #1
0
 /// <summary>
 /// 游戏内获得物品时调用
 /// </summary>
 /// <param name="rewardNum"></param>
 /// <param name="rsason"></param>
 public void OnReward(int rewardNum, string strRsason)
 {
     if (!isRuntime)
     {
         return;
     }
     TDGAVirtualCurrency.OnReward(rewardNum, strRsason);
 }
Example #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);
    }
Example #3
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 #4
0
    void OnGUI()
    {
        int i = 0;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Demo Menu");

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Create User"))
        {
            account = TDGAAccount.SetAccount("User" + index);
            index++;
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Account Level +1"))
        {
            if (account != null)
            {
                account.SetLevel(level++);
            }
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Chagen Game Server + 'a'"))
        {
            if (account != null)
            {
                gameserver += "a";
                account.SetGameServer(gameserver);
            }
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Charge Request 10"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10, "CH", 10, "PT");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Charge Success 10"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Reward 100"))
        {
            TDGAVirtualCurrency.OnReward(100, "reason");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Item Purchase 10"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10);
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Item Use 1"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }

        if (GUI.Button(new Rect(left, top + step * i++, width, height), "Custome Event"))
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            dic.Add("StartApp" + "StartAppTime", "startAppMac" + "#" + "02/01/2013 09:52:24");
            dic.Add("IntValue", 1);
            TalkingDataGA.OnEvent("action_id", dic);
        }
    }
    private void OnGUI()
    {
        int num = 0;

        GUI.Box(new Rect(10f, 10f, (float)(Screen.width - 20), (float)(Screen.height - 20)), "Demo Menu");
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Create User"))
        {
            this.account = TDGAAccount.SetAccount("User" + this.index);
            this.index++;
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Account Level +1") && this.account != null)
        {
            this.account.SetLevel(this.level++);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Chagen Game Server + 'a'") && this.account != null)
        {
            this.gameserver += "a";
            this.account.SetGameServer(this.gameserver);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Charge Request 10"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10.0, "CH", 10.0, "PT");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Charge Success 10"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Reward 100"))
        {
            TDGAVirtualCurrency.OnReward(100.0, "reason");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Item Purchase 10"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10.0);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Item Use 1"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }
        if (GUI.Button(new Rect(90f, (float)(60 + 60 * num++), (float)this.width, 50f), "Custome Event"))
        {
            TalkingDataGA.OnEvent("action_id", new Dictionary <string, object>
            {
                {
                    "StartAppStartAppTime",
                    "startAppMac#02/01/2013 09:52:24"
                },
                {
                    "IntValue",
                    1
                }
            });
        }
    }
Example #6
0
 /// <summary>
 /// 获得虚拟币记录
 /// </summary>
 /// <param name="virtualCurrency"></param>
 /// <param name="reason"></param>
 public void OnReward(double virtualCurrency, string reason = "")
 {
     TDGAVirtualCurrency.OnReward(virtualCurrency, reason);
 }
Example #7
0
    private void OnGUI()
    {
        int i = 0;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Demo Menu");

        GUI.Label(new Rect(left, top + (step * i++), width, height), deviceId);
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "getDeviceId"))
        {
            deviceId = TalkingDataGA.GetDeviceId();
        }

        GUI.Label(new Rect(left, top + (step * i++), width, height), oaid);
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "getOAID"))
        {
            oaid = TalkingDataGA.GetOAID();
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "SetLocation"))
        {
            TalkingDataGA.SetLocation(39.94, 116.43);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Create Profile"))
        {
            profile = TDGAProfile.SetProfile("User" + index++);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Profile Name"))
        {
            if (profile != null)
            {
                profile.SetProfileName("name");
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Profile Type"))
        {
            if (profile != null)
            {
                profile.SetProfileType(ProfileType.WEIXIN);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Level"))
        {
            if (profile != null)
            {
                profile.SetLevel(level++);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Gender"))
        {
            if (profile != null)
            {
                profile.SetGender(Gender.MALE);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Age"))
        {
            if (profile != null)
            {
                profile.SetAge(21);
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Set Game Server"))
        {
            if (profile != null)
            {
                profile.SetGameServer("server1");
            }
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Begin"))
        {
            TDGAMission.OnBegin("miss001");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Completed"))
        {
            TDGAMission.OnCompleted("miss001");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Mission Failed"))
        {
            TDGAMission.OnFailed("miss001", "failed");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Charge Request"))
        {
            TDGAVirtualCurrency.OnChargeRequest("order01", "iap", 10, "CNY", 10, "UnionPay");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Charge Success"))
        {
            TDGAVirtualCurrency.OnChargeSuccess("order01");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Reward"))
        {
            TDGAVirtualCurrency.OnReward(100, "reason");
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Item Purchase"))
        {
            TDGAItem.OnPurchase("itemid001", 10, 10);
        }

        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Item Use"))
        {
            TDGAItem.OnUse("itemid001", 1);
        }

#if TDGA_CUSTOM
        if (GUI.Button(new Rect(left, top + (step * i++), width, height), "Custome Event"))
        {
            Dictionary <string, object> dic = new Dictionary <string, object>
            {
                { "StringValue", "Pi" },
                { "NumberValue", 3.14 }
            };
            TalkingDataGA.OnEvent("action_id", dic);
        }
#endif
    }