iOSImpl.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using UnityEngine;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace cn.sharesdk.unity3d
  7. {
  8. #if UNITY_IPHONE
  9. //public class iOSImpl : ShareSDKImpl
  10. //{
  11. //[DllImport("__Internal")]
  12. //private static extern void __iosShareSDKRegisterAppAndSetPltformsConfig (string appKey, string configInfo);
  13. //[DllImport("__Internal")]
  14. //private static extern void __iosShareSDKAuthorize (int reqID, int platType, string observer);
  15. //[DllImport("__Internal")]
  16. //private static extern void __iosShareSDKCancelAuthorize (int platType);
  17. //[DllImport("__Internal")]
  18. //private static extern bool __iosShareSDKHasAuthorized (int platType);
  19. //[DllImport("__Internal")]
  20. //private static extern void __iosShareSDKGetUserInfo (int reqID, int platType, string observer);
  21. //[DllImport("__Internal")]
  22. //private static extern void __iosShareSDKShare (int reqID, int platType, string content, string observer);
  23. //[DllImport("__Internal")]
  24. //private static extern void __iosShareSDKOneKeyShare (int reqID, string platTypes, string content, string observer);
  25. //[DllImport("__Internal")]
  26. //private static extern void __iosShareSDKShowShareMenu (int reqID, string platTypes, string content, int x, int y, string observer);
  27. //[DllImport("__Internal")]
  28. //private static extern void __iosShareSDKShowShareView (int reqID, int platType, string content, string observer);
  29. //[DllImport("__Internal")]
  30. //private static extern void __iosShareSDKGetFriendsList (int reqID, int platType,int count, int page, string observer);
  31. //[DllImport("__Internal")]
  32. //private static extern void __iosShareSDKFollowFriend (int reqID, int platform,string account, string observer);
  33. //[DllImport("__Internal")]
  34. //private static extern string __iosShareSDKGetCredential (int platType);
  35. //[DllImport("__Internal")]
  36. //private static extern bool __iosShareSDKIsClientInstalled (int platType);
  37. //[DllImport("__Internal")]
  38. //private static extern void __iosShareSDKShareWithContentName (int reqID, int platform, string contentName, string customFields, string observer);
  39. //[DllImport("__Internal")]
  40. //private static extern void __iosShareSDKShowShareMenuWithContentName (int reqID, string contentName, string customFields, string platTypes, int x, int y, string observer);
  41. //[DllImport("__Internal")]
  42. //private static extern void __iosShareSDKShowShareViewWithContentName (int reqID, int platform, string contentName, string customFields, string observer);
  43. //private string _callbackObjectName = "Main Camera";
  44. //private string _appKey;
  45. //public iOSImpl (GameObject go)
  46. //{
  47. // Debug.Log("iOSUtils ===>>> iOSUtils" );
  48. // try{
  49. // _callbackObjectName = go.name;
  50. // } catch(Exception e) {
  51. // Console.WriteLine("{0} Exception caught.", e);
  52. // }
  53. //}
  54. //public override void InitSDK (String appKey)
  55. //{
  56. // _appKey = appKey;
  57. //}
  58. //public override void SetPlatformConfig (Hashtable configs)
  59. //{
  60. // String json = ShareMiniJSON.jsonEncode(configs);
  61. // __iosShareSDKRegisterAppAndSetPltformsConfig (_appKey, json);
  62. //}
  63. //public override void Authorize(int reqID, PlatformType platform)
  64. //{
  65. // __iosShareSDKAuthorize (reqID, (int)platform, _callbackObjectName);
  66. //}
  67. //public override void CancelAuthorize (PlatformType platform)
  68. //{
  69. // __iosShareSDKCancelAuthorize ((int)platform);
  70. //}
  71. //public override bool IsAuthorized (PlatformType platform)
  72. //{
  73. // return __iosShareSDKHasAuthorized ((int)platform);
  74. //}
  75. //public override bool IsClientValid (PlatformType platform)
  76. //{
  77. // return __iosShareSDKIsClientInstalled ((int)platform);
  78. //}
  79. //public override void GetUserInfo (int reqID, PlatformType platform)
  80. //{
  81. // __iosShareSDKGetUserInfo (reqID, (int)platform, _callbackObjectName);
  82. //}
  83. //public override void ShareContent (int reqID, PlatformType platform, ShareContent content)
  84. //{
  85. // __iosShareSDKShare (reqID, (int)platform, content.GetShareParamsStr(), _callbackObjectName);
  86. //}
  87. //public override void ShareContent (int reqID, PlatformType[] platforms, ShareContent content)
  88. //{
  89. // string platTypesStr = null;
  90. // if (platforms != null)
  91. // {
  92. // List<int> platTypesArr = new List<int>();
  93. // foreach (PlatformType type in platforms)
  94. // {
  95. // platTypesArr.Add((int)type);
  96. // }
  97. // platTypesStr = ShareMiniJSON.jsonEncode(platTypesArr.ToArray());
  98. // }
  99. // __iosShareSDKOneKeyShare (reqID, platTypesStr, content.GetShareParamsStr(), _callbackObjectName);
  100. //}
  101. //public override void ShowPlatformList (int reqID, PlatformType[] platforms, ShareContent content, int x, int y)
  102. //{
  103. // string platTypesStr = null;
  104. // if (platforms != null)
  105. // {
  106. // List<int> platTypesArr = new List<int>();
  107. // foreach (PlatformType type in platforms)
  108. // {
  109. // platTypesArr.Add((int)type);
  110. // }
  111. // platTypesStr = ShareMiniJSON.jsonEncode(platTypesArr.ToArray());
  112. // }
  113. // __iosShareSDKShowShareMenu (reqID, platTypesStr, content.GetShareParamsStr(), x, y, _callbackObjectName);
  114. //}
  115. //public override void ShowShareContentEditor (int reqID, PlatformType platform, ShareContent content)
  116. //{
  117. // __iosShareSDKShowShareView (reqID, (int)platform, content.GetShareParamsStr(), _callbackObjectName);
  118. //}
  119. //public override void ShareWithContentName (int reqId, PlatformType platform, string contentName, Hashtable customFields)
  120. //{
  121. // String customFieldsStr = ShareMiniJSON.jsonEncode(customFields);
  122. // __iosShareSDKShareWithContentName (reqId, (int)platform, contentName, customFieldsStr, _callbackObjectName);
  123. //}
  124. //public override void ShowPlatformListWithContentName (int reqId, string contentName, Hashtable customFields, PlatformType[] platforms, int x, int y)
  125. //{
  126. // String customFieldsStr = ShareMiniJSON.jsonEncode(customFields);
  127. // string platTypesStr = null;
  128. // if (platforms != null)
  129. // {
  130. // List<int> platTypesArr = new List<int>();
  131. // foreach (PlatformType type in platforms)
  132. // {
  133. // platTypesArr.Add((int)type);
  134. // }
  135. // platTypesStr = ShareMiniJSON.jsonEncode(platTypesArr.ToArray());
  136. // }
  137. // __iosShareSDKShowShareMenuWithContentName (reqId, contentName, customFieldsStr, platTypesStr, x, y, _callbackObjectName);
  138. //}
  139. //public override void ShowShareContentEditorWithContentName (int reqId, PlatformType platform, string contentName, Hashtable customFields)
  140. //{
  141. // String customFieldsStr = ShareMiniJSON.jsonEncode(customFields);
  142. // __iosShareSDKShowShareViewWithContentName (reqId, (int)platform, contentName, customFieldsStr, _callbackObjectName);
  143. //}
  144. //public override void GetFriendList (int reqID, PlatformType platform, int count, int page)
  145. //{
  146. // __iosShareSDKGetFriendsList (reqID, (int)platform, count, page, _callbackObjectName);
  147. //}
  148. //public override void AddFriend (int reqID, PlatformType platform, String account)
  149. //{
  150. // __iosShareSDKFollowFriend (reqID, (int)platform, account, _callbackObjectName);
  151. //}
  152. //public override Hashtable GetAuthInfo (PlatformType platform)
  153. //{
  154. // //need modify,
  155. // string credStr = __iosShareSDKGetCredential((int)platform);
  156. // Hashtable authInfo = (Hashtable)ShareMiniJSON.jsonDecode (credStr);
  157. // return authInfo;
  158. //}
  159. //public override void DisableSSO (Boolean open)
  160. //{
  161. // // no this interface on iOS
  162. // Console.WriteLine ("#waring : no this interface on iOS");
  163. //}
  164. //}
  165. #endif
  166. }