public override void ShareContent(int reqID, PlatformType[] platforms, ShareContent content)
        {
            string platTypesStr = null;

            if (platforms != null)
            {
                List <int> platTypesArr = new List <int>();
                foreach (PlatformType type in platforms)
                {
                    platTypesArr.Add((int)type);
                }
                platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray());
            }
            __iosShareSDKOneKeyShare(reqID, platTypesStr, content.GetShareParamsStr(), _callbackObjectName);
        }
Beispiel #2
0
        public override void ShowShareMenu(int reqID, PlatformType[] platforms, Hashtable content, int x, int y)
        {
            string platTypesStr = null;

            if (platforms != null)
            {
                List <int> platTypesArr = new List <int>();
                foreach (PlatformType type in platforms)
                {
                    platTypesArr.Add((int)type);
                }
                platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray());
            }

            __iosShareSDKShowShareMenu(reqID, platTypesStr, MiniJSON.jsonEncode(content), x, y, _callbackObjectName);
        }
Beispiel #3
0
        public override void ShowPlatformListWithContentName(int reqId, string contentName, Hashtable customFields, PlatformType[] platforms, int x, int y)
        {
            String customFieldsStr = MiniJSON.jsonEncode(customFields);
            string platTypesStr    = null;

            if (platforms != null)
            {
                List <int> platTypesArr = new List <int>();
                foreach (PlatformType type in platforms)
                {
                    platTypesArr.Add((int)type);
                }
                platTypesStr = MiniJSON.jsonEncode(platTypesArr.ToArray());
            }

            __iosShareSDKShowShareMenuWithContentName(reqId, contentName, customFieldsStr, platTypesStr, x, y, _callbackObjectName);
        }
        private void checkRestoreScene(RestoreSceneConfigure restoreSceneConfig)
        {
            Hashtable enableRestoreScene = new Hashtable();

            if (restoreSceneConfig != null && restoreSceneConfig.Enable)
            {
                enableRestoreScene.Add("open", "1");
                if (restoreSceneConfig.capabilititesAssociatedDomain != null)
                {
                    enableRestoreScene.Add("Capabilitites_AssociatedDomain", restoreSceneConfig.capabilititesAssociatedDomain);
                    enableRestoreScene.Add("Capabilitites_EntitlementsPath", restoreSceneConfig.capabilititesEntitlementsPathInXcode);
                }
                else
                {
                    enableRestoreScene.Add("Capabilitites_AssociatedDomain", "");
                    enableRestoreScene.Add("Capabilitites_EntitlementsPath", "");
                }
            }

            var      files           = System.IO.Directory.GetFiles(Application.dataPath, "ShareSDK.mobpds", System.IO.SearchOption.AllDirectories);
            string   filePath        = files[0];
            FileInfo projectFileInfo = new FileInfo(filePath);

            if (projectFileInfo.Exists)
            {
                StreamReader sReader  = projectFileInfo.OpenText();
                string       contents = sReader.ReadToEnd();
                sReader.Close();
                sReader.Dispose();
                Hashtable datastore = (Hashtable)MiniJSON.jsonDecode(contents);
                if (datastore.ContainsKey("ShareSDKRestoreScene"))
                {
                    datastore["ShareSDKRestoreScene"] = enableRestoreScene;
                }
                else
                {
                    datastore.Add("ShareSDKRestoreScene", enableRestoreScene);
                }
                var          json    = MiniJSON.jsonEncode(datastore);
                StreamWriter sWriter = new StreamWriter(filePath);
                sWriter.WriteLine(json);
                sWriter.Close();
                sWriter.Dispose();
            }
        }
Beispiel #5
0
        //shareSDK
        private void checkPlatforms(DevInfoSet devInfo)
        {
            Type type = devInfo.GetType();

            FieldInfo[] devInfoFields   = type.GetFields();
            Hashtable   enablePlatforms = new Hashtable();

            foreach (FieldInfo devInfoField in devInfoFields)
            {
                DevInfo info = (DevInfo)devInfoField.GetValue(devInfo);
                if (info.Enable)
                {
                    int    platformId = (int)info.GetType().GetField("type").GetValue(info);
                    string appkey     = GetAPPKey(info, platformId);
                    enablePlatforms.Add(platformId, appkey);
                }
            }
            var      files           = System.IO.Directory.GetFiles(Application.dataPath, "ShareSDK.mobpds", System.IO.SearchOption.AllDirectories);
            string   filePath        = files [0];
            FileInfo projectFileInfo = new FileInfo(filePath);

            if (projectFileInfo.Exists)
            {
                StreamReader sReader  = projectFileInfo.OpenText();
                string       contents = sReader.ReadToEnd();
                sReader.Close();
                sReader.Dispose();
                Hashtable datastore = (Hashtable)MiniJSON.jsonDecode(contents);
                if (datastore.ContainsKey("ShareSDKPlatforms"))
                {
                    datastore["ShareSDKPlatforms"] = enablePlatforms;
                }
                else
                {
                    datastore.Add("ShareSDKPlatforms", enablePlatforms);
                }
                var          json    = MiniJSON.jsonEncode(datastore);
                StreamWriter sWriter = new StreamWriter(filePath);
                sWriter.WriteLine(json);
                sWriter.Close();
                sWriter.Dispose();
            }
        }
Beispiel #6
0
        public override void ShowShareContentEditorWithContentName(int reqId, PlatformType platform, string contentName, Hashtable customFields)
        {
            String customFieldsStr = MiniJSON.jsonEncode(customFields);

            __iosShareSDKShowShareViewWithContentName(reqId, (int)platform, contentName, customFieldsStr, _callbackObjectName);
        }
Beispiel #7
0
        public override void SetPlatformConfig(Hashtable configs)
        {
            String json = MiniJSON.jsonEncode(configs);

            __iosShareSDKRegisterAppAndSetPltformsConfig(_appKey, json);
        }
Beispiel #8
0
 public override void ShareContent(int reqID, PlatformType platform, Hashtable content)
 {
     __iosShareSDKShare(reqID, (int)platform, MiniJSON.jsonEncode(content), _callbackObjectName);
 }
        //shareSDK
        private void checkPlatforms(DevInfoSet devInfo)
        {
            Type type = devInfo.GetType();

            FieldInfo[] devInfoFields   = type.GetFields();
            Hashtable   enablePlatforms = new Hashtable();

            foreach (FieldInfo devInfoField in devInfoFields)
            {
                DevInfo info = (DevInfo)devInfoField.GetValue(devInfo);
                if (info.Enable)
                {
                    int    platformId = (int)info.GetType().GetField("type").GetValue(info);
                    string appkey     = GetAPPKey(info, platformId);
                    enablePlatforms.Add(platformId, appkey);

                    if (info.GetType().GetField("app_universalLink") != null)
                    {
                        string app_universalLink = GetValueByName(info, "app_universalLink");
                        if (app_universalLink != null && app_universalLink.Length > 0)
                        {
                            app_universalLink = app_universalLink.Trim().TrimEnd('/');

                            if (app_universalLink.Contains("://"))
                            {
                                string[] links = app_universalLink.Split(new[] { "://" }, StringSplitOptions.None);
                                app_universalLink = "applinks:" + links[1];
                                associatedDomains.Add(app_universalLink);
                            }
                            else
                            {
                                if (app_universalLink.Contains(":"))
                                {
                                    associatedDomains.Add(app_universalLink);
                                }
                                else
                                {
                                    app_universalLink = "applinks:" + app_universalLink;
                                    associatedDomains.Add(app_universalLink);
                                }
                            }
                        }
                    }
                }
            }
            var      files           = System.IO.Directory.GetFiles(Application.dataPath, "ShareSDK.mobpds", System.IO.SearchOption.AllDirectories);
            string   filePath        = files [0];
            FileInfo projectFileInfo = new FileInfo(filePath);

            if (projectFileInfo.Exists)
            {
                StreamReader sReader  = projectFileInfo.OpenText();
                string       contents = sReader.ReadToEnd();
                sReader.Close();
                sReader.Dispose();
                Hashtable datastore = (Hashtable)MiniJSON.jsonDecode(contents);
                if (datastore.ContainsKey("ShareSDKPlatforms"))
                {
                    datastore["ShareSDKPlatforms"] = enablePlatforms;
                }
                else
                {
                    datastore.Add("ShareSDKPlatforms", enablePlatforms);
                }

                //Debug.LogWarning("=======================");
                Debug.LogWarning(associatedDomains.ToArray());
                //if (associatedDomains.Count > 0)
                //{
                var associatedDomains_t = associatedDomains.Distinct();

                if (datastore.ContainsKey("AssociatedDomains"))
                {
                    datastore["AssociatedDomains"] = associatedDomains_t.ToArray();
                }
                else
                {
                    datastore.Add("AssociatedDomains", associatedDomains_t.ToArray());
                }
                //}


                var          json    = MiniJSON.jsonEncode(datastore);
                StreamWriter sWriter = new StreamWriter(filePath);
                sWriter.WriteLine(json);
                sWriter.Close();
                sWriter.Dispose();
            }
        }
Beispiel #10
0
        /// <summary>
        /// Raises the success event.
        /// </summary>
        /// <param name="platform">Platform.</param>
        /// <param name="action">Action.</param>
        /// <param name="res">Res.</param>
        public void OnComplete(int reqID, PlatformType platform, int action, Hashtable res)
        {
            Debug.Log("Oncomplete : reqID:" + reqID.ToString() + " platform: " + platform.ToString() + " action" + action.ToString() + " res:" + MiniJSON.jsonEncode(res));
            switch (action)
            {
            case 1:
            {             // 1 == Platform.ACTION_AUTHORIZING
                Debug.Log("登录函数回调!");
                if (authHandler != null)
                {
                    authHandler(reqID, ResponseState.Success, platform, res);
                }
                break;
            }

            case 2:
            {             //2 == Platform.ACTION_GETTING_FRIEND_LIST
                if (getFriendsHandler != null)
                {
                    getFriendsHandler(reqID, ResponseState.Success, platform, res);
                }
                break;
            }

            case 6:
            {             //6 == Platform.ACTION_FOLLOWING_USER
                if (followFriendHandler != null)
                {
                    followFriendHandler(reqID, ResponseState.Success, platform, res);
                }
                break;
            }

            case 8:
            {             // 8 == Platform.ACTION_USER_INFOR
                if (showUserHandler != null)
                {
                    showUserHandler(reqID, ResponseState.Success, platform, res);
                }
                break;
            }

            case 9:
            {             // 9 == Platform.ACTION_SHARE
                if (shareHandler != null)
                {
                    shareHandler(reqID, ResponseState.Success, platform, res);
                }
                break;
            }
            }
        }
 public static string toJson(this Dictionary <string, string> obj)
 {
     return(MiniJSON.jsonEncode(obj));
 }
 public static string toJson(this Hashtable obj)
 {
     return(MiniJSON.jsonEncode(obj));
 }
Beispiel #13
0
        /// <summary>
        /// Sets the platform config.
        /// </summary>
        /// <param name="platform">Platform.</param>
        /// <param name="configs">Configs.</param>
        public void setPlatformConfig(int platform, Hashtable configs)
        {
            String json = MiniJSON.jsonEncode(configs);

            ssdk.CallStatic("setPlatformConfig", platform, json);
        }