Example #1
0
        private void _init()
        {
            if (shareSDKUtils == null)
            {
                Debug.Log("init shareSDKUtils gameObject=" + gameObject);
#if UNITY_ANDROID
                shareSDKUtils = new AndroidImpl(gameObject);
#elif UNITY_IPHONE
                shareSDKUtils = new iOSImpl(gameObject);
#endif
            }
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
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);
        }
Example #5
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);
        }
Example #6
0
        private void Awake()
        {
            if (Application.isEditor)
            {
                return;
            }
            MonoBehaviour.print("ShareSDK Awake");
            Type      type      = this.devInfo.GetType();
            Hashtable hashtable = new Hashtable();

            FieldInfo[] fields = type.GetFields();
            FieldInfo[] array  = fields;
            for (int i = 0; i < array.Length; i++)
            {
                FieldInfo   fieldInfo  = array[i];
                DevInfo     devInfo    = (DevInfo)fieldInfo.GetValue(this.devInfo);
                int         num        = (int)devInfo.GetType().GetField("type").GetValue(devInfo);
                FieldInfo[] fields2    = devInfo.GetType().GetFields();
                Hashtable   hashtable2 = new Hashtable();
                FieldInfo[] array2     = fields2;
                for (int j = 0; j < array2.Length; j++)
                {
                    FieldInfo fieldInfo2 = array2[j];
                    if (!"type".EndsWith(fieldInfo2.Name))
                    {
                        if ("Enable".EndsWith(fieldInfo2.Name) || "ShareByAppClient".EndsWith(fieldInfo2.Name) || "BypassApproval".EndsWith(fieldInfo2.Name))
                        {
                            hashtable2.Add(fieldInfo2.Name, Convert.ToString(fieldInfo2.GetValue(devInfo)).ToLower());
                        }
                        else
                        {
                            hashtable2.Add(fieldInfo2.Name, Convert.ToString(fieldInfo2.GetValue(devInfo)));
                        }
                    }
                }
                hashtable.Add(num, hashtable2);
            }
            this.shareSDKUtils = new AndroidImpl(base.gameObject);
            this.shareSDKUtils.InitSDK(this.appKey);
            this.shareSDKUtils.SetPlatformConfig(hashtable);
        }
Example #7
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);
        }