1
This commit is contained in:
BIN
.gradle/8.11.1/checksums/checksums.lock
Normal file
BIN
.gradle/8.11.1/checksums/checksums.lock
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/checksums/md5-checksums.bin
Normal file
BIN
.gradle/8.11.1/checksums/md5-checksums.bin
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/checksums/sha1-checksums.bin
Normal file
BIN
.gradle/8.11.1/checksums/sha1-checksums.bin
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/8.11.1/executionHistory/executionHistory.lock
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/fileChanges/last-build.bin
Normal file
BIN
.gradle/8.11.1/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/8.11.1/fileHashes/fileHashes.bin
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/8.11.1/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
BIN
.gradle/8.11.1/fileHashes/resourceHashesCache.bin
Normal file
BIN
.gradle/8.11.1/fileHashes/resourceHashesCache.bin
Normal file
Binary file not shown.
0
.gradle/8.11.1/gc.properties
Normal file
0
.gradle/8.11.1/gc.properties
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
.gradle/buildOutputCleanup/cache.properties
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#Tue Mar 10 14:43:18 CST 2026
|
||||||
|
gradle.version=8.11.1
|
||||||
2
.gradle/config.properties
Normal file
2
.gradle/config.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#Tue Mar 10 14:42:45 CST 2026
|
||||||
|
java.home=D\:\\Program Files\\Android\\Android Studio\\jbr
|
||||||
0
.gradle/vcs-1/gc.properties
Normal file
0
.gradle/vcs-1/gc.properties
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
|||||||
|
magotest
|
||||||
6
.idea/AndroidProjectSystem.xml
generated
Normal file
6
.idea/AndroidProjectSystem.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AndroidProjectSystem">
|
||||||
|
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1490
.idea/caches/deviceStreaming.xml
generated
Normal file
1490
.idea/caches/deviceStreaming.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
6
.idea/compiler.xml
generated
Normal file
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/deploymentTargetSelector.xml
generated
Normal file
10
.idea/deploymentTargetSelector.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetSelector">
|
||||||
|
<selectionStates>
|
||||||
|
<SelectionState runConfigName="magotest">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
</selectionStates>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
20
.idea/gradle.xml
generated
Normal file
20
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="C:/ProgramData/cocos/editors/Creator/3.8.8/resources/resources/3d/engine/native/cocos/platform/android/libcocos2dx" />
|
||||||
|
<option value="$PROJECT_DIR$/../okey101_native_sm/okey/native/engine/android/app" />
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/libservice" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/migrations.xml
generated
Normal file
10
.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectMigrations">
|
||||||
|
<option name="MigrateToGradleLocalJavaHome">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/misc.xml
generated
Normal file
10
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="Android" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
17
.idea/runConfigurations.xml
generated
Normal file
17
.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||||
|
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||||
|
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
15
android/CMakeLists.txt
Normal file
15
android/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
|
||||||
|
option(APP_NAME "Project Name" "magotest")
|
||||||
|
project(${APP_NAME} CXX)
|
||||||
|
set(CC_LIB_NAME cocos)
|
||||||
|
set(CC_PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
set(CC_PROJ_SOURCES)
|
||||||
|
set(CC_COMMON_SOURCES)
|
||||||
|
set(CC_ALL_SOURCES)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/../common/CMakeLists.txt)
|
||||||
|
|
||||||
|
cc_android_before_target(${CC_LIB_NAME})
|
||||||
|
add_library(${CC_LIB_NAME} SHARED ${CC_ALL_SOURCES})
|
||||||
|
cc_android_after_target(${CC_LIB_NAME})
|
||||||
1
android/Post-service.cmake
Normal file
1
android/Post-service.cmake
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Supported for Cocos Service!
|
||||||
1
android/Pre-service.cmake
Normal file
1
android/Pre-service.cmake
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Supported for Cocos Service!
|
||||||
16
android/app/AndroidManifest.xml
Normal file
16
android/app/AndroidManifest.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
<application android:allowBackup="true" android:label="@string/app_name" android:usesCleartextTraffic="true" android:icon="@mipmap/ic_launcher" android:resizeableActivity="true">
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="cocos"/>
|
||||||
|
<activity android:name="com.cocos.game.AppActivity" android:screenOrientation="sensorLandscape" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.cocos.lib.CocosEditBoxActivity" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:screenOrientation="behind" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
119
android/app/build.gradle
Normal file
119
android/app/build.gradle
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
RES_PATH = RES_PATH.replace("\\", "/")
|
||||||
|
COCOS_ENGINE_PATH = COCOS_ENGINE_PATH.replace("\\", "/")
|
||||||
|
|
||||||
|
buildDir = "${RES_PATH}/proj/build/${project.name ==~ /^[_a-zA-Z0-9-]+$/ ? project.name : 'CocosGame'}"
|
||||||
|
android {
|
||||||
|
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
|
||||||
|
buildToolsVersion PROP_BUILD_TOOLS_VERSION
|
||||||
|
ndkVersion PROP_NDK_VERSION
|
||||||
|
namespace APPLICATION_ID
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId APPLICATION_ID
|
||||||
|
minSdkVersion PROP_MIN_SDK_VERSION
|
||||||
|
targetSdkVersion PROP_TARGET_SDK_VERSION
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
targets "cocos"
|
||||||
|
arguments "-DRES_DIR=${RES_PATH}", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
|
||||||
|
}
|
||||||
|
ndk { abiFilters PROP_APP_ABI.split(':') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main {
|
||||||
|
java.srcDirs "../src", "src"
|
||||||
|
res.srcDirs "../res", 'res', "${RES_PATH}/proj/res"
|
||||||
|
jniLibs.srcDirs "../libs", 'libs'
|
||||||
|
manifest.srcFile "AndroidManifest.xml"
|
||||||
|
assets.srcDir "${RES_PATH}/data"
|
||||||
|
jniLibs {
|
||||||
|
// Vulkan validation layer
|
||||||
|
// srcDir "${android.ndkDirectory}/sources/third_party/vulkan/src/build-android/jniLibs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
jniLibs {
|
||||||
|
useLegacyPackaging Boolean.parseBoolean(PROP_ENABLE_COMPRESS_SO)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
version "3.22.1"
|
||||||
|
path "../CMakeLists.txt"
|
||||||
|
buildStagingDirectory "${RES_PATH}/proj/build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
|
||||||
|
release {
|
||||||
|
if (project.hasProperty("RELEASE_STORE_FILE") && !RELEASE_STORE_FILE.isEmpty()) {
|
||||||
|
storeFile file(RELEASE_STORE_FILE)
|
||||||
|
storePassword RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
debuggable false
|
||||||
|
jniDebuggable false
|
||||||
|
renderscriptDebuggable false
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
// switch HIDE_SYMBOLS to OFF to skip compilation flag `-fvisibility=hidden`
|
||||||
|
arguments "-DHIDE_SYMBOLS=ON"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Boolean.parseBoolean(PROP_IS_DEBUG)) {
|
||||||
|
getIsDefault().set(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
debug {
|
||||||
|
debuggable true
|
||||||
|
jniDebuggable true
|
||||||
|
renderscriptDebuggable true
|
||||||
|
// resValue "string", "app_name", "${PROP_APP_NAME}-dbg"
|
||||||
|
// applicationIdSuffix ".debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation fileTree(dir: "${COCOS_ENGINE_PATH}/cocos/platform/android/java/libs", include: ['*.jar'])
|
||||||
|
implementation project(':libservice')
|
||||||
|
implementation project(':libcocos')
|
||||||
|
if (Boolean.parseBoolean(PROP_ENABLE_INPUTSDK)) {
|
||||||
|
implementation 'com.google.android.libraries.play.games:inputmapping:1.1.0-beta'
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
54
android/app/proguard-rules.pro
vendored
Normal file
54
android/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Proguard Cocos2d-x-lite for release
|
||||||
|
-keep public class com.cocos.** { *; }
|
||||||
|
-dontwarn com.cocos.**
|
||||||
|
|
||||||
|
# Proguard Apache HTTP for release
|
||||||
|
-keep class org.apache.http.** { *; }
|
||||||
|
-dontwarn org.apache.http.**
|
||||||
|
|
||||||
|
# Proguard okhttp for release
|
||||||
|
-keep class okhttp3.** { *; }
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
|
||||||
|
-keep class okio.** { *; }
|
||||||
|
-dontwarn okio.**
|
||||||
|
|
||||||
|
# Proguard Android Webivew for release. you can comment if you are not using a webview
|
||||||
|
-keep public class android.net.http.SslError
|
||||||
|
-keep public class android.webkit.WebViewClient
|
||||||
|
|
||||||
|
-keep public class com.google.** { *; }
|
||||||
|
|
||||||
|
-dontwarn android.webkit.WebView
|
||||||
|
-dontwarn android.net.http.SslError
|
||||||
|
-dontwarn android.webkit.WebViewClient
|
||||||
|
|
||||||
|
# This is generated automatically by the Android Gradle plugin.
|
||||||
|
-dontwarn android.hardware.BatteryState
|
||||||
|
-dontwarn android.hardware.lights.Light
|
||||||
|
-dontwarn android.hardware.lights.LightState$Builder
|
||||||
|
-dontwarn android.hardware.lights.LightState
|
||||||
|
-dontwarn android.hardware.lights.LightsManager$LightsSession
|
||||||
|
-dontwarn android.hardware.lights.LightsManager
|
||||||
|
-dontwarn android.hardware.lights.LightsRequest$Builder
|
||||||
|
-dontwarn android.hardware.lights.LightsRequest
|
||||||
|
-dontwarn android.net.ssl.SSLSockets
|
||||||
|
-dontwarn android.os.VibratorManager
|
||||||
125
android/app/src/com/cocos/game/AppActivity.java
Normal file
125
android/app/src/com/cocos/game/AppActivity.java
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
||||||
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
package com.cocos.game;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
|
import com.cocos.service.SDKWrapper;
|
||||||
|
import com.cocos.lib.CocosActivity;
|
||||||
|
|
||||||
|
public class AppActivity extends CocosActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
// DO OTHER INITIALIZATION BELOW
|
||||||
|
SDKWrapper.shared().init(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
SDKWrapper.shared().onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
SDKWrapper.shared().onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||||
|
if (!isTaskRoot()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SDKWrapper.shared().onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
SDKWrapper.shared().onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
SDKWrapper.shared().onNewIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestart() {
|
||||||
|
super.onRestart();
|
||||||
|
SDKWrapper.shared().onRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
SDKWrapper.shared().onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
SDKWrapper.shared().onBackPressed();
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
SDKWrapper.shared().onConfigurationChanged(newConfig);
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
SDKWrapper.shared().onRestoreInstanceState(savedInstanceState);
|
||||||
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
SDKWrapper.shared().onSaveInstanceState(outState);
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
SDKWrapper.shared().onStart();
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLowMemory() {
|
||||||
|
SDKWrapper.shared().onLowMemory();
|
||||||
|
super.onLowMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
8
android/build-cfg.json
Normal file
8
android/build-cfg.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"ndk_module_path" :[
|
||||||
|
"${COCOS_ROOT}",
|
||||||
|
"${COCOS_ROOT}/cocos",
|
||||||
|
"${COCOS_ROOT}/external"
|
||||||
|
],
|
||||||
|
"copy_resources": []
|
||||||
|
}
|
||||||
28
android/build.gradle
Normal file
28
android/build.gradle
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
// jcenter() // keeped as anchor, will be removed soon
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:8.10.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
// jcenter() // keeped as anchor, will be removed soon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task clean(type: Delete) {
|
||||||
|
delete rootProject.buildDir
|
||||||
|
}
|
||||||
23
android/instantapp/AndroidManifest.xml
Normal file
23
android/instantapp/AndroidManifest.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:dist="http://schemas.android.com/apk/distribution" android:installLocation="auto">
|
||||||
|
<dist:module dist:instant="true"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
<application android:allowBackup="true" android:label="@string/app_name" android:usesCleartextTraffic="true" android:supportsRtl="true" android:icon="@mipmap/ic_launcher" android:resizeableActivity="true">
|
||||||
|
<meta-data android:name="aia-compat-api-min-version" android:value="1"/>
|
||||||
|
<meta-data android:name="android.app.lib_name" android:value="cocos"/>
|
||||||
|
<activity android:name="com.cocos.game.InstantActivity" android:screenOrientation="sensorLandscape" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:launchMode="singleTask" android:exported="true">
|
||||||
|
<intent-filter android:order="1">
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.cocos.lib.CocosEditBoxActivity" android:configChanges="orientation|keyboardHidden|screenSize|screenLayout|smallestScreenSize" android:screenOrientation="behind" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
106
android/instantapp/build.gradle
Normal file
106
android/instantapp/build.gradle
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
RES_PATH = RES_PATH.replace("\\", "/")
|
||||||
|
COCOS_ENGINE_PATH = COCOS_ENGINE_PATH.replace("\\", "/")
|
||||||
|
buildDir = "${RES_PATH}/proj/build/instantapp"
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
|
||||||
|
buildToolsVersion PROP_BUILD_TOOLS_VERSION
|
||||||
|
ndkVersion PROP_NDK_VERSION
|
||||||
|
namespace APPLICATION_ID
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion PROP_MIN_SDK_VERSION
|
||||||
|
targetSdkVersion PROP_TARGET_SDK_VERSION
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
targets "cocos"
|
||||||
|
arguments "-DRES_DIR=${RES_PATH}", "-DCOCOS_X_PATH=${COCOS_ENGINE_PATH}","-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", "-DANDROID_LD=gold"
|
||||||
|
cppFlags "-frtti -fexceptions -fsigned-char -DANDROID_INSTANT=1"
|
||||||
|
}
|
||||||
|
ndk { abiFilters PROP_APP_ABI.split(':') }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main {
|
||||||
|
java.srcDirs "../src", "src"
|
||||||
|
res.srcDirs "../res", 'res', "${RES_PATH}/proj/res"
|
||||||
|
jniLibs.srcDirs "../libs", 'libs'
|
||||||
|
manifest.srcFile "AndroidManifest.xml"
|
||||||
|
assets.srcDir "${RES_PATH}/data"
|
||||||
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
jniLibs {
|
||||||
|
useLegacyPackaging Boolean.parseBoolean(PROP_ENABLE_COMPRESS_SO)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
version "3.22.1"
|
||||||
|
path "../CMakeLists.txt"
|
||||||
|
buildStagingDirectory "${RES_PATH}/proj/build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
|
||||||
|
release {
|
||||||
|
if (project.hasProperty("RELEASE_STORE_FILE") && !RELEASE_STORE_FILE.isEmpty()) {
|
||||||
|
storeFile file(RELEASE_STORE_FILE)
|
||||||
|
storePassword RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
debuggable false
|
||||||
|
jniDebuggable false
|
||||||
|
renderscriptDebuggable false
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
if (project.hasProperty("RELEASE_STORE_FILE")) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
// switch HIDE_SYMBOLS to OFF to skip compilation flag `-fvisibility=hidden`
|
||||||
|
arguments "-DHIDE_SYMBOLS=ON"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug {
|
||||||
|
debuggable true
|
||||||
|
jniDebuggable true
|
||||||
|
renderscriptDebuggable true
|
||||||
|
// resValue "string", "app_name", "${PROP_APP_NAME}-dbg"
|
||||||
|
// applicationIdSuffix ".debug"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: '../libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation fileTree(dir: "${COCOS_ENGINE_PATH}/cocos/platform/android/java/libs", include: ['*.jar'])
|
||||||
|
implementation project(':libservice')
|
||||||
|
implementation project(':libcocos')
|
||||||
|
}
|
||||||
54
android/instantapp/proguard-rules.pro
vendored
Normal file
54
android/instantapp/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Proguard Cocos2d-x-lite for release
|
||||||
|
-keep public class com.cocos.** { *; }
|
||||||
|
-dontwarn com.cocos.**
|
||||||
|
|
||||||
|
# Proguard Apache HTTP for release
|
||||||
|
-keep class org.apache.http.** { *; }
|
||||||
|
-dontwarn org.apache.http.**
|
||||||
|
|
||||||
|
# Proguard okhttp for release
|
||||||
|
-keep class okhttp3.** { *; }
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
|
||||||
|
-keep class okio.** { *; }
|
||||||
|
-dontwarn okio.**
|
||||||
|
|
||||||
|
# Proguard Android Webivew for release. you can comment if you are not using a webview
|
||||||
|
-keep public class android.net.http.SslError
|
||||||
|
-keep public class android.webkit.WebViewClient
|
||||||
|
|
||||||
|
-keep public class com.google.** { *; }
|
||||||
|
|
||||||
|
-dontwarn android.webkit.WebView
|
||||||
|
-dontwarn android.net.http.SslError
|
||||||
|
-dontwarn android.webkit.WebViewClient
|
||||||
|
|
||||||
|
# This is generated automatically by the Android Gradle plugin.
|
||||||
|
-dontwarn android.hardware.BatteryState
|
||||||
|
-dontwarn android.hardware.lights.Light
|
||||||
|
-dontwarn android.hardware.lights.LightState$Builder
|
||||||
|
-dontwarn android.hardware.lights.LightState
|
||||||
|
-dontwarn android.hardware.lights.LightsManager$LightsSession
|
||||||
|
-dontwarn android.hardware.lights.LightsManager
|
||||||
|
-dontwarn android.hardware.lights.LightsRequest$Builder
|
||||||
|
-dontwarn android.hardware.lights.LightsRequest
|
||||||
|
-dontwarn android.net.ssl.SSLSockets
|
||||||
|
-dontwarn android.os.VibratorManager
|
||||||
125
android/instantapp/src/com/cocos/game/InstantActivity.java
Normal file
125
android/instantapp/src/com/cocos/game/InstantActivity.java
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
||||||
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
package com.cocos.game;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
|
||||||
|
import com.cocos.service.SDKWrapper;
|
||||||
|
import com.cocos.lib.CocosActivity;
|
||||||
|
|
||||||
|
public class InstantActivity extends CocosActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
// DO OTHER INITIALIZATION BELOW
|
||||||
|
SDKWrapper.shared().init(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
SDKWrapper.shared().onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
SDKWrapper.shared().onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
|
||||||
|
if (!isTaskRoot()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SDKWrapper.shared().onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
SDKWrapper.shared().onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
SDKWrapper.shared().onNewIntent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestart() {
|
||||||
|
super.onRestart();
|
||||||
|
SDKWrapper.shared().onRestart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
SDKWrapper.shared().onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
SDKWrapper.shared().onBackPressed();
|
||||||
|
super.onBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
SDKWrapper.shared().onConfigurationChanged(newConfig);
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
SDKWrapper.shared().onRestoreInstanceState(savedInstanceState);
|
||||||
|
super.onRestoreInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
|
SDKWrapper.shared().onSaveInstanceState(outState);
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
SDKWrapper.shared().onStart();
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLowMemory() {
|
||||||
|
SDKWrapper.shared().onLowMemory();
|
||||||
|
super.onLowMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
android/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
android/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
BIN
android/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
android/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
android/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
android/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
BIN
android/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
android/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
android/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
android/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
2
android/res/values/strings.xml
Normal file
2
android/res/values/strings.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<resources>
|
||||||
|
</resources>
|
||||||
18
build.gradle
Normal file
18
build.gradle
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
// jcenter() // keeped as anchor, will be removed soon
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:8.10.1'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: NATIVE_DIR +"/build.gradle"
|
||||||
27
cfg.cmake
Normal file
27
cfg.cmake
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
set(CC_USE_GLES3 ON)
|
||||||
|
set(CC_USE_GLES2 ON)
|
||||||
|
set(USE_SERVER_MODE OFF)
|
||||||
|
set(NET_MODE 0)
|
||||||
|
set(XXTEAKEY "ffLzRmJHtIxbW5NJ")
|
||||||
|
set(CC_ENABLE_SWAPPY OFF)
|
||||||
|
set(APP_NAME "magotest")
|
||||||
|
set(COCOS_X_PATH "C:/ProgramData/cocos/editors/Creator/3.8.8/resources/resources/3d/engine/native")
|
||||||
|
set(USE_JOB_SYSTEM_TASKFLOW OFF)
|
||||||
|
set(USE_JOB_SYSTEM_TBB OFF)
|
||||||
|
set(ENABLE_FLOAT_OUTPUT OFF)
|
||||||
|
set(USE_PHYSICS_PHYSX OFF)
|
||||||
|
set(USE_BOX2D_JSB OFF)
|
||||||
|
set(USE_OCCLUSION_QUERY OFF)
|
||||||
|
set(USE_GEOMETRY_RENDERER OFF)
|
||||||
|
set(USE_DEBUG_RENDERER ON)
|
||||||
|
set(USE_AUDIO ON)
|
||||||
|
set(USE_VIDEO ON)
|
||||||
|
set(USE_WEBVIEW ON)
|
||||||
|
set(USE_SOCKET ON)
|
||||||
|
set(USE_WEBSOCKET_SERVER OFF)
|
||||||
|
set(USE_VENDOR OFF)
|
||||||
|
set(USE_SPINE_3_8 OFF)
|
||||||
|
set(USE_SPINE_4_2 ON)
|
||||||
|
set(USE_DRAGONBONES ON)
|
||||||
|
set(CC_USE_VULKAN OFF)
|
||||||
|
set(USE_ADPF ON)
|
||||||
76
gradle.properties
Normal file
76
gradle.properties
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
|
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8
|
||||||
|
android.useAndroidX=true
|
||||||
|
|
||||||
|
android.injected.testOnly=false
|
||||||
|
|
||||||
|
android.native.buildOutput=verbose
|
||||||
|
|
||||||
|
# Android SDK version that will be used as the compile project
|
||||||
|
PROP_COMPILE_SDK_VERSION=36
|
||||||
|
|
||||||
|
# Android SDK version that will be used as the earliest version of android this application can run on
|
||||||
|
PROP_MIN_SDK_VERSION=21
|
||||||
|
|
||||||
|
# Android SDK version that will be used as the latest version of android this application has been tested on
|
||||||
|
PROP_TARGET_SDK_VERSION=35
|
||||||
|
|
||||||
|
# Android Build Tools version that will be used as the compile project
|
||||||
|
PROP_BUILD_TOOLS_VERSION=36.0.0
|
||||||
|
|
||||||
|
# Android Application Name
|
||||||
|
PROP_APP_NAME=magotest
|
||||||
|
|
||||||
|
# Instant App
|
||||||
|
PROP_ENABLE_INSTANT_APP=false
|
||||||
|
|
||||||
|
# InputSDK
|
||||||
|
PROP_ENABLE_INPUTSDK=false
|
||||||
|
|
||||||
|
PROP_NDK_VERSION=29.0.14206865
|
||||||
|
|
||||||
|
PROP_ENABLE_COMPRESS_SO=true
|
||||||
|
|
||||||
|
# Build variant
|
||||||
|
PROP_IS_DEBUG=false
|
||||||
|
|
||||||
|
# Cocos Engine Path
|
||||||
|
COCOS_ENGINE_PATH=C:/ProgramData/cocos/editors/Creator/3.8.8/resources/resources/3d/engine/native
|
||||||
|
|
||||||
|
# Res path
|
||||||
|
RES_PATH=E:/project/okey101_native_sm/okey/build/android
|
||||||
|
|
||||||
|
# Native source dir
|
||||||
|
NATIVE_DIR=E:/project/okey101_native_sm/okey/native/engine/android
|
||||||
|
|
||||||
|
# Application ID
|
||||||
|
APPLICATION_ID=top.android.test
|
||||||
|
|
||||||
|
# List of CPU Archtexture to build that application with
|
||||||
|
# Available architextures (armeabi-v7a | arm64-v8a | x86 | x86_64)
|
||||||
|
# To build for multiple architexture, use the `:` between them
|
||||||
|
# Example - PROP_APP_ABI=arm64-v8a
|
||||||
|
PROP_APP_ABI=arm64-v8a
|
||||||
|
|
||||||
|
# fill in sign information for release mode
|
||||||
|
RELEASE_STORE_FILE=C:/ProgramData/cocos/editors/Creator/3.8.8/resources/tools/keystore/debug.keystore
|
||||||
|
RELEASE_STORE_PASSWORD=123456
|
||||||
|
RELEASE_KEY_ALIAS=debug_keystore
|
||||||
|
RELEASE_KEY_PASSWORD=123456
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Tue Apr 25 14:17:09 CST 2023
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
164
gradlew
vendored
Normal file
164
gradlew
vendored
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||||
90
gradlew.bat
vendored
Normal file
90
gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
3
libservice/AndroidManifest.xml
Normal file
3
libservice/AndroidManifest.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
</manifest>
|
||||||
35
libservice/build.gradle
Normal file
35
libservice/build.gradle
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
|
||||||
|
namespace 'com.cocos.service'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion PROP_MIN_SDK_VERSION
|
||||||
|
targetSdkVersion PROP_TARGET_SDK_VERSION
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.main {
|
||||||
|
java.srcDirs "src"
|
||||||
|
res.srcDirs 'res'
|
||||||
|
jniLibs.srcDirs 'libs'
|
||||||
|
manifest.srcFile "AndroidManifest.xml"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
|
||||||
|
implementation project(':libcocos')
|
||||||
|
}
|
||||||
21
libservice/proguard-rules.pro
vendored
Normal file
21
libservice/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
185
libservice/src/com/cocos/service/SDKWrapper.java
Normal file
185
libservice/src/com/cocos/service/SDKWrapper.java
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
|
||||||
|
http://www.cocos.com
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated engine source code (the "Software"), a limited,
|
||||||
|
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||||
|
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||||
|
not use Cocos Creator software for developing other software or tools that's
|
||||||
|
used for developing games. You are not granted to publish, distribute,
|
||||||
|
sublicense, and/or sell copies of Cocos Creator.
|
||||||
|
The software or tools in this License Agreement are licensed, not sold.
|
||||||
|
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
package com.cocos.service;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.AssetManager;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class SDKWrapper {
|
||||||
|
private SDKWrapper() {}
|
||||||
|
private static class SDKWrapperInstance {
|
||||||
|
private static final SDKWrapper mInstance = new SDKWrapper();
|
||||||
|
}
|
||||||
|
public static SDKWrapper shared() { return SDKWrapperInstance.mInstance; }
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface SDKInterface {
|
||||||
|
default void init(Context context) {}
|
||||||
|
default void onStart() {}
|
||||||
|
default void onPause() {}
|
||||||
|
default void onResume() {}
|
||||||
|
default void onStop() {}
|
||||||
|
default void onDestroy() {}
|
||||||
|
default void onRestart() {}
|
||||||
|
default void onNewIntent(Intent intent) {}
|
||||||
|
default void onActivityResult(int requestCode, int resultCode, Intent data) {}
|
||||||
|
default void onConfigurationChanged(Configuration newConfig) {}
|
||||||
|
default void onRestoreInstanceState(Bundle savedInstanceState) {}
|
||||||
|
default void onSaveInstanceState(Bundle outState) {}
|
||||||
|
default void onBackPressed() {}
|
||||||
|
default void onLowMemory() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private WeakReference<Activity> mActivity = null;
|
||||||
|
private List<SDKInterface> serviceInstances;
|
||||||
|
|
||||||
|
private void loadSDKInterface() {
|
||||||
|
ArrayList<SDKInterface> instances = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
String json = this.getJson("service.json");
|
||||||
|
JSONObject jsonObject = new JSONObject(json);
|
||||||
|
JSONArray serviceClasses = jsonObject.getJSONArray("serviceClasses");
|
||||||
|
if (serviceClasses == null) return;
|
||||||
|
int length = serviceClasses.length();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
instances.add((SDKInterface) Class.forName(serviceClasses.getString(i)).newInstance());
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) { }
|
||||||
|
this.serviceInstances = instances;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("SameParameterValue")
|
||||||
|
private String getJson(String fileName) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
try {
|
||||||
|
AssetManager am = this.mActivity.get().getAssets();
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(am.open(fileName)));
|
||||||
|
String next;
|
||||||
|
while (null != (next = br.readLine())) { sb.append(next); }
|
||||||
|
} catch (IOException e) {
|
||||||
|
sb.delete(0, sb.length());
|
||||||
|
}
|
||||||
|
return sb.toString().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Activity getActivity() { return this.mActivity.get(); }
|
||||||
|
|
||||||
|
public void init(Activity activity) {
|
||||||
|
this.mActivity = new WeakReference<>(activity);
|
||||||
|
this.loadSDKInterface();
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.init(activity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onResume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPause() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onPause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDestroy() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onDestroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onNewIntent(Intent intent) {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onNewIntent(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRestart() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onRestart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStop() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onBackPressed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onRestoreInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStart() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onStart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLowMemory() {
|
||||||
|
for (SDKInterface sdk : this.serviceInstances) {
|
||||||
|
sdk.onLowMemory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
local.properties
Normal file
1
local.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
sdk.dir=D\:\\tools\\Android\\Sdk\\
|
||||||
3
res/values/strings.xml
Normal file
3
res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name" translatable="false">magotest</string>
|
||||||
|
</resources>
|
||||||
10
settings.gradle
Normal file
10
settings.gradle
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
include ':libcocos',':libservice',':app'
|
||||||
|
project(':libcocos').projectDir = new File(COCOS_ENGINE_PATH,'cocos/platform/android/libcocos2dx')
|
||||||
|
project(':app').projectDir = new File(NATIVE_DIR, 'app')
|
||||||
|
project(':app').name = "magotest"
|
||||||
|
if(PROP_ENABLE_INSTANT_APP == "true" || PROP_ENABLE_INSTANT_APP == "yes") {
|
||||||
|
include ':instantapp'
|
||||||
|
project(':instantapp').projectDir = new File(NATIVE_DIR, 'instantapp')
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "magotest"
|
||||||
Reference in New Issue
Block a user