同步
This commit is contained in:
@@ -13,6 +13,7 @@ LOCAL_CFLAGS := \
|
||||
-DANDROID_ARM_NEON=TRUE \
|
||||
-DANDROID_STL=c++_shared \
|
||||
-DANDROID_TOOLCHAIN=clang \
|
||||
-DAL_ALEXT_PROTOTYPES \
|
||||
-frtti
|
||||
|
||||
LOCAL_CPPFLAGS += -std=c++11
|
||||
@@ -75,28 +76,6 @@ LOCAL_SRC_FILES := \
|
||||
../../../../source/common/resource/JCFileResManager.cpp \
|
||||
../../../../source/common/resource/JCResManager.cpp \
|
||||
../../../../source/common/resource/JCResource.cpp \
|
||||
../../../../source/common/OpenAL/OpenAL32/alAuxEffectSlot.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alBuffer.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alDatabuffer.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alEffect.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alError.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alExtension.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alFilter.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alListener.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alSource.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alState.c \
|
||||
../../../../source/common/OpenAL/OpenAL32/alThunk.c \
|
||||
../../../../source/common/OpenAL/Alc/ALc.c \
|
||||
../../../../source/common/OpenAL/Alc/alcConfig.c \
|
||||
../../../../source/common/OpenAL/Alc/alcEcho.c \
|
||||
../../../../source/common/OpenAL/Alc/alcModulator.c \
|
||||
../../../../source/common/OpenAL/Alc/alcReverb.c \
|
||||
../../../../source/common/OpenAL/Alc/alcRing.c \
|
||||
../../../../source/common/OpenAL/Alc/alcThread.c \
|
||||
../../../../source/common/OpenAL/Alc/ALu.c \
|
||||
../../../../source/common/OpenAL/Alc/android.c \
|
||||
../../../../source/common/OpenAL/Alc/bs2b.c \
|
||||
../../../../source/common/OpenAL/Alc/null.c \
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := ../../../../../ThirdParty/curl/include/android \
|
||||
@@ -106,8 +85,7 @@ LOCAL_C_INCLUDES := ../../../../../ThirdParty/curl/include/android \
|
||||
../../../../../ThirdParty/zip/include/android \
|
||||
../../../../../ThirdParty/ogg/include/android \
|
||||
../../../../../ThirdParty/zlib/include/android \
|
||||
../../../../source/common/OpenAL/include \
|
||||
../../../../source/common/OpenAL/OpenAL32/Include \
|
||||
../../../../../ThirdParty/openal/include/android \
|
||||
../../../../source/common/glm \
|
||||
|
||||
#LOCAL_IS64:=32
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;GLM_FORCE_DEPTH_ZERO_TO_ONE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\ThirdParty\curl\include\win32;..\..\..\..\ThirdParty\angle\include;..\..\..\..\ThirdParty\png\include\win32;..\..\..\..\ThirdParty\jpeg\include\win32;..\..\..\..\ThirdParty\zlib\include\win32;..\..\..\..\ThirdParty\freetype\include\win32;..\..\..\..\ThirdParty\zip\include\win32;..\..\..\..\ThirdParty\openal\include;..\..\..\..\ThirdParty\ogg\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\ThirdParty\curl\include\win32;..\..\..\..\ThirdParty\angle\include;..\..\..\..\ThirdParty\png\include\win32;..\..\..\..\ThirdParty\jpeg\include\win32;..\..\..\..\ThirdParty\zlib\include\win32;..\..\..\..\ThirdParty\freetype\include\win32;..\..\..\..\ThirdParty\zip\include\win32;..\..\..\..\ThirdParty\openal\include\win32;..\..\..\..\ThirdParty\ogg\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
IsHandleUpdateAPK=1
|
||||
ApkUpdateUrl=https://www.layabox.com/layanative2.0/apk/update/conch-layaair/version.xml
|
||||
UpdateDownloadPath=mnt/sdcard
|
||||
UpdateAPKFileName=autoupdate.apk
|
||||
CheckNetwork=1
|
||||
ThreadMode=2
|
||||
JSDebugPort=5959
|
||||
|
||||
+1
-16
@@ -41,7 +41,6 @@ import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import layaair.autoupdateversion.AutoUpdateAPK;
|
||||
import layaair.game.conch.ILayaEventListener;
|
||||
import layaair.game.conch.LayaConch5;
|
||||
import layaair.game.config.config;
|
||||
@@ -257,20 +256,7 @@ public class LayaWrapper implements ILayaLibWrapper{
|
||||
public void checkApkUpdate( Context context,final ValueCallback<Integer> callback)
|
||||
{
|
||||
if (isOpenNetwork(context)) {
|
||||
// 自动版本更新
|
||||
if ( "0".equals(config.GetInstance().getProperty("IsHandleUpdateAPK","0")) == false && ContextCompat.checkSelfPermission(ms_layaMainActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||
Log.e("0", "==============Java流程 checkApkUpdate");
|
||||
new AutoUpdateAPK(context, new ValueCallback<Integer>() {
|
||||
@Override
|
||||
public void onReceiveValue(Integer integer) {
|
||||
Log.e("",">>>>>>>>>>>>>>>>>>");
|
||||
callback.onReceiveValue(integer);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.e("0", "==============Java流程 checkApkUpdate 不需要自己管理update");
|
||||
callback.onReceiveValue(1);
|
||||
}
|
||||
callback.onReceiveValue(1);
|
||||
} else {
|
||||
settingNetwork(context,1);
|
||||
}
|
||||
@@ -489,7 +475,6 @@ public class LayaWrapper implements ILayaLibWrapper{
|
||||
|
||||
private static void DelInstance()
|
||||
{
|
||||
AutoUpdateAPK.DelInstance();
|
||||
m_pEngine=null;
|
||||
m_LayaEngineContext=null;
|
||||
ms_layaEngine=null;
|
||||
|
||||
+4
-1
@@ -37,7 +37,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
// ------------------------------------------------------------------------------
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (!isTaskRoot()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
JSBridge.mMainActivity = this;
|
||||
mSplashDialog = new SplashDialog(this);
|
||||
mSplashDialog.showSplash();
|
||||
|
||||
@@ -480,11 +480,11 @@ class MouseEvent extends UIEvent {
|
||||
}
|
||||
var _lbMouseEvent = window['MouseEvent'] = MouseEvent;
|
||||
class MouseWheelEvent extends MouseEvent {
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
constructor() {
|
||||
super("mousewheel");
|
||||
}
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
}
|
||||
class WheelEvent extends MouseEvent {
|
||||
constructor(typeArg, eventInitDict) {
|
||||
@@ -962,8 +962,6 @@ var _lbKeyboardEvent = window["KeyboardEvent"] = KeyboardEvent;
|
||||
});
|
||||
})(window.document);
|
||||
class Navigator {
|
||||
constructor() {
|
||||
}
|
||||
get appName() { return 'Netscape'; }
|
||||
get appVersion() { return this.userAgent; }
|
||||
;
|
||||
@@ -992,6 +990,8 @@ class Navigator {
|
||||
get language() { return 'zh-CN'; }
|
||||
;
|
||||
get userLanguage() { return 'zh-CN'; }
|
||||
constructor() {
|
||||
}
|
||||
getGamepads() {
|
||||
return null;
|
||||
}
|
||||
@@ -6310,10 +6310,6 @@ class HTMLMediaElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
class HTMLMetaElement extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
get httpEquiv() {
|
||||
return this["http-equiv"];
|
||||
}
|
||||
@@ -6325,6 +6321,10 @@ class HTMLMetaElement extends HTMLElement {
|
||||
get name() {
|
||||
return this._name;
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
}
|
||||
class HTMLAudioElement extends HTMLMediaElement {
|
||||
constructor() {
|
||||
@@ -6895,6 +6895,9 @@ class _jsXmlAttr {
|
||||
}
|
||||
}
|
||||
class _jsXmlNode extends _jsXmlAttr {
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
constructor() {
|
||||
super("", "");
|
||||
this.childNodes = [];
|
||||
@@ -6903,9 +6906,6 @@ class _jsXmlNode extends _jsXmlAttr {
|
||||
};
|
||||
this.attributes = [];
|
||||
}
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
getElementsByTagName(name) {
|
||||
var result = [];
|
||||
if (this.nodeName == name)
|
||||
@@ -7026,6 +7026,11 @@ Object.defineProperty(window, 'onerror', { set: function (fun) {
|
||||
}, get: function () {
|
||||
return conch.__onerror;
|
||||
} });
|
||||
Object.defineProperty(window, 'onunhandledrejection', { set: function (fun) {
|
||||
conch.onunhandledrejection = fun;
|
||||
}, get: function () {
|
||||
return conch.onunhandledrejection;
|
||||
} });
|
||||
var document = window.document;
|
||||
var addEventListener = window.addEventListener.bind(this);
|
||||
var dispatchEvent = window.dispatchEvent.bind(this);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ LOCAL_CFLAGS := \
|
||||
-DANDROID_TOOLCHAIN=clang \
|
||||
-fno-rtti \
|
||||
-DJS_V8_DEBUGGER \
|
||||
-DAL_ALEXT_PROTOTYPES \
|
||||
|
||||
LOCAL_CPPFLAGS += -std=c++11
|
||||
ifeq ($(APP_PERFTEST),1)
|
||||
@@ -65,6 +66,7 @@ LOCAL_SRC_FILES := \
|
||||
../../../../source/conch/JSWrapper/LayaWrap/JSShaderPrecisionFormat.cpp \
|
||||
../../../../source/conch/JSWrapper/LayaWrap/JSCallbackFuncObj.cpp \
|
||||
../../../../source/conch/JSWrapper/LayaWrap/JSWebGLPlus.cpp \
|
||||
../../../../source/conch/JSWrapper/LayaWrap/JSPromiseRejectionEvent.cpp \
|
||||
../../../../source/conch/Audio/android/JCAudioMp3Media.cpp \
|
||||
../../../../source/conch/Audio/JCAudioManager.cpp \
|
||||
../../../../source/conch/WebSocket/WebSocket.cpp \
|
||||
@@ -92,8 +94,7 @@ LOCAL_C_INCLUDES := ../../../../../ThirdParty/curl/include/android \
|
||||
../../../../../ThirdParty/ogg/include/android \
|
||||
../../../../../ThirdParty/websockets/include/android \
|
||||
../../../../../ThirdParty/openssl/include/android \
|
||||
../../../../include/common/OpenAL/include \
|
||||
../../../../include/common/OpenAL/OpenAL32/Include \
|
||||
../../../../../ThirdParty/openal/include/android \
|
||||
../../../../include/common \
|
||||
../../../../include/render \
|
||||
../../../../include/webglPlus \
|
||||
@@ -107,7 +108,7 @@ else ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_IS64:=x86
|
||||
endif
|
||||
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||
LOCAL_LDLIBS := -llog -lGLESv3 -landroid -ljnigraphics -lm -lz -lc++ \
|
||||
LOCAL_LDLIBS := -lOpenSLES -llog -lGLESv3 -landroid -ljnigraphics -lm -lz -lc++ \
|
||||
../../../../libs/android-$(LOCAL_IS64)/librender.a \
|
||||
../../../../libs/android-$(LOCAL_IS64)/libcommon.a \
|
||||
../../../../../ThirdParty/curl/lib/android-$(LOCAL_IS64)/libcurl.a \
|
||||
@@ -126,6 +127,7 @@ LOCAL_LDLIBS := -llog -lGLESv3 -landroid -ljnigraphics -lm -lz -lc++ \
|
||||
../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libBulletDynamics.a \
|
||||
../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libBulletCollision.a \
|
||||
../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libLinearMath.a \
|
||||
../../../../../ThirdParty/openal/lib/android-$(LOCAL_IS64)/libopenal.a \
|
||||
# ../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libBullet2FileLoader.a \
|
||||
# ../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libBullet3Collision.a \
|
||||
# ../../../../../ThirdParty/bullet/lib/android-$(LOCAL_IS64)/libBullet3Common.a \
|
||||
|
||||
@@ -480,11 +480,11 @@ class MouseEvent extends UIEvent {
|
||||
}
|
||||
var _lbMouseEvent = window['MouseEvent'] = MouseEvent;
|
||||
class MouseWheelEvent extends MouseEvent {
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
constructor() {
|
||||
super("mousewheel");
|
||||
}
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
}
|
||||
class WheelEvent extends MouseEvent {
|
||||
constructor(typeArg, eventInitDict) {
|
||||
@@ -962,8 +962,6 @@ var _lbKeyboardEvent = window["KeyboardEvent"] = KeyboardEvent;
|
||||
});
|
||||
})(window.document);
|
||||
class Navigator {
|
||||
constructor() {
|
||||
}
|
||||
get appName() { return 'Netscape'; }
|
||||
get appVersion() { return this.userAgent; }
|
||||
;
|
||||
@@ -992,6 +990,8 @@ class Navigator {
|
||||
get language() { return 'zh-CN'; }
|
||||
;
|
||||
get userLanguage() { return 'zh-CN'; }
|
||||
constructor() {
|
||||
}
|
||||
getGamepads() {
|
||||
return null;
|
||||
}
|
||||
@@ -6310,10 +6310,6 @@ class HTMLMediaElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
class HTMLMetaElement extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
get httpEquiv() {
|
||||
return this["http-equiv"];
|
||||
}
|
||||
@@ -6325,6 +6321,10 @@ class HTMLMetaElement extends HTMLElement {
|
||||
get name() {
|
||||
return this._name;
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
}
|
||||
class HTMLAudioElement extends HTMLMediaElement {
|
||||
constructor() {
|
||||
@@ -6895,6 +6895,9 @@ class _jsXmlAttr {
|
||||
}
|
||||
}
|
||||
class _jsXmlNode extends _jsXmlAttr {
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
constructor() {
|
||||
super("", "");
|
||||
this.childNodes = [];
|
||||
@@ -6903,9 +6906,6 @@ class _jsXmlNode extends _jsXmlAttr {
|
||||
};
|
||||
this.attributes = [];
|
||||
}
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
getElementsByTagName(name) {
|
||||
var result = [];
|
||||
if (this.nodeName == name)
|
||||
@@ -7026,6 +7026,11 @@ Object.defineProperty(window, 'onerror', { set: function (fun) {
|
||||
}, get: function () {
|
||||
return conch.__onerror;
|
||||
} });
|
||||
Object.defineProperty(window, 'onunhandledrejection', { set: function (fun) {
|
||||
conch.onunhandledrejection = fun;
|
||||
}, get: function () {
|
||||
return conch.onunhandledrejection;
|
||||
} });
|
||||
var document = window.document;
|
||||
var addEventListener = window.addEventListener.bind(this);
|
||||
var dispatchEvent = window.dispatchEvent.bind(this);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_TEST_;WIN32;GL_GLEXT_PROTOTYPES;NDEBUG;_CONSOLE;JS_V8;V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR;_CRT_SECURE_NO_WARNINGS;OPENVG_STATIC_LIBRARY;GLM_FORCE_DEPTH_ZERO_TO_ONE;BT_USE_DOUBLE_PRECISION;JS_V8_DEBUGGER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\..\ThirdParty\angle\include;..\..\..\..\include\common;..\..\..\..\include\webglPlus;..\..\..\..\..\ThirdParty\v8_8.8\include;..\..\..\..\include\render;..\..\..\..\..\ThirdParty\zip\include\win32;..\..\..\..\..\ThirdParty\openal\include;..\..\..\..\..\ThirdParty\ogg\include\win32;..\..\..\..\..\ThirdParty\websockets\include\win32;..\..\..\..\include\msgpack\include;..\..\..\..\..\ThirdParty\freetype\include\win32;..\..\..\..\..\ThirdParty\zlib\include\win32;..\..\..\..\..\ThirdParty\openssl\include\win32;..\..\..\..\..\ThirdParty\bullet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\..\..\ThirdParty\angle\include;..\..\..\..\include\common;..\..\..\..\include\webglPlus;..\..\..\..\..\ThirdParty\v8_8.8\include;..\..\..\..\include\render;..\..\..\..\..\ThirdParty\zip\include\win32;..\..\..\..\..\ThirdParty\openal\include\win32;..\..\..\..\..\ThirdParty\ogg\include\win32;..\..\..\..\..\ThirdParty\websockets\include\win32;..\..\..\..\include\msgpack\include;..\..\..\..\..\ThirdParty\freetype\include\win32;..\..\..\..\..\ThirdParty\zlib\include\win32;..\..\..\..\..\ThirdParty\openssl\include\win32;..\..\..\..\..\ThirdParty\bullet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -135,7 +135,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\angle\lib\Release;..\..\..\..\..\ThirdParty\v8_8.8\lib\win-x86-release;..\..\..\..\..\ThirdParty\openal\libs\Win32;..\..\..\..\..\ThirdParty\curl\lib\win32;..\..\..\..\..\ThirdParty\freetype\lib\win32;..\..\..\..\..\ThirdParty\jpeg\lib\win32;..\..\..\..\..\ThirdParty\ogg\lib\win32;..\..\..\..\..\ThirdParty\openssl\lib\win32;..\..\..\..\..\ThirdParty\png\lib\win32;..\..\..\..\..\ThirdParty\websockets\lib\win32;..\..\..\..\..\ThirdParty\zip\lib\win32;..\..\..\..\..\ThirdParty\zlib\lib\win32;..\..\..\..\libs\win32;..\..\..\..\..\ThirdParty\bullet\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>..\..\..\..\..\ThirdParty\angle\lib\Release;..\..\..\..\..\ThirdParty\v8_8.8\lib\win-x86-release;..\..\..\..\..\ThirdParty\openal\lib\win32\Win32;..\..\..\..\..\ThirdParty\curl\lib\win32;..\..\..\..\..\ThirdParty\freetype\lib\win32;..\..\..\..\..\ThirdParty\jpeg\lib\win32;..\..\..\..\..\ThirdParty\ogg\lib\win32;..\..\..\..\..\ThirdParty\openssl\lib\win32;..\..\..\..\..\ThirdParty\png\lib\win32;..\..\..\..\..\ThirdParty\websockets\lib\win32;..\..\..\..\..\ThirdParty\zip\lib\win32;..\..\..\..\..\ThirdParty\zlib\lib\win32;..\..\..\..\libs\win32;..\..\..\..\..\ThirdParty\bullet\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>winmm.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;common.lib;render.lib;zlib.lib;libjpeg.lib;libpng.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;alut.lib;dsound.lib;OpenAL32.lib;imm32.lib;strmiids.lib;freetype.lib;websockets.lib;zip.lib;libcrypto.lib;libssl.lib;iphlpapi.lib;Bullet2FileLoader.lib;Bullet3Collision.lib;Bullet3Common.lib;Bullet3Dynamics.lib;Bullet3Geometry.lib;BulletCollision.lib;BulletDynamics.lib;BulletFileLoader.lib;BulletInverseDynamics.lib;BulletInverseDynamicsUtils.lib;BulletSoftBody.lib;BulletWorldImporter.lib;BulletXmlWorldImporter.lib;ConvexDecomposition.lib;GIMPACTUtils.lib;HACD.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -198,6 +198,7 @@
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSInput.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSLayaGL.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSNotify.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSPromiseRejectionEvent.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSRuntime.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSShaderActiveInfo.h" />
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSShaderPrecisionFormat.h" />
|
||||
@@ -261,6 +262,7 @@
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSInput.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSLayaGL.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSNotify.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSPromiseRejectionEvent.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSRuntime.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSShaderActiveInfo.cpp" />
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSShaderPrecisionFormat.cpp" />
|
||||
|
||||
@@ -221,9 +221,6 @@
|
||||
<ClInclude Include="..\..\..\..\source\conch\JCScriptRuntime.h">
|
||||
<Filter>Source Files\App</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\Bullet\JSbtBindHelper.h">
|
||||
<Filter>Source Files\JSWrapper\LayaWrap\Bullet</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\source\conch\Bridge\JCConchBridge.h">
|
||||
<Filter>Source Files\Bridge</Filter>
|
||||
</ClInclude>
|
||||
@@ -263,6 +260,9 @@
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSArrayBufferRef.h">
|
||||
<Filter>Source Files\JSWrapper\LayaWrap</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSPromiseRejectionEvent.h">
|
||||
<Filter>Source Files\JSWrapper\LayaWrap</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Conch6.cpp">
|
||||
@@ -475,5 +475,8 @@
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSArrayBufferRef.cpp">
|
||||
<Filter>Source Files\JSWrapper\LayaWrap</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\source\conch\JSWrapper\LayaWrap\JSPromiseRejectionEvent.cpp">
|
||||
<Filter>Source Files\JSWrapper\LayaWrap</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -20,6 +20,7 @@
|
||||
A247BC01237109FB009B1189 /* LayaBulletExportImp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A247BBFF237109FA009B1189 /* LayaBulletExportImp.cpp */; };
|
||||
A25F7B2F219AB6DC004FA571 /* IVideoRenderTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A25F7B2E219AB6DC004FA571 /* IVideoRenderTarget.m */; };
|
||||
A25F7B32219ABD4D004FA571 /* VideoOutputRenderTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = A25F7B31219ABD4D004FA571 /* VideoOutputRenderTarget.m */; };
|
||||
A263418F280821BC00FF7034 /* JSPromiseRejectionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A263418D280821BC00FF7034 /* JSPromiseRejectionEvent.cpp */; };
|
||||
A264F7C220C7DDC100D95F1B /* JSLayaGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A264F7C020C7DDC100D95F1B /* JSLayaGL.cpp */; };
|
||||
A270D73A2170FD8D000D994D /* JCConchBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A270D7392170FD8D000D994D /* JCConchBridge.cpp */; };
|
||||
A2729C9A1D20C51C00EC01E6 /* JSHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2729C981D20C51C00EC01E6 /* JSHistory.cpp */; };
|
||||
@@ -118,6 +119,8 @@
|
||||
A25F7B2E219AB6DC004FA571 /* IVideoRenderTarget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = IVideoRenderTarget.m; path = Video/IVideoRenderTarget.m; sourceTree = "<group>"; };
|
||||
A25F7B30219ABD2D004FA571 /* VideoOutputRenderTarget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VideoOutputRenderTarget.h; path = Video/VideoOutputRenderTarget.h; sourceTree = "<group>"; };
|
||||
A25F7B31219ABD4D004FA571 /* VideoOutputRenderTarget.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = VideoOutputRenderTarget.m; path = Video/VideoOutputRenderTarget.m; sourceTree = "<group>"; };
|
||||
A263418D280821BC00FF7034 /* JSPromiseRejectionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSPromiseRejectionEvent.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSPromiseRejectionEvent.cpp; sourceTree = "<group>"; };
|
||||
A263418E280821BC00FF7034 /* JSPromiseRejectionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSPromiseRejectionEvent.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSPromiseRejectionEvent.h; sourceTree = "<group>"; };
|
||||
A264F7BF20C7DDC000D95F1B /* JSLayaGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSLayaGL.h; path = ../../../../source/conch/JSWrapper/LayaWrap/JSLayaGL.h; sourceTree = "<group>"; };
|
||||
A264F7C020C7DDC100D95F1B /* JSLayaGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSLayaGL.cpp; path = ../../../../source/conch/JSWrapper/LayaWrap/JSLayaGL.cpp; sourceTree = "<group>"; };
|
||||
A270D7382170FD8D000D994D /* JCConchBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JCConchBridge.h; sourceTree = "<group>"; };
|
||||
@@ -443,6 +446,8 @@
|
||||
A2D119571D0BC959004C229D /* LayaWrap */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A263418D280821BC00FF7034 /* JSPromiseRejectionEvent.cpp */,
|
||||
A263418E280821BC00FF7034 /* JSPromiseRejectionEvent.h */,
|
||||
A2FBA93D2702BC7D00846E17 /* JSArrayBufferRef.cpp */,
|
||||
A2FBA93E2702BC7E00846E17 /* JSArrayBufferRef.h */,
|
||||
A2FBA93C2702BC7D00846E17 /* JSWebGLPlus.cpp */,
|
||||
@@ -653,6 +658,7 @@
|
||||
A2D119D71D0BCA70004C229D /* JSInput.cpp in Sources */,
|
||||
A2C56AC21C8ADAF2009DDC1D /* LayaNotifyManager.m in Sources */,
|
||||
A2C56AE11C8ADB5A009DDC1D /* CToObjectCIOS.mm in Sources */,
|
||||
A263418F280821BC00FF7034 /* JSPromiseRejectionEvent.cpp in Sources */,
|
||||
A2D119F81D0BFA31004C229D /* JSCBinder.cpp in Sources */,
|
||||
A2D119D01D0BCA70004C229D /* JSDOMParser.cpp in Sources */,
|
||||
A2FBA93A2702015300846E17 /* JSObjBase.cpp in Sources */,
|
||||
|
||||
@@ -458,7 +458,7 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
|
||||
if( nNum > 0 )
|
||||
{
|
||||
kIOSTouchPD.m_nCount = nNum;
|
||||
[self sendTouchEvent:kIOSTouch ratio:m_fRetinaValue offset:m_nGLViewOffset];
|
||||
[self sendTouchEvent:kIOSTouchPD ratio:m_fRetinaValue offset:m_nGLViewOffset];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -246,6 +246,8 @@ void parseFontFamilyAndBorder(const char* pData, std::vector<std::string>& fontF
|
||||
if (!pData)
|
||||
return;
|
||||
int len = strlen(pData);
|
||||
if (len <= 0)
|
||||
return;
|
||||
//当前数据,指向字符串的最末尾
|
||||
char* pDt =(char*)pData+len;
|
||||
char cdt = *(--pDt);
|
||||
|
||||
@@ -469,7 +469,8 @@ namespace laya
|
||||
}
|
||||
|
||||
bitmapData->m_nWidth = width + nBorderSize * 2;
|
||||
bitmapData->m_nHeight = height + nBorderSize * 2;;
|
||||
bitmapData->m_nHeight = height + nBorderSize * 2;
|
||||
|
||||
if (bitmapData->m_nHeight > MAX_CHAR_HEIGHT || bitmapData->m_nWidth > MAX_LINE_WIDTH)
|
||||
{
|
||||
infoVector.clear();
|
||||
@@ -533,7 +534,7 @@ namespace laya
|
||||
int g = (int)(nBG * fAlpha);
|
||||
int r = (int)(nBR * fAlpha);
|
||||
int pos = offset + x + currentInfo.datal + (y + currentInfo.datat) * bitmapData->m_nWidth;
|
||||
if (!pBuff[pos])
|
||||
if (pos < MAX_INT32_INDEX && !pBuff[pos])
|
||||
pBuff[pos] = ((int)bmpColor << 24) + (b << 16) + (g << 8) + r;
|
||||
}
|
||||
}
|
||||
@@ -553,7 +554,7 @@ namespace laya
|
||||
int alpha = (int)(currentInfo.pBmp[x + y*currentInfo.dataw]);
|
||||
float fAlpha = alpha / 255.0f;
|
||||
int nPos = (y + currentInfo.datat + nBorderSize) * bitmapData->m_nWidth + offset + x + nBorderSize + currentInfo.datal;
|
||||
if (alpha > 0)
|
||||
if (nPos < MAX_INT32_INDEX && alpha > 0)
|
||||
{
|
||||
int r = (int)(nTR * fAlpha + nBR * (1 - fAlpha));
|
||||
int g = (int)(nTG * fAlpha + nBG * (1 - fAlpha));
|
||||
@@ -571,7 +572,10 @@ namespace laya
|
||||
int nLineTop = currentInfo.nUnderlineTop + nBorderSize * 2;
|
||||
for (int y = 0; y < currentInfo.nUnderlineHeight; y++) {
|
||||
for (int x = 0; x < currentInfo.nTextWidth; x++) {
|
||||
pBuff[offset + x + (y + nLineTop) * bitmapData->m_nWidth] = *(int*)(pLineColor);
|
||||
int index = offset + x + (y + nLineTop) * bitmapData->m_nWidth;
|
||||
if (index < MAX_INT32_INDEX) {
|
||||
pBuff[index] = *(int*)(pLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nLineTop + currentInfo.nUnderlineHeight > currentInfo.nTextHeight)
|
||||
@@ -592,7 +596,10 @@ namespace laya
|
||||
int b = (int)(nTB * fAlpha);
|
||||
int g = (int)(nTG * fAlpha);
|
||||
int r = (int)(nTR * fAlpha);
|
||||
pBuff[offset + x + currentInfo.datal + (y + currentInfo.datat) * bitmapData->m_nWidth] = (a << 24) + (b << 16) + (g << 8) + r;
|
||||
int index = offset + x + currentInfo.datal + (y + currentInfo.datat) * bitmapData->m_nWidth;
|
||||
if (index < MAX_INT32_INDEX) {
|
||||
pBuff[index] = (a << 24) + (b << 16) + (g << 8) + r;
|
||||
}
|
||||
}
|
||||
}
|
||||
//下划线
|
||||
@@ -603,7 +610,10 @@ namespace laya
|
||||
std::swap(pLineColor[0], pLineColor[2]);
|
||||
for (int y = 0; y < currentInfo.nUnderlineHeight; y++) {
|
||||
for (int x = 0; x < currentInfo.nTextWidth; x++) {
|
||||
pBuff[offset + x + (y + currentInfo.nUnderlineTop) * bitmapData->m_nWidth] = *(int*)(pLineColor);
|
||||
int index = offset + x + (y + currentInfo.nUnderlineTop) * bitmapData->m_nWidth;
|
||||
if (index < MAX_INT32_INDEX) {
|
||||
pBuff[index] = *(int*)(pLineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentInfo.nUnderlineTop + currentInfo.nUnderlineHeight > currentInfo.nTextHeight)
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace laya
|
||||
const uint32_t MAX_CHAR_WIDTH = 512;
|
||||
const uint32_t MAX_CHAR_HEIGHT = 512;
|
||||
const uint32_t MAX_LINE_WIDTH = 2048;
|
||||
const uint32_t MAX_INT32_INDEX = MAX_CHAR_HEIGHT * MAX_LINE_WIDTH;
|
||||
class JCFreeTypeFontRender
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "JCWaveParser.h"
|
||||
#include "JCOggParser.h"
|
||||
#include "../JCFileResManager.h"
|
||||
#ifdef ANDROID
|
||||
#include "AL/alext.h"
|
||||
#endif
|
||||
//------------------------------------------------------------------------------
|
||||
namespace laya
|
||||
{
|
||||
@@ -273,6 +276,9 @@ void JCAudioWavPlayer::pause()
|
||||
{
|
||||
alSourcePause(m_pOpenALSource[i]->m_nOpenALSouceID);
|
||||
}
|
||||
#ifdef ANDROID
|
||||
alcDevicePauseSOFT(m_pDevice);
|
||||
#endif
|
||||
}
|
||||
void JCAudioWavPlayer::resume()
|
||||
{
|
||||
@@ -281,6 +287,9 @@ void JCAudioWavPlayer::resume()
|
||||
{
|
||||
alSourcePlay(m_pOpenALSource[i]->m_nOpenALSouceID);
|
||||
}
|
||||
#ifdef ANDROID
|
||||
alcDeviceResumeSOFT(m_pDevice);
|
||||
#endif
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void JCAudioWavPlayer::setAllVolume( float p_nVolume )
|
||||
|
||||
@@ -583,6 +583,10 @@ namespace laya
|
||||
std::string UrlEncode(const char* str)
|
||||
{
|
||||
std::string strTemp = "";
|
||||
if (str == NULL)
|
||||
{
|
||||
return strTemp;
|
||||
}
|
||||
size_t length = strlen(str);
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "JSWrapper/LayaWrap/JSLayaGL.h"
|
||||
#include <LayaGL/JCLayaGLDispatch.h>
|
||||
#include <webglplus/JCWebGLPlus.h>
|
||||
#include "JSWrapper/LayaWrap/JSPromiseRejectionEvent.h"
|
||||
#ifdef JS_V8
|
||||
#include "JSWrapper/v8debug/debug-agent.h"
|
||||
#endif
|
||||
@@ -205,11 +206,25 @@ namespace laya
|
||||
m_pAssetsRes = pAssetRes;
|
||||
m_pPoster = pThreadCmdSender;
|
||||
}
|
||||
static void onUnhandledRejection(JSValueAsParam pPromise, JSValueAsParam pReason, const char* type)
|
||||
{
|
||||
#ifdef JS_V8
|
||||
JSPromiseRejectionEvent* event = new JSPromiseRejectionEvent;
|
||||
event->setPromise(pPromise);
|
||||
event->setReason(pReason);
|
||||
event->setType(type);
|
||||
JCScriptRuntime::s_JSRT->m_pJSOnUnhandledRejectionFunction.Call(JSP_TO_JS(JSPromiseRejectionEvent*, event));
|
||||
#endif
|
||||
}
|
||||
void JCScriptRuntime::start(const char* pStartJS)
|
||||
{
|
||||
LOGI("Start js %s", pStartJS);
|
||||
if (pStartJS)m_strStartJS = pStartJS;
|
||||
#ifdef JS_V8
|
||||
m_pScriptThread->initialize(JCConch::s_pConch->m_nJSDebugPort, std::bind(&onUnhandledRejection, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
#else
|
||||
m_pScriptThread->initialize(JCConch::s_pConch->m_nJSDebugPort);
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
m_pScriptThread->setLoopFunc(std::bind(&JCScriptRuntime::onUpdate, this));
|
||||
#endif
|
||||
@@ -374,6 +389,7 @@ namespace laya
|
||||
m_pJSOnDrawFunction.Reset();
|
||||
m_bJSBulletGetWorldTransformHandle.Reset();
|
||||
m_bJSBulletSetWorldTransformHandle.Reset();
|
||||
m_pJSOnUnhandledRejectionFunction.Reset();
|
||||
#ifndef WIN32
|
||||
m_pCurEditBox = NULL;
|
||||
#endif
|
||||
|
||||
@@ -231,6 +231,7 @@ namespace laya
|
||||
JsObjHandle m_pJSOnceOtherEvtFuction; //注册一次的事件 如截屏
|
||||
JsObjHandle m_pJSNetworkEvtFunction; //网络事件的监听
|
||||
JsObjHandle m_pJSOnBackPressedFunction;
|
||||
JsObjHandle m_pJSOnUnhandledRejectionFunction;
|
||||
bool m_bJSOnBackPressedFunctionSet;
|
||||
JsObjHandle m_bJSBulletGetWorldTransformHandle;
|
||||
JsObjHandle m_bJSBulletSetWorldTransformHandle;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace laya
|
||||
|
||||
v8::Local<v8::ObjectTemplate> GetObjectTemplate(JsObjClassInfo* info);
|
||||
|
||||
void* m_data = nullptr;
|
||||
private:
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "util/Log.h"
|
||||
#include "JSCProxyTLS.h"
|
||||
#include "IsolateData.h"
|
||||
#include "JSCProxyTrnasfer.h"
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
@@ -57,8 +58,9 @@ namespace laya
|
||||
v8::V8::ShutdownPlatform();
|
||||
delete m_pPlatform;
|
||||
}
|
||||
void Javascript::init(int nPort)
|
||||
void Javascript::init(int nPort, std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char*)> func)
|
||||
{
|
||||
m_promiseRejectHandler = func;
|
||||
m_nListenPort = 0;
|
||||
if (nPort > 0 && nPort <0xFFFF)
|
||||
{
|
||||
@@ -69,6 +71,33 @@ namespace laya
|
||||
{
|
||||
|
||||
}
|
||||
static void PromiseRejectHandlerInMainThread(v8::PromiseRejectMessage data) {
|
||||
v8::Local<v8::Promise> promise = data.GetPromise();
|
||||
v8::Isolate* isolate = promise->GetIsolate();
|
||||
if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) {
|
||||
return;
|
||||
} else if (data.GetEvent() == v8::kPromiseRejectAfterResolved || data.GetEvent() == v8::kPromiseResolveAfterResolved) {
|
||||
// Ignore reject/resolve after resolved.
|
||||
return;
|
||||
}
|
||||
v8::Local<v8::Value> exception = data.GetValue();
|
||||
char* error_message = nullptr;
|
||||
v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception);
|
||||
if (!message.IsEmpty()) {
|
||||
if (message->Get().IsEmpty() || message->Get()->IsNull())
|
||||
error_message = "";
|
||||
error_message = __TransferToCpp<char*>::ToCpp(message->Get().As<v8::Value>());
|
||||
}
|
||||
|
||||
//std::string kBuf = "if(conch.onunhandledrejection){conch.onunhandledrejection('";
|
||||
//kBuf += UrlEncode(error_message != nullptr ? error_message : "");
|
||||
//kBuf += "');};";
|
||||
//__JSRun::Run(kBuf.c_str());
|
||||
IsolateData* pIsolateData = IsolateData::From(isolate);
|
||||
Javascript* pJavascript = (Javascript*)pIsolateData->m_data;
|
||||
pJavascript->m_promiseRejectHandler(data.GetPromise(), data.GetValue(), "unhandledrejection");
|
||||
}
|
||||
|
||||
void Javascript::initJSEngine()
|
||||
{
|
||||
v8::Isolate::CreateParams create_params;
|
||||
@@ -79,6 +108,8 @@ namespace laya
|
||||
v8::Local<v8::Context> context = v8::Context::New(m_pIsolate);
|
||||
m_context.Reset(m_pIsolate, context);
|
||||
m_IsolateData = new IsolateData(m_pIsolate, NULL);
|
||||
m_IsolateData->m_data = (void*)this;
|
||||
m_pIsolate->SetPromiseRejectCallback(PromiseRejectHandlerInMainThread);
|
||||
context->Enter();
|
||||
}
|
||||
void Javascript::uninitJSEngine()
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace laya
|
||||
|
||||
~Javascript();
|
||||
|
||||
void init(int nPort);
|
||||
void init(int nPort, std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char*)> func);
|
||||
|
||||
//在init之后,并且在js线程的情况下,可以添加js导出
|
||||
//执行一段脚本。并立即退出。
|
||||
@@ -63,6 +63,7 @@ namespace laya
|
||||
v8::Global<v8::Context> m_context;
|
||||
v8::Platform* m_pPlatform = NULL;
|
||||
IsolateData* m_IsolateData;
|
||||
std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char*)> m_promiseRejectHandler;
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +82,7 @@ namespace laya
|
||||
virtual void on(int nEvent, JCEventEmitter::EventHandler func, void* pInThread=0) = 0;
|
||||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void initialize(int nPort) = 0;
|
||||
virtual void initialize(int nPort, std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char* func)>) = 0;
|
||||
virtual void uninitialize() = 0;
|
||||
virtual void setLoopFunc(std::function<bool(void)> func) = 0;
|
||||
virtual void pushDbgFunc(std::function<void(void)> task) = 0;
|
||||
@@ -144,9 +145,9 @@ namespace laya
|
||||
{
|
||||
m_kWorker.stop();
|
||||
}
|
||||
void initialize(int nPort)
|
||||
void initialize(int nPort, std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char*)> func)
|
||||
{
|
||||
m_kJS.init(nPort);
|
||||
m_kJS.init(nPort, func);
|
||||
}
|
||||
void uninitialize()
|
||||
{
|
||||
@@ -254,10 +255,10 @@ namespace laya
|
||||
{
|
||||
m_kStopFunc.func(NULL);
|
||||
}
|
||||
void initialize(int nPort)
|
||||
void initialize(int nPort, std::function<void(v8::Local<v8::Value>, v8::Local<v8::Value>, const char*)> func)
|
||||
{
|
||||
clearFunc();
|
||||
m_kJS.init(nPort);
|
||||
m_kJS.init(nPort, func);
|
||||
m_kJS.initJSEngine();
|
||||
}
|
||||
void uninitialize()
|
||||
|
||||
@@ -334,11 +334,11 @@ namespace laya
|
||||
const char* JSConchConfig::getRuntimeVersion()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return "ios-conch6-release-2.12.2";
|
||||
return "ios-conch6-release-2.13.1";
|
||||
#elif ANDROID
|
||||
return "android-conch6-release-2.12.2";
|
||||
return "android-conch6-release-2.13.1";
|
||||
#elif WIN32
|
||||
return "window-conch6-release-2.12.2";
|
||||
return "window-conch6-release-2.13.1";
|
||||
#endif
|
||||
}
|
||||
const char* JSConchConfig::getAppVersion()
|
||||
@@ -350,7 +350,8 @@ namespace laya
|
||||
CToJavaBridge::JavaRet kRet;
|
||||
if (CToJavaBridge::GetInstance()->callMethod(CToJavaBridge::JavaClass.c_str(), "getAppVersion", kRet))
|
||||
{
|
||||
return CToJavaBridge::GetInstance()->getJavaString(kRet.pJNI, kRet.strRet).c_str();;
|
||||
m_sAppVersion = CToJavaBridge::GetInstance()->getJavaString(kRet.pJNI, kRet.strRet);
|
||||
return m_sAppVersion.c_str();
|
||||
}
|
||||
return "";
|
||||
#elif WIN32
|
||||
@@ -366,7 +367,8 @@ namespace laya
|
||||
CToJavaBridge::JavaRet kRet;
|
||||
if (CToJavaBridge::GetInstance()->callMethod(CToJavaBridge::JavaClass.c_str(), "getAppLocalVersion", kRet))
|
||||
{
|
||||
return CToJavaBridge::GetInstance()->getJavaString(kRet.pJNI, kRet.strRet).c_str();;
|
||||
m_sAppLocalVersion = CToJavaBridge::GetInstance()->getJavaString(kRet.pJNI, kRet.strRet);
|
||||
return m_sAppLocalVersion.c_str();
|
||||
}
|
||||
return "";
|
||||
#elif WIN32
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "Bullet/LayaBulletExport.h"
|
||||
#include "JSArrayBufferRef.h"
|
||||
#include "JSWebGLPlus.h"
|
||||
#include "JSPromiseRejectionEvent.h"
|
||||
extern int g_nInnerWidth ;
|
||||
extern int g_nInnerHeight ;
|
||||
extern bool g_bGLCanvasSizeChanged;
|
||||
@@ -206,6 +207,17 @@ namespace laya
|
||||
void setJoystickEvtFunc(JSValueAsParam pObj)
|
||||
{
|
||||
}
|
||||
void copy(const char* data)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#elif ANDROID
|
||||
std::string strBuffer = data;
|
||||
CToJavaBridge::JavaRet kRet;
|
||||
CToJavaBridge::GetInstance()->callMethod(CToJavaBridge::JavaClass.c_str(), "copy", strBuffer.c_str(), kRet);
|
||||
#elif __APPLE__
|
||||
#endif
|
||||
}
|
||||
|
||||
void evalJS(const char* p_sSource)
|
||||
{
|
||||
JSP_RUN_SCRIPT(p_sSource);
|
||||
@@ -444,6 +456,7 @@ namespace laya
|
||||
JSLayaGL::getInstance()->exportJS();
|
||||
JSShaderActiveInfo::exportJS();
|
||||
JSShaderPrecisionFormat::exportJS();
|
||||
JSPromiseRejectionEvent::exportJS();
|
||||
#ifdef WIN32
|
||||
JSWindowEditBox::exportJS();
|
||||
#elif ANDROID
|
||||
|
||||
@@ -393,6 +393,14 @@ namespace laya
|
||||
return JSWebGLPlus::getInstance()->updateArrayBufferRef(nID, bSyncToRender, pArrayBuffer);
|
||||
}*/
|
||||
|
||||
void JSRuntime::setOnUnhandledRejection(JSValueAsParam p_pFunction)
|
||||
{
|
||||
m_pScrpitRuntime->m_pJSOnUnhandledRejectionFunction.set(onunhandledrejection, this, p_pFunction);
|
||||
}
|
||||
JsValue JSRuntime::getOnUnhandledRejection()
|
||||
{
|
||||
return m_pScrpitRuntime->m_pJSOnUnhandledRejectionFunction.getJsObj();
|
||||
}
|
||||
void JSRuntime::exportJS()
|
||||
{
|
||||
JSP_GLOBAL_CLASS("conch", JSRuntime, this);
|
||||
@@ -430,6 +438,7 @@ namespace laya
|
||||
JSP_GLOBAL_ADD_METHOD("convertBitmapToPng", JSRuntime::convertBitmapToPng);
|
||||
JSP_GLOBAL_ADD_METHOD("convertBitmapToJpeg", JSRuntime::convertBitmapToJpeg);
|
||||
JSP_GLOBAL_ADD_METHOD("callWebviewJS", JSRuntime::callWebviewJS);
|
||||
JSP_GLOBAL_ADD_PROPERTY(onunhandledrejection, JSRuntime, getOnUnhandledRejection, setOnUnhandledRejection);
|
||||
//JSP_GLOBAL_ADD_METHOD("updateArrayBufferRef", JSRuntime::updateArrayBufferRef);
|
||||
JSP_GLOBAL_ADD_METHOD("exit", JSRuntime::exit);
|
||||
JSP_INSTALL_GLOBAL_CLASS("conch", JSRuntime, this );
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace laya
|
||||
public:
|
||||
enum
|
||||
{
|
||||
onframeid, ondrawid, onresizeid, ontouchevtid,ondevicemotionevtid, onkeyevtid, onmouseevtid, oninvalidglid,onotherevtid,onnetworkevt,onbackpressed,onblurid,onfocusid, bulletsetid, bulletgetid
|
||||
onframeid, ondrawid, onresizeid, ontouchevtid,ondevicemotionevtid, onkeyevtid, onmouseevtid, oninvalidglid,onotherevtid,onnetworkevt,onbackpressed,onblurid,onfocusid, bulletsetid, bulletgetid,onunhandledrejection,
|
||||
};
|
||||
|
||||
static JsObjClassInfo JSCLSINFO;
|
||||
@@ -79,6 +79,9 @@ namespace laya
|
||||
|
||||
void setSetWorldTransformFunction(JSValueAsParam p_pFunction);
|
||||
|
||||
void setOnUnhandledRejection(JSValueAsParam p_pFunction);
|
||||
|
||||
JsValue getOnUnhandledRejection();
|
||||
public:
|
||||
static JSRuntime* getInstance();
|
||||
|
||||
|
||||
@@ -154,12 +154,12 @@ namespace laya
|
||||
{
|
||||
LOGW("JSMemoryCanvas::measureText 没有设置FontInfo");
|
||||
JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("width"), JSValueMakeNumber(ctx, width), kJSPropertyAttributeNone, nullptr);
|
||||
//JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("height"), JSValueMakeNumber(ctx, height), kJSPropertyAttributeNone, nullptr);
|
||||
JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("height"), JSValueMakeNumber(ctx, height), kJSPropertyAttributeNone, nullptr);
|
||||
return obj;
|
||||
}
|
||||
m_pFreeTypeRender->measureChar(unicode, m_pCurrentFontInfo, width, height);
|
||||
JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("width"), JSValueMakeNumber(ctx, width), kJSPropertyAttributeNone, nullptr);
|
||||
//JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("height"), JSValueMakeNumber(ctx, height), kJSPropertyAttributeNone, nullptr);
|
||||
JSObjectSetProperty(ctx, obj, JSStringCreateWithUTF8CString("height"), JSValueMakeNumber(ctx, height), kJSPropertyAttributeNone, nullptr);
|
||||
#else
|
||||
Isolate* iso = Isolate::GetCurrent();
|
||||
Local<Context> context = iso->GetCurrentContext();
|
||||
@@ -169,12 +169,12 @@ namespace laya
|
||||
{
|
||||
LOGW("JSMemoryCanvas::measureText 没有设置FontInfo");
|
||||
obj->Set(context, String::NewFromUtf8(iso, "width").ToLocalChecked(), Number::New(iso, 0));
|
||||
//obj->Set(context, String::NewFromUtf8(iso, "height"), Number::New(iso, 0));
|
||||
obj->Set(context, String::NewFromUtf8(iso, "height").ToLocalChecked(), Number::New(iso, 0));
|
||||
return obj;
|
||||
}
|
||||
m_pFreeTypeRender->measureChar(unicode, m_pCurrentFontInfo, width, height);
|
||||
obj->Set(context, String::NewFromUtf8(iso, "width").ToLocalChecked(), Number::New(iso, width));
|
||||
//obj->Set(context, String::NewFromUtf8(iso, "height"), Number::New(iso, height));
|
||||
obj->Set(context, String::NewFromUtf8(iso, "height").ToLocalChecked(), Number::New(iso, height));
|
||||
#endif
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <thread>
|
||||
#include <stdlib.h>
|
||||
#include <downloadCache/JCFileSource.h>
|
||||
#include <algorithm>
|
||||
#ifdef ANDROID
|
||||
#include <downloadCache/JCAndroidFileSource.h>
|
||||
#elif __APPLE_
|
||||
@@ -27,11 +28,15 @@
|
||||
#ifdef WIN32
|
||||
#include <filesystem>
|
||||
namespace fs = std::experimental::filesystem::v1;
|
||||
#ifdef min
|
||||
#undef min
|
||||
#endif
|
||||
#else
|
||||
#include "fileSystem/JCFileSystem.h"
|
||||
#endif
|
||||
extern std::string gRedistPath;
|
||||
extern std::string gResourcePath;
|
||||
const uint32_t RX_BUFFER_SIZE = 65536;
|
||||
namespace laya{
|
||||
|
||||
std::string WebSocket::s_strProxy;
|
||||
@@ -266,7 +271,7 @@ bool WebSocket::init(const Delegate& delegate,
|
||||
char* name = new char[(*iter).length()+1];
|
||||
strcpy(name, (*iter).c_str());
|
||||
m_wsProtocols[i].name = name;
|
||||
m_wsProtocols[i].rx_buffer_size=65536;
|
||||
m_wsProtocols[i].rx_buffer_size = RX_BUFFER_SIZE;
|
||||
m_wsProtocols[i].callback = WebSocketCallbackWrapper::onSocketCallback;
|
||||
}
|
||||
}
|
||||
@@ -275,7 +280,7 @@ bool WebSocket::init(const Delegate& delegate,
|
||||
char* name = new char[20];
|
||||
strcpy(name, "default-protocol");
|
||||
m_wsProtocols[0].name = name;
|
||||
m_wsProtocols[0].rx_buffer_size=65536; //如果这里不设,则在android下当发送的数据很多的时候,会导致发送失败(返回0)
|
||||
m_wsProtocols[0].rx_buffer_size = RX_BUFFER_SIZE; //如果这里不设,则在android下当发送的数据很多的时候,会导致发送失败(返回0)
|
||||
//猎刃有时候打不到怪就是因为这个(抓包看到的是发送的为原始内容,同普通socket不知道为什么,可能无关?)
|
||||
m_wsProtocols[0].callback = WebSocketCallbackWrapper::onSocketCallback;
|
||||
}
|
||||
@@ -457,70 +462,97 @@ int WebSocket::onSocketCallback(
|
||||
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(*m_wsHelper->m_subThreadWsMessageQueueMutex);
|
||||
|
||||
std::list<WsMessage*>::iterator iter = m_wsHelper->m_subThreadWsMessageQueue->begin();
|
||||
|
||||
int bytesWrite = 0;
|
||||
for (; iter != m_wsHelper->m_subThreadWsMessageQueue->end(); )
|
||||
{
|
||||
WsMessage* subThreadMsg = *iter;
|
||||
|
||||
if ( WS_MSG_TO_SUBTRHEAD_SENDING_STRING == subThreadMsg->what
|
||||
|| WS_MSG_TO_SUBTRHEAD_SENDING_BINARY == subThreadMsg->what)
|
||||
{
|
||||
Data* data = (Data*)subThreadMsg->obj;
|
||||
do {
|
||||
std::lock_guard<std::mutex> lock(*m_wsHelper->m_subThreadWsMessageQueueMutex);
|
||||
|
||||
std::list<WsMessage *>::iterator iter = m_wsHelper->m_subThreadWsMessageQueue->begin();
|
||||
|
||||
int bytesWrite = 0;
|
||||
for (; iter != m_wsHelper->m_subThreadWsMessageQueue->end();) {
|
||||
WsMessage *subThreadMsg = *iter;
|
||||
|
||||
if (WS_MSG_TO_SUBTRHEAD_SENDING_STRING == subThreadMsg->what
|
||||
|| WS_MSG_TO_SUBTRHEAD_SENDING_BINARY == subThreadMsg->what) {
|
||||
Data *data = (Data *) subThreadMsg->obj;
|
||||
|
||||
uint32_t toWriteSize = std::min(RX_BUFFER_SIZE, data->getBytesLeft());
|
||||
unsigned char *buf = new unsigned char[LWS_SEND_BUFFER_PRE_PADDING
|
||||
+ toWriteSize];
|
||||
|
||||
memset(&buf[LWS_SEND_BUFFER_PRE_PADDING], 0, toWriteSize);
|
||||
memcpy((char *) &buf[LWS_SEND_BUFFER_PRE_PADDING], data->getPayload(),
|
||||
toWriteSize);
|
||||
|
||||
int writeProtocol;
|
||||
uint32_t bytesLeft = data->getBytesLeft();
|
||||
if (data->bytesWritten == 0) {
|
||||
if (WS_MSG_TO_SUBTRHEAD_SENDING_STRING == subThreadMsg->what) {
|
||||
writeProtocol = LWS_WRITE_TEXT;
|
||||
} else {
|
||||
writeProtocol = LWS_WRITE_BINARY;
|
||||
}
|
||||
if (data->len > RX_BUFFER_SIZE) {
|
||||
writeProtocol |= LWS_WRITE_NO_FIN;
|
||||
}
|
||||
} else {
|
||||
writeProtocol = LWS_WRITE_CONTINUATION;
|
||||
if (data->getBytesLeft() != toWriteSize) {
|
||||
writeProtocol |= LWS_WRITE_NO_FIN;
|
||||
}
|
||||
}
|
||||
|
||||
bytesWrite = lws_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING],
|
||||
toWriteSize,
|
||||
static_cast<lws_write_protocol>(writeProtocol));
|
||||
/*if (bytesWrite == 0) {
|
||||
//暂时无法发送,等会儿再试
|
||||
break;
|
||||
}
|
||||
if (bytesWrite == 0) {
|
||||
break;
|
||||
}*/
|
||||
if (bytesWrite < 0) {
|
||||
//发生错误了。
|
||||
LOGE("WebSocket::onSocketCallback libwebsocket_write error! ");
|
||||
LAYA_SAFE_DELETE_ARRAY(data->bytes);
|
||||
LAYA_SAFE_DELETE(data);
|
||||
LAYA_SAFE_DELETE_ARRAY(buf);
|
||||
break;
|
||||
}
|
||||
else if (bytesWrite < toWriteSize) {
|
||||
data->updateBytesWritten(bytesWrite);
|
||||
LAYA_SAFE_DELETE_ARRAY(buf);
|
||||
}
|
||||
else if (bytesLeft == bytesWrite) {
|
||||
LAYA_SAFE_DELETE_ARRAY(data->bytes);
|
||||
LAYA_SAFE_DELETE(data);
|
||||
LAYA_SAFE_DELETE_ARRAY(buf);
|
||||
|
||||
iter = m_wsHelper->m_subThreadWsMessageQueue->erase(iter);
|
||||
LAYA_SAFE_DELETE(subThreadMsg);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
data->updateBytesWritten(bytesWrite);
|
||||
LAYA_SAFE_DELETE_ARRAY(buf);
|
||||
}
|
||||
}
|
||||
//if (bytesWrite < data->len) {
|
||||
//}
|
||||
|
||||
|
||||
unsigned char* buf = new unsigned char[LWS_SEND_BUFFER_PRE_PADDING
|
||||
+ data->len + LWS_SEND_BUFFER_POST_PADDING];
|
||||
|
||||
memset(&buf[LWS_SEND_BUFFER_PRE_PADDING], 0, data->len);
|
||||
memcpy((char*)&buf[LWS_SEND_BUFFER_PRE_PADDING], data->bytes, data->len);
|
||||
|
||||
enum lws_write_protocol writeProtocol;
|
||||
|
||||
if (WS_MSG_TO_SUBTRHEAD_SENDING_STRING == subThreadMsg->what)
|
||||
{
|
||||
writeProtocol = LWS_WRITE_TEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
writeProtocol = LWS_WRITE_BINARY;
|
||||
}
|
||||
|
||||
bytesWrite = lws_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING], data->len, writeProtocol);
|
||||
if( bytesWrite==0){
|
||||
//暂时无法发送,等会儿再试
|
||||
break;
|
||||
}
|
||||
if( bytesWrite==0){
|
||||
break;
|
||||
}
|
||||
if (bytesWrite < 0)
|
||||
{
|
||||
//发生错误了。
|
||||
LOGE("WebSocket::onSocketCallback libwebsocket_write error! ");
|
||||
break;
|
||||
}
|
||||
if (bytesWrite < data->len)
|
||||
{
|
||||
}
|
||||
|
||||
LAYA_SAFE_DELETE_ARRAY(data->bytes);
|
||||
LAYA_SAFE_DELETE(data);
|
||||
LAYA_SAFE_DELETE_ARRAY(buf);
|
||||
}
|
||||
|
||||
iter = m_wsHelper->m_subThreadWsMessageQueue->erase(iter);
|
||||
LAYA_SAFE_DELETE(subThreadMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// m_wsHelper->m_subThreadWsMessageQueue->clear();
|
||||
|
||||
|
||||
|
||||
|
||||
} while(false);
|
||||
|
||||
/* get notified as soon as we can write again */
|
||||
|
||||
lws_callback_on_writable( wsi);
|
||||
|
||||
lws_callback_on_writable(wsi);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -48,9 +48,20 @@ public:
|
||||
struct Data
|
||||
{
|
||||
Data():bytes(NULL), len(0), isBinary(false){}
|
||||
char* bytes;
|
||||
int len;
|
||||
|
||||
bool isBinary;
|
||||
char* getPayload() {
|
||||
return bytes + bytesWritten;
|
||||
}
|
||||
void updateBytesWritten(uint32_t bytes) {
|
||||
bytesWritten += bytes;
|
||||
}
|
||||
uint32_t getBytesLeft() {
|
||||
return len - bytesWritten;
|
||||
}
|
||||
int bytesWritten = 0;
|
||||
char* bytes;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,6 +47,7 @@ interface Window extends EventTarget, WindowTimers{
|
||||
ConchVirtualBitmap:any; //TODO 临时
|
||||
alert:(message?: any)=> void
|
||||
onerror:(message: string, filename?: string, lineno?: number, colno?: number, error?:Error)=>void;
|
||||
onunhandledrejection:(ev: any)=>void;
|
||||
onload: (ev: Event) => any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
onresize: (ev: UIEvent) => any;
|
||||
@@ -208,7 +209,6 @@ conch.onerror = function (message, filename, lineno, colno, error) {
|
||||
window.onerror(mg=="undefined"?undefined:mg,fn=="undefined"?undefined:fn,ln!="undefined"?parseInt(ln):undefined,cn!="undefined"?parseInt(cn):undefined,e);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 全局错误处理
|
||||
*/
|
||||
@@ -221,6 +221,12 @@ Object.defineProperty(window,'onerror',{set:function(fun){
|
||||
}});
|
||||
|
||||
|
||||
Object.defineProperty(window,'onunhandledrejection',{set:function(fun){
|
||||
conch.onunhandledrejection = fun;
|
||||
},get:function(){
|
||||
return conch.onunhandledrejection;
|
||||
}});
|
||||
|
||||
/*window.onerror = function(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void{
|
||||
alert('window.onerror');
|
||||
}*/
|
||||
|
||||
+3
-2
@@ -261,7 +261,6 @@ interface ZipFile{
|
||||
*/
|
||||
readFile(id:number):ArrayBuffer;
|
||||
close():void;
|
||||
|
||||
new ():ZipFile;
|
||||
}
|
||||
|
||||
@@ -524,7 +523,7 @@ interface conchConfig{
|
||||
localizable:boolean;
|
||||
pushAtlasMaxWidth:number;
|
||||
maxEJAnimation:number;
|
||||
urlIgnoreCase:boolean;
|
||||
urlIgnoreCase:boolean;
|
||||
getStoragePath():string;
|
||||
setMemoryCanvasSize(w:number,h:number):void;
|
||||
getTotalMem():number;
|
||||
@@ -664,6 +663,8 @@ interface _textBitmap
|
||||
interface conch {
|
||||
onerror:Function;
|
||||
__onerror:Function;
|
||||
onunhandledrejection:Function;
|
||||
__onunhandledrejection:Function;
|
||||
callWebviewJS(methodName:string,parms:string,callbackMethodName:string);
|
||||
exp:any;
|
||||
showWebView();
|
||||
|
||||
+16
-11
@@ -480,11 +480,11 @@ class MouseEvent extends UIEvent {
|
||||
}
|
||||
var _lbMouseEvent = window['MouseEvent'] = MouseEvent;
|
||||
class MouseWheelEvent extends MouseEvent {
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
constructor() {
|
||||
super("mousewheel");
|
||||
}
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
}
|
||||
class WheelEvent extends MouseEvent {
|
||||
constructor(typeArg, eventInitDict) {
|
||||
@@ -962,8 +962,6 @@ var _lbKeyboardEvent = window["KeyboardEvent"] = KeyboardEvent;
|
||||
});
|
||||
})(window.document);
|
||||
class Navigator {
|
||||
constructor() {
|
||||
}
|
||||
get appName() { return 'Netscape'; }
|
||||
get appVersion() { return this.userAgent; }
|
||||
;
|
||||
@@ -992,6 +990,8 @@ class Navigator {
|
||||
get language() { return 'zh-CN'; }
|
||||
;
|
||||
get userLanguage() { return 'zh-CN'; }
|
||||
constructor() {
|
||||
}
|
||||
getGamepads() {
|
||||
return null;
|
||||
}
|
||||
@@ -6310,10 +6310,6 @@ class HTMLMediaElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
class HTMLMetaElement extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
get httpEquiv() {
|
||||
return this["http-equiv"];
|
||||
}
|
||||
@@ -6325,6 +6321,10 @@ class HTMLMetaElement extends HTMLElement {
|
||||
get name() {
|
||||
return this._name;
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
}
|
||||
class HTMLAudioElement extends HTMLMediaElement {
|
||||
constructor() {
|
||||
@@ -6895,6 +6895,9 @@ class _jsXmlAttr {
|
||||
}
|
||||
}
|
||||
class _jsXmlNode extends _jsXmlAttr {
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
constructor() {
|
||||
super("", "");
|
||||
this.childNodes = [];
|
||||
@@ -6903,9 +6906,6 @@ class _jsXmlNode extends _jsXmlAttr {
|
||||
};
|
||||
this.attributes = [];
|
||||
}
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
getElementsByTagName(name) {
|
||||
var result = [];
|
||||
if (this.nodeName == name)
|
||||
@@ -7026,6 +7026,11 @@ Object.defineProperty(window, 'onerror', { set: function (fun) {
|
||||
}, get: function () {
|
||||
return conch.__onerror;
|
||||
} });
|
||||
Object.defineProperty(window, 'onunhandledrejection', { set: function (fun) {
|
||||
conch.onunhandledrejection = fun;
|
||||
}, get: function () {
|
||||
return conch.onunhandledrejection;
|
||||
} });
|
||||
var document = window.document;
|
||||
var addEventListener = window.addEventListener.bind(this);
|
||||
var dispatchEvent = window.dispatchEvent.bind(this);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
IsHandleUpdateAPK=0
|
||||
ApkUpdateUrl=https://www.layabox.com/layanative2.0/apk/update/conch-layaair/version.xml
|
||||
UpdateDownloadPath=mnt/sdcard
|
||||
UpdateAPKFileName=autoupdate.apk
|
||||
CheckNetwork=0
|
||||
ThreadMode=1
|
||||
JSDebugPort=5959
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
IsHandleUpdateAPK=0
|
||||
ApkUpdateUrl=https://www.layabox.com/layanative2.0/apk/update/conch-layaair/version.xml
|
||||
UpdateDownloadPath=mnt/sdcard
|
||||
UpdateAPKFileName=autoupdate.apk
|
||||
CheckNetwork=0
|
||||
ThreadMode=1
|
||||
JSDebugPort=5959
|
||||
|
||||
+6
-45
@@ -1,6 +1,5 @@
|
||||
package demo;
|
||||
import java.io.InputStream;
|
||||
import layaair.autoupdateversion.AutoUpdateAPK;
|
||||
import layaair.game.IMarket.IPlugin;
|
||||
import layaair.game.IMarket.IPluginRuntimeProxy;
|
||||
import layaair.game.Market.GameEngine;
|
||||
@@ -18,7 +17,6 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.ValueCallback;
|
||||
|
||||
|
||||
public class MainActivity extends Activity{
|
||||
@@ -31,16 +29,16 @@ public class MainActivity extends Activity{
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!isTaskRoot()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
JSBridge.mMainActivity = this;
|
||||
mSplashDialog = new SplashDialog(this);
|
||||
mSplashDialog.showSplash();
|
||||
/*
|
||||
* 如果不想使用更新流程,可以屏蔽checkApkUpdate函数,直接打开initEngine函数
|
||||
*/
|
||||
checkApkUpdate(this);
|
||||
//initEngine();
|
||||
initEngine();
|
||||
}
|
||||
public void initEngine()
|
||||
{
|
||||
@@ -98,45 +96,8 @@ public class MainActivity extends Activity{
|
||||
alertdlg.setCanceledOnTouchOutside(false);
|
||||
alertdlg.show();
|
||||
}
|
||||
public void checkApkUpdate( Context context,final ValueCallback<Integer> callback)
|
||||
{
|
||||
if (isOpenNetwork(context)) {
|
||||
// 自动版本更新
|
||||
if ( "0".equals(config.GetInstance().getProperty("IsHandleUpdateAPK","0")) == false ) {
|
||||
Log.e("0", "==============Java流程 checkApkUpdate");
|
||||
new AutoUpdateAPK(context, new ValueCallback<Integer>() {
|
||||
@Override
|
||||
public void onReceiveValue(Integer integer) {
|
||||
Log.e("",">>>>>>>>>>>>>>>>>>");
|
||||
callback.onReceiveValue(integer);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.e("0", "==============Java流程 checkApkUpdate 不许要自己管理update");
|
||||
callback.onReceiveValue(1);
|
||||
}
|
||||
} else {
|
||||
settingNetwork(context,AR_CHECK_UPDATE);
|
||||
}
|
||||
}
|
||||
public void checkApkUpdate(Context context) {
|
||||
InputStream inputStream = getClass().getResourceAsStream("/assets/config.ini");
|
||||
config.GetInstance().init(inputStream);
|
||||
checkApkUpdate(context,new ValueCallback<Integer>() {
|
||||
@Override
|
||||
public void onReceiveValue(Integer integer) {
|
||||
if (integer.intValue() == 1) {
|
||||
initEngine();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
public void onActivityResult(int requestCode, int resultCode,Intent intent) {
|
||||
if (requestCode == AR_CHECK_UPDATE) {
|
||||
checkApkUpdate(this);
|
||||
}
|
||||
|
||||
}
|
||||
protected void onPause()
|
||||
{
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
|
||||
maven { url 'https://maven.aliyun.com/repository/public' }
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.2'
|
||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
||||
|
||||
@@ -480,11 +480,11 @@ class MouseEvent extends UIEvent {
|
||||
}
|
||||
var _lbMouseEvent = window['MouseEvent'] = MouseEvent;
|
||||
class MouseWheelEvent extends MouseEvent {
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
constructor() {
|
||||
super("mousewheel");
|
||||
}
|
||||
initMouseWheelEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg) {
|
||||
}
|
||||
}
|
||||
class WheelEvent extends MouseEvent {
|
||||
constructor(typeArg, eventInitDict) {
|
||||
@@ -962,8 +962,6 @@ var _lbKeyboardEvent = window["KeyboardEvent"] = KeyboardEvent;
|
||||
});
|
||||
})(window.document);
|
||||
class Navigator {
|
||||
constructor() {
|
||||
}
|
||||
get appName() { return 'Netscape'; }
|
||||
get appVersion() { return this.userAgent; }
|
||||
;
|
||||
@@ -992,6 +990,8 @@ class Navigator {
|
||||
get language() { return 'zh-CN'; }
|
||||
;
|
||||
get userLanguage() { return 'zh-CN'; }
|
||||
constructor() {
|
||||
}
|
||||
getGamepads() {
|
||||
return null;
|
||||
}
|
||||
@@ -6310,10 +6310,6 @@ class HTMLMediaElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
class HTMLMetaElement extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
get httpEquiv() {
|
||||
return this["http-equiv"];
|
||||
}
|
||||
@@ -6325,6 +6321,10 @@ class HTMLMetaElement extends HTMLElement {
|
||||
get name() {
|
||||
return this._name;
|
||||
}
|
||||
constructor() {
|
||||
super();
|
||||
this.tagName = "META";
|
||||
}
|
||||
}
|
||||
class HTMLAudioElement extends HTMLMediaElement {
|
||||
constructor() {
|
||||
@@ -6895,6 +6895,9 @@ class _jsXmlAttr {
|
||||
}
|
||||
}
|
||||
class _jsXmlNode extends _jsXmlAttr {
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
constructor() {
|
||||
super("", "");
|
||||
this.childNodes = [];
|
||||
@@ -6903,9 +6906,6 @@ class _jsXmlNode extends _jsXmlAttr {
|
||||
};
|
||||
this.attributes = [];
|
||||
}
|
||||
get firstChild() {
|
||||
return this.childNodes ? this.childNodes[0] : null;
|
||||
}
|
||||
getElementsByTagName(name) {
|
||||
var result = [];
|
||||
if (this.nodeName == name)
|
||||
@@ -7026,6 +7026,11 @@ Object.defineProperty(window, 'onerror', { set: function (fun) {
|
||||
}, get: function () {
|
||||
return conch.__onerror;
|
||||
} });
|
||||
Object.defineProperty(window, 'onunhandledrejection', { set: function (fun) {
|
||||
conch.onunhandledrejection = fun;
|
||||
}, get: function () {
|
||||
return conch.onunhandledrejection;
|
||||
} });
|
||||
var document = window.document;
|
||||
var addEventListener = window.addEventListener.bind(this);
|
||||
var dispatchEvent = window.dispatchEvent.bind(this);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user