public static SessionStarted ( string appKey, string channelId ) : void | ||
appKey | string | |
channelId | string | |
return | void |
public override void OnApplicationPause(bool bPause) { base.OnApplicationPause(bPause); if (bPause) { PlayerPrefs.SetFloat("PlayTime", GetPlayTime()); //暂停时保存游戏时间 #if UNITY_ANDROID || UNITY_IPHONE if (CapsConfig.EnableTalkingData) { TalkingDataPlugin.SessionStoped(); } #endif } else { m_playTime = PlayerPrefs.GetFloat("PlayTime"); //恢复时读取游戏时间 m_startAppTime = Time.realtimeSinceStartup; #if UNITY_ANDROID || UNITY_IPHONE if (CapsConfig.EnableTalkingData) { TalkingDataPlugin.SessionStarted("8F604653A8CC694E6954B51FE6D26127", "Test"); } #endif } }
private void Start() { string channelName = Singleton <NetworkManager> .Instance.channelConfig.ChannelName; TalkingDataPlugin.SetLogEnabled(true); TalkingDataPlugin.SetExceptionReportEnabled(true); TalkingDataPlugin.SessionStarted("A0F361D0ACD1B1846FCEE7327ADEF913", channelName); }
void Start() { Debug.Log("start...!!!!!!!!!!"); TalkingDataPlugin.SetLogEnabled(true); TalkingDataPlugin.SetExceptionReportEnabled(true); TalkingDataPlugin.SessionStarted("E7538D90715219B3A2272A3E07E69C57", "your_channel_id"); TalkingDataEAuth.SuccessDelegate successMethod = new TalkingDataEAuth.SuccessDelegate(this.OnEAuthSuccess); TalkingDataEAuth.FailedDelegate failedMethod = new TalkingDataEAuth.FailedDelegate(this.OnEAuthFailed); TalkingDataEAuth.Init("506610b4d5a142809cca181e32d70e21", "7c1573fbd1cc33d336f01838dc2d606e", successMethod, failedMethod); #if UNITY_IPHONE #if UNITY_5 || UNITY_5_6_OR_NEWER UnityEngine.iOS.NotificationServices.RegisterForNotifications( UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #else UnityEngine.iOS.NotificationServices.RegisterForNotifications( UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound); #endif #endif }
protected override void DoInit() { //根据平台开关数据分析 if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.WP8Player) { CapsConfig.EnableGA = true; CapsConfig.EnableTalkingData = true; Resources.Load("GA_SystemTracker"); } else { CapsConfig.EnableGA = false; CapsConfig.EnableTalkingData = false; } #if UNITY_ANDROID || UNITY_IPHONE if (CapsConfig.EnableTalkingData) { TalkingDataPlugin.SessionStarted("8F604653A8CC694E6954B51FE6D26127", "Test"); } #endif m_startAppTime = Time.realtimeSinceStartup; m_playTime = PlayerPrefs.GetFloat("PlayTime"); if (!PlayerPrefs.HasKey("Music")) //第一次运行 { PlayerPrefs.SetInt("Music", 1); PlayerPrefs.SetInt("SFX", 1); GlobalVars.UseMusic = true; GlobalVars.UseSFX = true; } else { GlobalVars.UseMusic = (PlayerPrefs.GetInt("Music") == 1); GlobalVars.UseSFX = (PlayerPrefs.GetInt("SFX") == 1); } Application.targetFrameRate = 60; // if (Application.platform == RuntimePlatform.WindowsPlayer) { Screen.SetResolution(480, 800, false); } new CapsConfig(); new ResourceManager(); UIDrawer.Singleton.AddPrefab(ResourceManager.Singleton.GetUIPrefabByName("BaseTextLabel")); UIDrawer.Singleton.fontDefaultPrefabID = UIDrawer.Singleton.AddPrefab(ResourceManager.Singleton.GetUIPrefabByName("OutlineTextLabel")); UIDrawer.Singleton.AddPrefab(ResourceManager.Singleton.GetUIPrefabByName("ShadowTextLabel")); UIDrawer.Singleton.spriteDefaultPrefabID = UIDrawer.Singleton.AddPrefab(ResourceManager.Singleton.GetUIPrefabByName("BaseSpriteCommonAtlas")); UIDrawer.Singleton.numDefaultPrefabID = UIDrawer.Singleton.AddPrefab(ResourceManager.Singleton.GetUIPrefabByName("BaseNumber")); TextTable.Singleton.AddTextMap(@"baseText"); TextTable.Singleton.AddTextMap(@"errorcode"); ChangeState((int)StateEnum.Login); GlobalVars.TotalStageCount = CapsConfig.Instance.TotalStageCount; if (CapsConfig.Instance.MoveTime > 0) { GameLogic.MOVE_TIME = CapsConfig.Instance.MoveTime; } if (CapsConfig.Instance.EatTime > 0) { GameLogic.EATBLOCK_TIME = CapsConfig.Instance.EatTime; } if (CapsConfig.Instance.DropAcc > 0) { GameLogic.DROP_ACC = CapsConfig.Instance.DropAcc; } if (CapsConfig.Instance.DropSpeed > 0) { GameLogic.DROP_SPEED = CapsConfig.Instance.DropSpeed; } if (CapsConfig.Instance.SlideSpeed > 0) { GameLogic.SLIDE_SPEED = CapsConfig.Instance.SlideSpeed; } GlobalVars.ReadHeart(); UIWindowManager.Singleton.CreateWindow <UILogin>(); Timer.AddDelayFunc(0.3f, delegate() { UIWindowManager.Singleton.GetUIWindow <UILogin>().ShowWindow(delegate() { GameObject obj = GameObject.Find("FirstTimeBackground"); //为了让第一次进游戏的图平滑变化没有闪烁,先在场景里垫了一张图,现在用完了,把图删除 GameObject.Destroy(obj); }); }); Localization.instance.currentLanguage = "Chinese"; //中文版 //初始化支付插件 if (Application.platform != RuntimePlatform.WindowsPlayer) { Unibiller.onBillerReady += OnUniBillInitialised; Unibiller.Initialise(); } if (Application.platform != RuntimePlatform.WP8Player) { //第一次运行时,5月份之前,送点金币 if (System.DateTime.Today.Year == 2014 && System.DateTime.Today.Month <= 5 && !PlayerPrefs.HasKey("GiveFirstTimeMoney3")) { PlayerPrefs.SetInt("GiveFirstTimeMoney3", 1); Unibiller.CreditBalance("gold", 3000); //给3000金币 } } }