Skip to content

Commit

Permalink
Merge branch 'main' into docs-20240214-many-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cutekibry committed Feb 15, 2024
2 parents 75b2cf2 + 3cd0a9c commit b5fd930
Show file tree
Hide file tree
Showing 10 changed files with 255 additions and 24 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/godot-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: "godot-ci export"
on: push
on:
- push
- pull_request

env:
GODOT_VERSION: 4.2.1
Expand All @@ -24,7 +26,7 @@ jobs:
- name: Windows Build
run: |
mkdir -v -p build/windows
godot --headless --verbose --export-release "Windows Desktop" build/windows/$EXPORT_NAME.exe
godot --headless --verbose --export-debug "Windows Desktop" build/windows/$EXPORT_NAME.exe
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -48,7 +50,7 @@ jobs:
- name: Linux Build
run: |
mkdir -v -p build/linux
godot --headless --verbose --export-release "Linux/X11" build/linux/$EXPORT_NAME.x86_64
godot --headless --verbose --export-debug "Linux/X11" build/linux/$EXPORT_NAME.x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -72,7 +74,7 @@ jobs:
- name: Web Build
run: |
mkdir -v -p build/web
godot --headless --verbose --export-release "Web" build/web/index.html
godot --headless --verbose --export-debug "Web" build/web/index.html
- name: Install rsync 📚
run: |
apt-get update && apt-get install -y rsync curl
Expand All @@ -87,11 +89,6 @@ jobs:
with:
name: web
path: build/web
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: build/web # The folder the action should deploy.

export-mac:
name: Mac Export
Expand All @@ -110,7 +107,7 @@ jobs:
- name: Mac Build
run: |
mkdir -v -p build/mac
godot --headless --verbose --export-release "mac" build/mac/$EXPORT_NAME.zip
godot --headless --verbose --export-debug "mac" build/mac/$EXPORT_NAME.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand Down
121 changes: 121 additions & 0 deletions .github/workflows/godot-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: "godot-release"
on:
push:
tags:
- "v*"

env:
GODOT_VERSION: 4.2.1
EXPORT_NAME: equal_to_p
PROJECT_PATH: equal_to_p

jobs:
export-windows:
name: Windows Export
runs-on: ubuntu-22.04
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Windows Build
run: |
mkdir -v -p build/windows
godot --headless --verbose --export-release "Windows Desktop" build/windows/$EXPORT_NAME.exe
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: windows
path: build/windows

export-linux:
name: Linux Export
runs-on: ubuntu-22.04
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Linux Build
run: |
mkdir -v -p build/linux
godot --headless --verbose --export-release "Linux/X11" build/linux/$EXPORT_NAME.x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: linux
path: build/linux

export-web:
name: Web Export
runs-on: ubuntu-22.04
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Web Build
run: |
mkdir -v -p build/web
godot --headless --verbose --export-release "Web" build/web/index.html
- name: Install rsync 📚
run: |
apt-get update && apt-get install -y rsync curl
- name: Patch for Cross Origin Isolation and SharedArrayBuffer
run: |
cd build/web/
curl https://raw.githubusercontent.com/josephrocca/clip-image-sorter/92b108dc670d0b56bd6b72963b0e86c4c862412e/enable-threads.js --output enable-threads.js
sed -i 's|headers.set("Cross-Origin-Embedder-Policy", "credentialless")|headers.set("Cross-Origin-Embedder-Policy", "require-corp")|g' enable-threads.js
sed -i 's|<script src="index.js"></script>|<script src="enable-threads.js"></script><script src="index.js"></script>|g' index.html
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: web
path: build/web
- name: Deploy to GitHub Pages 🚀
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: build/web # The folder the action should deploy.

export-mac:
name: Mac Export
runs-on: ubuntu-22.04
container:
image: barichello/godot-ci:4.2.1
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
- name: Setup
run: |
mkdir -v -p ~/.local/share/godot/export_templates
mv /root/.local/share/godot/export_templates/${GODOT_VERSION}.stable ~/.local/share/godot/export_templates/${GODOT_VERSION}.stable
- name: Mac Build
run: |
mkdir -v -p build/mac
godot --headless --verbose --export-release "mac" build/mac/$EXPORT_NAME.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: mac
path: build/mac
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.GITHUB_TOKEN }}
# this is a built-in strategy in release-please, see "Action Inputs"
# for more options
release-type: simple
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Changelog

## 1.0.0 (2024-02-14)


### ⚠ BREAKING CHANGES

* **block.gd:** void set_block_type(value: String) 被移除。
* **card_base:** 重构 Card Base 代码。
* **block:** 对 Block 进行若干重构
* **card:** 对 Card 重大重构
* **word.gd:** Word 的第一个字符从下划线 "_" 改为空格 " "。

### Features

* **base_level.gd:** 更新关卡 ([e846aee](https://github.com/ligen131/equal_to_p/commit/e846aeec74ddc72164014cd342bfe30556623a35))
* **block, card:** 添加震动、改变边框颜色、改变文字颜色的功能 ([7be6967](https://github.com/ligen131/equal_to_p/commit/7be69670e17ffae332a8d7ea0f529d16ddc5b553))
* **block.gd:** 添加 is_golden_frame 属性和方法 ([0036966](https://github.com/ligen131/equal_to_p/commit/0036966a1ee6d4cdf0e0686281491c3db5230172))
* **card_base.gd:** 添加改变卡背颜色功能 ([f049ab1](https://github.com/ligen131/equal_to_p/commit/f049ab1df2b20b96bc81028cb9cbf37895247c1c))
* **card:** 添加自动修改卡背颜色的功能 ([b95ca39](https://github.com/ligen131/equal_to_p/commit/b95ca390f3de614acaaefa2e9150193f50d63fe5))
* **expr_validator.gd:** 添加 VAR 和 CONST ([d6581cc](https://github.com/ligen131/equal_to_p/commit/d6581cc659c8190d606f242bd40db899481d41f3))
* **goal_frame:** 添加红框素材,重命名 goal_frame2.png 到 goal_frame.png ([104b475](https://github.com/ligen131/equal_to_p/commit/104b4751a9adcc72d872714a459493f499081bc9))
* **image_lib.gd:** 新配色及 update_animation 功能 ([826cd41](https://github.com/ligen131/equal_to_p/commit/826cd41f307361a0666ce55d5c320e1c4a6904f7))
* **word.gd:** 对 Word 进行重要修改 ([1e41c38](https://github.com/ligen131/equal_to_p/commit/1e41c380aa38e5057f8a99d85334527c5920733a))
* **word.gd:** 添加 class_name ([a107e96](https://github.com/ligen131/equal_to_p/commit/a107e96b886b42fd4903608113d27d6c75e383cf))
* 使指针在 card 和 card_base 上会发生改变 ([edad156](https://github.com/ligen131/equal_to_p/commit/edad1563636067669224bbea51b4a055c30a1d44))


### Bug Fixes

* **base_level.gd:** 将 preload 改为 load ([2015ae9](https://github.com/ligen131/equal_to_p/commit/2015ae9a3f8caa29090f62aba974c078a7c97258))
* **base_level.gd:** 适配 block.gd 新接口 ([2a08458](https://github.com/ligen131/equal_to_p/commit/2a084580f7ecc4831b752ae180d71a7bef98b43b))
* **card.gd:** 修正震动时高亮边框不动的 bug ([c7c8470](https://github.com/ligen131/equal_to_p/commit/c7c84707febc8c0dd868e20752ed472dad217667))
* **card.gd:** 删去未使用的 cardback_color 变量 ([41fde44](https://github.com/ligen131/equal_to_p/commit/41fde44eef1c05691f18da1c15576e5917ff1a83))
* **card.png:** 修复 Card 素材与 Block 间隙不匹配的问题 ([a0b4f04](https://github.com/ligen131/equal_to_p/commit/a0b4f04ac381f09e6be6018ba0aa33bef64420c9))


### Code Refactoring

* **block:** 对 Block 进行若干重构 ([3f750e8](https://github.com/ligen131/equal_to_p/commit/3f750e8c9728a8e6f32837db6199f674ce44f925))
* **card_base:** 重构 Card Base 代码。 ([6b9f1ee](https://github.com/ligen131/equal_to_p/commit/6b9f1ee1860e37f86d0eab8be898ec9d9b63ad04))
* **card:** 对 Card 重大重构 ([b0ace12](https://github.com/ligen131/equal_to_p/commit/b0ace12c02936680d6984e93edf698ecebbcae9a))
* **word.gd:** 更改 Word 的默认字符为空格 ([30adff0](https://github.com/ligen131/equal_to_p/commit/30adff0245109a81d7836a1a64bc84e92eb2b70c))
7 changes: 1 addition & 6 deletions main.gd
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
extends Node


const CURSOR_ARROW := preload("res://bg/cursor/cursor_arrow.png")
const CURSOR_POINTING_HAND := preload("res://bg/cursor/cursor_pointing_hand.png")
const CURSOR_DRAG := preload("res://bg/cursor/cursor_drag.png")



func _ready():
Input.set_custom_mouse_cursor(CURSOR_ARROW)
Input.set_custom_mouse_cursor(CURSOR_POINTING_HAND, Input.CURSOR_POINTING_HAND)
Input.set_custom_mouse_cursor(CURSOR_DRAG, Input.CURSOR_DRAG)


func _on_main_menu_enter_level():
Expand Down
5 changes: 4 additions & 1 deletion main.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=5 format=3 uid="uid://c17fbsiogbgo1"]
[gd_scene load_steps=6 format=3 uid="uid://c17fbsiogbgo1"]

[ext_resource type="PackedScene" uid="uid://c07co5p46apu7" path="res://objects/main_menu/main_menu.tscn" id="1_fk6j6"]
[ext_resource type="Script" path="res://main.gd" id="1_nb6uf"]
[ext_resource type="PackedScene" uid="uid://d3geq38s5fjc6" path="res://bg/dynamic_bg/dynamic_bg.tscn" id="2_8k4il"]
[ext_resource type="AudioStream" uid="uid://cr3nkhf0fejm5" path="res://levels/base_level/bgm.wav" id="3_n81it"]
[ext_resource type="PackedScene" uid="uid://prht3u5pnjls" path="res://scripts/cursor_manager/cursor_manager.tscn" id="5_pqych"]

[node name="Main" type="Node"]
script = ExtResource("1_nb6uf")
Expand All @@ -20,5 +21,7 @@ stream = ExtResource("3_n81it")
volume_db = -4.685
attenuation = 0.0001

[node name="CursorManager" parent="." instance=ExtResource("5_pqych")]

[connection signal="enter_level" from="MainMenu" to="." method="_on_main_menu_enter_level"]
[connection signal="finished" from="BGMPlayer" to="." method="_on_bgm_player_finished"]
5 changes: 0 additions & 5 deletions objects/card/card.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ func put_down():
$SFXPutDown.play()

entered_block.set_card(self)

Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) # 设置鼠标指针形状为手形

else:
queue_free()
Expand Down Expand Up @@ -107,7 +105,6 @@ func _ready():
func _process(_delta: float) -> void:
if self.is_dragging: # 如果正在拖拽
self.global_position = get_global_mouse_position().round() # 将卡牌位置设置为鼠标位置的全局位置,四舍五入取整
Input.set_default_cursor_shape(Input.CURSOR_DRAG) # 设置鼠标指针形状为拖拽形状

var offset := 0
if self.is_shaking:
Expand Down Expand Up @@ -138,12 +135,10 @@ func _input_event(_viewport: Object, event: InputEvent, _shape_idx: int) -> void

func _on_mouse_entered():
$HighlightSprite.visible = true
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) # 设置鼠标指针形状为手形


func _on_mouse_exited():
$HighlightSprite.visible = false
Input.set_default_cursor_shape(Input.CURSOR_ARROW) # 设置鼠标指针形状为箭头


func _on_tree_exiting():
Expand Down
7 changes: 5 additions & 2 deletions objects/card_base/card_base.gd
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ func get_word() -> String:
return $Word.get_word()


## 获取剩余卡牌数量。
func get_card_count() -> int:
return self.card_count


## 进行通关后的处理。
func set_victory() -> void:
# 开始淡出
Expand Down Expand Up @@ -116,14 +121,12 @@ func _on_mouse_entered():
is_mouse_on = true
if available_stat == DEFAULT:
available_stat = HIGHLIGHT
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)


func _on_mouse_exited():
is_mouse_on = false
if available_stat == HIGHLIGHT:
available_stat = DEFAULT
Input.set_default_cursor_shape(Input.CURSOR_ARROW)


func _on_cards_child_exiting_tree(node: Node) -> void:
Expand Down
38 changes: 38 additions & 0 deletions scripts/cursor_manager/cursor_manager.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## 用于检测与鼠标重合的、[member Area2D.z_index] 最高的 [Area2D],并根据其状态设置鼠标光标形状。
class_name CursorManager extends Area2D


const CURSOR_ARROW := preload("res://bg/cursor/cursor_arrow.png") ## 鼠标光标为指针时的素材。
const CURSOR_POINTING_HAND := preload("res://bg/cursor/cursor_pointing_hand.png") ## 鼠标光标为指向时的素材。
const CURSOR_DRAG := preload("res://bg/cursor/cursor_drag.png") ## 鼠标光标为拖拽时的素材。


func _ready():
Input.set_custom_mouse_cursor(CURSOR_ARROW)
Input.set_custom_mouse_cursor(CURSOR_POINTING_HAND, Input.CURSOR_POINTING_HAND)
Input.set_custom_mouse_cursor(CURSOR_DRAG, Input.CURSOR_DRAG)


func _process(_delta):
self.global_position = get_global_mouse_position()

# 获取 z_index 最高的 Area2D
var top_area: Area2D = null
for area in get_overlapping_areas():
if top_area == null or area.z_index > top_area.z_index:
top_area = area

if top_area == null:
Input.set_custom_mouse_cursor(CURSOR_ARROW)
elif top_area is Card:
if top_area.is_dragging:
Input.set_custom_mouse_cursor(CURSOR_DRAG)
else:
Input.set_custom_mouse_cursor(CURSOR_POINTING_HAND)
elif top_area is CardBase:
if top_area.get_card_count() > 0:
Input.set_custom_mouse_cursor(CURSOR_POINTING_HAND)
else:
Input.set_custom_mouse_cursor(CURSOR_ARROW)
else:
Input.set_custom_mouse_cursor(CURSOR_ARROW)
12 changes: 12 additions & 0 deletions scripts/cursor_manager/cursor_manager.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://prht3u5pnjls"]

[ext_resource type="Script" path="res://scripts/cursor_manager/cursor_manager.gd" id="1_v3lev"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_stfy2"]
size = Vector2(0, 0)

[node name="CursorManager" type="Area2D"]
script = ExtResource("1_v3lev")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_stfy2")

0 comments on commit b5fd930

Please sign in to comment.