Ejemplo n.º 1
0
        //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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        // 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);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the platform config.
 /// </summary>
 public void SetPlatformConfig(Hashtable configInfo)
 {
     shareSDKUtils.SetPlatformConfig(configInfo);
 }
Ejemplo n.º 6
0
        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);
        }