//public OnLoopShareCallBack onLoopsharecallback; #endif void Awake() { Type type = devInfo.GetType(); Hashtable platformConfigs = new Hashtable(); FieldInfo[] devInfoFields = type.GetFields(); foreach (FieldInfo devInfoField in devInfoFields) { DevInfo info = (DevInfo)devInfoField.GetValue(devInfo); int platformId = (int)info.GetType().GetField("type").GetValue(info); FieldInfo[] fields = info.GetType().GetFields(); Hashtable table = new Hashtable(); foreach (FieldInfo field in fields) { if ("type".EndsWith(field.Name)) { continue; } else if ("Enable".EndsWith(field.Name) || "ShareByAppClient".EndsWith(field.Name) || "BypassApproval".EndsWith(field.Name) || "WithShareTicket".EndsWith(field.Name)) { table.Add(field.Name, Convert.ToString(field.GetValue(info)).ToLower()); //Debug.Log("======================platformConfigs table info 1:" + Convert.ToString(field.GetValue(info)).ToLower()); } else { table.Add(field.Name, Convert.ToString(field.GetValue(info))); //Debug.Log("======================platformConfigs table info 2:" + Convert.ToString(field.GetValue(info))); } } //Debug.Log("======================platformConfigs platformId:" + platformId); //Debug.Log("======================platformConfigs table:" + table); platformConfigs.Add(platformId, table); } //Debug.Log("======================platformConfigs:" + platformConfigs); #if UNITY_ANDROID shareSDKUtils = new AndroidImpl(gameObject); shareSDKUtils.InitSDK(appKey, appSecret); //add listener for loopshare shareSDKUtils.PrepareLoopShare(); shareSDKUtils.setChannelId(); #elif UNITY_IPHONE shareSDKUtils = new iOSImpl(gameObject); #endif shareSDKUtils.SetPlatformConfig(platformConfigs); }
/// <summary> /// 初始化shareSDK /// </summary> public void InitializeShareSDK() { if (initialized) { return; } Type type = devInfo.GetType(); Hashtable platformConfigs = new Hashtable(); FieldInfo[] devInfoFields = type.GetFields(); foreach (FieldInfo devInfoField in devInfoFields) { DevInfo info = (DevInfo)devInfoField.GetValue(devInfo); int platformId = (int)info.GetType().GetField("type").GetValue(info); FieldInfo[] fields = info.GetType().GetFields(); Hashtable table = new Hashtable(); foreach (FieldInfo field in fields) { if ("type".EndsWith(field.Name)) { continue; } else if ("Enable".EndsWith(field.Name) || "ShareByAppClient".EndsWith(field.Name) || "BypassApproval".EndsWith(field.Name)) { table.Add(field.Name, Convert.ToString(field.GetValue(info)).ToLower()); } else { table.Add(field.Name, Convert.ToString(field.GetValue(info))); } } platformConfigs.Add(platformId, table); } #if UNITY_ANDROID shareSDKUtils = new AndroidImpl(gameObject); shareSDKUtils.InitSDK(appKey, appSecret); #elif UNITY_IPHONE shareSDKUtils = new iOSImpl(gameObject); #endif initialized = true; shareSDKUtils.SetPlatformConfig(platformConfigs); }
private void Awake() { if (Application.platform != RuntimePlatform.Android && Application.platform != RuntimePlatform.IPhonePlayer) { return; } print("ShareSDK Awake"); Type type = devInfo.GetType(); Hashtable platformConfigs = new Hashtable(); FieldInfo[] devInfoFields = type.GetFields(); foreach (FieldInfo devInfoField in devInfoFields) { DevInfo info = (DevInfo)devInfoField.GetValue(devInfo); int platformId = (int)info.GetType().GetField("type").GetValue(info); FieldInfo[] fields = info.GetType().GetFields(); Hashtable table = new Hashtable(); foreach (FieldInfo field in fields) { if ("type".EndsWith(field.Name)) { continue; } else if ("Enable".EndsWith(field.Name) || "ShareByAppClient".EndsWith(field.Name) || "BypassApproval".EndsWith(field.Name)) { table.Add(field.Name, Convert.ToString(field.GetValue(info)).ToLower()); } else { table.Add(field.Name, Convert.ToString(field.GetValue(info))); } } platformConfigs.Add(platformId, table); } #if UNITY_ANDROID shareSDKUtils = new AndroidImpl(gameObject); #elif UNITY_IPHONE shareSDKUtils = new iOSImpl(gameObject); #endif shareSDKUtils.InitSDK(appKey); shareSDKUtils.SetPlatformConfig(platformConfigs); }
// public EventHandler showAutoInfoHandler; void Awake() { print("ShareSDK Awake"); Type type = devInfo.GetType(); Hashtable platformConfigs = new Hashtable(); FieldInfo[] devInfoFields = type.GetFields(); foreach (FieldInfo devInfoField in devInfoFields) { DevInfo info = (DevInfo)devInfoField.GetValue(devInfo); Type type0 = info.GetType(); int platformId = (int)type0.GetField("type").GetValue(info); //int platformId = (int) info.GetType().GetField("type").GetValue(info); FieldInfo[] fields = info.GetType().GetFields(); Hashtable table = new Hashtable(); foreach (FieldInfo field in fields) { if ("type".EndsWith(field.Name)) { continue; } else if ("Enable".EndsWith(field.Name) || "ShareByAppClient".EndsWith(field.Name) || "BypassApproval".EndsWith(field.Name)) { table.Add(field.Name, Convert.ToString(field.GetValue(info)).ToLower()); } else { table.Add(field.Name, Convert.ToString(field.GetValue(info))); } } platformConfigs.Add(platformId, table); } #if UNITY_ANDROID shareSDKUtils = new AndroidImpl(gameObject); #elif UNITY_IOS shareSDKUtils = new iOSImpl(gameObject); #endif Debug.Log("ShareSDK:" + appKey); shareSDKUtils.InitSDK(appKey); shareSDKUtils.SetPlatformConfig(platformConfigs); }
/// <summary> /// init the ShareSDK. /// </summary> public void InitSDK(String appKey) { // if you don't add ShareSDK.xml in your assets folder, use the following line shareSDKUtils.InitSDK(appKey); }
void Awake() { print("ShareSDK Awake"); Type type = devInfo.GetType(); Hashtable platformConfigs = new Hashtable(); FieldInfo[] devInfoFields = type.GetFields(); foreach (FieldInfo devInfoField in devInfoFields) { DevInfo info = (DevInfo) devInfoField.GetValue(devInfo); int platformId = (int) info.GetType().GetField("type").GetValue(info); FieldInfo[] fields = info.GetType().GetFields(); Hashtable table = new Hashtable(); foreach (FieldInfo field in fields) { if ("type".EndsWith(field.Name)) { continue; } else if ("Enable".EndsWith(field.Name)) { table.Add(field.Name, Convert.ToString(field.GetValue(info)).ToLower()); } else { table.Add(field.Name, Convert.ToString(field.GetValue(info))); } } platformConfigs.Add(platformId, table); } #if UNITY_ANDROID shareSDKUtils = new AndroidImpl(gameObject); #elif UNITY_IPHONE shareSDKUtils = new iOSImpl(gameObject); #endif shareSDKUtils.InitSDK(appKey); shareSDKUtils.SetPlatformConfig(platformConfigs); }