Merge 42a77d281e47bd0a9d9c1f4e8345812eccdc0270 into e8f95a4d4d7d3448a2984d39df4b70688e28ba54

This commit is contained in:
tlibn 2022-09-20 12:22:24 +08:00 committed by GitHub
commit 5a20ab2767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 84 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM nginx:1.10
COPY dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx
RUN true
VOLUME /mydata/nginx/conf:/etc/nginx
VOLUME /mydata/nginx/html:/usr/share/nginx/html
VOLUME /mydata/nginx/log:/var/log/nginx

View File

@ -30,5 +30,37 @@
3. 随机生成块:包括随机生成方块的图案和坐标。首先我根据全局参数计算出了总块数,然后用 shuffle 函数打乱存储所有动物图案的数组,再依次将数组中的图案填充到方块中。生成坐标的原理是随机选取坐标范围内的点,坐标范围可以随着层级的增加而递减,即生成的图案越来越挤,达到难度逐层加大的效果。
4. 块的覆盖关系:怎么做到点击上层的块后,才能点下层的块呢?首先要给每个块指定一个层级属性。然后有两种思路,第 1 种是先逐层生成,然后每个格子里层级最高的块依次判断其周围格子有没有块层级大于它;第 2 种是在随机生成块的时候就给相互重叠的块绑定层级关系(即谁覆盖了我?我覆盖了谁?)。这里我选择了第 2 种方法,感觉效率会高一些。
## 启动命令
- 安装yarn install
- 本地启动yarn dev
- 构建yarn build
## docker
### 打镜像目录
![docker镜像构建目录](doc/build_docker_image_dir.png)
### 相关命令
- docker build -f Dockerfile -t yulegeyu .
![docker镜像构建目录](doc/building.png)
- docker images
![docker镜像构建目录](doc/build_done.png)
- docker run --name yulegeyu -p 8111:80 -d yulegeyu
![docker镜像构建目录](doc/docker_run.png)
- 阿里云安全组放开8111端口
![docker镜像构建目录](doc/aliport.jpg)
- 示例图
![docker镜像构建目录](doc/game1.png)
![docker镜像构建目录](doc/game2.png)

BIN
doc/aliport.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
doc/build_done.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
doc/building.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
doc/docker_run.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
doc/game1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

BIN
doc/game2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

45
nginx.conf Normal file
View File

@ -0,0 +1,45 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}