README.md
1# Mouse Event
2
3### Introduction
4
5This sample simulates a minesweeper game that invokes mouse event-related APIs.
6
7### Usage
8
91. Minesweeper rules: A player clicks a square to open it. If the player opens a mined cell, the game ends. Otherwise, the opened cell displays a number indicating the quantity of mines diagonally and/or adjacent to it. Right-clicking a cell will flag it, and the quantity of remaining mines decreases by 1. The player wins the game when all the hidden mines are found.
102. Hover the mouse pointer over a gray cell on the screen. The color of the cell becomes lighter.
113. Click a blank cell. A number is displayed in the cell, and this cell does not respond.
124. Right-click a blank cell, and the cell is displayed in red. If the cell contains a mine, the quantity of remaining mines decreases by 1, and the game continues. Otherwise, a dialog box is displayed, indicating that the game is over.
135. Middle-click a cell displayed with a number. The blank cells around that cell blink, and the non-blank cells (opened or flagged cells) do not blink.
146. In the dialog box that indicates the game is over, touch **Restart**. The screen refreshes and a new game starts.
157. In the dialog box that indicates the game is over, touch **Exit**. The game exits and the app is closed.
16
17### Constraints
18
19This sample requires an external mouse. It can only be run on standard-system devices.
20
README_zh.md
1# 鼠标事件
2
3### 简介
4
5本示例模拟了简单的扫雷游戏调用了鼠标事件的相关接口。效果图如下:
6
7
8
9### 相关概念
10
11鼠标输入事件:设备上报的鼠标事件。
12
13### 相关权限
14
15不涉及。
16
17### 使用说明
18
191.扫雷规则:左键打开方格,方格显示的数字为方格周围一圈的地雷数目(9代表地雷),右键标记地雷方格且剩余地雷数目-1,若标记错误游戏结束,当剩余地雷数目为0时,玩家获得胜利游戏结束。
20
212.移动鼠标悬停在界面中的灰色方格中,方格颜色变浅。
22
233.在空白方格上点击鼠标左键,空白方格中出现数字,被标记的方格无反应。
24
254.在空白方格上点击鼠标右键,空白方格被标红,若此格不为地雷格弹出弹窗,显示游戏结束,若此格为地雷格剩余地雷数目-1游戏继续。
26
275.在数字方格上点击鼠标中键,数字方格周围一圈的的空白方格闪烁,打开或标记为地雷的方格不闪烁。
28
296.点击弹窗按钮**再来一局**,游戏界面刷新,开启新一局游戏。
30
317.点击弹窗按钮**退出游戏**,游戏结束应用关闭。
32
33### 约束与限制
34
351.本示例正常测试需要外接鼠标,仅支持在标准系统上运行。
36
372.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
38