备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f347e0b07c5d64926ac64031c3bba013
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ThinkingData.Analytics.TDException
|
||||
{
|
||||
public class TDExceptionHandler
|
||||
{
|
||||
|
||||
//Whether to exit the program when an exception occurs
|
||||
public static bool IsQuitWhenException = false;
|
||||
|
||||
//Whether the exception catch has been registered
|
||||
public static bool IsRegistered = false;
|
||||
private static TDAutoTrackEventHandler mEventCallback;
|
||||
private static Dictionary<string, object> mProperties;
|
||||
|
||||
|
||||
public static void SetAutoTrackProperties(Dictionary<string, object> properties)
|
||||
{
|
||||
if (!(mProperties is Dictionary<string, object>))
|
||||
{
|
||||
mProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
foreach (var item in properties)
|
||||
{
|
||||
if (!mProperties.ContainsKey(item.Key))
|
||||
{
|
||||
mProperties.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RegisterTAExceptionHandler(TDAutoTrackEventHandler eventCallback)
|
||||
{
|
||||
mEventCallback = eventCallback;
|
||||
//Register exception handling delegate
|
||||
try
|
||||
{
|
||||
if (!IsRegistered)
|
||||
{
|
||||
Application.logMessageReceived += _LogHandler;
|
||||
AppDomain.CurrentDomain.UnhandledException += _UncaughtExceptionHandler;
|
||||
IsRegistered = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void RegisterTAExceptionHandler(Dictionary<string, object> properties)
|
||||
{
|
||||
SetAutoTrackProperties(properties);
|
||||
//Register exception handling delegate
|
||||
try
|
||||
{
|
||||
if (!IsRegistered)
|
||||
{
|
||||
Application.logMessageReceived += _LogHandler;
|
||||
AppDomain.CurrentDomain.UnhandledException += _UncaughtExceptionHandler;
|
||||
IsRegistered = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnregisterTAExceptionHandler ()
|
||||
{
|
||||
//Clear exception handling delegate
|
||||
try
|
||||
{
|
||||
Application.logMessageReceived -= _LogHandler;
|
||||
System.AppDomain.CurrentDomain.UnhandledException -= _UncaughtExceptionHandler;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void _LogHandler( string logString, string stackTrace, LogType type )
|
||||
{
|
||||
if( type == LogType.Error || type == LogType.Exception || type == LogType.Assert )
|
||||
{
|
||||
//Report exception event
|
||||
string reasonStr = "exception_type: " + type.ToString() + " <br> " + "exception_message: " + logString + " <br> " + "stack_trace: " + stackTrace + " <br> " ;
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>(){
|
||||
{"#app_crashed_reason", reasonStr}
|
||||
};
|
||||
properties = MergeProperties(properties);
|
||||
TDAnalytics.Track("ta_app_crash", properties);
|
||||
|
||||
if ( IsQuitWhenException )
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void _UncaughtExceptionHandler (object sender, System.UnhandledExceptionEventArgs args)
|
||||
{
|
||||
if (args == null || args.ExceptionObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (args.ExceptionObject.GetType () != typeof(System.Exception))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.Exception e = (System.Exception)args.ExceptionObject;
|
||||
|
||||
//Report exception event
|
||||
string reasonStr = "exception_type: " + e.GetType().Name + " <br> " + "exception_message: " + e.Message + " <br> " + "stack_trace: " + e.StackTrace + " <br> " ;
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>(){
|
||||
{"#app_crashed_reason", reasonStr}
|
||||
};
|
||||
properties = MergeProperties(properties);
|
||||
TDAnalytics.Track("ta_app_crash", properties);
|
||||
|
||||
if ( IsQuitWhenException )
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> MergeProperties(Dictionary<string, object> properties)
|
||||
{
|
||||
|
||||
if (mEventCallback is TDAutoTrackEventHandler)
|
||||
{
|
||||
Dictionary<string, object> callbackProperties = mEventCallback.GetAutoTrackEventProperties((int)TDAutoTrackEventType.AppCrash, properties);
|
||||
foreach (var item in callbackProperties)
|
||||
{
|
||||
if (!properties.ContainsKey(item.Key))
|
||||
{
|
||||
properties.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mProperties is Dictionary<string, object>)
|
||||
{
|
||||
foreach (var item in mProperties)
|
||||
{
|
||||
if (!properties.ContainsKey(item.Key))
|
||||
{
|
||||
properties.Add(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76f285e49c9584fce99e9fe1536fea17
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e5d07cff2f9b45d6afa9ab9a879fbff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- TDAnalytics DisablePresetProperties start -->
|
||||
<!-- <string-array name="TDDisPresetProperties"> -->
|
||||
<!-- <item>#disk</item> -->
|
||||
<!-- <item>#fps</item> -->
|
||||
<!-- <item>#ram</item> -->
|
||||
<!-- <item>#app_version</item> -->
|
||||
<!-- <item>#os_version</item> -->
|
||||
<!-- <item>#manufacturer</item> -->
|
||||
<!-- <item>#device_model</item> -->
|
||||
<!-- <item>#screen_height</item> -->
|
||||
<!-- <item>#screen_width</item> -->
|
||||
<!-- <item>#carrier</item> -->
|
||||
<!-- <item>#device_id</item> -->
|
||||
<!-- <item>#system_language</item> -->
|
||||
<!-- <item>#lib</item> -->
|
||||
<!-- <item>#lib_version</item> -->
|
||||
<!-- <item>#os</item> -->
|
||||
<!-- <item>#bundle_id</item> -->
|
||||
<!-- <item>#install_time</item> -->
|
||||
<!-- <item>#start_reason</item> -->
|
||||
<!-- <item>#simulator</item> -->
|
||||
<!-- <item>#network_type</item> -->
|
||||
<!-- <item>#start_reason</item> -->
|
||||
<!-- <item>#resume_from_background</item> -->
|
||||
<!-- <item>#title</item> -->
|
||||
<!-- <item>#screen_name</item> -->
|
||||
<!-- <item>#url</item> -->
|
||||
<!-- <item>#referrer</item> -->
|
||||
<!-- <item>#element_type</item> -->
|
||||
<!-- <item>#element_id</item> -->
|
||||
<!-- <item>#element_position</item> -->
|
||||
<!-- <item>#element_content</item> -->
|
||||
<!-- <item>#element_selector</item> -->
|
||||
<!-- <item>#app_crashed_reason</item> -->
|
||||
<!-- </string-array> -->
|
||||
<!-- TDAnalytics DisablePresetProperties end -->
|
||||
|
||||
<!-- TDAnalytics disable C# Exception start -->
|
||||
<!-- <bool name="DisableCSharpException">true</bool> -->
|
||||
<!-- TDAnalytics disable C# Exception end -->
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b67db39cd532b4f08b95b2cf5938553f
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "ThinkingAnalytics",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:0a958a7eb80a248e1b8bc4553787c209"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff4bf6c59d1ac413a8f34ced5be76ecd
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7df5c5e5307f460e917e72bf75ec567
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3471622134282543401
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 57277738888238098}
|
||||
- component: {fileID: 1362306111410183020}
|
||||
m_Layer: 0
|
||||
m_Name: TDAnalytics
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &57277738888238098
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3471622134282543401}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1362306111410183020
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3471622134282543401}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d7df5c5e5307f460e917e72bf75ec567, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
startManually: 1
|
||||
enableLog: 1
|
||||
networkType: 1
|
||||
configs:
|
||||
- appId: 1b1c1fef65e3482bad5c9d0e6a823356
|
||||
serverUrl: https://receiver.ta.thinkingdata.cn
|
||||
mode: 0
|
||||
timeZone: 0
|
||||
timeZoneId:
|
||||
enableEncrypt: 0
|
||||
encryptVersion: 0
|
||||
encryptPublicKey:
|
||||
pinningMode: 0
|
||||
allowInvalidCertificates: 0
|
||||
validatesDomainName: 0
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 986ad473b78d14e08b1f05d368cb1591
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace ThinkingData.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Time Zone in SDK options
|
||||
/// </summary>
|
||||
public enum TDTimeZone
|
||||
{
|
||||
Local,
|
||||
UTC,
|
||||
Asia_Shanghai,
|
||||
Asia_Tokyo,
|
||||
America_Los_Angeles,
|
||||
America_New_York,
|
||||
Other = 100
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SDK running mode options
|
||||
/// </summary>
|
||||
public enum TDMode
|
||||
{
|
||||
Debug = 1,
|
||||
DebugOnly = 2,
|
||||
Normal = 0
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data post options
|
||||
/// </summary>
|
||||
public enum TDNetworkType
|
||||
{
|
||||
Wifi = 2,
|
||||
All = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Auto-tracking Events Type options
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum TDAutoTrackEventType
|
||||
{
|
||||
None = 0,
|
||||
AppStart = 1 << 0, // reporting when the app enters the foreground (ta_app_start)
|
||||
AppEnd = 1 << 1, // reporting when the app enters the background (ta_app_end)
|
||||
AppCrash = 1 << 4, // reporting when an uncaught exception occurs (ta_app_crash)
|
||||
AppInstall = 1 << 5, // reporting when the app is opened for the first time after installation (ta_app_install)
|
||||
AppSceneLoad = 1 << 6, // reporting when the scene is loaded in the app (ta_scene_loaded)
|
||||
AppSceneUnload = 1 << 7, // reporting when the scene is unloaded in the app (ta_scene_loaded)
|
||||
All = AppStart | AppEnd | AppInstall | AppCrash | AppSceneLoad | AppSceneUnload
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data Reporting Status
|
||||
/// </summary>
|
||||
public enum TDTrackStatus
|
||||
{
|
||||
Pause = 1, // pause data reporting
|
||||
Stop = 2, // stop data reporting, and clear caches
|
||||
SaveOnly = 3, // data stores in the cache, but not be reported
|
||||
Normal = 4 // resume data reporting
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d704b4acc93944242809914ff26be411
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ThinkingData.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Special event class for internal use, do not use this class directly.
|
||||
/// </summary>
|
||||
public abstract class TDEventModel
|
||||
{
|
||||
public enum TDEventType
|
||||
{
|
||||
First,
|
||||
Updatable,
|
||||
Overwritable
|
||||
}
|
||||
|
||||
public TDEventModel(string eventName)
|
||||
{
|
||||
EventName = eventName;
|
||||
}
|
||||
|
||||
public TDEventType? EventType { get; set; }
|
||||
public string EventName { get; }
|
||||
public Dictionary<string, object> Properties { get; set; }
|
||||
|
||||
private DateTime EventTime { get; set; }
|
||||
private TimeZoneInfo EventTimeZone { get; set; }
|
||||
protected string ExtraId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set date time and timezone for the event
|
||||
/// </summary>
|
||||
/// <param name="time">date time</param>
|
||||
/// <param name="timeZone">timezone</param>
|
||||
public void SetTime(DateTime time, TimeZoneInfo timeZone)
|
||||
{
|
||||
EventTime = time;
|
||||
EventTimeZone = timeZone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get date time for the event
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime GetEventTime()
|
||||
{
|
||||
return EventTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get timezone for the event
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public TimeZoneInfo GetEventTimeZone()
|
||||
{
|
||||
return EventTimeZone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get identify code for the event
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetEventId()
|
||||
{
|
||||
return ExtraId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// First Event Model
|
||||
/// </summary>
|
||||
public class TDFirstEventModel : TDEventModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct TDFirstEventModel instance
|
||||
/// </summary>
|
||||
/// <param name="eventName">name for the event</param>
|
||||
public TDFirstEventModel(string eventName) : base(eventName)
|
||||
{
|
||||
EventType = TDEventType.First;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct TDFirstEventModel instance
|
||||
/// </summary>
|
||||
/// <param name="eventName">name for the event</param>
|
||||
/// <param name="firstCheckId">check ID for the first event</param>
|
||||
public TDFirstEventModel(string eventName, string firstCheckId) : base(eventName)
|
||||
{
|
||||
EventType = TDEventType.First;
|
||||
ExtraId = firstCheckId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updatable Event Model
|
||||
/// </summary>
|
||||
public class TDUpdatableEventModel : TDEventModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct TDUpdatableEventModel instance
|
||||
/// </summary>
|
||||
/// <param name="eventName">name for the event</param>
|
||||
/// <param name="eventId">ID for the event</param>
|
||||
public TDUpdatableEventModel(string eventName, string eventId) : base(eventName)
|
||||
{
|
||||
EventType = TDEventType.Updatable;
|
||||
ExtraId = eventId;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overwritable Event Model
|
||||
/// </summary>
|
||||
public class TDOverwritableEventModel : TDEventModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct TDOverwritableEventModel instance
|
||||
/// </summary>
|
||||
/// <param name="eventName">name for the event</param>
|
||||
/// <param name="eventId">ID for the event</param>
|
||||
public TDOverwritableEventModel(string eventName, string eventId) : base(eventName)
|
||||
{
|
||||
EventType = TDEventType.Overwritable;
|
||||
ExtraId = eventId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e80e3a99b3f0414187c8b3e448b4d66
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ThinkingData.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Dynamic super properties interfaces.
|
||||
/// </summary>
|
||||
public interface TDDynamicSuperPropertiesHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Dynamically gets event properties
|
||||
/// </summary>
|
||||
/// <returns>event properties</returns>
|
||||
Dictionary<string, object> GetDynamicSuperProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Auto track event callback interfaces.
|
||||
/// </summary>
|
||||
public interface TDAutoTrackEventHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Get Auto track event properties
|
||||
/// </summary>
|
||||
/// <param name="type">auto track event type</param>
|
||||
/// <param name="properties">event properties</param>
|
||||
/// <returns>event properties</returns>
|
||||
Dictionary<string, object> GetAutoTrackEventProperties(int type, Dictionary<string, object> properties);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bba307e0084684dc08b109bd32fb415f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ThinkingData.Analytics
|
||||
{
|
||||
/// <summary>
|
||||
/// Preset Properties
|
||||
/// </summary>
|
||||
public class TDPresetProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Construct TDPresetProperties instance
|
||||
/// </summary>
|
||||
/// <param name="properties">preset properties</param>
|
||||
public TDPresetProperties(Dictionary<string, object> properties)
|
||||
{
|
||||
properties = TDEncodeDate(properties);
|
||||
mPresetProperties = properties;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns Preset Properties
|
||||
/// The key starts with "#", it is not recommended to use it directly as a user properties
|
||||
/// </summary>
|
||||
/// <returns>preset properties</returns>
|
||||
public Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
return mPresetProperties;
|
||||
}
|
||||
/// <summary>
|
||||
/// Application Version Number
|
||||
/// </summary>
|
||||
public string AppVersion
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#app_version") ? mPresetProperties["#app_version"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Application Bundle Identify
|
||||
/// </summary>
|
||||
public string BundleId
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#bundle_id") ? mPresetProperties["#bundle_id"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Network Carrier
|
||||
/// </summary>
|
||||
public string Carrier
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#carrier") ? mPresetProperties["#carrier"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Identify
|
||||
/// </summary>
|
||||
public string DeviceId
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#device_id") ? mPresetProperties["#device_id"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Model Name
|
||||
/// </summary>
|
||||
public string DeviceModel
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#device_model") ? mPresetProperties["#device_model"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Hardware Manufacturer
|
||||
/// </summary>
|
||||
public string Manufacturer
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#manufacturer") ? mPresetProperties["#manufacturer"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Network Type
|
||||
/// </summary>
|
||||
public string NetworkType
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#network_type") ? mPresetProperties["#network_type"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device System OS Name
|
||||
/// </summary>
|
||||
public string OS
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#os") ? mPresetProperties["#os"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device System OS Version Number
|
||||
/// </summary>
|
||||
public string OSVersion
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#os_version") ? mPresetProperties["#os_version"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Screen Height
|
||||
/// </summary>
|
||||
public double ScreenHeight
|
||||
{
|
||||
get { return Convert.ToDouble(mPresetProperties.ContainsKey("#screen_height") ? mPresetProperties["#screen_height"] : 0); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Screen Width
|
||||
/// </summary>
|
||||
public double ScreenWidth
|
||||
{
|
||||
get { return Convert.ToDouble(mPresetProperties.ContainsKey("#screen_width") ? mPresetProperties["#screen_width"] : 0); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device System Language Code
|
||||
/// </summary>
|
||||
public string SystemLanguage
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#system_language") ? mPresetProperties["#system_language"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Time Zone Offset With UTC
|
||||
/// </summary>
|
||||
public double ZoneOffset
|
||||
{
|
||||
get { return Convert.ToDouble(mPresetProperties.ContainsKey("#zone_offset") ? mPresetProperties["#zone_offset"] : 0); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Application Install Time
|
||||
/// </summary>
|
||||
public string InstallTime
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#install_time") ? mPresetProperties["#install_time"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Disk Size
|
||||
/// </summary>
|
||||
public string Disk
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#disk") ? mPresetProperties["#disk"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device Ram Size
|
||||
/// </summary>
|
||||
public string Ram
|
||||
{
|
||||
get { return (string)(mPresetProperties.ContainsKey("#ram") ? mPresetProperties["#ram"] : ""); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device FPS
|
||||
/// </summary>
|
||||
public double Fps
|
||||
{
|
||||
get { return Convert.ToDouble(mPresetProperties.ContainsKey("#fps") ? mPresetProperties["#fps"] : 0); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Device is an Simulator
|
||||
/// </summary>
|
||||
public bool Simulator
|
||||
{
|
||||
get { return (bool)(mPresetProperties.ContainsKey("#simulator") ? mPresetProperties["#simulator"] : false); }
|
||||
}
|
||||
|
||||
private Dictionary<string, object> mPresetProperties { get; set; }
|
||||
private Dictionary<string, object> TDEncodeDate(Dictionary<string, object> properties)
|
||||
{
|
||||
Dictionary<string, object> mProperties = new Dictionary<string, object>();
|
||||
foreach (KeyValuePair<string, object> kv in properties)
|
||||
{
|
||||
if (kv.Value is DateTime)
|
||||
{
|
||||
DateTime dateTime = (DateTime)kv.Value;
|
||||
mProperties.Add(kv.Key, dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
else
|
||||
{
|
||||
mProperties.Add(kv.Key, kv.Value);
|
||||
}
|
||||
}
|
||||
return mProperties;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23d7545160a0c4e67be49833c78690e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3281a13f4ff754b019604465fadd63ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efe5e95f8073844fcbaedf8453895210
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
namespace ThinkingData.Analytics.Utils
|
||||
{
|
||||
public class TDCommonUtils
|
||||
{
|
||||
public static string FormatDate(DateTime dateTime, TimeZoneInfo timeZone)
|
||||
{
|
||||
bool success = true;
|
||||
DateTime univDateTime = dateTime.ToUniversalTime();
|
||||
TimeSpan timeSpan = new TimeSpan();
|
||||
try
|
||||
{
|
||||
timeSpan = timeZone.BaseUtcOffset;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
success = false;
|
||||
//if (ThinkingSDKPublicConfig.IsPrintLog()) ThinkingSDKLogger.Print("FormatDate - TimeSpan get failed : " + e.Message);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (timeZone.IsDaylightSavingTime(dateTime))
|
||||
{
|
||||
TimeSpan timeSpan1 = TimeSpan.FromHours(1);
|
||||
timeSpan = timeSpan.Add(timeSpan1);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
success = false;
|
||||
//if (ThinkingSDKPublicConfig.IsPrintLog()) ThinkingSDKLogger.Print("FormatDate: IsDaylightSavingTime get failed : " + e.Message);
|
||||
}
|
||||
if (success == false)
|
||||
{
|
||||
timeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
|
||||
}
|
||||
try
|
||||
{
|
||||
DateTime dateNew = univDateTime + timeSpan;
|
||||
return dateNew.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return univDateTime.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public static string FormatDate(DateTime dateTime, TDTimeZone timeZone) {
|
||||
DateTime univDateTime = dateTime.ToUniversalTime();
|
||||
TimeSpan span;
|
||||
switch (timeZone)
|
||||
{
|
||||
case TDTimeZone.Local:
|
||||
span = TimeZoneInfo.Local.BaseUtcOffset;
|
||||
break;
|
||||
case TDTimeZone.UTC:
|
||||
span = TimeSpan.Zero;
|
||||
break;
|
||||
case TDTimeZone.Asia_Shanghai:
|
||||
span = TimeSpan.FromHours(8);
|
||||
break;
|
||||
case TDTimeZone.Asia_Tokyo:
|
||||
span = TimeSpan.FromHours(9);
|
||||
break;
|
||||
case TDTimeZone.America_Los_Angeles:
|
||||
span = TimeSpan.FromHours(-7);
|
||||
break;
|
||||
case TDTimeZone.America_New_York:
|
||||
span = TimeSpan.FromHours(-4);
|
||||
break;
|
||||
default:
|
||||
span = TimeSpan.Zero;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
DateTime dateNew = univDateTime + span;
|
||||
return dateNew.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception) {
|
||||
}
|
||||
return univDateTime.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56ef1531e6e06454aa9a6700b418632d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace ThinkingData.Analytics.Utils
|
||||
{
|
||||
public class TDLog
|
||||
{
|
||||
private static bool enableLog;
|
||||
public static void EnableLog(bool enabled)
|
||||
{
|
||||
enableLog = enabled;
|
||||
}
|
||||
|
||||
public static bool GetEnable()
|
||||
{
|
||||
return enableLog;
|
||||
}
|
||||
|
||||
|
||||
public static void i(string message)
|
||||
{
|
||||
if (enableLog)
|
||||
{
|
||||
Debug.Log("[ThinkingData] Info: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(string message)
|
||||
{
|
||||
if (enableLog)
|
||||
{
|
||||
Debug.Log("[ThinkingData] Debug: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void e(string message)
|
||||
{
|
||||
if (enableLog)
|
||||
{
|
||||
Debug.LogError("[ThinkingData] Error: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void w(string message)
|
||||
{
|
||||
if (enableLog)
|
||||
{
|
||||
Debug.LogWarning("[ThinkingData] Warning: " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b49f9a69526c4417963783322d7e904
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,610 @@
|
||||
/*
|
||||
* MIT License. Forked from GA_MiniJSON.
|
||||
* I modified it so that it could be used for TD limitations.
|
||||
*/
|
||||
// using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ThinkingData.Analytics.Utils
|
||||
{
|
||||
/* Based on the JSON parser from
|
||||
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
|
||||
*
|
||||
* I simplified it so that it doesn't throw exceptions
|
||||
* and can be used in Unity iPhone with maximum code stripping.
|
||||
*/
|
||||
/// <summary>
|
||||
/// This class encodes and decodes JSON strings.
|
||||
/// Spec. details, see http://www.json.org/
|
||||
///
|
||||
/// JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable.
|
||||
/// All numbers are parsed to floats.
|
||||
/// </summary>
|
||||
public class TDMiniJson
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses the string json into a value
|
||||
/// </summary>
|
||||
/// <param name="json">A JSON string.</param>
|
||||
/// <returns>An List<object>, a Dictionary<string, object>, a double, an integer, a string, null, true, or false</returns>
|
||||
public static Dictionary<string, object> Deserialize(string json)
|
||||
{
|
||||
// save the string for debug information
|
||||
if (json == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Parser.Parse(json);
|
||||
}
|
||||
|
||||
sealed class Parser : IDisposable
|
||||
{
|
||||
const string WORD_BREAK = "{}[],:\"";
|
||||
|
||||
public static bool IsWordBreak(char c)
|
||||
{
|
||||
return Char.IsWhiteSpace(c) || WORD_BREAK.IndexOf(c) != -1;
|
||||
}
|
||||
|
||||
enum TOKEN
|
||||
{
|
||||
NONE,
|
||||
CURLY_OPEN,
|
||||
CURLY_CLOSE,
|
||||
SQUARED_OPEN,
|
||||
SQUARED_CLOSE,
|
||||
COLON,
|
||||
COMMA,
|
||||
STRING,
|
||||
NUMBER,
|
||||
TRUE,
|
||||
FALSE,
|
||||
NULL
|
||||
};
|
||||
|
||||
StringReader json;
|
||||
|
||||
Parser(string jsonString)
|
||||
{
|
||||
json = new StringReader(jsonString);
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> Parse(string jsonString)
|
||||
{
|
||||
using (var instance = new Parser(jsonString))
|
||||
{
|
||||
return instance.ParseObject();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
json.Dispose();
|
||||
json = null;
|
||||
}
|
||||
|
||||
Dictionary<string, object> ParseObject()
|
||||
{
|
||||
Dictionary<string, object> table = new Dictionary<string, object>();
|
||||
|
||||
// ditch opening brace
|
||||
json.Read();
|
||||
|
||||
// {
|
||||
while (true)
|
||||
{
|
||||
switch (NextToken)
|
||||
{
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.CURLY_CLOSE:
|
||||
return table;
|
||||
default:
|
||||
// name
|
||||
string name = ParseString();
|
||||
if (name == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// :
|
||||
if (NextToken != TOKEN.COLON)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// ditch the colon
|
||||
json.Read();
|
||||
|
||||
// value
|
||||
table[name] = ParseValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<object> ParseArray()
|
||||
{
|
||||
List<object> array = new List<object>();
|
||||
|
||||
// ditch opening bracket
|
||||
json.Read();
|
||||
|
||||
// [
|
||||
var parsing = true;
|
||||
while (parsing)
|
||||
{
|
||||
TOKEN nextToken = NextToken;
|
||||
|
||||
switch (nextToken)
|
||||
{
|
||||
case TOKEN.NONE:
|
||||
return null;
|
||||
case TOKEN.COMMA:
|
||||
continue;
|
||||
case TOKEN.SQUARED_CLOSE:
|
||||
parsing = false;
|
||||
break;
|
||||
default:
|
||||
object value = ParseByToken(nextToken);
|
||||
|
||||
array.Add(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
object ParseValue()
|
||||
{
|
||||
TOKEN nextToken = NextToken;
|
||||
return ParseByToken(nextToken);
|
||||
}
|
||||
|
||||
object ParseByToken(TOKEN token)
|
||||
{
|
||||
switch (token)
|
||||
{
|
||||
case TOKEN.STRING:
|
||||
string str = ParseString();
|
||||
DateTime dateTime;
|
||||
if (DateTime.TryParseExact(str, "yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
return str;
|
||||
case TOKEN.NUMBER:
|
||||
return ParseNumber();
|
||||
case TOKEN.CURLY_OPEN:
|
||||
return ParseObject();
|
||||
case TOKEN.SQUARED_OPEN:
|
||||
return ParseArray();
|
||||
case TOKEN.TRUE:
|
||||
return true;
|
||||
case TOKEN.FALSE:
|
||||
return false;
|
||||
case TOKEN.NULL:
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
string ParseString()
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
char c;
|
||||
|
||||
// ditch opening quote
|
||||
json.Read();
|
||||
|
||||
bool parsing = true;
|
||||
while (parsing)
|
||||
{
|
||||
|
||||
if (json.Peek() == -1)
|
||||
{
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
parsing = false;
|
||||
break;
|
||||
case '\\':
|
||||
if (json.Peek() == -1)
|
||||
{
|
||||
parsing = false;
|
||||
break;
|
||||
}
|
||||
|
||||
c = NextChar;
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
s.Append(c);
|
||||
break;
|
||||
case 'b':
|
||||
s.Append('\b');
|
||||
break;
|
||||
case 'f':
|
||||
s.Append('\f');
|
||||
break;
|
||||
case 'n':
|
||||
s.Append('\n');
|
||||
break;
|
||||
case 'r':
|
||||
s.Append('\r');
|
||||
break;
|
||||
case 't':
|
||||
s.Append('\t');
|
||||
break;
|
||||
case 'u':
|
||||
var hex = new char[4];
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
hex[i] = NextChar;
|
||||
}
|
||||
|
||||
s.Append((char)Convert.ToInt32(new string(hex), 16));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s.Append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
object ParseNumber()
|
||||
{
|
||||
string number = NextWord;
|
||||
|
||||
if (number.IndexOf('.') == -1 && number.IndexOf('E') == -1 && number.IndexOf('e') == -1)
|
||||
{
|
||||
long parsedInt;
|
||||
Int64.TryParse(number, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out parsedInt);
|
||||
return parsedInt;
|
||||
}
|
||||
|
||||
double parsedDouble;
|
||||
if (!Double.TryParse(number, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out parsedDouble))
|
||||
{
|
||||
Double.TryParse(number, System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.CreateSpecificCulture("es-ES"), out parsedDouble);
|
||||
}
|
||||
return parsedDouble;
|
||||
}
|
||||
|
||||
void EatWhitespace()
|
||||
{
|
||||
while (Char.IsWhiteSpace(PeekChar))
|
||||
{
|
||||
json.Read();
|
||||
|
||||
if (json.Peek() == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char PeekChar
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToChar(json.Peek());
|
||||
}
|
||||
}
|
||||
|
||||
char NextChar
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToChar(json.Read());
|
||||
}
|
||||
}
|
||||
|
||||
string NextWord
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder word = new StringBuilder();
|
||||
|
||||
while (!IsWordBreak(PeekChar))
|
||||
{
|
||||
word.Append(NextChar);
|
||||
|
||||
if (json.Peek() == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return word.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
TOKEN NextToken
|
||||
{
|
||||
get
|
||||
{
|
||||
EatWhitespace();
|
||||
|
||||
if (json.Peek() == -1)
|
||||
{
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
|
||||
switch (PeekChar)
|
||||
{
|
||||
case '{':
|
||||
return TOKEN.CURLY_OPEN;
|
||||
case '}':
|
||||
json.Read();
|
||||
return TOKEN.CURLY_CLOSE;
|
||||
case '[':
|
||||
return TOKEN.SQUARED_OPEN;
|
||||
case ']':
|
||||
json.Read();
|
||||
return TOKEN.SQUARED_CLOSE;
|
||||
case ',':
|
||||
json.Read();
|
||||
return TOKEN.COMMA;
|
||||
case '"':
|
||||
return TOKEN.STRING;
|
||||
case ':':
|
||||
return TOKEN.COLON;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
return TOKEN.NUMBER;
|
||||
}
|
||||
|
||||
switch (NextWord)
|
||||
{
|
||||
case "false":
|
||||
return TOKEN.FALSE;
|
||||
case "true":
|
||||
return TOKEN.TRUE;
|
||||
case "null":
|
||||
return TOKEN.NULL;
|
||||
}
|
||||
|
||||
return TOKEN.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
|
||||
/// </summary>
|
||||
/// <param name="json">A Dictionary<string, object> / List<object></param>
|
||||
/// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
|
||||
public static string Serialize(object obj, Func<DateTime, string> func = null)
|
||||
{
|
||||
return Serializer.Serialize(obj, func);
|
||||
}
|
||||
|
||||
sealed class Serializer
|
||||
{
|
||||
StringBuilder builder;
|
||||
Func<DateTime, string> func;
|
||||
|
||||
Serializer()
|
||||
{
|
||||
builder = new StringBuilder();
|
||||
}
|
||||
|
||||
public static string Serialize(object obj, Func<DateTime, string> func)
|
||||
{
|
||||
var instance = new Serializer();
|
||||
instance.func = func;
|
||||
|
||||
instance.SerializeValue(obj);
|
||||
|
||||
return instance.builder.ToString();
|
||||
}
|
||||
|
||||
void SerializeValue(object value)
|
||||
{
|
||||
IList asList;
|
||||
IDictionary asDict;
|
||||
string asStr;
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
builder.Append("null");
|
||||
}
|
||||
else if ((asStr = value as string) != null)
|
||||
{
|
||||
SerializeString(asStr);
|
||||
}
|
||||
else if (value is bool)
|
||||
{
|
||||
builder.Append((bool)value ? "true" : "false");
|
||||
}
|
||||
else if ((asList = value as IList) != null)
|
||||
{
|
||||
SerializeArray(asList);
|
||||
}
|
||||
else if ((asDict = value as IDictionary) != null)
|
||||
{
|
||||
SerializeObject(asDict);
|
||||
}
|
||||
else if (value is char)
|
||||
{
|
||||
SerializeString(new string((char)value, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializeOther(value);
|
||||
}
|
||||
}
|
||||
|
||||
void SerializeObject(IDictionary obj)
|
||||
{
|
||||
bool first = true;
|
||||
|
||||
builder.Append('{');
|
||||
|
||||
foreach (object e in obj.Keys)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeString(e.ToString());
|
||||
builder.Append(':');
|
||||
|
||||
SerializeValue(obj[e]);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append('}');
|
||||
}
|
||||
|
||||
void SerializeArray(IList anArray)
|
||||
{
|
||||
builder.Append('[');
|
||||
|
||||
bool first = true;
|
||||
|
||||
foreach (object obj in anArray)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
builder.Append(',');
|
||||
}
|
||||
|
||||
SerializeValue(obj);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.Append(']');
|
||||
}
|
||||
|
||||
void SerializeString(string str)
|
||||
{
|
||||
builder.Append('\"');
|
||||
|
||||
char[] charArray = str.ToCharArray();
|
||||
foreach (var c in charArray)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '"':
|
||||
builder.Append("\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
builder.Append("\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
builder.Append("\\b");
|
||||
break;
|
||||
case '\f':
|
||||
builder.Append("\\f");
|
||||
break;
|
||||
case '\n':
|
||||
builder.Append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.Append("\\r");
|
||||
break;
|
||||
case '\t':
|
||||
builder.Append("\\t");
|
||||
break;
|
||||
default:
|
||||
int codepoint = Convert.ToInt32(c);
|
||||
if ((codepoint >= 32) && (codepoint <= 126))
|
||||
{
|
||||
builder.Append(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append("\\u");
|
||||
builder.Append(codepoint.ToString("x4"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
builder.Append('\"');
|
||||
}
|
||||
|
||||
void SerializeOther(object value)
|
||||
{
|
||||
// NOTE: decimals lose precision during serialization.
|
||||
// They always have, I'm just letting you know.
|
||||
// Previously floats and doubles lost precision too.
|
||||
if (value is float)
|
||||
{
|
||||
builder.Append(((float)value).ToString("R", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (value is int
|
||||
|| value is uint
|
||||
|| value is long
|
||||
|| value is sbyte
|
||||
|| value is byte
|
||||
|| value is short
|
||||
|| value is ushort
|
||||
|| value is ulong)
|
||||
{
|
||||
builder.Append(value);
|
||||
}
|
||||
else if (value is double)
|
||||
{
|
||||
builder.Append(Convert.ToDouble(value).ToString("R", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (value is decimal) {
|
||||
builder.Append(Convert.ToDecimal(value).ToString("G", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (value is DateTime)
|
||||
{
|
||||
builder.Append('\"');
|
||||
DateTime dateTime = (DateTime)value;
|
||||
if (null != func)
|
||||
{
|
||||
builder.Append(func((DateTime)value));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append(dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture));
|
||||
}
|
||||
builder.Append('\"');
|
||||
}
|
||||
else
|
||||
{
|
||||
SerializeString(value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03cd5f56606ff4dd694406f5594f0cf2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ThinkingData.Analytics.Utils
|
||||
{
|
||||
public class TDPropertiesChecker
|
||||
{
|
||||
private static readonly Regex keyPattern = new Regex(@"^[a-zA-Z][a-zA-Z\d_#]{0,49}$");
|
||||
private static readonly List<string> propertyNameWhitelist = new List<string>() { "#scene_name", "#scene_path", "#app_crashed_reason" };
|
||||
|
||||
public static bool IsNumeric(object obj)
|
||||
{
|
||||
return obj is sbyte
|
||||
|| obj is byte
|
||||
|| obj is short
|
||||
|| obj is ushort
|
||||
|| obj is int
|
||||
|| obj is uint
|
||||
|| obj is long
|
||||
|| obj is ulong
|
||||
|| obj is double
|
||||
|| obj is decimal
|
||||
|| obj is float;
|
||||
}
|
||||
public static bool IsString(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
return obj is string;
|
||||
}
|
||||
public static bool IsDictionary(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
return (obj.GetType().IsGenericType && obj.GetType().GetGenericTypeDefinition() == typeof(Dictionary<,>));
|
||||
}
|
||||
public static bool IsList(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
return (obj.GetType().IsGenericType && obj.GetType().GetGenericTypeDefinition() == typeof(List<>)) || obj is Array;
|
||||
}
|
||||
public static bool CheckProperties<V>(Dictionary<string, V> properties)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool ret = true;
|
||||
foreach(KeyValuePair<string, V> kv in properties)
|
||||
{
|
||||
if (!CheckString(kv.Key))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
if (!(kv.Value is string || kv.Value is DateTime || kv.Value is bool || IsNumeric(kv.Value) || IsList(kv.Value) || IsDictionary(kv.Value)))
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect property - property values must be one of: String, Numberic, Boolean, DateTime, Array, Row");
|
||||
ret = false;
|
||||
}
|
||||
if (IsString(kv.Value) && !CheckProperties(kv.Value as string))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
if (IsNumeric(kv.Value)) {
|
||||
double number = Convert.ToDouble(kv.Value);
|
||||
if (!CheckProperties(number))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
if (IsList(kv.Value) && !CheckProperties(kv.Value as List<object>)) {
|
||||
ret = false;
|
||||
}
|
||||
if (IsDictionary(kv.Value) && !CheckProperties(kv.Value as Dictionary<string, object>))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public static bool CheckProperties(List<object> properties)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool ret = true;
|
||||
foreach (object value in properties)
|
||||
{
|
||||
if (!(value is string || value is DateTime || value is bool || IsNumeric(value) || IsDictionary(value)))
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect property - property values in list must be one of: String, Numberic, Boolean, DateTime, Row");
|
||||
ret = false;
|
||||
}
|
||||
if (IsString(value) && !CheckProperties(value as string))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
if (IsNumeric(value)) {
|
||||
double number = Convert.ToDouble(value);
|
||||
if (!CheckProperties(number))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
if (IsDictionary(value) && !CheckProperties(value as Dictionary<string, object>))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public static bool CheckProperties(List<string> properties)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
foreach(string value in properties)
|
||||
{
|
||||
if (!CheckProperties(value))
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public static bool CheckProperties(string properties)
|
||||
{
|
||||
if (properties is string && System.Text.Encoding.UTF8.GetBytes(Convert.ToString(properties)).Length > 2048) {
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect properties - the string is too long: " + (string)(object)properties);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static bool CheckProperties(double properties)
|
||||
{
|
||||
if (properties > 9999999999999.999 || properties < -9999999999999.999)
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect properties - number value is invalid: " + properties + ", the data range is -9E15 to 9E15, with a maximum of 3 decimal places");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public static bool CheckString(string eventName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(eventName))
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect event name - the string is null");
|
||||
return false;
|
||||
}
|
||||
if (keyPattern.IsMatch(eventName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (propertyNameWhitelist.Contains(eventName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(TDLog.GetEnable()) TDLog.w("Incorrect event name - the string is invalid for TDAnalytics: " + eventName + ", event name and properties name rules: must be character string type, starting with a character and containing figures, characters, and an underline \"_\", with a maximum length of 50 characters");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static void MergeProperties(Dictionary<string, object> source, Dictionary<string, object> dest)
|
||||
{
|
||||
if (null == source) return;
|
||||
foreach (KeyValuePair<string, object> kv in source)
|
||||
{
|
||||
if (dest.ContainsKey(kv.Key))
|
||||
{
|
||||
dest[kv.Key] = kv.Value;
|
||||
} else
|
||||
{
|
||||
dest.Add(kv.Key, kv.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d887a818e74eb4316a839030f930036b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ThinkingData.Analytics.Utils
|
||||
{
|
||||
// Crosss Platform
|
||||
public enum TDThirdPartyType
|
||||
{
|
||||
NONE = 0,
|
||||
APPSFLYER = 1 << 0, // AppsFlyer
|
||||
IRONSOURCE = 1 << 1, // IronSource
|
||||
ADJUST = 1 << 2, // Adjust
|
||||
BRANCH = 1 << 3, // Branch
|
||||
TOPON = 1 << 4, // TopOn
|
||||
TRACKING = 1 << 5, // ReYun
|
||||
TRADPLUS = 1 << 6, // TradPlus
|
||||
};
|
||||
|
||||
// SSL
|
||||
public enum TDSSLPinningMode
|
||||
{
|
||||
NONE = 0, // Only allow certificates trusted by the system
|
||||
PUBLIC_KEY = 1 << 0, // Verify public key
|
||||
CERTIFICATE = 1 << 1 // Verify all contents
|
||||
}
|
||||
|
||||
public class TDPublicConfig
|
||||
{
|
||||
public static bool DisableCSharpException = false;
|
||||
public static List<string> DisPresetProperties = new List<string>();
|
||||
|
||||
public static readonly string LIB_VERSION = "3.0.7";
|
||||
|
||||
public static void GetPublicConfig()
|
||||
{
|
||||
TextAsset textAsset = Resources.Load<TextAsset>("ta_public_config");
|
||||
if (textAsset != null && !string.IsNullOrEmpty(textAsset.text))
|
||||
{
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.LoadXml(textAsset.text);
|
||||
XmlNode root = xmlDoc.SelectSingleNode("resources");
|
||||
for (int i=0; i<root.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlNode x1 = root.ChildNodes[i];
|
||||
if (x1.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
XmlElement e1 = x1 as XmlElement;
|
||||
if (e1.HasAttributes)
|
||||
{
|
||||
string name = e1.GetAttribute("name");
|
||||
if (name == "TDDisPresetProperties" && e1.HasChildNodes)
|
||||
{
|
||||
for (int j=0; j<e1.ChildNodes.Count; j++)
|
||||
{
|
||||
XmlNode x2 = e1.ChildNodes[j];
|
||||
if (x2.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
DisPresetProperties.Add(x2.InnerText);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name == "DisableCSharpException")
|
||||
{
|
||||
DisableCSharpException = Convert.ToBoolean(e1.InnerText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31781ef5586fb47b68b6d0dbb4bc79a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57bb4a9644e4f47f48024ccf8af3de0c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,941 @@
|
||||
#if UNITY_ANDROID && !(UNITY_EDITOR) && !TE_DISABLE_ANDROID_JAVA
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ThinkingData.Analytics.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ThinkingData.Analytics.Wrapper
|
||||
{
|
||||
public partial class TDWrapper
|
||||
{
|
||||
private static readonly string JSON_CLASS = "org.json.JSONObject";
|
||||
private static readonly AndroidJavaClass sdkClass = new AndroidJavaClass("cn.thinkingdata.analytics.ThinkingAnalyticsSDK");
|
||||
//private static readonly AndroidJavaClass configClass = new AndroidJavaClass("cn.thinkingdata.android.TDConfig");
|
||||
|
||||
private static readonly AndroidJavaObject unityAPIInstance = new AndroidJavaObject("cn.thinkingdata.engine.ThinkingAnalyticsUnityAPI");
|
||||
|
||||
private static Dictionary<string, AndroidJavaObject> light_instances = null;
|
||||
private static TimeZoneInfo defaultTimeZone = null;
|
||||
private static TDTimeZone defaultTDTimeZone = TDTimeZone.Local;
|
||||
|
||||
/// <summary>
|
||||
/// Convert Dictionary object to JSONObject in Java.
|
||||
/// </summary>
|
||||
/// <returns>The JSONObject instance.</returns>
|
||||
/// <param name="data">The Dictionary containing some data </param>
|
||||
private static AndroidJavaObject getJSONObject(Dictionary<string, object> data)
|
||||
{
|
||||
if (data == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string dataString = serilize(data);
|
||||
|
||||
try
|
||||
{
|
||||
return new AndroidJavaObject(JSON_CLASS, dataString);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string getTimeString(DateTime dateTime) {
|
||||
//long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
//DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
//long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
|
||||
//AndroidJavaObject date = new AndroidJavaObject("java.util.Date", currentMillis);
|
||||
|
||||
//return getInstance(default_appId).Call<string>("getTimeString", date);
|
||||
if (defaultTimeZone == null)
|
||||
{
|
||||
return TDCommonUtils.FormatDate(dateTime, defaultTDTimeZone);
|
||||
}
|
||||
else {
|
||||
return TDCommonUtils.FormatDate(dateTime, defaultTimeZone);
|
||||
}
|
||||
}
|
||||
|
||||
private static AndroidJavaObject getInstance(string appId) {
|
||||
using (AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"))
|
||||
{
|
||||
AndroidJavaObject currentInstance;
|
||||
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
appId = default_appId;
|
||||
}
|
||||
|
||||
if (light_instances != null && light_instances.ContainsKey(appId))
|
||||
{
|
||||
currentInstance = light_instances[appId];
|
||||
}
|
||||
else
|
||||
{
|
||||
currentInstance = sdkClass.CallStatic<AndroidJavaObject>("sharedInstance", context, appId);
|
||||
}
|
||||
|
||||
if (currentInstance == null)
|
||||
{
|
||||
currentInstance = sdkClass.CallStatic<AndroidJavaObject>("sharedInstance", context, default_appId);
|
||||
}
|
||||
|
||||
return currentInstance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void enableLog(bool enable) {
|
||||
sdkClass.CallStatic("enableTrackLog", enable);
|
||||
}
|
||||
private static void setVersionInfo(string libName, string version) {
|
||||
sdkClass.CallStatic("setCustomerLibInfo", libName, version);
|
||||
}
|
||||
|
||||
private static void init(TDConfig token)
|
||||
{
|
||||
AndroidJavaObject context = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
|
||||
// AndroidJavaObject config = null;
|
||||
// if (!string.IsNullOrEmpty(token.GetInstanceName()))
|
||||
// {
|
||||
// config = configClass.CallStatic<AndroidJavaObject>("getInstance", context, token.appid, token.serverUrl, token.GetInstanceName());
|
||||
// if (string.IsNullOrEmpty(default_appId)) default_appId = token.GetInstanceName();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// config = configClass.CallStatic<AndroidJavaObject>("getInstance", context, token.appid, token.serverUrl);
|
||||
// if (string.IsNullOrEmpty(default_appId)) default_appId = token.appid;
|
||||
// }
|
||||
// config.Call("setModeInt", (int) token.mode);
|
||||
|
||||
// string timeZoneId = token.getTimeZoneId();
|
||||
// if (null != timeZoneId && timeZoneId.Length > 0)
|
||||
// {
|
||||
// AndroidJavaObject timeZone = new AndroidJavaClass("java.util.TimeZone").CallStatic<AndroidJavaObject>("getTimeZone", timeZoneId);
|
||||
// if (null != timeZone)
|
||||
// {
|
||||
// config.Call("setDefaultTimeZone", timeZone);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (token.enableEncrypt == true)
|
||||
// {
|
||||
// config.Call("enableEncrypt", true);
|
||||
// AndroidJavaObject secreteKey = new AndroidJavaObject("cn.thinkingdata.android.encrypt.TDSecreteKey", token.encryptPublicKey, token.encryptVersion, "AES", "RSA");
|
||||
// config.Call("setSecretKey", secreteKey);
|
||||
// }
|
||||
|
||||
// sdkClass.CallStatic<AndroidJavaObject>("sharedInstance", config);
|
||||
|
||||
if (string.IsNullOrEmpty(default_appId)) default_appId = token.appId;
|
||||
Dictionary<string, object> configDic = new Dictionary<string, object>();
|
||||
configDic["appId"] = token.appId;
|
||||
configDic["serverUrl"] = token.serverUrl;
|
||||
configDic["mode"] = (int) token.mode;
|
||||
if (!string.IsNullOrEmpty(token.name))
|
||||
{
|
||||
// if (string.IsNullOrEmpty(default_appId)) default_appId = token.GetInstanceName();
|
||||
configDic["instanceName"] = token.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (string.IsNullOrEmpty(default_appId)) default_appId = token.appid;
|
||||
}
|
||||
string timeZoneId = token.getTimeZoneId();
|
||||
defaultTDTimeZone = token.timeZone;
|
||||
if (null != timeZoneId && timeZoneId.Length > 0)
|
||||
{
|
||||
configDic["timeZone"] = timeZoneId;
|
||||
if (defaultTimeZone == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
defaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (defaultTimeZone == null) {
|
||||
defaultTimeZone = TimeZoneInfo.Local;
|
||||
}
|
||||
}
|
||||
if (token.enableEncrypt == true)
|
||||
{
|
||||
configDic["enableEncrypt"] = true;
|
||||
configDic["secretKey"] = new Dictionary<string, object>() {
|
||||
{"publicKey", token.encryptPublicKey},
|
||||
{"version", token.encryptVersion},
|
||||
{"symmetricEncryption", "AES"},
|
||||
{"asymmetricEncryption", "RSA"},
|
||||
};
|
||||
}
|
||||
unityAPIInstance.Call("sharedInstance", context, TDMiniJson.Serialize(configDic));
|
||||
}
|
||||
|
||||
private static void flush(string appId)
|
||||
{
|
||||
getInstance(appId).Call("flush");
|
||||
}
|
||||
|
||||
private static AndroidJavaObject getDate(DateTime dateTime)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
return new AndroidJavaObject("java.util.Date", currentMillis);
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
AndroidJavaClass tzClass = new AndroidJavaClass("java.util.TimeZone");
|
||||
AndroidJavaObject tz = null;
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("track", eventName, javaProperties, date, tz);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (date != null) {
|
||||
date.Dispose();
|
||||
}
|
||||
if (tzClass != null) {
|
||||
tzClass.Dispose();
|
||||
}
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, TimeZoneInfo timeZone, string appId)
|
||||
{
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
AndroidJavaClass tzClass = new AndroidJavaClass("java.util.TimeZone");
|
||||
AndroidJavaObject tz = null;
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
if (null != timeZone && null != timeZone.Id && timeZone.Id.Length > 0)
|
||||
{
|
||||
if ("Local" == timeZone.Id) {
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getDefault");
|
||||
}
|
||||
else {
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", timeZone.Id);
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("track", eventName, javaProperties, date, tz);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (date != null) {
|
||||
date.Dispose();
|
||||
}
|
||||
if (tzClass != null) {
|
||||
tzClass.Dispose();
|
||||
}
|
||||
if (tz != null) {
|
||||
tz.Dispose();
|
||||
}
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void trackForAll(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
string appId = "";
|
||||
track(eventName, properties, appId);
|
||||
}
|
||||
|
||||
private static void track(TDEventModel taEvent, string appId)
|
||||
{
|
||||
AndroidJavaObject javaEvent = null;
|
||||
AndroidJavaObject javaProperties = getJSONObject(getFinalEventProperties(taEvent.Properties));
|
||||
switch (taEvent.EventType)
|
||||
{
|
||||
case TDEventModel.TDEventType.First:
|
||||
javaEvent = new AndroidJavaObject("cn.thinkingdata.analytics.TDFirstEvent",
|
||||
taEvent.EventName, javaProperties);
|
||||
|
||||
string extraId = taEvent.GetEventId();
|
||||
if (!string.IsNullOrEmpty(extraId))
|
||||
{
|
||||
javaEvent.Call("setFirstCheckId", extraId);
|
||||
}
|
||||
|
||||
break;
|
||||
case TDEventModel.TDEventType.Updatable:
|
||||
javaEvent = new AndroidJavaObject("cn.thinkingdata.analytics.TDUpdatableEvent",
|
||||
taEvent.EventName, javaProperties, taEvent.GetEventId());
|
||||
break;
|
||||
case TDEventModel.TDEventType.Overwritable:
|
||||
javaEvent = new AndroidJavaObject("cn.thinkingdata.analytics.TDOverWritableEvent",
|
||||
taEvent.EventName, javaProperties, taEvent.GetEventId());
|
||||
break;
|
||||
}
|
||||
if (null == javaEvent) {
|
||||
if(TDLog.GetEnable()) TDLog.w("Unexpected java event object. Returning...");
|
||||
return;
|
||||
}
|
||||
AndroidJavaObject date = getDate(taEvent.GetEventTime());
|
||||
AndroidJavaClass tzClass = new AndroidJavaClass("java.util.TimeZone");
|
||||
AndroidJavaObject tz = null;
|
||||
if (taEvent.GetEventTime() != null && taEvent.GetEventTime() != DateTime.MinValue) {
|
||||
if (taEvent.GetEventTimeZone() != null) {
|
||||
if ("Local" == taEvent.GetEventTimeZone().Id) {
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getDefault");
|
||||
}
|
||||
else {
|
||||
tz = tzClass.CallStatic<AndroidJavaObject>("getTimeZone", taEvent.GetEventTimeZone().Id);
|
||||
}
|
||||
javaEvent.Call("setEventTime", date, tz);
|
||||
}
|
||||
else
|
||||
{
|
||||
javaEvent.Call("setEventTime", date);
|
||||
}
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("track", javaEvent);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (date != null) {
|
||||
date.Dispose();
|
||||
}
|
||||
if (tzClass != null) {
|
||||
tzClass.Dispose();
|
||||
}
|
||||
if (tz != null) {
|
||||
tz.Dispose();
|
||||
}
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (javaEvent != null) {
|
||||
javaEvent.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("track", eventName, javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setSuperProperties(Dictionary<string, object> superProperties, string appId)
|
||||
{
|
||||
|
||||
AndroidJavaObject javaProperties = getJSONObject(superProperties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("setSuperProperties", getJSONObject(superProperties));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void unsetSuperProperty(string superPropertyName, string appId)
|
||||
{
|
||||
getInstance(appId).Call("unsetSuperProperty", superPropertyName);
|
||||
}
|
||||
|
||||
private static void clearSuperProperty(string appId)
|
||||
{
|
||||
getInstance(appId).Call("clearSuperProperties");
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getSuperProperties(string appId)
|
||||
{
|
||||
Dictionary<string, object> result = null;
|
||||
AndroidJavaObject superPropertyObject = getInstance(appId).Call<AndroidJavaObject>("getSuperProperties");
|
||||
try
|
||||
{
|
||||
if (null != superPropertyObject)
|
||||
{
|
||||
string superPropertiesString = superPropertyObject.Call<string>("toString");
|
||||
result = TDMiniJson.Deserialize(superPropertiesString);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (superPropertyObject != null) {
|
||||
superPropertyObject.Dispose();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getPresetProperties(string appId)
|
||||
{
|
||||
Dictionary<string, object> result = null;
|
||||
AndroidJavaObject presetPropertyObject = getInstance(appId).Call<AndroidJavaObject>("getPresetProperties").Call<AndroidJavaObject>("toEventPresetProperties");
|
||||
try
|
||||
{
|
||||
if (null != presetPropertyObject)
|
||||
{
|
||||
string presetPropertiesString = presetPropertyObject.Call<string>("toString");
|
||||
result = TDMiniJson.Deserialize(presetPropertiesString);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (presetPropertyObject != null) {
|
||||
presetPropertyObject.Dispose();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void timeEvent(string eventName, string appId)
|
||||
{
|
||||
getInstance(appId).Call("timeEvent", eventName);
|
||||
}
|
||||
|
||||
private static void timeEventForAll(string eventName)
|
||||
{
|
||||
getInstance("").Call("timeEvent", eventName);
|
||||
}
|
||||
|
||||
private static void identify(string uniqueId, string appId)
|
||||
{
|
||||
getInstance(appId).Call("identify", uniqueId);
|
||||
}
|
||||
|
||||
private static string getDistinctId(string appId)
|
||||
{
|
||||
return getInstance(appId).Call<string>("getDistinctId");
|
||||
}
|
||||
|
||||
private static void login(string uniqueId, string appId)
|
||||
{
|
||||
getInstance(appId).Call("login", uniqueId);
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_setOnce", javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null) {
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_setOnce", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null) {
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_set", javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_set", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, string appId)
|
||||
{
|
||||
userUnset(properties, DateTime.Now, appId);
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>();
|
||||
foreach(string s in properties)
|
||||
{
|
||||
finalProperties.Add(s, 0);
|
||||
}
|
||||
AndroidJavaObject javaProperties = getJSONObject(finalProperties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_unset", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_add", javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_add", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_append", javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_append", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_uniqAppend", javaProperties);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject javaProperties = getJSONObject(properties);
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_uniqAppend", javaProperties, date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (javaProperties != null)
|
||||
{
|
||||
javaProperties.Dispose();
|
||||
}
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void userDelete(string appId)
|
||||
{
|
||||
getInstance(appId).Call("user_delete");
|
||||
}
|
||||
|
||||
private static void userDelete(DateTime dateTime, string appId)
|
||||
{
|
||||
AndroidJavaObject date = getDate(dateTime);
|
||||
try
|
||||
{
|
||||
getInstance(appId).Call("user_delete", date);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (TDLog.GetEnable()) TDLog.w("ThinkingAnalytics: unexpected exception: " + e);
|
||||
}
|
||||
finally {
|
||||
if (date != null)
|
||||
{
|
||||
date.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void logout(string appId)
|
||||
{
|
||||
getInstance(appId).Call("logout");
|
||||
}
|
||||
|
||||
private static string getDeviceId()
|
||||
{
|
||||
return getInstance(default_appId).Call<string>("getDeviceId");
|
||||
}
|
||||
|
||||
private static void setDynamicSuperProperties(TDDynamicSuperPropertiesHandler dynamicSuperProperties, string appId)
|
||||
{
|
||||
DynamicListenerAdapter listenerAdapter = new DynamicListenerAdapter();
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
appId = default_appId;
|
||||
}
|
||||
unityAPIInstance.Call("setDynamicSuperPropertiesTrackerListener", appId, listenerAdapter);
|
||||
}
|
||||
|
||||
private static void setNetworkType(TDNetworkType networkType) {
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>() { };
|
||||
switch (networkType)
|
||||
{
|
||||
case TDNetworkType.Wifi:
|
||||
properties["network_type"] = 1;
|
||||
break;
|
||||
case TDNetworkType.All:
|
||||
properties["network_type"] = 2;
|
||||
break;
|
||||
default:
|
||||
properties["network_type"] = 2;
|
||||
break;
|
||||
|
||||
}
|
||||
unityAPIInstance.Call("setNetworkType", TDMiniJson.Serialize(properties));
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType events, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
appId = default_appId;
|
||||
}
|
||||
Dictionary<string, object> propertiesNew = new Dictionary<string, object>() {
|
||||
{ "appId", appId},
|
||||
{ "autoTrackType", (int)events}
|
||||
};
|
||||
unityAPIInstance.Call("enableAutoTrack", TDMiniJson.Serialize(propertiesNew));
|
||||
propertiesNew["properties"] = properties;
|
||||
unityAPIInstance.Call("setAutoTrackProperties", TDMiniJson.Serialize(propertiesNew));
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType events, TDAutoTrackEventHandler eventCallback, string appId)
|
||||
{
|
||||
AutoTrackListenerAdapter listenerAdapter = new AutoTrackListenerAdapter();
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
appId = default_appId;
|
||||
}
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>() {
|
||||
{ "appId", appId},
|
||||
{ "autoTrackType", (int)events}
|
||||
};
|
||||
unityAPIInstance.Call("enableAutoTrack", TDMiniJson.Serialize(properties), listenerAdapter);
|
||||
}
|
||||
|
||||
private static void setAutoTrackProperties(TDAutoTrackEventType events, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
appId = default_appId;
|
||||
}
|
||||
Dictionary<string, object> propertiesNew = new Dictionary<string, object>() {
|
||||
{ "appId", appId},
|
||||
{ "autoTrackType", (int)events}
|
||||
};
|
||||
propertiesNew["properties"] = properties;
|
||||
unityAPIInstance.Call("setAutoTrackProperties", TDMiniJson.Serialize(propertiesNew));
|
||||
}
|
||||
|
||||
private static void setTrackStatus(TDTrackStatus status, string appId)
|
||||
{
|
||||
AndroidJavaClass javaClass = new AndroidJavaClass("cn.thinkingdata.analytics.ThinkingAnalyticsSDK$TATrackStatus");
|
||||
AndroidJavaObject trackStatus;
|
||||
switch (status)
|
||||
{
|
||||
case TDTrackStatus.Pause:
|
||||
trackStatus = javaClass.GetStatic<AndroidJavaObject>("PAUSE");
|
||||
break;
|
||||
case TDTrackStatus.Stop:
|
||||
trackStatus = javaClass.GetStatic<AndroidJavaObject>("STOP");
|
||||
break;
|
||||
case TDTrackStatus.SaveOnly:
|
||||
trackStatus = javaClass.GetStatic<AndroidJavaObject>("SAVE_ONLY");
|
||||
break;
|
||||
case TDTrackStatus.Normal:
|
||||
default:
|
||||
trackStatus = javaClass.GetStatic<AndroidJavaObject>("NORMAL");
|
||||
break;
|
||||
}
|
||||
getInstance(appId).Call("setTrackStatus", trackStatus);
|
||||
}
|
||||
|
||||
private static void optOutTracking(string appId)
|
||||
{
|
||||
getInstance(appId).Call("optOutTracking");
|
||||
}
|
||||
|
||||
private static void optOutTrackingAndDeleteUser(string appId)
|
||||
{
|
||||
getInstance(appId).Call("optOutTrackingAndDeleteUser");
|
||||
}
|
||||
|
||||
private static void optInTracking(string appId)
|
||||
{
|
||||
getInstance(appId).Call("optInTracking");
|
||||
}
|
||||
|
||||
private static void enableTracking(bool enabled, string appId)
|
||||
{
|
||||
getInstance(appId).Call("enableTracking", enabled);
|
||||
}
|
||||
|
||||
private static string createLightInstance()
|
||||
{
|
||||
string randomID = System.Guid.NewGuid().ToString("N");
|
||||
AndroidJavaObject lightInstance = getInstance(default_appId).Call<AndroidJavaObject>("createLightInstance");
|
||||
if (light_instances == null) {
|
||||
light_instances = new Dictionary<string, AndroidJavaObject>();
|
||||
}
|
||||
light_instances.Add(randomID, lightInstance);
|
||||
return randomID;
|
||||
}
|
||||
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
sdkClass.CallStatic("calibrateTime", timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
unityAPIInstance.Call("calibrateTimeWithNtp", ntpServer);
|
||||
}
|
||||
|
||||
private static void enableThirdPartySharing(TDThirdPartyType shareType, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
Dictionary<string, object> obj = new Dictionary<string, object>() {
|
||||
{ "appId", appId },
|
||||
{ "type", (int)shareType }
|
||||
};
|
||||
obj["properties"] = properties;
|
||||
unityAPIInstance.Call("enableThirdPartySharing", TDMiniJson.Serialize(obj));
|
||||
}
|
||||
|
||||
//dynamic super properties
|
||||
public interface IDynamicSuperPropertiesTrackerListener
|
||||
{
|
||||
string getDynamicSuperPropertiesString();
|
||||
}
|
||||
|
||||
private class DynamicListenerAdapter : AndroidJavaProxy {
|
||||
public DynamicListenerAdapter() : base("cn.thinkingdata.engine.ThinkingAnalyticsUnityAPI$DynamicSuperPropertiesTrackerListener") {}
|
||||
public string getDynamicSuperPropertiesString()
|
||||
{
|
||||
Dictionary<string, object> ret;
|
||||
if (TDWrapper.mDynamicSuperProperties != null) {
|
||||
ret = TDWrapper.mDynamicSuperProperties.GetDynamicSuperProperties();
|
||||
}
|
||||
else {
|
||||
ret = new Dictionary<string, object>();
|
||||
}
|
||||
//return TDMiniJson.Serialize(ret);
|
||||
return serilize(ret);
|
||||
}
|
||||
}
|
||||
|
||||
//auto-tracking
|
||||
public interface IAutoTrackEventTrackerListener
|
||||
{
|
||||
string eventCallback(int type, string appId, string properties);
|
||||
}
|
||||
|
||||
private class AutoTrackListenerAdapter : AndroidJavaProxy {
|
||||
public AutoTrackListenerAdapter() : base("cn.thinkingdata.engine.ThinkingAnalyticsUnityAPI$AutoTrackEventTrackerListener") {}
|
||||
string eventCallback(int type, string appId, string properties)
|
||||
{
|
||||
Dictionary<string, object> ret;
|
||||
if (string.IsNullOrEmpty(appId)) appId = default_appId;
|
||||
if (TDWrapper.mAutoTrackEventCallbacks.ContainsKey(appId))
|
||||
{
|
||||
Dictionary<string, object> propertiesDic = TDMiniJson.Deserialize(properties);
|
||||
ret = TDWrapper.mAutoTrackEventCallbacks[appId].GetAutoTrackEventProperties(type, propertiesDic);
|
||||
}
|
||||
else {
|
||||
ret = new Dictionary<string, object>();
|
||||
}
|
||||
return serilize(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03113e111863a4fd68539598dc2dbb97
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,415 @@
|
||||
#if ((!(UNITY_IOS) || UNITY_EDITOR) && (!(UNITY_ANDROID) || UNITY_EDITOR)) || TE_DISABLE_ANDROID_JAVA || TE_DISABLE_IOS_OC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ThinkingData.Analytics.Utils;
|
||||
using ThinkingSDK.PC.Main;
|
||||
using ThinkingSDK.PC.Utils;
|
||||
using ThinkingSDK.PC.DataModel;
|
||||
using ThinkingSDK.PC.Config;
|
||||
|
||||
namespace ThinkingData.Analytics.Wrapper
|
||||
{
|
||||
public partial class TDWrapper : TDDynamicSuperPropertiesHandler_PC, TDAutoTrackEventHandler_PC
|
||||
{
|
||||
static TDAutoTrackEventHandler mEventCallback;
|
||||
public Dictionary<string, object> GetDynamicSuperProperties_PC()
|
||||
{
|
||||
if (mDynamicSuperProperties != null)
|
||||
{
|
||||
return mDynamicSuperProperties.GetDynamicSuperProperties();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object> AutoTrackEventCallback_PC(int type, Dictionary<string, object> properties)
|
||||
{
|
||||
if (mEventCallback != null)
|
||||
{
|
||||
return mEventCallback.GetAutoTrackEventProperties(type, properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Dictionary<string, object>();
|
||||
}
|
||||
}
|
||||
|
||||
private static void init(TDConfig token)
|
||||
{
|
||||
ThinkingSDKConfig config = ThinkingSDKConfig.GetInstance(token.appId, token.serverUrl, token.name);
|
||||
if (!string.IsNullOrEmpty(token.getTimeZoneId()))
|
||||
{
|
||||
try
|
||||
{
|
||||
config.SetTimeZone(TimeZoneInfo.FindSystemTimeZoneById(token.getTimeZoneId()));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//if (ThinkingSDKPublicConfig.IsPrintLog()) ThinkingSDKLogger.Print("TimeZoneInfo set failed : " + e.Message);
|
||||
}
|
||||
}
|
||||
if (token.mode == TDMode.Debug)
|
||||
{
|
||||
config.SetMode(Mode.DEBUG);
|
||||
}
|
||||
else if (token.mode == TDMode.DebugOnly)
|
||||
{
|
||||
config.SetMode(Mode.DEBUG_ONLY);
|
||||
}
|
||||
ThinkingPCSDK.Init(token.appId, token.serverUrl, token.name, config, sMono);
|
||||
}
|
||||
|
||||
private static void identify(string uniqueId, string appId)
|
||||
{
|
||||
ThinkingPCSDK.Identifiy(uniqueId, appId);
|
||||
}
|
||||
|
||||
private static string getDistinctId(string appId)
|
||||
{
|
||||
return ThinkingPCSDK.DistinctId(appId);
|
||||
}
|
||||
|
||||
private static void login(string accountId, string appId)
|
||||
{
|
||||
ThinkingPCSDK.Login(accountId, appId);
|
||||
}
|
||||
|
||||
private static void logout(string appId)
|
||||
{
|
||||
ThinkingPCSDK.Logout(appId);
|
||||
}
|
||||
|
||||
private static void flush(string appId)
|
||||
{
|
||||
ThinkingPCSDK.Flush(appId);
|
||||
}
|
||||
|
||||
private static void setVersionInfo(string lib_name, string lib_version)
|
||||
{
|
||||
ThinkingPCSDK.SetLibName(lib_name);
|
||||
ThinkingPCSDK.SetLibVersion(lib_version);
|
||||
}
|
||||
|
||||
private static void track(TDEventModel taEvent, string appId)
|
||||
{
|
||||
ThinkingSDKEventData eventData = null;
|
||||
switch (taEvent.EventType)
|
||||
{
|
||||
case TDEventModel.TDEventType.First:
|
||||
{
|
||||
eventData = new ThinkingSDKFirstEvent(taEvent.EventName);
|
||||
if (!string.IsNullOrEmpty(taEvent.GetEventId()))
|
||||
{
|
||||
((ThinkingSDKFirstEvent)eventData).SetFirstCheckId(taEvent.GetEventId());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TDEventModel.TDEventType.Updatable:
|
||||
eventData = new ThinkingSDKUpdateEvent(taEvent.EventName, taEvent.GetEventId());
|
||||
break;
|
||||
case TDEventModel.TDEventType.Overwritable:
|
||||
eventData = new ThinkingSDKOverWritableEvent(taEvent.EventName, taEvent.GetEventId());
|
||||
break;
|
||||
}
|
||||
if (mDynamicSuperProperties != null)
|
||||
{
|
||||
eventData.SetProperties(mDynamicSuperProperties.GetDynamicSuperProperties());
|
||||
}
|
||||
if (taEvent.Properties != null)
|
||||
{
|
||||
eventData.SetProperties(taEvent.Properties);
|
||||
}
|
||||
if (taEvent.GetEventTime() != null && taEvent.GetEventTimeZone() != null)
|
||||
{
|
||||
eventData.SetEventTime(taEvent.GetEventTime());
|
||||
eventData.SetTimeZone(taEvent.GetEventTimeZone());
|
||||
}
|
||||
ThinkingPCSDK.Track(eventData, appId);
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.Track(eventName, properties, appId);
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.Track(eventName, properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, TimeZoneInfo timeZone, string appId)
|
||||
{
|
||||
ThinkingPCSDK.Track(eventName, properties, dateTime, timeZone, appId);
|
||||
}
|
||||
|
||||
private static void trackForAll(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
ThinkingPCSDK.TrackForAll(eventName, properties);
|
||||
}
|
||||
|
||||
private static void setSuperProperties(Dictionary<string, object> superProperties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.SetSuperProperties(superProperties, appId);
|
||||
}
|
||||
|
||||
private static void unsetSuperProperty(string superPropertyName, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UnsetSuperProperty(superPropertyName, appId);
|
||||
}
|
||||
|
||||
private static void clearSuperProperty(string appId)
|
||||
{
|
||||
ThinkingPCSDK.ClearSuperProperties(appId);
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getSuperProperties(string appId)
|
||||
{
|
||||
return ThinkingPCSDK.SuperProperties(appId);
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getPresetProperties(string appId)
|
||||
{
|
||||
return ThinkingPCSDK.PresetProperties(appId);
|
||||
}
|
||||
private static void timeEvent(string eventName, string appId)
|
||||
{
|
||||
ThinkingPCSDK.TimeEvent(eventName, appId);
|
||||
}
|
||||
private static void timeEventForAll(string eventName)
|
||||
{
|
||||
ThinkingPCSDK.TimeEventForAll(eventName);
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserSet(properties, appId);
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserSet(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserUnset(properties, appId);
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserUnset(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserSetOnce(properties, appId);
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserSetOnce(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserAdd(properties, appId);
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserAdd(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userDelete(string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserDelete(appId);
|
||||
}
|
||||
|
||||
private static void userDelete(DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserDelete(dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserAppend(properties, appId);
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserAppend(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserUniqAppend(properties, appId);
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
ThinkingPCSDK.UserUniqAppend(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
private static void setNetworkType(TDNetworkType networkType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static string getDeviceId()
|
||||
{
|
||||
return ThinkingPCSDK.GetDeviceId();
|
||||
}
|
||||
|
||||
private static void setDynamicSuperProperties(TDDynamicSuperPropertiesHandler dynamicSuperProperties, string appId)
|
||||
{
|
||||
ThinkingPCSDK.SetDynamicSuperProperties(new TDWrapper());
|
||||
}
|
||||
|
||||
private static void setTrackStatus(TDTrackStatus status, string appId)
|
||||
{
|
||||
ThinkingPCSDK.SetTrackStatus((ThinkingSDK.PC.Main.TDTrackStatus)status, appId);
|
||||
}
|
||||
|
||||
private static void optOutTracking(string appId)
|
||||
{
|
||||
ThinkingPCSDK.OptTracking(false, appId);
|
||||
}
|
||||
|
||||
private static void optOutTrackingAndDeleteUser(string appId)
|
||||
{
|
||||
ThinkingPCSDK.OptTrackingAndDeleteUser(appId);
|
||||
}
|
||||
|
||||
private static void optInTracking(string appId)
|
||||
{
|
||||
ThinkingPCSDK.OptTracking(true, appId);
|
||||
}
|
||||
|
||||
private static void enableTracking(bool enabled, string appId)
|
||||
{
|
||||
ThinkingPCSDK.EnableTracking(enabled);
|
||||
}
|
||||
|
||||
private static string createLightInstance()
|
||||
{
|
||||
return ThinkingPCSDK.CreateLightInstance();
|
||||
}
|
||||
|
||||
private static string getTimeString(DateTime dateTime)
|
||||
{
|
||||
|
||||
return ThinkingPCSDK.TimeString(dateTime);
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType autoTrackEvents, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ThinkingSDK.PC.Main.TDAutoTrackEventType pcAutoTrackEvents = ThinkingSDK.PC.Main.TDAutoTrackEventType.None;
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppInstall) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppInstall;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppStart) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppStart;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppEnd) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppEnd;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppCrash) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppCrash;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneLoad;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneUnload;
|
||||
}
|
||||
ThinkingPCSDK.EnableAutoTrack(pcAutoTrackEvents, properties, appId);
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType autoTrackEvents, TDAutoTrackEventHandler eventCallback, string appId)
|
||||
{
|
||||
ThinkingSDK.PC.Main.TDAutoTrackEventType pcAutoTrackEvents = ThinkingSDK.PC.Main.TDAutoTrackEventType.None;
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppInstall) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppInstall;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppStart) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppStart;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppEnd) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppEnd;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppCrash) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppCrash;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneLoad;
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
pcAutoTrackEvents = pcAutoTrackEvents | ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneUnload;
|
||||
}
|
||||
mEventCallback = eventCallback;
|
||||
ThinkingPCSDK.EnableAutoTrack(pcAutoTrackEvents, new TDWrapper(), appId);
|
||||
}
|
||||
|
||||
private static void setAutoTrackProperties(TDAutoTrackEventType autoTrackEvents, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppInstall) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppInstall, properties, appId);
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppStart) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppStart, properties, appId);
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppEnd) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppEnd, properties, appId);
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppCrash) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppCrash, properties, appId);
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneLoad, properties, appId);
|
||||
}
|
||||
if ((autoTrackEvents & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
ThinkingPCSDK.SetAutoTrackProperties(ThinkingSDK.PC.Main.TDAutoTrackEventType.AppSceneUnload, properties, appId);
|
||||
}
|
||||
}
|
||||
|
||||
private static void enableLog(bool enable)
|
||||
{
|
||||
ThinkingPCSDK.EnableLog(enable);
|
||||
}
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
ThinkingPCSDK.CalibrateTime(timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
ThinkingPCSDK.CalibrateTimeWithNtp(ntpServer);
|
||||
}
|
||||
|
||||
private static void enableThirdPartySharing(TDThirdPartyType shareType, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if (ThinkingSDKPublicConfig.IsPrintLog()) ThinkingSDKLogger.Print("Sharing data is not support on PC: " + shareType + ", " + properties + ", " + appId);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f9ded317afe443d894852ab82fad3ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,472 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ThinkingData.Analytics.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace ThinkingData.Analytics.Wrapper
|
||||
{
|
||||
public partial class TDWrapper
|
||||
{
|
||||
public static MonoBehaviour sMono;
|
||||
private static TDDynamicSuperPropertiesHandler mDynamicSuperProperties;
|
||||
private static Dictionary<string, TDAutoTrackEventHandler> mAutoTrackEventCallbacks = new Dictionary<string, TDAutoTrackEventHandler>();
|
||||
private static Dictionary<string, Dictionary<string, object>> mAutoTrackProperties = new Dictionary<string, Dictionary<string, object>>();
|
||||
private static Dictionary<string, TDAutoTrackEventType> mAutoTrackEventInfos = new Dictionary<string, TDAutoTrackEventType>();
|
||||
private static System.Random rnd = new System.Random();
|
||||
|
||||
private static string default_appId = null;
|
||||
|
||||
// add Dictionary to Dictionary
|
||||
public static void AddDictionary(Dictionary<string, object> originalDic, Dictionary<string, object> subDic)
|
||||
{
|
||||
if (originalDic != subDic)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> kv in subDic)
|
||||
{
|
||||
originalDic[kv.Key] = kv.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string serilize<T>(Dictionary<string, T> data) {
|
||||
return TDMiniJson.Serialize(data, getTimeString);
|
||||
}
|
||||
|
||||
public static void ShareInstance(TDConfig token, MonoBehaviour mono, bool initRequired = true)
|
||||
{
|
||||
sMono = mono;
|
||||
if (string.IsNullOrEmpty(default_appId)) default_appId = token.appId;
|
||||
if (initRequired) init(token);
|
||||
}
|
||||
|
||||
public static void EnableLog(bool enable)
|
||||
{
|
||||
enableLog(enable);
|
||||
}
|
||||
|
||||
public static void SetVersionInfo(string version)
|
||||
{
|
||||
setVersionInfo("Unity", version);
|
||||
}
|
||||
|
||||
public static void SetDistinctId(string uniqueId, string appId)
|
||||
{
|
||||
identify(uniqueId, appId);
|
||||
}
|
||||
|
||||
public static string GetDistinctId(string appId)
|
||||
{
|
||||
return getDistinctId(appId);
|
||||
}
|
||||
|
||||
public static void Login(string accountId, string appId)
|
||||
{
|
||||
login(accountId, appId);
|
||||
}
|
||||
|
||||
public static void Logout(string appId)
|
||||
{
|
||||
logout(appId);
|
||||
}
|
||||
|
||||
public static void EnableAutoTrack(TDAutoTrackEventType events, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId)) appId = default_appId;
|
||||
UpdateAutoTrackSceneInfos(events, appId);
|
||||
SetAutoTrackProperties(events, properties, appId);
|
||||
enableAutoTrack(events, properties, appId);
|
||||
if ((events & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
TrackSceneLoad(SceneManager.GetActiveScene(), appId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnableAutoTrack(TDAutoTrackEventType events, TDAutoTrackEventHandler eventCallback, string appId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId)) appId = default_appId;
|
||||
UpdateAutoTrackSceneInfos(events, appId);
|
||||
mAutoTrackEventCallbacks[appId] = eventCallback;
|
||||
//mAutoTrackEventCallback = eventCallback;
|
||||
enableAutoTrack(events, eventCallback, appId);
|
||||
if ((events & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
TrackSceneLoad(SceneManager.GetActiveScene(), appId);
|
||||
}
|
||||
}
|
||||
|
||||
private static string TDAutoTrackEventType_APP_SCENE_LOAD = "AppSceneLoad";
|
||||
private static string TDAutoTrackEventType_APP_SCENE_UNLOAD = "AppSceneUnload";
|
||||
public static void SetAutoTrackProperties(TDAutoTrackEventType events, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if ((events & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
if (mAutoTrackProperties.ContainsKey(TDAutoTrackEventType_APP_SCENE_LOAD))
|
||||
{
|
||||
AddDictionary(mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_LOAD], properties);
|
||||
}
|
||||
else
|
||||
mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_LOAD] = properties;
|
||||
}
|
||||
if ((events & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
if (mAutoTrackProperties.ContainsKey(TDAutoTrackEventType_APP_SCENE_UNLOAD))
|
||||
{
|
||||
AddDictionary(mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_UNLOAD], properties);
|
||||
}
|
||||
else
|
||||
mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_UNLOAD] = properties;
|
||||
}
|
||||
setAutoTrackProperties(events, properties, appId);
|
||||
}
|
||||
|
||||
public static void TrackSceneLoad(Scene scene, string appId = "")
|
||||
{
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>() {
|
||||
{ "#scene_name", scene.name },
|
||||
{ "#scene_path", scene.path }
|
||||
};
|
||||
if (mAutoTrackProperties.ContainsKey(TDAutoTrackEventType_APP_SCENE_LOAD))
|
||||
{
|
||||
AddDictionary(properties, mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_LOAD]);
|
||||
}
|
||||
if (string.IsNullOrEmpty(appId))
|
||||
{
|
||||
foreach (var kv in mAutoTrackEventInfos)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>(properties);
|
||||
if (mAutoTrackEventCallbacks.ContainsKey(kv.Key))
|
||||
{
|
||||
AddDictionary(finalProperties, mAutoTrackEventCallbacks[kv.Key].GetAutoTrackEventProperties((int)TDAutoTrackEventType.AppSceneLoad, properties));
|
||||
}
|
||||
if ((kv.Value & TDAutoTrackEventType.AppSceneLoad) != 0)
|
||||
{
|
||||
Track("ta_scene_loaded", finalProperties, kv.Key);
|
||||
}
|
||||
if ((kv.Value & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
TimeEvent("ta_scene_unloaded", kv.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>(properties);
|
||||
if (mAutoTrackEventCallbacks.ContainsKey(appId))
|
||||
{
|
||||
AddDictionary(finalProperties, mAutoTrackEventCallbacks[appId].GetAutoTrackEventProperties((int)TDAutoTrackEventType.AppSceneLoad, properties));
|
||||
}
|
||||
Track("ta_scene_loaded", finalProperties, appId);
|
||||
TimeEvent("ta_scene_unloaded", appId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void TrackSceneUnload(Scene scene, string appId = "")
|
||||
{
|
||||
Dictionary<string, object> properties = new Dictionary<string, object>() {
|
||||
{ "#scene_name", scene.name },
|
||||
{ "#scene_path", scene.path }
|
||||
};
|
||||
if (mAutoTrackProperties.ContainsKey(TDAutoTrackEventType_APP_SCENE_UNLOAD))
|
||||
{
|
||||
AddDictionary(properties, mAutoTrackProperties[TDAutoTrackEventType_APP_SCENE_UNLOAD]);
|
||||
}
|
||||
foreach (var kv in mAutoTrackEventInfos)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>(properties);
|
||||
if (mAutoTrackEventCallbacks.ContainsKey(kv.Key))
|
||||
{
|
||||
AddDictionary(finalProperties, mAutoTrackEventCallbacks[kv.Key].GetAutoTrackEventProperties((int)TDAutoTrackEventType.AppSceneUnload, properties));
|
||||
}
|
||||
if ((kv.Value & TDAutoTrackEventType.AppSceneUnload) != 0)
|
||||
{
|
||||
Track("ta_scene_unloaded", finalProperties, kv.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateAutoTrackSceneInfos(TDAutoTrackEventType events, string appId = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(appId)) appId = default_appId;
|
||||
mAutoTrackEventInfos[appId] = events;
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getFinalEventProperties(Dictionary<string, object> properties)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
|
||||
if (null != mDynamicSuperProperties)
|
||||
{
|
||||
Dictionary<string, object> finalProperties = new Dictionary<string, object>();
|
||||
TDPropertiesChecker.MergeProperties(mDynamicSuperProperties.GetDynamicSuperProperties(), finalProperties);
|
||||
TDPropertiesChecker.MergeProperties(properties, finalProperties);
|
||||
return finalProperties;
|
||||
}
|
||||
else
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
public static void Track(string eventName, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
track(eventName, getFinalEventProperties(properties), appId);
|
||||
}
|
||||
|
||||
public static void Track(string eventName, Dictionary<string, object> properties, DateTime datetime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
track(eventName, getFinalEventProperties(properties), datetime, appId);
|
||||
}
|
||||
|
||||
public static void Track(string eventName, Dictionary<string, object> properties, DateTime datetime, TimeZoneInfo timeZone, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
track(eventName, getFinalEventProperties(properties), datetime, timeZone, appId);
|
||||
}
|
||||
|
||||
public static void TrackForAll(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
trackForAll(eventName, getFinalEventProperties(properties));
|
||||
}
|
||||
|
||||
public static void Track(TDEventModel taEvent, string appId)
|
||||
{
|
||||
if (null == taEvent || null == taEvent.EventType)
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("Ignoring invalid TA event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taEvent.GetEventTime() == null)
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.w("ppp null...");
|
||||
}
|
||||
TDPropertiesChecker.CheckString(taEvent.EventName);
|
||||
TDPropertiesChecker.CheckProperties(taEvent.Properties);
|
||||
track(taEvent, appId);
|
||||
}
|
||||
|
||||
public static void QuickTrack(string eventName, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
if ("SceneView" == eventName)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new Dictionary<string, object>() { };
|
||||
}
|
||||
Scene scene = SceneManager.GetActiveScene();
|
||||
if (scene != null)
|
||||
{
|
||||
properties.Add("#scene_name", scene.name);
|
||||
properties.Add("#scene_path", scene.path);
|
||||
}
|
||||
Track("ta_scene_view", properties, appId);
|
||||
}
|
||||
else if ("AppClick" == eventName)
|
||||
{
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new Dictionary<string, object>() { };
|
||||
}
|
||||
Track("ta_app_click", properties, appId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetSuperProperties(Dictionary<string, object> superProperties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(superProperties);
|
||||
setSuperProperties(superProperties, appId);
|
||||
}
|
||||
|
||||
public static void UnsetSuperProperty(string superPropertyName, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(superPropertyName);
|
||||
unsetSuperProperty(superPropertyName, appId);
|
||||
}
|
||||
|
||||
public static void ClearSuperProperty(string appId)
|
||||
{
|
||||
clearSuperProperty(appId);
|
||||
}
|
||||
|
||||
|
||||
public static void TimeEvent(string eventName, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
timeEvent(eventName, appId);
|
||||
}
|
||||
|
||||
public static void TimeEventForAll(string eventName)
|
||||
{
|
||||
TDPropertiesChecker.CheckString(eventName);
|
||||
timeEventForAll(eventName);
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GetSuperProperties(string appId)
|
||||
{
|
||||
return getSuperProperties(appId);
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GetPresetProperties(string appId)
|
||||
{
|
||||
return getPresetProperties(appId);
|
||||
}
|
||||
|
||||
public static void UserSet(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userSet(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserSet(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userSet(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserSetOnce(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userSetOnce(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserSetOnce(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userSetOnce(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserUnset(List<string> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userUnset(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserUnset(List<string> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userUnset(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserAdd(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userAdd(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserAdd(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userAdd(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userAppend(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userAppend(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserUniqAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userUniqAppend(properties, appId);
|
||||
}
|
||||
|
||||
public static void UserUniqAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
TDPropertiesChecker.CheckProperties(properties);
|
||||
userUniqAppend(properties, dateTime, appId);
|
||||
}
|
||||
|
||||
public static void UserDelete(string appId)
|
||||
{
|
||||
userDelete(appId);
|
||||
}
|
||||
|
||||
public static void UserDelete(DateTime dateTime, string appId)
|
||||
{
|
||||
userDelete(dateTime, appId);
|
||||
}
|
||||
|
||||
public static void Flush(string appId)
|
||||
{
|
||||
flush(appId);
|
||||
}
|
||||
|
||||
public static void SetNetworkType(TDNetworkType networkType)
|
||||
{
|
||||
setNetworkType(networkType);
|
||||
}
|
||||
|
||||
public static string GetDeviceId()
|
||||
{
|
||||
return getDeviceId();
|
||||
}
|
||||
|
||||
public static void SetDynamicSuperProperties(TDDynamicSuperPropertiesHandler dynamicSuperProperties, string appId)
|
||||
{
|
||||
if (!TDPropertiesChecker.CheckProperties(dynamicSuperProperties.GetDynamicSuperProperties()))
|
||||
{
|
||||
if(TDLog.GetEnable()) TDLog.d("Cannot set dynamic super properties due to invalid properties.");
|
||||
}
|
||||
mDynamicSuperProperties = dynamicSuperProperties;
|
||||
setDynamicSuperProperties(dynamicSuperProperties, appId);
|
||||
}
|
||||
|
||||
public static void SetTrackStatus(TDTrackStatus status, string appId)
|
||||
{
|
||||
setTrackStatus(status, appId);
|
||||
}
|
||||
|
||||
public static void OptOutTracking(string appId)
|
||||
{
|
||||
optOutTracking(appId);
|
||||
}
|
||||
|
||||
public static void OptOutTrackingAndDeleteUser(string appId)
|
||||
{
|
||||
optOutTrackingAndDeleteUser(appId);
|
||||
}
|
||||
|
||||
public static void OptInTracking(string appId)
|
||||
{
|
||||
optInTracking(appId);
|
||||
}
|
||||
|
||||
public static void EnableTracking(bool enabled, string appId)
|
||||
{
|
||||
enableTracking(enabled, appId);
|
||||
}
|
||||
|
||||
public static string CreateLightInstance()
|
||||
{
|
||||
return createLightInstance();
|
||||
}
|
||||
|
||||
public static void CalibrateTime(long timestamp)
|
||||
{
|
||||
calibrateTime(timestamp);
|
||||
}
|
||||
|
||||
public static void CalibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
calibrateTimeWithNtp(ntpServer);
|
||||
}
|
||||
|
||||
public static void EnableThirdPartySharing(TDThirdPartyType shareType, Dictionary<string, object> properties = null, string appId = "")
|
||||
{
|
||||
if (null == properties) properties = new Dictionary<string, object>();
|
||||
enableThirdPartySharing(shareType, properties, appId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 306f69768d6114f989d144fd22df1b13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,516 @@
|
||||
#if UNITY_IOS && !(UNITY_EDITOR) && !TE_DISABLE_IOS_OC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using ThinkingData.Analytics.Utils;
|
||||
|
||||
namespace ThinkingData.Analytics.Wrapper
|
||||
{
|
||||
public partial class TDWrapper
|
||||
{
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_start(string app_id, string url, int mode, string timezone_id, bool enable_encrypt, int encrypt_version, string encrypt_public_key, int pinning_mode, bool allow_invalid_certificates, bool validates_domain_name, string instance_name);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_identify(string app_id, string unique_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string ta_get_distinct_id(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_login(string app_id, string account_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_logout(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_track(string app_id, string event_name, string properties, long time_stamp_millis, string timezone);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_track_event(string app_id, string event_string);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_set_super_properties(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_unset_super_property(string app_id, string property_name);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_clear_super_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string ta_get_super_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string ta_get_preset_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_time_event(string app_id, string event_name);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_set(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_set_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_unset(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_unset_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_set_once(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_set_once_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_add(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_add_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_delete(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_delete_with_time(string app_id, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_append(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_append_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_uniq_append(string app_id, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_user_uniq_append_with_time(string app_id, string properties, long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_flush(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_set_network_type(int type);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_enable_log(bool is_enable);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string ta_get_device_id();
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_set_dynamic_super_properties(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_enable_tracking(string app_id, bool enabled);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_set_track_status(string app_id, int status);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_opt_out_tracking(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_opt_out_tracking_and_delete_user(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_opt_in_tracking(string app_id);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_create_light_instance(string delegate_token);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_enable_autoTrack(string app_id, int events, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_enable_autoTrack_with_callback(string app_id, int events);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_set_autoTrack_properties(string app_id, int events, string properties);
|
||||
[DllImport("__Internal")]
|
||||
private static extern string ta_get_time_string(long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_calibrate_time(long timestamp);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_calibrate_time_with_ntp(string ntpServer);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_config_custom_lib_info(string lib_name, string lib_version);
|
||||
[DllImport("__Internal")]
|
||||
private static extern void ta_enable_third_party_sharing(string app_id, int share_type, string properties);
|
||||
|
||||
private static TimeZoneInfo defaultTimeZone = null;
|
||||
private static TDTimeZone defaultTDTimeZone = TDTimeZone.Local;
|
||||
|
||||
private static void init(TDConfig token)
|
||||
{
|
||||
registerRecieveGameCallback();
|
||||
ta_start(token.appId, token.serverUrl, (int)token.mode, token.getTimeZoneId(), token.enableEncrypt, token.encryptVersion, token.encryptPublicKey, (int) token.pinningMode, token.allowInvalidCertificates, token.validatesDomainName, token.name);
|
||||
string timeZoneId = token.getTimeZoneId();
|
||||
defaultTDTimeZone = token.timeZone;
|
||||
if (null != timeZoneId && timeZoneId.Length > 0)
|
||||
{
|
||||
if (defaultTimeZone == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
defaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaultTimeZone == null)
|
||||
{
|
||||
defaultTimeZone = TimeZoneInfo.Local;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void identify(string uniqueId, string appId)
|
||||
{
|
||||
ta_identify(appId, uniqueId);
|
||||
}
|
||||
|
||||
private static string getDistinctId(string appId)
|
||||
{
|
||||
return ta_get_distinct_id(appId);
|
||||
}
|
||||
|
||||
private static void login(string accountId, string appId)
|
||||
{
|
||||
ta_login(appId, accountId);
|
||||
}
|
||||
|
||||
private static void logout(string appId)
|
||||
{
|
||||
ta_logout(appId);
|
||||
}
|
||||
|
||||
private static void flush(string appId)
|
||||
{
|
||||
ta_flush(appId);
|
||||
}
|
||||
|
||||
private static void enableLog(bool enable)
|
||||
{
|
||||
ta_enable_log(enable);
|
||||
}
|
||||
|
||||
private static void setVersionInfo(string lib_name, string lib_version) {
|
||||
ta_config_custom_lib_info(lib_name, lib_version);
|
||||
}
|
||||
|
||||
private static void track(TDEventModel taEvent, string appId)
|
||||
{
|
||||
Dictionary<string, object> finalEvent = new Dictionary<string, object>();
|
||||
string extraId = taEvent.GetEventId();
|
||||
switch (taEvent.EventType)
|
||||
{
|
||||
case TDEventModel.TDEventType.First:
|
||||
finalEvent["event_type"] = "track_first";
|
||||
break;
|
||||
case TDEventModel.TDEventType.Updatable:
|
||||
finalEvent["event_type"] = "track_update";
|
||||
break;
|
||||
case TDEventModel.TDEventType.Overwritable:
|
||||
finalEvent["event_type"] = "track_overwrite";
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(extraId))
|
||||
{
|
||||
finalEvent["extra_id"] = extraId;
|
||||
}
|
||||
|
||||
finalEvent["event_name"] = taEvent.EventName;
|
||||
finalEvent["event_properties"] = taEvent.Properties;
|
||||
if (taEvent.GetEventTime() != null && taEvent.GetEventTime() != DateTime.MinValue)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(taEvent.GetEventTime()).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
finalEvent["event_time"] = currentMillis;
|
||||
}
|
||||
if (taEvent.GetEventTimeZone() != null)
|
||||
{
|
||||
finalEvent["event_timezone"] = taEvent.GetEventTimeZone().Id;
|
||||
}
|
||||
|
||||
ta_track_event(appId, serilize(finalEvent));
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_track(appId, eventName, serilize(properties), 0, "");
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
string tz = "";
|
||||
ta_track(appId, eventName, serilize(properties), currentMillis, tz);
|
||||
}
|
||||
|
||||
private static void track(string eventName, Dictionary<string, object> properties, DateTime dateTime, TimeZoneInfo timeZone, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
string tz = "";
|
||||
if (timeZone != null)
|
||||
{
|
||||
tz = timeZone.Id;
|
||||
}
|
||||
ta_track(appId, eventName, serilize(properties), currentMillis, tz);
|
||||
}
|
||||
|
||||
private static void trackForAll(string eventName, Dictionary<string, object> properties)
|
||||
{
|
||||
string appId = "";
|
||||
track(eventName, properties, appId);
|
||||
}
|
||||
|
||||
private static void setSuperProperties(Dictionary<string, object> superProperties, string appId)
|
||||
{
|
||||
ta_set_super_properties(appId, serilize(superProperties));
|
||||
}
|
||||
|
||||
private static void unsetSuperProperty(string superPropertyName, string appId)
|
||||
{
|
||||
ta_unset_super_property(appId, superPropertyName);
|
||||
}
|
||||
|
||||
private static void clearSuperProperty(string appId)
|
||||
{
|
||||
ta_clear_super_properties(appId);
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getSuperProperties(string appId)
|
||||
{
|
||||
string superPropertiesString = ta_get_super_properties(appId);
|
||||
return TDMiniJson.Deserialize(superPropertiesString);
|
||||
}
|
||||
|
||||
private static Dictionary<string, object> getPresetProperties(string appId)
|
||||
{
|
||||
string presetPropertiesString = ta_get_preset_properties(appId);
|
||||
return TDMiniJson.Deserialize(presetPropertiesString);
|
||||
}
|
||||
|
||||
private static void timeEvent(string eventName, string appId)
|
||||
{
|
||||
ta_time_event(appId, eventName);
|
||||
}
|
||||
|
||||
private static void timeEventForAll(string eventName)
|
||||
{
|
||||
ta_time_event("", eventName);
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_user_set(appId, serilize(properties));
|
||||
}
|
||||
|
||||
private static void userSet(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_set_with_time(appId, serilize(properties), currentMillis);
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, string appId)
|
||||
{
|
||||
foreach (string property in properties)
|
||||
{
|
||||
ta_user_unset(appId, property);
|
||||
}
|
||||
}
|
||||
|
||||
private static void userUnset(List<string> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
foreach (string property in properties)
|
||||
{
|
||||
ta_user_unset_with_time(appId, property, currentMillis);
|
||||
}
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_user_set_once(appId, serilize(properties));
|
||||
}
|
||||
|
||||
private static void userSetOnce(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_set_once_with_time(appId, serilize(properties), currentMillis);
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_user_add(appId, serilize(properties));
|
||||
}
|
||||
|
||||
private static void userAdd(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_add_with_time(appId, serilize(properties), currentMillis);
|
||||
}
|
||||
|
||||
private static void userDelete(string appId)
|
||||
{
|
||||
ta_user_delete(appId);
|
||||
}
|
||||
|
||||
private static void userDelete(DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_delete_with_time(appId, currentMillis);
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_user_append(appId, serilize(properties));
|
||||
}
|
||||
|
||||
private static void userAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_append_with_time(appId, serilize(properties), currentMillis);
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_user_uniq_append(appId, serilize(properties));
|
||||
}
|
||||
|
||||
private static void userUniqAppend(Dictionary<string, object> properties, DateTime dateTime, string appId)
|
||||
{
|
||||
long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
ta_user_uniq_append_with_time(appId, serilize(properties), currentMillis);
|
||||
}
|
||||
|
||||
private static void setNetworkType(TDNetworkType networkType)
|
||||
{
|
||||
ta_set_network_type((int)networkType);
|
||||
}
|
||||
|
||||
private static string getDeviceId()
|
||||
{
|
||||
return ta_get_device_id();
|
||||
}
|
||||
|
||||
private static void setDynamicSuperProperties(TDDynamicSuperPropertiesHandler dynamicSuperProperties, string appId)
|
||||
{
|
||||
ta_set_dynamic_super_properties(appId);
|
||||
}
|
||||
|
||||
private static void setTrackStatus(TDTrackStatus status, string appId)
|
||||
{
|
||||
ta_set_track_status(appId, (int)status);
|
||||
}
|
||||
|
||||
private static void optOutTracking(string appId)
|
||||
{
|
||||
ta_opt_out_tracking(appId);
|
||||
}
|
||||
|
||||
private static void optOutTrackingAndDeleteUser(string appId)
|
||||
{
|
||||
ta_opt_out_tracking_and_delete_user(appId);
|
||||
}
|
||||
|
||||
private static void optInTracking(string appId)
|
||||
{
|
||||
ta_opt_in_tracking(appId);
|
||||
}
|
||||
|
||||
private static void enableTracking(bool enabled, string appId)
|
||||
{
|
||||
ta_enable_tracking(appId, enabled);
|
||||
}
|
||||
|
||||
private static string createLightInstance()
|
||||
{
|
||||
string randomID = System.Guid.NewGuid().ToString("N");
|
||||
ta_create_light_instance(randomID);
|
||||
return randomID;
|
||||
}
|
||||
|
||||
private static string getTimeString(DateTime dateTime)
|
||||
{
|
||||
//long dateTimeTicksUTC = TimeZoneInfo.ConvertTimeToUtc(dateTime).Ticks;
|
||||
//DateTime dtFrom = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
//long currentMillis = (dateTimeTicksUTC - dtFrom.Ticks) / 10000;
|
||||
//return ta_get_time_string(currentMillis);
|
||||
if (defaultTimeZone == null)
|
||||
{
|
||||
return TDCommonUtils.FormatDate(dateTime, defaultTDTimeZone);
|
||||
}
|
||||
else
|
||||
{
|
||||
return TDCommonUtils.FormatDate(dateTime, defaultTimeZone);
|
||||
}
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType autoTrackEvents, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_enable_autoTrack(appId, (int)autoTrackEvents, serilize(properties));
|
||||
}
|
||||
|
||||
private static void enableAutoTrack(TDAutoTrackEventType autoTrackEvents, TDAutoTrackEventHandler eventCallback, string appId)
|
||||
{
|
||||
ta_enable_autoTrack_with_callback(appId, (int)autoTrackEvents);
|
||||
}
|
||||
|
||||
private static void setAutoTrackProperties(TDAutoTrackEventType autoTrackEvents, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_set_autoTrack_properties(appId, (int)autoTrackEvents, serilize(properties));
|
||||
}
|
||||
|
||||
private static void calibrateTime(long timestamp)
|
||||
{
|
||||
ta_calibrate_time(timestamp);
|
||||
}
|
||||
|
||||
private static void calibrateTimeWithNtp(string ntpServer)
|
||||
{
|
||||
ta_calibrate_time_with_ntp(ntpServer);
|
||||
}
|
||||
|
||||
private static void enableThirdPartySharing(TDThirdPartyType shareType, Dictionary<string, object> properties, string appId)
|
||||
{
|
||||
ta_enable_third_party_sharing(appId, (int) shareType, serilize(properties));
|
||||
}
|
||||
|
||||
private static void registerRecieveGameCallback()
|
||||
{
|
||||
ResultHandler handler = new ResultHandler(resultHandler);
|
||||
IntPtr handlerPointer = Marshal.GetFunctionPointerForDelegate(handler);
|
||||
RegisterRecieveGameCallback(handlerPointer);
|
||||
}
|
||||
|
||||
[DllImport("__Internal")]
|
||||
public static extern void RegisterRecieveGameCallback
|
||||
(
|
||||
IntPtr handlerPointer
|
||||
);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate string ResultHandler(string type, string jsonData);
|
||||
|
||||
[AOT.MonoPInvokeCallback(typeof(ResultHandler))]
|
||||
static string resultHandler(string type, string jsonData)
|
||||
{
|
||||
if (type == "AutoTrackProperties")
|
||||
{
|
||||
Dictionary<string, object>properties = TDMiniJson.Deserialize(jsonData);
|
||||
string appId = properties["AppID"].ToString();
|
||||
int eventType = Convert.ToInt32(properties["EventType"]);
|
||||
if (!string.IsNullOrEmpty(appId) && mAutoTrackEventCallbacks.ContainsKey(appId))
|
||||
{
|
||||
properties.Remove("EventType");
|
||||
properties.Remove("AppID");
|
||||
Dictionary<string, object>autoTrackProperties = mAutoTrackEventCallbacks[appId].GetAutoTrackEventProperties(eventType, properties);
|
||||
//return TDMiniJson.Serialize(autoTrackProperties);
|
||||
return serilize(autoTrackProperties);
|
||||
}
|
||||
}
|
||||
else if (type == "DynamicSuperProperties")
|
||||
{
|
||||
if (mDynamicSuperProperties != null)
|
||||
{
|
||||
Dictionary<string, object>dynamicSuperProperties = mDynamicSuperProperties.GetDynamicSuperProperties();
|
||||
//return TDMiniJson.Serialize(dynamicSuperProperties);
|
||||
return serilize(dynamicSuperProperties);
|
||||
}
|
||||
}
|
||||
return "{}";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2049ce2b30da48328f05872adacceed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user