Пример #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);
        }