예제 #1
0
 void ShareResultHandler(int reqID, ResponseState state, PlatformType type, Hashtable result)
     
 {
     if (state == ResponseState.Success)
     {
         Debug.Log("---------------- share successfully - share result :");
         Debug.Log(ShareSDKMiniJSON.jsonEncode(result));
         EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state);
     }
     else if (state == ResponseState.Fail)
     {
         #if UNITY_ANDROID
         Debug.Log("fail! throwable stack = " + result["stack"] + "; error msg = " + result["msg"]);
         #elif UNITY_IPHONE
         Debug.Log("fail! error code = " + result["error_code"] + "; error msg = " + result["error_msg"]);
         #endif
         EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state);
     }
     else if (state == ResponseState.Cancel)
     {
         Debug.Log("cancel !");
         EventDispatcher.Instance.TriggerEvent("ShareSDKReceiveMessageEvent", state);
     }
         
 }
예제 #2
0
 private void Save()
 {
     try
     {
         var    files    = System.IO.Directory.GetFiles(Application.dataPath, "MOB.keypds", System.IO.SearchOption.AllDirectories);
         string filePath = files [0];
         if (File.Exists(filePath))
         {
             Hashtable datastore = new Hashtable();
             datastore["MobAppKey"]    = appKey;
             datastore["MobAppSecret"] = appSecret;
             var          json    = ShareSDKMiniJSON.jsonEncode(datastore);
             StreamWriter sWriter = new StreamWriter(filePath);
             sWriter.WriteLine(json);
             sWriter.Close();
             sWriter.Dispose();
         }
         else
         {
             Debug.LogWarning("MOB.keypds no find");
         }
     }
     catch (Exception e)
     {
         Debug.LogWarning("error");
         Debug.LogException(e);
     }
 }
예제 #3
0
        public override void SetPlatformConfig(Hashtable configs)
        {
            String json = ShareSDKMiniJSON.jsonEncode(configs);

            Debug.Log("AndroidImpl  ===>>>  SetPlatformConfig === " + json);
            if (ssdk != null)
            {
                ssdk.Call("setPlatformConfig", json);
            }
        }
예제 #4
0
        public Hashtable GetShareParams()
        {
            if (customizeShareParams.Count > 0)
            {
                shareParams["customizeShareParams"] = customizeShareParams;
            }
            String jsonStr = ShareSDKMiniJSON.jsonEncode(shareParams);

            Debug.Log("ParseShareParams  ===>>> " + jsonStr);
            return(shareParams);
        }
예제 #5
0
        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 = ShareSDKMiniJSON.jsonEncode(platTypesArr.ToArray());
            }
            __iosShareSDKOneKeyShare(reqID, platTypesStr, content.GetShareParamsStr(), _callbackObjectName);
        }
예제 #6
0
        public override void ShowPlatformListWithContentName(int reqId, string contentName, Hashtable customFields, PlatformType[] platforms, int x, int y)
        {
            String customFieldsStr = ShareSDKMiniJSON.jsonEncode(customFields);
            string platTypesStr    = null;

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

            __iosShareSDKShowShareMenuWithContentName(reqId, contentName, customFieldsStr, platTypesStr, x, y, _callbackObjectName);
        }
예제 #7
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)ShareSDKMiniJSON.jsonDecode(contents);
                if (datastore.ContainsKey("ShareSDKPlatforms"))
                {
                    datastore["ShareSDKPlatforms"] = enablePlatforms;
                }
                else
                {
                    datastore.Add("ShareSDKPlatforms", enablePlatforms);
                }
                var          json    = ShareSDKMiniJSON.jsonEncode(datastore);
                StreamWriter sWriter = new StreamWriter(filePath);
                sWriter.WriteLine(json);
                sWriter.Close();
                sWriter.Dispose();
            }
        }
예제 #8
0
        public override void SetPlatformConfig(Hashtable configs)
        {
            String json = ShareSDKMiniJSON.jsonEncode(configs);

            __iosShareSDKRegisterAppAndSetPltformsConfig(_appKey, json);
        }
예제 #9
0
        public override void ShowShareContentEditorWithContentName(int reqId, PlatformType platform, string contentName, Hashtable customFields)
        {
            String customFieldsStr = ShareSDKMiniJSON.jsonEncode(customFields);

            __iosShareSDKShowShareViewWithContentName(reqId, (int)platform, contentName, customFieldsStr, _callbackObjectName);
        }
예제 #10
0
 public static string toJson(this Dictionary <string, string> obj)
 {
     return(ShareSDKMiniJSON.jsonEncode(obj));
 }
예제 #11
0
 public static string toJson(this Hashtable obj)
 {
     return(ShareSDKMiniJSON.jsonEncode(obj));
 }