public static TrackEventWithParameters ( string eventId, string eventLabel, object>.Dictionary |
||
eventId | string | |
eventLabel | string | |
parameters | object>.Dictionary | |
Résultat | void |
public void RefreshData() { if (GameLogic.Singleton.IsStageFinish() && GameLogic.Singleton.CheckGetEnoughScore()) //检查关卡是否结束 { m_bWin = true; } else { m_bWin = false; if (GlobalVars.CurStageData.Target == GameTarget.ClearJelly) { m_infoLabel.text = Localization.instance.Get("DidNotClearIce"); } else if (GlobalVars.CurStageData.Target == GameTarget.BringFruitDown) { m_infoLabel.text = Localization.instance.Get("DidNotBringNuts"); } else if (GlobalVars.CurStageData.Target == GameTarget.Collect) { m_infoLabel.text = Localization.instance.Get("DidNotCollectEnough"); } else if (GlobalVars.CurStageData.Target == GameTarget.GetScore) //分数要求的情况 { m_infoLabel.text = Localization.instance.Get("NotEnoughScore"); } else { m_infoLabel.text = Localization.instance.Get("EndGameByHimSelf"); } } if (m_bWin) { GlobalVars.AddHeart(1); //若关卡成功,需要把之前扣的心恢复回来 } if (m_bWin) { if (GlobalVars.AvailabeStageCount == GlobalVars.CurStageNum) { if (GlobalVars.AvailabeStageCount < GlobalVars.TotalStageCount) { ++GlobalVars.AvailabeStageCount; //开启下一关 } //UIWindowManager.Singleton.GetUIWindow<UIMap>().OpenNewButton(GlobalVars.AvailabeStageCount); } for (int i = 2; i >= 0; --i) { if (GameLogic.Singleton.GetProgress() >= GlobalVars.CurStageData.StarScore[i]) { m_starCount = i + 1; break; } } if (GlobalVars.StageStarArray[GlobalVars.CurStageNum] == 0) //if it's the first time of finishing the stage { float scorePercent = (float)GameLogic.Singleton.GetProgress() / GameLogic.Singleton.PlayingStageData.StarScore[0]; if (CapsConfig.EnableGA) //游戏过关后的记录 { GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:StepLeft", GameLogic.Singleton.m_stepCountWhenReachTarget); // GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:Score_Percent", scorePercent); //记录当前开始的关卡的百分比 GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:StarCount", m_starCount); GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:FailedTimes", GlobalVars.StageFailedArray[GlobalVars.CurStageNum]); GA.API.Design.NewEvent("Stage" + GlobalVars.CurStageNum + ":FirstSucceed:PlayTime", GameLogic.Singleton.GetStagePlayTime()); } #if UNITY_ANDROID || UNITY_IPHONE if (CapsConfig.EnableTalkingData) { Dictionary <string, object> param = new Dictionary <string, object>(); if (GameLogic.Singleton.m_stepCountWhenReachTarget > 10) { param["StepLeft"] = ">10"; } else if (GameLogic.Singleton.m_stepCountWhenReachTarget > 5) { param["StepLeft"] = ">5"; } else { param["StepLeft"] = GameLogic.Singleton.m_stepCountWhenReachTarget.ToString(); } param["StarCount"] = m_starCount.ToString(); if (scorePercent > 5) { param["ScorePercent"] = ">5"; } else if (scorePercent > 3) { param["ScorePercent"] = ">3"; } else if (scorePercent > 2) { param["ScorePercent"] = ">2"; } else if (scorePercent > 1.5) { param["ScorePercent"] = ">1.5"; } else { param["ScorePercent"] = ">1"; } float playTime = GameLogic.Singleton.GetStagePlayTime(); if (playTime > 600) { param["PlayTime"] = ">10min"; } else if (playTime > 60) { param["PlayTime"] = ((int)(playTime / 60)).ToString() + "min"; } else { param["PlayTime"] = "<1min"; } int failedTimes = GlobalVars.StageFailedArray[GlobalVars.CurStageNum]; if (failedTimes > 20) { param["FailedTime"] = ">20"; } else if (failedTimes > 10) { param["PlayTime"] = ">10"; } else if (failedTimes > 5) { param["PlayTime"] = ">5"; } else { param["PlayTime"] = failedTimes.ToString(); } TalkingDataPlugin.TrackEventWithParameters("Stage" + GlobalVars.CurStageNum + ":FirstSucceed", "", param); } #endif } PlayerPrefs.SetInt("StageAvailableCount", GlobalVars.AvailabeStageCount); //保存进度 if (m_starCount > GlobalVars.StageStarArray[GlobalVars.CurStageNum - 1]) { GlobalVars.StageStarArray[GlobalVars.CurStageNum - 1] = m_starCount; //保存星数 PlayerPrefsExtend.SetIntArray("StageStars", GlobalVars.StageStarArray); //保存进度 } if (GameLogic.Singleton.GetProgress() > GlobalVars.StageScoreArray[GlobalVars.CurStageNum - 1]) //记录分数记录 { GlobalVars.StageScoreArray[GlobalVars.CurStageNum - 1] = GameLogic.Singleton.GetProgress(); PlayerPrefsExtend.SetIntArray("StageScores", GlobalVars.StageScoreArray); } UIWindowManager.Singleton.GetUIWindow <UIMap>().RefreshButtonStar(GlobalVars.CurStageNum); //刷新当前关卡的星星 UIWindowManager.Singleton.GetUIWindow <UIMap>().RefreshButton(GlobalVars.CurStageNum - 1); //刷新当前关卡的星星 } else { GlobalVars.StageFailedArray[GlobalVars.CurStageNum]++; PlayerPrefsExtend.SetIntArray("StageFailed", GlobalVars.StageFailedArray); } m_levelLabel.SetNumberRapid(GlobalVars.CurStageNum); }
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), "Apply Auth Code")) { TalkingDataEAuth.ApplyAuthCode("86", mobile, TalkingDataAuthCodeType.smsAuth, account, smsId); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "Reapply Auth Code")) { TalkingDataEAuth.ReapplyAuthCode("86", mobile, TalkingDataAuthCodeType.voiceCallAuth, account, smsId, request_id); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "Is Verify Account")) { TalkingDataEAuth.IsVerifyAccount(account); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "Is Mobile Match Account")) { TalkingDataEAuth.IsMobileMatchAccount(account, "86", mobile); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "Bind")) { TalkingDataEAuth.Bind("86", mobile, "001178", account); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "Unbind")) { TalkingDataEAuth.Unbind("86", mobile, account); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnRegister")) { TalkingDataPlugin.OnRegister("user01", TalkingDataAccountType.ANONYMOUS, "abc"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnLogin")) { TalkingDataPlugin.OnLogin("user01", TalkingDataAccountType.TYPE1, "abc"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnPlaceOrder")) { TalkingDataOrder order = TalkingDataOrder.CreateOrder("order01", 2466400, "CNY"); order.AddItem("A1660", "手机", "iPhone 7", 538800, 2); order.AddItem("MLH12CH", "电脑", "MacBook Pro", 1388800, 1); TalkingDataPlugin.OnPlaceOrder("user01", order); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnOrderPaySucc")) { TalkingDataOrder order = TalkingDataOrder.CreateOrder("order01", 2466400, "CNY"); order.AddItem("A1660", "手机", "iPhone 7", 538800, 2); order.AddItem("MLH12CH", "电脑", "MacBook Pro", 1388800, 1); TalkingDataPlugin.OnOrderPaySucc("user01", "AliPay", order); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnViewItem")) { TalkingDataPlugin.OnViewItem("A1660", "手机", "iPhone 7", 538800); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnAddItemToShoppingCart")) { TalkingDataPlugin.OnAddItemToShoppingCart("MLH12CH", "电脑", "MacBook Pro", 1388800, 1); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "OnViewShoppingCart")) { TalkingDataShoppingCart shoppingCart = TalkingDataShoppingCart.CreateShoppingCart(); if (shoppingCart != null) { shoppingCart.AddItem("A1660", "手机", "iPhone 7", 538800, 2); shoppingCart.AddItem("MLH12CH", "电脑", "MacBook Pro", 1388800, 1); TalkingDataPlugin.OnViewShoppingCart(shoppingCart); } } if (GUI.Button(new Rect(left, top + step * i++, width, height), "TrackPageBegin")) { TalkingDataPlugin.TrackPageBegin("page_name"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "TrackPageEnd")) { TalkingDataPlugin.TrackPageEnd("page_name"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "TrackEvent")) { TalkingDataPlugin.TrackEvent("action_id"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "TrackEventWithLabel")) { TalkingDataPlugin.TrackEventWithLabel("action_id", "action_label"); } if (GUI.Button(new Rect(left, top + step * i++, width, height), "TrackEventWithParameters")) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("StartApp" + "StartAppTime", "startAppMac" + "#" + "02/01/2013 09:52:24"); dic.Add("IntValue", 1); TalkingDataPlugin.TrackEventWithParameters("action_id", "action_label", dic); } }