Permalink
Browse files

修改Android桥接层;统一入口

  • Loading branch information...
U-UZ\litl U-UZ\litl
U-UZ\litl authored and U-UZ\litl committed Jun 13, 2017
1 parent 57876b5 commit 35be7007abb344ed88ba3e098850def0bd22ef12
Showing with 55 additions and 48 deletions.
  1. +1 −1 Android-Unity-Bridge/UnityBridge/AndroidManifest.xml
  2. +1 −0 Android-Unity-Bridge/UnityBridge/build.gradle
  3. +16 −1 Android-Unity-Bridge/UnityBridge/src/{main/java → }/com/mob/moblink/unity/ActionListener.java
  4. 0 Android-Unity-Bridge/UnityBridge/src/{main/java → }/com/mob/moblink/unity/RestoreSceneListener.java
  5. 0 Android-Unity-Bridge/UnityBridge/src/{main/java → }/com/mob/moblink/unity/UnityPlayerActivity.java
  6. +0 −12 Android-Unity-Bridge/UnityBridge/src/main/AndroidManifest.xml
  7. +1 −1 Android-Unity-Bridge/build.gradle
  8. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobCommons-2017.0418.1953.jar
  9. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobCommons.jar
  10. +2 −2 ...nk/Assets/Plugins/Android/MobLink/libs/{MobCommons-2017.0418.1953.jar.meta → MobCommons.jar.meta}
  11. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobLink-1.1.0.jar
  12. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobLink-2.0.0.jar
  13. +2 −2 ...y3D-MobLink/Assets/Plugins/Android/MobLink/libs/{MobLink-1.1.0.jar.meta → MobLink-2.0.0.jar.meta}
  14. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobLink-Unity.jar
  15. +1 −1 Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobLink-Unity.jar.meta
  16. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobTools-2017.0418.1953.jar
  17. BIN Unity3D-MobLink/Assets/Plugins/Android/MobLink/libs/MobTools.jar
  18. +2 −2 ...obLink/Assets/Plugins/Android/MobLink/libs/{MobTools-2017.0418.1953.jar.meta → MobTools.jar.meta}
  19. +2 −2 Unity3D-MobLink/Assets/Plugins/MobLink/Android/AndroidMobLinkImpl.cs
  20. +6 −19 Unity3D-MobLink/Assets/Plugins/MobLink/MobLink.cs
  21. BIN Unity3D-MobLink/Library/CurrentLayout.dwlt
  22. +16 −1 Unity3D-MobLink/Library/LastSceneManagerSetup.txt
  23. BIN Unity3D-MobLink/Library/ProjectSettings.asset
  24. BIN Unity3D-MobLink/Library/expandedItems
  25. +5 −4 Unity3D-MobLink/Unity3D-MobLink.userprefs
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mob.moblink"
package="com.mob.moblink.unity"
android:versionCode="200"
android:versionName="2.0.0" >
@@ -48,4 +48,5 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':MobLink')
}
@@ -15,6 +15,14 @@
* <li>method 是回调函数名, 注意此函数签名与 UnitySendMessage中传递的函数签名一致</li>
* <li>回调的参数是json字符串</li>
* </ul>
*
* 鉴于与ios平台保持入口一致, 约定统一返回一致数据结构, 如下所示:<br/>
* <pre>
* { "mobid" : "abc",
* "result" : 0/1,
* "errorMsg" : "xxx";}
* </pre>
*
*/
public class ActionListener extends Object implements com.mob.moblink.ActionListener {
private String gameObjectName;
@@ -36,14 +44,21 @@ public ActionListener(String goName, String successMethod, String failMethod) {
@Override
public void onResult(HashMap<String, Object> params) {
params.put("mobid", params.remove("mobID"));
params.put("result", 1);
params.put("errorMsg", "");
JSONObject json = new JSONObject(params);
String value = json.toString();
UnitySendMessage(gameObjectName, callbackSuccessMethod, value);
}
@Override
public void onError(Throwable t) {
JSONObject json = new JSONObject();
HashMap<String, Object> params = new HashMap<String, Object>();
params.put("mobid", "");
params.put("result", 0);
params.put("errorMsg", t.toString());
JSONObject json = new JSONObject(params);
String value = json.toString();
UnitySendMessage(gameObjectName, callbackFailMethod, value);
}

This file was deleted.

Oops, something went wrong.
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -9,8 +9,8 @@ namespace com.moblink.unity3d
public class AndroidMobLinkImpl : MobLinkImpl {
public const string MOB_GAMEOBJECT_NAME = "MobLink";
public const string MOB_GETMOBID_CALLBACK_SUCCESS_METHOD = "_MobIdCallbackSuccess";
public const string MOB_GETMOBID_CALLBACK_FAIL_METHOD = "_MobIdCallbackFail";
public const string MOB_GETMOBID_CALLBACK_SUCCESS_METHOD = "_MobIdCallback";
public const string MOB_GETMOBID_CALLBACK_FAIL_METHOD = "_MobIdCallback";
public const string MOB_RESTORE_CALLBACK_METHOD = "_RestoreCallBack";
public override void setRestoreSceneListener ()
@@ -75,9 +75,13 @@ public static void getMobId(MobLinkScene scene, GetMobIdHandler modIdHandler)
moblinkUtils.GetMobId(scene);
}
private void _MobIdCallback (string mobid)
private void _MobIdCallback (string data)
{
onGetMobId (mobid);
// 解析出mobId
Hashtable json = (Hashtable) MiniJSON.jsonDecode(data);
string modId = json["mobID"].ToString();
onGetMobId (modId);
onGetMobId = null;
}
@@ -97,23 +101,6 @@ private void _RestoreCallBack (string data)
MobLinkScene scene = new MobLinkScene (path, source, customParams);
onRestoreScene (scene);
}
private void _MobIdCallbackFromAndroid(string data)
{
Hashtable json = (Hashtable) MiniJSON.jsonDecode(data);
}
private void _MobIdCallbackSuccess(string data)
{
Hashtable json = (Hashtable) MiniJSON.jsonDecode(data);
string modId = json["mobID"].ToString();
_MobIdCallback (modId);
}
private void _MobIdCallbackFail(string data)
{
onGetMobId = null;
}
}
}
Binary file not shown.
@@ -1 +1,16 @@
sceneSetups: []
sceneSetups:
- path: Assets/Demo.unity
isLoaded: 1
isActive: 1
- path: Assets/SceneA.unity
isLoaded: 1
isActive: 0
- path: Assets/SceneB.unity
isLoaded: 1
isActive: 0
- path: Assets/SceneC.unity
isLoaded: 1
isActive: 0
- path: Assets/SceneD.unity
isLoaded: 1
isActive: 0
View
Binary file not shown.
View
Binary file not shown.
@@ -3,18 +3,19 @@
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Plugins\MobLink\MobLink.cs">
<Files>
<File FileName="Assets\Demo\InnerScene.cs" Line="1" Column="1" />
<File FileName="Assets\Plugins\MobLink\MobLink.cs" Line="109" Column="43" />
<File FileName="Assets\Plugins\MobLink\MobLinkImpl.cs" Line="10" Column="48" />
<File FileName="Assets\Plugins\MobLink\Android\AndroidMobLinkImpl.cs" Line="75" Column="75" />
<File FileName="Assets\Plugins\MobLink\MobLink.cs" Line="46" Column="1" />
<File FileName="Assets\Plugins\MobLink\MobLinkImpl.cs" Line="1" Column="1" />
<File FileName="Assets\Plugins\MobLink\Android\AndroidMobLinkImpl.cs" Line="1" Column="1" />
<File FileName="Assets\Demo\Demo.cs" Line="1" Column="1" />
<File FileName="Assets\Plugins\MobLink\MobLinkConfig.cs" Line="1" Column="1" />
<File FileName="Assets\MobLinkAutoPackage\Editor\SDKPorter\MobLinkPostProcessBuild.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore>
<Breakpoint file="D:\workspace\Unity-For-MobLink\Unity3D-MobLink\Assets\SceneA.cs" line="40" column="1" />
<Breakpoint file="D:\workspace\Unity-For-MobLink\Unity3D-MobLink\Assets\SceneA.cs" line="16" column="1" />
<Breakpoint file="D:\workspace\Unity-For-MobLink\Unity3D-MobLink\Assets\Demo.cs" line="144" column="1" />
<RunToCursorBreakpoint file="D:\workspace\Unity-For-MobLink\Unity3D-MobLink\Assets\Plugins\MobLink\Android\AndroidMobLinkImpl.cs" line="76" column="10" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />

0 comments on commit 35be700

Please sign in to comment.