diff --git a/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/config.json b/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/config.json index 0e5e9f6dec1df297dce7a9b32d8c904f9bab09f0..265064e526c56306eb3edb27660e7d17ac095706 100644 --- a/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/config.json +++ b/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/config.json @@ -70,6 +70,11 @@ "autoDesignWidth": false } } + ], + "reqPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + } ] } } \ No newline at end of file diff --git a/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets b/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets index 061dbfc7b4bc3200372f220d4dcc672291784a0d..65b2bfbe0bbdb56ac1b4245df762324ce0145b67 100644 --- a/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets +++ b/Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import {GameElement} from '../model/GameElement' +import { GameElement } from '../model/GameElement' import prompt from '@system.prompt'; import RemoteDeviceModel from '../model/RemoteDeviceModel'; import featureAbility from '@ohos.ability.featureAbility'; @@ -198,6 +198,8 @@ struct Index { }); aboutToAppear() { + this.grantPermission() + this.subscribeEvent(); this.screenWidth = 720 this.screenHeight = 1200 @@ -208,6 +210,14 @@ struct Index { this.startGame() } + grantPermission() { + console.info(`[game] grantPermission`) + let context = featureAbility.getContext() + context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) { + console.info(`[game] grantPermission,requestPermissionsFromUser`) + }) + } + subscribeEvent() { let that = this; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作 @@ -323,7 +333,7 @@ struct Index { }, 16); } -// 收到手柄指令后移动飞机 + // 收到手柄指令后移动飞机 movePlaneByHandle() { this.planePosX += Math.cos((this.angle + 90) * (Math.PI / 180)) * 10 this.planePosY -= Math.sin((this.angle + 90) * (Math.PI / 180)) * 10 @@ -346,7 +356,7 @@ struct Index { this.bulletPosY = this.planePosY - this.bulletHeight } -// 创建子弹 + // 创建子弹 createBullet() { var that = this let bullet = new GameElement(); @@ -359,7 +369,7 @@ struct Index { that.bullets.push(bullet) } -// 创建敌机 + // 创建敌机 createEnemyPlane() { var that = this let flag = Math.round((Math.random() + 1)) @@ -382,7 +392,7 @@ struct Index { that.enemyPlanes.push(enemy) } -// 检查是否发生碰撞 + // 检查是否发生碰撞 checkCollision() { var that = this; @@ -436,7 +446,7 @@ struct Index { } -// 销毁所有敌机 + // 销毁所有敌机 destroyAllEnemy() { for (var k = 0; k < this.enemyPlanes.length; k++) { var destroyEnemy = this.enemyPlanes[k]; @@ -453,7 +463,7 @@ struct Index { this.propsPosY = 2000 } -// 判断两个元素是否有重叠 + // 判断两个元素是否有重叠 isInside(v1, v2) { var v1StartX = v1.positionX; var v1EndX = v1.positionX + v1.imgWidth; diff --git a/Distributed/HandleGameApplication/GameEtsOpenHarmony/local.properties b/Distributed/HandleGameApplication/GameEtsOpenHarmony/local.properties deleted file mode 100644 index 60b25f53723be603bc33864892014f55127d3610..0000000000000000000000000000000000000000 --- a/Distributed/HandleGameApplication/GameEtsOpenHarmony/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by DevEco Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file should *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# For customization when using a Version Control System, please read the header note. -sdk.dir=D:/Program Files/Huawei/OpenHarmonySDK -nodejs.dir=D:/Program Files/Huawei/DevEco Studio 3.0.0.900/tools/nodejs -npm.dir=D:/Program Files/Huawei/DevEco Studio 3.0.0.900/tools/nodejs \ No newline at end of file diff --git a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/config.json b/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/config.json index 0e5e9f6dec1df297dce7a9b32d8c904f9bab09f0..265064e526c56306eb3edb27660e7d17ac095706 100644 --- a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/config.json +++ b/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/config.json @@ -70,6 +70,11 @@ "autoDesignWidth": false } } + ], + "reqPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + } ] } } \ No newline at end of file diff --git a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets b/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets index 4ca80991c854e44aceb7ab8821cfca74e71a8d8f..34f3576e838ee516287af6fbd336b15f8e5c407b 100644 --- a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets +++ b/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets @@ -84,6 +84,7 @@ struct Index { @State score: number = 0 async aboutToAppear() { + this.grantPermission() this.subscribeEvent(); // 当被拉起时,通过want传递的参数同步对端界面UI @@ -96,6 +97,14 @@ struct Index { }); } + grantPermission() { + console.info(`[game] grantPermission`) + let context = featureAbility.getContext() + context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) { + console.info(`[game] grantPermission,requestPermissionsFromUser`) + }) + } + subscribeEvent() { let that = this; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作 @@ -169,7 +178,7 @@ struct Index { } } -// 计算手指(即小圆)移动距离大圆圆心的距离 + // 计算手指(即小圆)移动距离大圆圆心的距离 getDisZ() { // 小圆和大圆圆心 var centerX = this.startPosX + this.smallR + 60 @@ -213,7 +222,7 @@ struct Index { } -// 计算移动距离的绝对值 + // 计算移动距离的绝对值 getDisAbsX() { var disAbsX = Math.abs(this.smallPosX - this.startPosX); console.log("[demo4]disAbsX:" + disAbsX); @@ -223,7 +232,7 @@ struct Index { return disAbsX; } -// 计算移动距离的绝对值 + // 计算移动距离的绝对值 getDisAbsY() { var disAbsY = Math.abs(this.smallPosY - this.startPosY); console.log("[demo4]disAbsY:" + disAbsY); diff --git a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/local.properties b/Distributed/HandleGameApplication/HandleEtsOpenHarmony/local.properties deleted file mode 100644 index 60b25f53723be603bc33864892014f55127d3610..0000000000000000000000000000000000000000 --- a/Distributed/HandleGameApplication/HandleEtsOpenHarmony/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by DevEco Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file should *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# For customization when using a Version Control System, please read the header note. -sdk.dir=D:/Program Files/Huawei/OpenHarmonySDK -nodejs.dir=D:/Program Files/Huawei/DevEco Studio 3.0.0.900/tools/nodejs -npm.dir=D:/Program Files/Huawei/DevEco Studio 3.0.0.900/tools/nodejs \ No newline at end of file diff --git a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/computer/icon-pinn.png b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/computer/icon-pinn.png deleted file mode 100644 index 4ce0a868cc2cd5c83c915c0bb9ac1e55e6043a13..0000000000000000000000000000000000000000 Binary files a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/computer/icon-pinn.png and /dev/null differ diff --git a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/nav/iocn-my.png b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/nav/icon-my.png similarity index 100% rename from JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/nav/iocn-my.png rename to JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/common/nav/icon-my.png diff --git a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.css b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.css index 68fe8fb9bcd735a414be9645db0560ca416dd9d3..add3bc09bb5053614407d3a335b93ef59f29cb51 100644 --- a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.css +++ b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.css @@ -146,14 +146,6 @@ height: 160px; } -.container-home-pinned { - width: 80px; - height: 80px; - position: fixed; - bottom: 100px; - right: 30px; -} - .container-shopping-title { position: fixed; background-color: #00BFFF; diff --git a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.hml b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.hml index 002105882556bcb36b100a8b42e6831da81e32de..aef4607e95680f8b3f4e66c0e635541d13899a14 100644 --- a/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.hml +++ b/JSUI/ShoppingOpenHarmony/entry/src/main/js/MainAbility/pages/homepage/homepage.hml @@ -55,10 +55,6 @@ -