Fixes in udp_session type usage for cross-platform use.

This commit is contained in:
genxium 2023-01-26 12:43:38 +08:00
parent 2028f8277d
commit 7ab983949c
9 changed files with 481 additions and 163 deletions

View File

@ -72,22 +72,25 @@
"__id__": 3
},
{
"__id__": 7
"__id__": 5
},
{
"__id__": 9
},
{
"__id__": 11
}
],
"_active": true,
"_components": [
{
"__id__": 60
},
{
"__id__": 61
},
{
"__id__": 62
},
{
"__id__": 63
},
{
"__id__": 64
}
],
"_prefab": null,
@ -138,6 +141,102 @@
"groupIndex": 0,
"_id": "88kscZWXFCIZtNFekdSP/o"
},
{
"__type__": "cc.Node",
"_name": "Background",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 960
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "c8r+ISXVhBZarylAeQMAQK"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "637f31c2-c53e-4dec-ae11-d56c0c6177ad"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": {
"__uuid__": "030d9286-e8a2-40cf-98f8-baf713f0b8c4"
},
"_id": "6dhdFxELpEwZ4TjXC+WnyS"
},
{
"__type__": "cc.Node",
"_name": "Decorations",
@ -147,13 +246,13 @@
},
"_children": [
{
"__id__": 4
"__id__": 6
}
],
"_active": true,
"_components": [
{
"__id__": 6
"__id__": 8
}
],
"_prefab": null,
@ -209,13 +308,13 @@
"_name": "Logo",
"_objFlags": 0,
"_parent": {
"__id__": 3
"__id__": 5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 5
"__id__": 7
}
],
"_prefab": null,
@ -271,7 +370,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
"__id__": 6
},
"_enabled": true,
"_materials": [
@ -301,7 +400,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
"__id__": 5
},
"_enabled": true,
"alignMode": 0,
@ -334,7 +433,7 @@
"_active": true,
"_components": [
{
"__id__": 8
"__id__": 10
}
],
"_prefab": null,
@ -362,7 +461,7 @@
"array": [
0,
0,
209.6693197428241,
215.64032554232523,
0,
0,
0,
@ -390,7 +489,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
"__id__": 9
},
"_enabled": true,
"_cullingMask": 4294967295,
@ -430,13 +529,13 @@
},
"_children": [
{
"__id__": 10
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 59
"__id__": 61
}
],
"_prefab": null,
@ -492,41 +591,41 @@
"_name": "InteractiveControls",
"_objFlags": 0,
"_parent": {
"__id__": 9
"__id__": 11
},
"_children": [
{
"__id__": 11
},
{
"__id__": 19
"__id__": 13
},
{
"__id__": 21
},
{
"__id__": 30
"__id__": 23
},
{
"__id__": 32
},
{
"__id__": 41
"__id__": 34
},
{
"__id__": 48
"__id__": 43
},
{
"__id__": 54
"__id__": 50
},
{
"__id__": 56
},
{
"__id__": 58
}
],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 60
}
],
"_prefab": null,
@ -582,23 +681,23 @@
"_name": "phoneCountryCodeInput",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [
{
"__id__": 12
},
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 20
}
],
"_prefab": null,
@ -654,13 +753,13 @@
"_name": "BACKGROUND_SPRITE",
"_objFlags": 0,
"_parent": {
"__id__": 11
"__id__": 13
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
"__id__": 15
}
],
"_prefab": null,
@ -716,7 +815,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
"__id__": 14
},
"_enabled": true,
"_materials": [
@ -748,13 +847,13 @@
"_name": "TEXT_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 11
"__id__": 13
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
"__id__": 17
}
],
"_prefab": null,
@ -810,7 +909,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
"__id__": 16
},
"_enabled": true,
"_materials": [
@ -840,13 +939,13 @@
"_name": "PLACEHOLDER_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 11
"__id__": 13
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 17
"__id__": 19
}
],
"_prefab": null,
@ -902,7 +1001,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 18
},
"_enabled": true,
"_materials": [],
@ -928,7 +1027,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
"__id__": 13
},
"_enabled": true,
"_useOriginalSize": false,
@ -941,13 +1040,13 @@
"editingDidEnded": [],
"editingReturn": [],
"_N$textLabel": {
"__id__": 15
},
"_N$placeholderLabel": {
"__id__": 17
},
"_N$placeholderLabel": {
"__id__": 19
},
"_N$background": {
"__id__": 13
"__id__": 15
},
"_N$inputFlag": 5,
"_N$inputMode": 3,
@ -959,13 +1058,13 @@
"_name": "phoneLabel",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 22
}
],
"_prefab": null,
@ -1021,7 +1120,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
"__id__": 21
},
"_enabled": true,
"_materials": [
@ -1051,23 +1150,23 @@
"_name": "phoneNumberInput",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [
{
"__id__": 22
},
{
"__id__": 24
},
{
"__id__": 26
},
{
"__id__": 28
}
],
"_active": true,
"_components": [
{
"__id__": 29
"__id__": 31
}
],
"_prefab": null,
@ -1123,13 +1222,13 @@
"_name": "BACKGROUND_SPRITE",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 23
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
"__id__": 25
}
],
"_prefab": null,
@ -1185,7 +1284,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
"__id__": 24
},
"_enabled": true,
"_materials": [
@ -1217,13 +1316,13 @@
"_name": "TEXT_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 23
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 25
"__id__": 27
}
],
"_prefab": null,
@ -1279,7 +1378,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
"__id__": 26
},
"_enabled": true,
"_materials": [],
@ -1305,16 +1404,16 @@
"_name": "PLACEHOLDER_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 23
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 27
"__id__": 29
},
{
"__id__": 28
"__id__": 30
}
],
"_prefab": null,
@ -1370,7 +1469,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 28
},
"_enabled": true,
"_materials": [
@ -1400,7 +1499,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 28
},
"_enabled": true,
"_dataID": "login.hint.phoneInputHint",
@ -1411,7 +1510,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
"__id__": 23
},
"_enabled": true,
"_useOriginalSize": false,
@ -1424,13 +1523,13 @@
"editingDidEnded": [],
"editingReturn": [],
"_N$textLabel": {
"__id__": 25
},
"_N$placeholderLabel": {
"__id__": 27
},
"_N$placeholderLabel": {
"__id__": 29
},
"_N$background": {
"__id__": 23
"__id__": 25
},
"_N$inputFlag": 5,
"_N$inputMode": 1,
@ -1442,13 +1541,13 @@
"_name": " smsLoginCaptchaLabel",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 31
"__id__": 33
}
],
"_prefab": null,
@ -1504,7 +1603,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 30
"__id__": 32
},
"_enabled": true,
"_materials": [
@ -1534,23 +1633,23 @@
"_name": "smsLoginCaptchaInput",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [
{
"__id__": 33
},
{
"__id__": 35
},
{
"__id__": 37
},
{
"__id__": 39
}
],
"_active": true,
"_components": [
{
"__id__": 40
"__id__": 42
}
],
"_prefab": null,
@ -1606,13 +1705,13 @@
"_name": "BACKGROUND_SPRITE",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
"__id__": 36
}
],
"_prefab": null,
@ -1668,7 +1767,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
"__id__": 35
},
"_enabled": true,
"_materials": [
@ -1700,13 +1799,13 @@
"_name": "TEXT_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 34
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 36
"__id__": 38
}
],
"_prefab": null,
@ -1762,7 +1861,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 35
"__id__": 37
},
"_enabled": true,
"_materials": [],
@ -1788,16 +1887,16 @@
"_name": "PLACEHOLDER_LABEL",
"_objFlags": 0,
"_parent": {
"__id__": 32
"__id__": 34
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 40
},
{
"__id__": 39
"__id__": 41
}
],
"_prefab": null,
@ -1853,7 +1952,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 39
},
"_enabled": true,
"_materials": [
@ -1883,7 +1982,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 39
},
"_enabled": true,
"_dataID": "login.hint.captchaInputHint",
@ -1894,7 +1993,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
"__id__": 34
},
"_enabled": true,
"_useOriginalSize": false,
@ -1907,13 +2006,13 @@
"editingDidEnded": [],
"editingReturn": [],
"_N$textLabel": {
"__id__": 36
},
"_N$placeholderLabel": {
"__id__": 38
},
"_N$placeholderLabel": {
"__id__": 40
},
"_N$background": {
"__id__": 34
"__id__": 36
},
"_N$inputFlag": 5,
"_N$inputMode": 2,
@ -1925,20 +2024,20 @@
"_name": "smsLoginCaptchaButton",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [
{
"__id__": 42
"__id__": 44
},
{
"__id__": 44
"__id__": 46
}
],
"_active": true,
"_components": [
{
"__id__": 46
"__id__": 48
}
],
"_prefab": null,
@ -1994,13 +2093,13 @@
"_name": "smsGetCaptcha",
"_objFlags": 0,
"_parent": {
"__id__": 41
"__id__": 43
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 43
"__id__": 45
}
],
"_prefab": null,
@ -2056,7 +2155,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
"__id__": 44
},
"_enabled": true,
"_materials": [
@ -2090,13 +2189,13 @@
"_name": "captchaLabel",
"_objFlags": 0,
"_parent": {
"__id__": 41
"__id__": 43
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 47
}
],
"_prefab": null,
@ -2152,7 +2251,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 46
},
"_enabled": true,
"_materials": [
@ -2182,7 +2281,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
"__id__": 43
},
"_enabled": true,
"_normalMaterial": null,
@ -2191,7 +2290,7 @@
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 47
"__id__": 49
}
],
"_N$interactable": true,
@ -2257,7 +2356,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 41
"__id__": 43
},
"_id": "96L9tbxW9DHJHU5hUi9oNc"
},
@ -2276,20 +2375,20 @@
"_name": "loginButton",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [
{
"__id__": 49
"__id__": 51
}
],
"_active": true,
"_components": [
{
"__id__": 51
"__id__": 53
},
{
"__id__": 52
"__id__": 54
}
],
"_prefab": null,
@ -2345,13 +2444,13 @@
"_name": "loginLabel",
"_objFlags": 0,
"_parent": {
"__id__": 48
"__id__": 50
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 50
"__id__": 52
}
],
"_prefab": null,
@ -2407,7 +2506,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 49
"__id__": 51
},
"_enabled": true,
"_materials": [
@ -2437,7 +2536,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 50
},
"_enabled": true,
"_materials": [
@ -2471,7 +2570,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 48
"__id__": 50
},
"_enabled": true,
"_normalMaterial": null,
@ -2480,7 +2579,7 @@
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 53
"__id__": 55
}
],
"_N$interactable": true,
@ -2546,7 +2645,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 48
"__id__": 50
},
"_id": "0dQu3M5+hO8Ia4FD67Br39"
},
@ -2565,13 +2664,13 @@
"_name": "phoneNumberTips",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 55
"__id__": 57
}
],
"_prefab": null,
@ -2627,7 +2726,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 54
"__id__": 56
},
"_enabled": true,
"_materials": [
@ -2657,13 +2756,13 @@
"_name": "captchaTips",
"_objFlags": 0,
"_parent": {
"__id__": 10
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 57
"__id__": 59
}
],
"_prefab": null,
@ -2719,7 +2818,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 56
"__id__": 58
},
"_enabled": true,
"_materials": [
@ -2749,7 +2848,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
"__id__": 12
},
"_enabled": true,
"alignMode": 1,
@ -2776,7 +2875,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
"__id__": 11
},
"_enabled": true,
"alignMode": 0,
@ -2854,37 +2953,37 @@
"__id__": 2
},
"backgroundNode": {
"__id__": 9
},
"interactiveControls": {
"__id__": 10
},
"phoneLabel": {
"__id__": 19
},
"smsLoginCaptchaLabel": {
"__id__": 30
},
"phoneCountryCodeInput": {
"__id__": 11
},
"phoneNumberInput": {
"interactiveControls": {
"__id__": 12
},
"phoneLabel": {
"__id__": 21
},
"phoneNumberTips": {
"__id__": 54
},
"smsLoginCaptchaInput": {
"smsLoginCaptchaLabel": {
"__id__": 32
},
"smsLoginCaptchaButton": {
"__id__": 41
"phoneCountryCodeInput": {
"__id__": 13
},
"captchaTips": {
"phoneNumberInput": {
"__id__": 23
},
"phoneNumberTips": {
"__id__": 56
},
"smsLoginCaptchaInput": {
"__id__": 34
},
"smsLoginCaptchaButton": {
"__id__": 43
},
"captchaTips": {
"__id__": 58
},
"loginButton": {
"__id__": 48
"__id__": 50
},
"smsWaitCountdownPrefab": {
"__uuid__": "2c0101b8-c15a-4501-9fce-cd5a014af8bf"

View File

@ -17,6 +17,18 @@
"append_file": [{
"from": "cocos/scripting/js-bindings/manual/jsb_module_register.cpp",
"to": "frameworks/runtime-src/Classes/jsb_module_register.cpp"
}, {
"from": "frameworks/runtime-src/Classes/udp_session.hpp",
"to": "frameworks/runtime-src/Classes/udp_session.hpp"
}, {
"from": "frameworks/runtime-src/Classes/udp_session.cpp",
"to": "frameworks/runtime-src/Classes/udp_session.cpp"
}, {
"from": "frameworks/runtime-src/Classes/udp_session_bridge.hpp",
"to": "frameworks/runtime-src/Classes/udp_session_bridge.hpp"
}, {
"from": "frameworks/runtime-src/Classes/udp_session_bridge.cpp",
"to": "frameworks/runtime-src/Classes/udp_session_bridge.cpp"
}],
"project_rename": {
"src_project_name": "DelayNoMore",
@ -37,10 +49,6 @@
"frameworks/runtime-src/proj.win32/main.cpp",
"frameworks/runtime-src/proj.android-studio/settings.gradle",
"frameworks/runtime-src/proj.android-studio/app/res/values/strings.xml",
"frameworks/runtime-src/Classes/udp_session.hpp",
"frameworks/runtime-src/Classes/udp_session.cpp",
"frameworks/runtime-src/Classes/udp_session_bridge.hpp",
"frameworks/runtime-src/Classes/udp_session_bridge.cpp",
"frameworks/runtime-src/Classes/AppDelegate.cpp"
]
},

View File

@ -12,7 +12,7 @@ uv_loop_t* loop = NULL; // Only this loop is used for this simple PoC
int const maxPeerCnt = 10;
struct PeerAddr {
SOCKADDR_IN sockAddrIn;
struct sockaddr_in sockAddrIn;
uint32_t authKey;
};
struct PeerAddr peerAddrList[maxPeerCnt];
@ -30,7 +30,7 @@ void _onRead(uv_udp_t* req, ssize_t nread, const uv_buf_t* buf, const struct soc
return;
}
SOCKADDR_IN* sockAddr = (SOCKADDR_IN*)addr;
struct sockaddr_in* sockAddr = (struct sockaddr_in*)addr;
char ip[64] = { 0 };
uv_ip4_name(sockAddr, ip, sizeof ip);
int port = sockAddr->sin_port;
@ -104,7 +104,7 @@ bool DelayNoMore::UdpSession::openUdpSession(int port) {
uv_mutex_init(&recvLock);
udpSocket = (uv_udp_t*)malloc(sizeof(uv_udp_t));
SOCKADDR_IN recv_addr;
struct sockaddr_in recv_addr;
uv_ip4_addr("0.0.0.0", port, &recv_addr);
uv_udp_bind(udpSocket, (struct sockaddr const*)&recv_addr, UV_UDP_REUSEADDR);
@ -182,7 +182,7 @@ bool DelayNoMore::UdpSession::punchToServer(CHARC* const srvIp, int const srvPor
uv_udp_send_t* req = (uv_udp_send_t*)malloc(sizeof(uv_udp_send_t));
uv_buf_t sendBuffer = uv_buf_init(bytes, strlen(bytes));
SOCKADDR_IN destAddr;
struct sockaddr_in destAddr;
uv_ip4_addr(SRV_IP, SRV_PORT, &destAddr);
uv_mutex_lock(&sendLock);
@ -190,4 +190,4 @@ bool DelayNoMore::UdpSession::punchToServer(CHARC* const srvIp, int const srvPor
uv_mutex_unlock(&sendLock);
return true;
}
}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.genxium.delaynomore"
android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" />
<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"/>
<!-- TODO: Remove "usesCleartextTraffic" in production -->
<application
android:allowBackup="true"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<!-- Tell Cocos2dxActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="cocos2djs" />
<activity
android:name="org.cocos2dx.javascript.AppActivity"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:taskAffinity="" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,25 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
ifeq ($(USE_ARM_MODE),1)
LOCAL_ARM_MODE := arm
endif
LOCAL_SRC_FILES := hellojavascript/main.cpp \
../../../Classes/AppDelegate.cpp \
../../../Classes/jsb_module_register.cpp \
../../../Classes/udp_session.cpp \
../../../Classes/udp_session_bridge.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module, cocos)

View File

@ -0,0 +1,119 @@
/****************************************************************************
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 org.cocos2dx.javascript;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
public class AppActivity extends Cocos2dxActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
if (!isTaskRoot()) {
// Android launched another instance of the root activity into an existing task
// so just quietly finish and go away, dropping the user back into the activity
// at the top of the stack (ie: the last state of this task)
// Don't need to finish it again since it's finished in super.onCreate .
return;
}
// DO OTHER INITIALIZATION BELOW
}
@Override
public Cocos2dxGLSurfaceView onCreateView() {
Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
// TestCpp should create stencil buffer
glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
return glSurfaceView;
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
}
@Override
protected void onRestart() {
super.onRestart();
}
@Override
protected void onStop() {
super.onStop();
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
@Override
protected void onStart() {
super.onStart();
}
}

View File

@ -0,0 +1,30 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@ -17,8 +17,7 @@
},
"encryptJs": false,
"excludeScenes": [
"2ff474d9-0c9e-4fe3-87ec-fbff7cae85b4",
"92160186-3e0d-4e0a-ae20-97286170ba58"
"8491a86c-bec9-4813-968a-128ca01639e0"
],
"fb-instant-games": {},
"includeSDKBox": false,
@ -38,7 +37,7 @@
"REMOTE_SERVER_ROOT": "",
"orientation": "portrait"
},
"startScene": "8491a86c-bec9-4813-968a-128ca01639e0",
"startScene": "2ff474d9-0c9e-4fe3-87ec-fbff7cae85b4",
"title": "DelayNoMore",
"webOrientation": "landscape",
"wechatgame": {
@ -58,5 +57,5 @@
"packageName": "org.genxium.delaynomore"
},
"win32": {},
"includeAnySDK": null
"includeAnySDK": false
}

View File

@ -33,8 +33,6 @@
"design-resolution-height": 640,
"design-resolution-width": 960,
"excluded-modules": [
"Audio",
"AudioSource",
"Collider",
"DragonBones",
"Geom Utils",