From e0703136c174e7baba711710764944260bff68a8 Mon Sep 17 00:00:00 2001 From: TxZgX <86029709+xuegao-tzx@users.noreply.github.com> Date: Thu, 23 Dec 2021 15:44:54 +0800 Subject: [PATCH] 1 --- .../15c2c2374b51ddda965f123d7721b78051be2c9f | 3 + .../36d48c2c0aa8cb6b91428b9d2d791dcae782d636 | 14 ++-- .../3bb84a6effd773d95ed647597ffe3ad387fdfbcf | 0 .../432f7b86a9ef0116a552dc8dd8867c619cd9f198 | 3 + .../6288971498872deb62c5e285d192d813e22b1c1c | 0 .../b4c4e536f4084a0b6a45f8b0d2725567135b92e6 | 3 + .../e76da2df200fc79b254b005f068d568bf8c2b7ec | 0 .../.idea/sonarlint/issuestore/index.pb | 16 ++++- MyApplication2/.idea/vcs.xml | 6 ++ MyApplication2/entry/build.gradle | 4 +- MyApplication2/entry/src/main/config.json | 11 ++- .../xcl20481/myapplication/MainAbility.java | 2 - .../entry/src/main/js/default/app.js | 3 +- .../src/main/js/default/pages/index/index.css | 14 ++-- .../src/main/js/default/pages/index/index.js | 18 ++++- .../src/main/js/default/pages/page0/page0.css | 42 +++++++++++ .../src/main/js/default/pages/page0/page0.hml | 10 +++ .../src/main/js/default/pages/page0/page0.js | 70 +++++++++++++++++++ 18 files changed, 195 insertions(+), 24 deletions(-) create mode 100644 MyApplication2/.idea/sonarlint/issuestore/1/5/15c2c2374b51ddda965f123d7721b78051be2c9f create mode 100644 MyApplication2/.idea/sonarlint/issuestore/3/b/3bb84a6effd773d95ed647597ffe3ad387fdfbcf create mode 100644 MyApplication2/.idea/sonarlint/issuestore/4/3/432f7b86a9ef0116a552dc8dd8867c619cd9f198 create mode 100644 MyApplication2/.idea/sonarlint/issuestore/6/2/6288971498872deb62c5e285d192d813e22b1c1c create mode 100644 MyApplication2/.idea/sonarlint/issuestore/e/7/e76da2df200fc79b254b005f068d568bf8c2b7ec create mode 100644 MyApplication2/.idea/vcs.xml create mode 100644 MyApplication2/entry/src/main/js/default/pages/page0/page0.css create mode 100644 MyApplication2/entry/src/main/js/default/pages/page0/page0.hml create mode 100644 MyApplication2/entry/src/main/js/default/pages/page0/page0.js diff --git a/MyApplication2/.idea/sonarlint/issuestore/1/5/15c2c2374b51ddda965f123d7721b78051be2c9f b/MyApplication2/.idea/sonarlint/issuestore/1/5/15c2c2374b51ddda965f123d7721b78051be2c9f new file mode 100644 index 0000000..c87a510 --- /dev/null +++ b/MyApplication2/.idea/sonarlint/issuestore/1/5/15c2c2374b51ddda965f123d7721b78051be2c9f @@ -0,0 +1,3 @@ + +C +java:S1185"(Remove this method to simply inherit it.(Ί \ No newline at end of file diff --git a/MyApplication2/.idea/sonarlint/issuestore/3/6/36d48c2c0aa8cb6b91428b9d2d791dcae782d636 b/MyApplication2/.idea/sonarlint/issuestore/3/6/36d48c2c0aa8cb6b91428b9d2d791dcae782d636 index 490a56f..0c5eb19 100644 --- a/MyApplication2/.idea/sonarlint/issuestore/3/6/36d48c2c0aa8cb6b91428b9d2d791dcae782d636 +++ b/MyApplication2/.idea/sonarlint/issuestore/3/6/36d48c2c0aa8cb6b91428b9d2d791dcae782d636 @@ -1,8 +1,8 @@ -wjavascript:S3776""TRefactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.(8/ -javascript:S4165'"eReview this redundant assignment: "start" already holds the assigned value along all execution paths.(8/ -javascript:S41651"eReview this redundant assignment: "start" already holds the assigned value along all execution paths.(8/ -Ejavascript:S1656R""'this.best' is assigned to itself.(8/ -Jjavascript:S1125Y"'Remove the unnecessary boolean literal.(8/ -Ojavascript:S1125o"'Remove the unnecessary boolean literal.(8/ -Ojavascript:S1125o"'Remove the unnecessary boolean literal.(8/ \ No newline at end of file +wjavascript:S3776#"TRefactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed.(8/ +javascript:S4165("eReview this redundant assignment: "start" already holds the assigned value along all execution paths.(8/ +javascript:S41652"eReview this redundant assignment: "start" already holds the assigned value along all execution paths.(8/ +Ejavascript:S1656S""'this.best' is assigned to itself.(8/ +Jjavascript:S1125Z"'Remove the unnecessary boolean literal.(8/ +Jjavascript:S1125p"'Remove the unnecessary boolean literal.(8/ +Jjavascript:S1125p"'Remove the unnecessary boolean literal.(8/ \ No newline at end of file diff --git a/MyApplication2/.idea/sonarlint/issuestore/3/b/3bb84a6effd773d95ed647597ffe3ad387fdfbcf b/MyApplication2/.idea/sonarlint/issuestore/3/b/3bb84a6effd773d95ed647597ffe3ad387fdfbcf new file mode 100644 index 0000000..e69de29 diff --git a/MyApplication2/.idea/sonarlint/issuestore/4/3/432f7b86a9ef0116a552dc8dd8867c619cd9f198 b/MyApplication2/.idea/sonarlint/issuestore/4/3/432f7b86a9ef0116a552dc8dd8867c619cd9f198 new file mode 100644 index 0000000..66ea0c1 --- /dev/null +++ b/MyApplication2/.idea/sonarlint/issuestore/4/3/432f7b86a9ef0116a552dc8dd8867c619cd9f198 @@ -0,0 +1,3 @@ + +C +java:S1185 "(Remove this method to simply inherit it.( \ No newline at end of file diff --git a/MyApplication2/.idea/sonarlint/issuestore/6/2/6288971498872deb62c5e285d192d813e22b1c1c b/MyApplication2/.idea/sonarlint/issuestore/6/2/6288971498872deb62c5e285d192d813e22b1c1c new file mode 100644 index 0000000..e69de29 diff --git a/MyApplication2/.idea/sonarlint/issuestore/b/4/b4c4e536f4084a0b6a45f8b0d2725567135b92e6 b/MyApplication2/.idea/sonarlint/issuestore/b/4/b4c4e536f4084a0b6a45f8b0d2725567135b92e6 index e69de29..00bf0b6 100644 --- a/MyApplication2/.idea/sonarlint/issuestore/b/4/b4c4e536f4084a0b6a45f8b0d2725567135b92e6 +++ b/MyApplication2/.idea/sonarlint/issuestore/b/4/b4c4e536f4084a0b6a45f8b0d2725567135b92e6 @@ -0,0 +1,3 @@ + +Kjavascript:S1186"#Unexpected empty method 'onCreate'.(ǎ8/ +Ljavascript:S1186"$Unexpected empty method 'onDestroy'.(٩8/ \ No newline at end of file diff --git a/MyApplication2/.idea/sonarlint/issuestore/e/7/e76da2df200fc79b254b005f068d568bf8c2b7ec b/MyApplication2/.idea/sonarlint/issuestore/e/7/e76da2df200fc79b254b005f068d568bf8c2b7ec new file mode 100644 index 0000000..e69de29 diff --git a/MyApplication2/.idea/sonarlint/issuestore/index.pb b/MyApplication2/.idea/sonarlint/issuestore/index.pb index c41e6c0..60b7500 100644 --- a/MyApplication2/.idea/sonarlint/issuestore/index.pb +++ b/MyApplication2/.idea/sonarlint/issuestore/index.pb @@ -1,13 +1,23 @@ -P - entry/src/main/js/default/app.js,b\4\b4c4e536f4084a0b6a45f8b0d2725567135b92e6 Y )entry/src/main/js/default/i18n/en-US.json,5\3\53c2f15f1da3e1de172f90feee9cf4143c3029f0 +o +?entry/src/main/java/com/xcl20481/myapplication/MainAbility.java,4\3\432f7b86a9ef0116a552dc8dd8867c619cd9f198 +q +Aentry/src/main/java/com/xcl20481/myapplication/MyApplication.java,1\5\15c2c2374b51ddda965f123d7721b78051be2c9f +P + entry/src/main/js/default/app.js,b\4\b4c4e536f4084a0b6a45f8b0d2725567135b92e6 +_ +/entry/src/main/js/default/pages/index/index.hml,e\b\eb4272ef57a8e412e241acf56c46fd3c2ccd3848 _ /entry/src/main/js/default/pages/index/index.css,b\d\bded84c8d7c3dc43c805144b684b7e76d317f963 _ -/entry/src/main/js/default/pages/index/index.hml,e\b\eb4272ef57a8e412e241acf56c46fd3c2ccd3848 +/entry/src/main/js/default/pages/page0/page0.hml,6\2\6288971498872deb62c5e285d192d813e22b1c1c ^ .entry/src/main/js/default/pages/index/index.js,3\6\36d48c2c0aa8cb6b91428b9d2d791dcae782d636 +_ +/entry/src/main/js/default/pages/page0/page0.css,3\b\3bb84a6effd773d95ed647597ffe3ad387fdfbcf +^ +.entry/src/main/js/default/pages/page0/page0.js,e\7\e76da2df200fc79b254b005f068d568bf8c2b7ec J entry/src/main/config.json,1\0\10f965cf51fe14a5ef0ca2ebefb1bd7e4607eeb2 \ No newline at end of file diff --git a/MyApplication2/.idea/vcs.xml b/MyApplication2/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/MyApplication2/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MyApplication2/entry/build.gradle b/MyApplication2/entry/build.gradle index b46b136..80aad93 100644 --- a/MyApplication2/entry/build.gradle +++ b/MyApplication2/entry/build.gradle @@ -13,9 +13,9 @@ ohos { certpath file('C:\\Users\\honor\\.ohos\\config\\auto_debug_myapplication_56657123.cer') } } - compileSdkVersion 5 + compileSdkVersion 7 defaultConfig { - compatibleSdkVersion 4 + compatibleSdkVersion 6 } buildTypes { release { diff --git a/MyApplication2/entry/src/main/config.json b/MyApplication2/entry/src/main/config.json index 5da71ae..6b7970e 100644 --- a/MyApplication2/entry/src/main/config.json +++ b/MyApplication2/entry/src/main/config.json @@ -1,10 +1,13 @@ { "app": { + "apiVersion": { + "compatible": 3 + }, "bundleName": "com.xcl20481.myapplication", "vendor": "xcl20481", "version": { "code": 1000000, - "name": "1.0.1" + "name": "1.0.2" } }, "deviceConfig": { @@ -16,6 +19,11 @@ "package": "com.xcl20481.myapplication", "name": ".MyApplication", "mainAbility": "com.xcl20481.myapplication.MainAbility", + "reqPermissions": [ + { + "name": "ohos.permission.VIBRATE" + } + ], "deviceType": [ "phone", "tablet", @@ -52,6 +60,7 @@ "js": [ { "pages": [ + "pages/page0/page0", "pages/index/index" ], "name": "default", diff --git a/MyApplication2/entry/src/main/java/com/xcl20481/myapplication/MainAbility.java b/MyApplication2/entry/src/main/java/com/xcl20481/myapplication/MainAbility.java index 9064207..3d16aaa 100644 --- a/MyApplication2/entry/src/main/java/com/xcl20481/myapplication/MainAbility.java +++ b/MyApplication2/entry/src/main/java/com/xcl20481/myapplication/MainAbility.java @@ -1,8 +1,6 @@ package com.xcl20481.myapplication; - import ohos.ace.ability.AceAbility; import ohos.aafwk.content.Intent; - public class MainAbility extends AceAbility { @Override public void onStart(Intent intent) { diff --git a/MyApplication2/entry/src/main/js/default/app.js b/MyApplication2/entry/src/main/js/default/app.js index aedcefe..feb8d1f 100644 --- a/MyApplication2/entry/src/main/js/default/app.js +++ b/MyApplication2/entry/src/main/js/default/app.js @@ -1,8 +1,7 @@ + export default { onCreate() { - console.info('AceApplication onCreate'); }, onDestroy() { - console.info('AceApplication onDestroy'); } }; diff --git a/MyApplication2/entry/src/main/js/default/pages/index/index.css b/MyApplication2/entry/src/main/js/default/pages/index/index.css index 2df94fc..c733b72 100644 --- a/MyApplication2/entry/src/main/js/default/pages/index/index.css +++ b/MyApplication2/entry/src/main/js/default/pages/index/index.css @@ -10,17 +10,19 @@ width: 70px; height: 17px; letter-spacing: 0px; - font-size: 11px; - margin-top: 1.8px; + font-size: 11.5px; + margin-top: 1px; margin-bottom:3px; + color: #eb0bc7f6; } .best{ text-align: center; width: 60px; height: 17px; - font-size: 12px; + font-size: 12.5px; letter-spacing: 0px; - margin-top: 8.5px; + margin-top: 8.3px; + color: #64f6f3; } .tile-wrap{ width: 150px; @@ -57,9 +59,9 @@ height: 150px; justify-content: center; align-items: center; - background-color: transparent; + background-color: black; } .gameover{ - font-size: 20px; + font-size: 30px; color: #FF7500; } diff --git a/MyApplication2/entry/src/main/js/default/pages/index/index.js b/MyApplication2/entry/src/main/js/default/pages/index/index.js index 08b7a78..e5880af 100644 --- a/MyApplication2/entry/src/main/js/default/pages/index/index.js +++ b/MyApplication2/entry/src/main/js/default/pages/index/index.js @@ -1,4 +1,5 @@ import brightness from '@system.brightness'; +import vibrator from '@system.vibrator'; let numbers,newNumbers; export default{ data:{ @@ -108,7 +109,22 @@ export default{ numbers=newNumbers; }, isGameOver(){ - if(this.isGridsFull()==true && this.isGridsNotMergeable()==true) return true; + if(this.isGridsFull()==true && this.isGridsNotMergeable()==true){ + vibrator.vibrate({ + mode: 'long', + success: function(ret) { + console.log('vibrate is successful'); + }, + fail: function(ret) { + console.log('vibrate is failed'); + }, + complete: function(ret) { + console.log('vibrate is completed'); + } + }); + console.info('游戏结束'); + return true; + } }, isGridsFull(){ if(numbers.indexOf(0)==-1){return true;} diff --git a/MyApplication2/entry/src/main/js/default/pages/page0/page0.css b/MyApplication2/entry/src/main/js/default/pages/page0/page0.css new file mode 100644 index 0000000..4cd622a --- /dev/null +++ b/MyApplication2/entry/src/main/js/default/pages/page0/page0.css @@ -0,0 +1,42 @@ +.container{ + width: 227px; + height: 227px; + flex-direction: column; + justify-content: center; + align-items: center; +} +.title { + text-align: center; + width: 140px; + height: 62px; + letter-spacing: 0px; + font-size: 19px; + margin-top: 40px; + margin-bottom:3px; + color: #eb0750cb; +} +.title1 { + text-align: center; + width: 180px; + height: 150px; + font-size: 15.5px; + margin-top: 5px; + margin-bottom:5px; + color: #eb0597bb; +} +.btn{ + width: 65.5px; + height: 35.5px; + background-color: #155ddc; + margin-top: 5px; + font-size: 13px; + margin-bottom: 3px; +} +.btn1{ + width: 65.5px; + height: 35.5px; + background-color: #155ddc; + margin-top: 5px; + font-size: 13px; + margin-bottom: 5px; +} \ No newline at end of file diff --git a/MyApplication2/entry/src/main/js/default/pages/page0/page0.hml b/MyApplication2/entry/src/main/js/default/pages/page0/page0.hml new file mode 100644 index 0000000..c5b6521 --- /dev/null +++ b/MyApplication2/entry/src/main/js/default/pages/page0/page0.hml @@ -0,0 +1,10 @@ +
+ + 《2048小游戏》 + + + 开始游戏即默认同意我的隐私声明:www.xuegao-tzx.top/g2048h.html + + + +
diff --git a/MyApplication2/entry/src/main/js/default/pages/page0/page0.js b/MyApplication2/entry/src/main/js/default/pages/page0/page0.js new file mode 100644 index 0000000..a1a936d --- /dev/null +++ b/MyApplication2/entry/src/main/js/default/pages/page0/page0.js @@ -0,0 +1,70 @@ +import router from '@system.router' +import app from '@system.app' +import brightness from '@system.brightness'; +import vibrator from '@system.vibrator'; +import prompt from '@system.prompt'; +export default { + onInit() { + brightness.setKeepScreenOn({keepScreenOn: true,}); + brightness.setMode({mode: 1,}); + }, + onSwipe(e) { + switch (e.direction) { + case 'left': + break; + case 'right': + break; + case 'up': + break; + case 'down': + break; + } + }, + onlongpress(){ + console.log('tzx 11'); + prompt.showToast({ + message: 'Message Info', + duration: 2000, + }); + }, + ToStart(){ + vibrator.vibrate({ + mode: 'short', + success: function(ret) { + console.log('tzx vibrate is successful'); + }, + fail: function(ret) { + console.log('tzx vibrate is failed'); + }, + complete: function(ret) { + console.log('tzx vibrate is completed'); + } + }); + prompt.showToast({ + message: '开始成功,By Xcl!', + duration: 3000, + }); + router.replace({ + uri: "pages/index/index", + }); + }, + ToClose(){ + prompt.showToast({ + message: '退出成功!', + duration: 3500, + }); + vibrator.vibrate({ + mode: 'short', + success: function(ret) { + console.log('tzx vibrate is successful'); + }, + fail: function(ret) { + console.log('tzx vibrate is failed'); + }, + complete: function(ret) { + console.log('tzx vibrate is completed'); + } + }); + app.terminate(); + }, +}