From 0595ce4ea6b8d5dc57a384173e8afff0c1e0eb95 Mon Sep 17 00:00:00 2001 From: C6H12O6 + NaCl + H2O <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:44:01 +0700 Subject: [PATCH 1/5] Update Vietnamese translation (again) (#929) --- parts/language/dict_vi.lua | 2 +- parts/language/dict_zh.lua | 7 ------- parts/language/lang_vi.lua | 12 +++++++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/parts/language/dict_vi.lua b/parts/language/dict_vi.lua index 36b7b806..2bef8a92 100644 --- a/parts/language/dict_vi.lua +++ b/parts/language/dict_vi.lua @@ -21,7 +21,7 @@ Có câu hỏi? Liên hệ mình qua server Techmino trên Discord. Mình hiện }, { "Mục lục", - "nhom02 index mucluc", + "nhom01 index mucluc", "help", [[ 01. Về Zictionary & Bản dịch game & Mục lục ← bạn đang xem mục này diff --git a/parts/language/dict_zh.lua b/parts/language/dict_zh.lua index 7a00b311..5cb840a8 100644 --- a/parts/language/dict_zh.lua +++ b/parts/language/dict_zh.lua @@ -142,13 +142,6 @@ FNNS and {"赞助3", -- id: support-3 -- platform-restriction: non-apple }, - {"赞助2", - "support aifadian afdian zanzhu daqian", - "org", - "Afdian", - -- id: support-2 - -- platform-restriction: apple - }, -- # 游戏(题库) {"TTT", "教程 trainer tres bien", diff --git a/parts/language/lang_vi.lua b/parts/language/lang_vi.lua index b8389320..a8642d17 100644 --- a/parts/language/lang_vi.lua +++ b/parts/language/lang_vi.lua @@ -1242,15 +1242,21 @@ C. Tay cầm chơi game (Gamepad) "shutdown /s /t 0", -- Turn off computer completely (no Fast Boot) "shutdown /s /t 0 /hybrid", -- Turn off computer with Fast Boot still activated -- Techmino has reached the limit. - "Bạn không thể mở Techmino vì đã đạt tới giới hạn", + "Không thể mở Techmino vì bạn đã quá nghiện game này rồi :>", -- Techmino.exe has stopped working. "Techmino.exe hiện không phản hồi", "Techmino đã đột ngột dừng lại", -- If you have a real interest in programming, I recommend Lua. Easy installation, simple syntax, and fast execution speed. Stay away from boring school programming (haha) {"Nếu bạn thực sự có hứng thú trong lập trình, tôi đề xuất sử dụng Lua. Dễ xài, cú pháp đơn giản, và tốc độ thực thi nhanh. Rồi tránh xa chương trình học nhàm chán ở trên trường luôn! (haha) - ",C.W,"Z",C.white," said."}, -- COLD CLEAR PATH - "Đường dẫn của Cold Clear: "..(SYSTEM=='Windows' and "\\CCLoader.dll" or SYSTEM=='Linux' and "/ColCLoader.so" or SYSTEM=='Android' and "/libAndroid/arm64-v8a (hoặc armeabi-v7a)/CCLoader.so" or SYSTEM=='OS X' and "\\CCloader.dll" or + SYSTEM=='Linux' and "/CCloader.so" or + SYSTEM=='Android' and "/libAndroid/arm64-v8a (hoặc armeabi-v7a)/CCloader.so" or + SYSTEM=='OS X' and " Date: Wed, 2 Aug 2023 21:45:31 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dfixed=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/seqGenerators.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index 23d49203..0f116be0 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -218,7 +218,7 @@ local seqGenerators={ end end, fixed=function(rndGen,seq0) - for i=#seq0,1,-1 do + for i=1,#seq0 do yield(seq0[i]) end end, From 0ae9cbcdaaab34cec790fd7f6a36df19ac350da8 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 3 Aug 2023 10:11:27 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=88=A0=E8=A1=8C=E6=9C=AB=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/build/iOS/love.patch | 12 ++++++------ .github/build/web/game.js | 1 - Zframework | 2 +- parts/eventsets/secret_grade.lua | 4 ++-- parts/language/dict_en.lua | 2 +- parts/language/dict_ja.lua | 2 +- parts/language/dict_zh.lua | 2 +- parts/language/lang_vi.lua | 4 ++-- parts/player/draw.lua | 2 +- parts/scenes/app_arithmetic.lua | 2 +- parts/scenes/dict.lua | 8 ++++---- 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/build/iOS/love.patch b/.github/build/iOS/love.patch index bbeec4d2..701b560d 100644 --- a/.github/build/iOS/love.patch +++ b/.github/build/iOS/love.patch @@ -8,7 +8,7 @@ index c1932555..552e432e 100644 **/ -void vibrate(); +void vibrate(const double seconds); - + /** * Enable mix mode (e.g. with background music apps) and playback with a muted device. diff --git a/src/common/ios.mm b/src/common/ios.mm @@ -18,16 +18,16 @@ index 7730991e..4ba8e708 100644 @@ -36,6 +36,8 @@ #include #include - + +#include + static NSArray *getLovesInDocuments(); static bool deleteFileInDocuments(NSString *filename); - + @@ -391,10 +393,40 @@ std::string getExecutablePath() } } - + -void vibrate() +void vibrate(const double seconds) { @@ -73,7 +73,7 @@ index c8af8596..ae7a5e32 100644 @@ -140,6 +140,10 @@ enum DoneAction DONE_RESTART, }; - + +extern "C" { + int luaopen_CCloader(lua_State *L); +} @@ -84,7 +84,7 @@ index c8af8596..ae7a5e32 100644 @@ -158,6 +162,9 @@ static DoneAction runlove(int argc, char **argv, int &retval) lua_State *L = luaL_newstate(); luaL_openlibs(L); - + + // Init CCloader + luaopen_CCloader(L); + diff --git a/.github/build/web/game.js b/.github/build/web/game.js index 05cb1185..f0755e5f 100644 --- a/.github/build/web/game.js +++ b/.github/build/web/game.js @@ -90,7 +90,6 @@ Module.expectedDataFileDownloads++; function assert(check, msg) { if (!check) throw msg + new Error().stack; } - function DataRequest(start, end, crunched, audio) { this.start = start; diff --git a/Zframework b/Zframework index 9ecedcbf..b2118b49 160000 --- a/Zframework +++ b/Zframework @@ -1 +1 @@ -Subproject commit 9ecedcbf7e2a69ad2cd02dd7318c3593c1bdf5a7 +Subproject commit b2118b4936d8e4998e7310785c54d8b708ba62f5 diff --git a/parts/eventsets/secret_grade.lua b/parts/eventsets/secret_grade.lua index c3d17d09..b93f44fc 100644 --- a/parts/eventsets/secret_grade.lua +++ b/parts/eventsets/secret_grade.lua @@ -33,8 +33,8 @@ end local function generateGuide(num) local l=#F - if l>num then - return + if l>num then + return end for i=l,num do F[i] = {} diff --git a/parts/language/dict_en.lua b/parts/language/dict_en.lua index a28aed10..8bdf7cea 100644 --- a/parts/language/dict_en.lua +++ b/parts/language/dict_en.lua @@ -1,5 +1,5 @@ -- Automatically generated by a Python script, from a markdown source file. --- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py +-- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py return { {"Translator Note 1", "", diff --git a/parts/language/dict_ja.lua b/parts/language/dict_ja.lua index b42c89ee..2807c3b2 100644 --- a/parts/language/dict_ja.lua +++ b/parts/language/dict_ja.lua @@ -1,5 +1,5 @@ -- Automatically generated by a Python script, from a markdown source file. --- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py +-- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py return { {"翻訳者からのメッセージ 1", "", diff --git a/parts/language/dict_zh.lua b/parts/language/dict_zh.lua index 5cb840a8..f7c57b10 100644 --- a/parts/language/dict_zh.lua +++ b/parts/language/dict_zh.lua @@ -1,5 +1,5 @@ -- Automatically generated by a Python script, from a markdown source file. --- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py +-- The script can be found here: https://github.com/user670/techmino-dictionary-converter/blob/master/tool.py return { {"新人须知", "读我 必读 萌新 xinren new noob readme", diff --git a/parts/language/lang_vi.lua b/parts/language/lang_vi.lua index a8642d17..1774f8ee 100644 --- a/parts/language/lang_vi.lua +++ b/parts/language/lang_vi.lua @@ -1248,7 +1248,7 @@ C. Tay cầm chơi game (Gamepad) "Techmino đã đột ngột dừng lại", -- If you have a real interest in programming, I recommend Lua. Easy installation, simple syntax, and fast execution speed. Stay away from boring school programming (haha) {"Nếu bạn thực sự có hứng thú trong lập trình, tôi đề xuất sử dụng Lua. Dễ xài, cú pháp đơn giản, và tốc độ thực thi nhanh. Rồi tránh xa chương trình học nhàm chán ở trên trường luôn! (haha) - ",C.W,"Z",C.white," said."}, - -- COLD CLEAR PATH + -- COLD CLEAR PATH "Đường dẫn của Cold Clear: "..( SYSTEM=='Windows' and "\\CCloader.dll" or SYSTEM=='Linux' and "/CCloader.so" or @@ -1256,7 +1256,7 @@ C. Tay cầm chơi game (Gamepad) SYSTEM=='OS X' and " [,10] + function()-- 1~3 <+> [,10] local s=rnd(2,9) local a=rnd(1,s) return a.."+"..s-a,s,function() diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index d78a392c..998dba98 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -17,7 +17,7 @@ local lastSearch-- Last searched string local lastSelected -- Last selected item local justSearched -- Just searched or not? -local currentFontSize=25 -- Current font size, default: 25 +local currentFontSize=25 -- Current font size, default: 25 local showingHelp=false -- Help is triggered or not local zoomWait=0 -- The last time zoom is triggered @@ -134,7 +134,7 @@ local function _updateInfoBox(c) CHAR.key.up, CHAR.key.down, CHAR.key.left, CHAR.key.right, CHAR.controller.dpadU,CHAR.controller.dpadD,CHAR.controller.dpadL,CHAR.controller.dpadR, CHAR.controller.xboxX,CHAR.controller.xboxY,CHAR.controller.xboxA,CHAR.controller.xboxB, - + CHAR.icon.help,CHAR.icon.copy, CHAR.icon.globe, CHAR.icon.toUp,CHAR.icon.toDown,CHAR.key.winMenu ),true @@ -245,7 +245,7 @@ function scene.keyDown(key) -- Switching selected items if key=='up' or key=='down' then if not showingHelp then - if love.mouse.isDown(2,3) then + if love.mouse.isDown(2,3) then listBox:arrowKey(key) return elseif WIDGET.isFocus(listBox) then @@ -415,7 +415,7 @@ scene.widgetList={ infoBox, WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not ((not (showingHelp or listBox.selected==0)) and _getList()[listBox.selected].url) end}, WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC'}, - + WIDGET.newKey {name='openzoom', x=1234,y=300,w=60,font=30,fText="aA", code=function() _openZoom() end,hide=false}, WIDGET.newKey {name='resetzoom',x=1234,y=370,w=60,font=25,fText="100%", code=function() _resetZoom() end,hide=false}, WIDGET.newKey {name='zoomin', x=1234,y=300,w=60,font=40,fText="A", code=function() _setZoom(5) end,hide=true}, From 20b74ea78a42b91bf566145b8f481aa8bd017716 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 3 Aug 2023 13:46:27 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AF=8D=E5=85=B8=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20=E6=A1=86=E6=9E=B6=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework | 2 +- parts/language/lang_en.lua | 48 ++---- parts/language/lang_vi.lua | 45 ++---- parts/language/lang_zh.lua | 38 ++--- parts/scenes/dict.lua | 290 +++++++++++-------------------------- 5 files changed, 129 insertions(+), 294 deletions(-) diff --git a/Zframework b/Zframework index b2118b49..35953907 160000 --- a/Zframework +++ b/Zframework @@ -1 +1 @@ -Subproject commit b2118b4936d8e4998e7310785c54d8b708ba62f5 +Subproject commit 3595390738cf1374dc54fe1210e38b0560764657 diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index 94c11bbe..a2d6e732 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -385,50 +385,34 @@ return { [[ INSTRUCTIONS FOR NAVIGATION IN TETRODICTIONARY -A. Mouse and Touchscreen - - Press/touch [$13] to open Help. - - Hold and drag up/down or scroll the mouse to navigate through the text. - - - Press/touch a term in the list on the left to select the entry you want to look up. - - Press/touch [$16] or [$17] to quickly scroll through the list. You can also click the middle mouse button or right mouse button and then scroll the mouse to switch between entries. - - - Press/touch [aA] to display the font control buttons. - - Press/touch [a] to decrease the font size and [A] to increase the font size. - - To reset the font size to the default size, wait for a few seconds until the [100%] button appears, then press [100%]. - - - Press/touch [$14] to copy the content of the current entry. - - Press/touch [$15] to open the link of the current entry (if available). - - - Click the back button in the top right corner to exit TetroDictionary. +A. Mouse / Touchscreen + - Press/touch a term in the list on the left to select the entry + - Press/touch [$14] to copy the content of the current entry + - Press/touch [$15] to open the link of the current entry (if available) B. Keyboard Press... - - [F1] to display Help. - - [$1] or [$2] to scroll through the text. - - [$3] to open the previous entry and [$4] to open the next entry. + - [F1] to display Help + - [$1] or [$2] to scroll through the text + - [$3] to open the previous entry and [$4] to open the next entry, speed up with [Ctrl] - - [Ctrl] + [-] to decrease the font size, [Ctrl] + [+] to increase the font size. - - [Ctrl] + [0] to restore the default font size. + - [-] to decrease the font size, [+] to increase the font size + - [0] to restore the default font size - - [Ctrl] + [C] to copy text. - - [$18] (Context Menu key/Application key) - - to open the link of the current entry (if available). - - - [Esc] to exit TetroDictionary. + - [Ctrl + C] to copy text + - [$16] (Context Menu key/Application key) to open the link of the current entry (if available) C. Gamepad - - Press $10 to display Help. - - Press $5 or $6 to scroll through the text. - - Press $7 to open the previous entry and $8 to open the next entry. - - Hold $11 and press $7 or $8 to scroll quickly through the list. - - Hold $11 and press $6 to decrease the font size or $5 to increase the font size. - - Press [BACK] to exit TetroDictionary. + - Press $10 to display Help + - Press $5 or $6 to scroll through the text, speed up with $11 + - Press $7 to open the previous entry and $8 to open the next entry. Speed up with $11 + - Hold $11 and press $6 to decrease the font size or $5 to increase ]] -- 1-4: Up, Down, Left, Right -- 5-8: Up, Down, Left, Right but D-Pad -- 9-12: X, Y, A, B - -- 13-18: Help, Copy, Open, Forward, Backward, MENU + -- 13-16: Help, Copy, Open, MENU }, WidgetText={ main={ diff --git a/parts/language/lang_vi.lua b/parts/language/lang_vi.lua index 1774f8ee..ab0fd93f 100644 --- a/parts/language/lang_vi.lua +++ b/parts/language/lang_vi.lua @@ -394,45 +394,28 @@ return { HƯỚNG DẪN ĐIỀU HƯỚNG TRONG TETRODICTIONARY A. Chuột và màn hình cảm ứng - - Nhấn/chạm [$13] để mở Trợ giúp. - - Giữ và kéo lên/xuống hoặc lăn chuột để cuộn văn bản. - - - Nhấn/chạm vào một mục trong danh sách ở bên trái để chọn mục cần tra. - - Nhấn/chạm [$16] hoặc [$17] để nhanh chóng cuộn qua danh sách. Bạn cũng có thể nhấn giữ chuột giữa hoặc chuột phải sau đó lăn chuột để chuyển qua các mục. - - - Nhấn/chạm [aA] để hiện 2 nút điều khiển cỡ chữ. - - Nhấn/chạm [a] để giảm cỡ chữ và [A] để tăng cỡ chữ. - - Để đặt cỡ chữ về cỡ mặc định, chờ một vài giây để nút [100%] xuất hiện, sau đó nhấn [100%]. - - - Nhấn/chạm [$14] để sao chép nội dung của mục đang xem. - - Nhấn/chạm [$15] để mở link của mục đang xem (nếu có). - - - Nhấp vào nút quay lại ở góc trên bên phải để thoát TetroDictionary + - Giữ và kéo lên/xuống hoặc lăn chuột để cuộn văn bản + - Nhấn/chạm [$14] để sao chép nội dung của mục đang xem + - Nhấn/chạm [$15] để mở link của mục đang xem (nếu có) B. Bàn phím Nhấn… - - [F1] để hiển thị Trợ giúp. - - [$1] hoặc [$2] để cuộn qua văn bản. - - [$3] để mở mục trước đó và [$4] để mở mục tiếp theo. + - [F1] để hiển thị Trợ giúp + - [$1] hoặc [$2] để cuộn qua văn bản + - [$3] để mở mục trước đó và [$4] để mở mục tiếp theo - - [Ctrl] + [-] để giảm cỡ chữ, [Ctrl] + [+] để tăng cỡ chữ. - - [Ctrl] + [0] để khôi phục về cỡ chữ mặc định - - - [Ctrl] + [C] để sao chép văn bản - - [$18] (phím Menu ngữ cảnh/phím Ứng dụng) - để mở liên kết của mục đang xem (nếu có) - - - [Esc] để thoát TetroDictionary + - [-] để giảm cỡ chữ, [+] để tăng cỡ chữ + - [0] để khôi phục về cỡ chữ mặc định + - [Ctrl + C] để sao chép văn bản + - [$16] (phím Menu ngữ cảnh/phím Ứng dụng) C. Tay cầm chơi game (Gamepad) - Nhấn $10 để hiển thị trợ giúp. - Nhấn $5 hoặc $6 để cuộn văn bản. - Nhấn $7 để mở mục trước và $8 để mở mục tiếp theo. - Giữ $11 và nhấn $7 hoặc $8 để cuộn nhanh qua danh sách. - Giữ $11 và nhấn $6 để giảm cỡ chữ hoặc $5 để tăng cỡ chữ. - Nhấn [BACK] để thoát TetroDictionary. + Nhấn $10 để hiển thị trợ giúp + Nhấn $5 hoặc $6 để cuộn văn bản, speed up with $11 + Nhấn $7 để mở mục trước và $8 để mở mục tiếp theo + Giữ $11 và nhấn $7 hoặc $8 để cuộn nhanh qua danh sách ]] -- 1-4: Up, Down, Left, Right -- 5-8: Up, Down, Left, Right but D-Pad diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 4d340b84..995d56c0 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -386,35 +386,29 @@ return { [[ 小Z词典操作说明 -鼠标与触摸屏: - 点击 [$13] 显示帮助。 - 拖动或使用鼠标滚轮以滚动文本。 - 点击左侧列表中的项目以选择词条,点击 [$16] 或 [$17] 快速滚动列表。 - 点击 [aA] 显示字号控制,然后点击 [a] 缩小字号,[A] 增大字号。要重置字号为默认大小,稍等片刻直到 [100%] 按钮显示,然后点击 [100%]。 - 点击 [$14] 复制词条文本。 - 点击 [$15] 打开词条中的链接(如有)。 - 点击右上角的返回按钮退出小Z词典。 +鼠标/触摸屏: + 点击左侧列表中的项目以选择词条 + 点击 [$14] 复制词条文本 + 点击 [$15] 打开词条中的链接(如有) 键盘: - 按 [F1] 显示帮助。 - 按 [$1] 或 [$2] 滚动文本。 - 按 [$3] 打开上一词条,按 [$4] 打开下一词条。使用 [Ctrl + $3] 或 [Ctrl + $4] 快速滚动列表。 - 按 [Ctrl + 减号键] 缩小字号,[Ctrl + 等号键] 增大字号,[Ctrl + 0] 恢复默认字号。 - 按 [Ctrl + C] 复制词条文本。 - 按 [$18] (上下文菜单键,应用程序键)打开词条中的链接(如有)。 - 按 [Esc] 退出小Z词典。 + 按 [F1] 显示帮助 + 按 [$1] 或 [$2] 滚动文本 + 按 [$3] 打开上一词条,按 [$4] 打开下一词条。按住 [Ctrl] 加速 + 按 [-] 缩小字号,[+] 增大字号,[0] 恢复默认字号 + 按 [Ctrl + C] 复制词条文本 + 按 [$16] (上下文菜单键/应用程序键)打开词条中的链接(如有) -游戏手柄: - 按 $10 显示帮助。 - 按 $5 或 $6 滚动文本。 - 按 $7 打开上一词条,按 $8 打开下一词条。按住 $11 并按 $7 或 $8 快速滚动列表。 - 按住 $11 并按 $6 缩小字号,或 $5 增大字号。 - 按 [BACK] 退出小Z词典。 +手柄: + 按 $10 to 显示帮助 + 按 $5 或 $6 滚动文本, 按 $11 加速 + 按 $7 打开上一词条,按 $8 打开下一词条。按住 $11 加速 + 按住 $11 并按 $6 缩小字号,或 $5 增大字号 ]] -- 1-4: Up, Down, Left, Right -- 5-8: Up, Down, Left, Right but D-Pad -- 9-12: X, Y, A, B - -- 13-18: Help, Copy, Open, Forward, Backward, MENU + -- 13-16: Help, Copy, Open, MENU }, WidgetText={ main={ diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 998dba98..68d5471d 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -1,7 +1,6 @@ local gc=love.graphics local int,abs=math.floor,math.abs -local min,sin=math.min,math.sin local ins=table.insert local find=string.find @@ -15,14 +14,8 @@ local searchWait-- Searching animation timer local lastSearch-- Last searched string local lastSelected -- Last selected item -local justSearched -- Just searched or not? local currentFontSize=25 -- Current font size, default: 25 -local showingHelp=false -- Help is triggered or not -local zoomWait=0 -- The last time zoom is triggered - -local lastScrollPos -local lastMouseX,lastMouseY,lastTouchX,lastTouchY local typeColor={ help=COLOR.Y, @@ -58,32 +51,23 @@ local function _scanDict(D) end local function _getList() return result[1] and result or dict end --- Drawing objects local infoBox =WIDGET.newTextBox {name='infoBox',x=320,y=180,w=862,h=526,font=25,fix=true} local inputBox=WIDGET.newInputBox{name='input', x=20, y=110,w=762,h=60, font=40,limit=32} local listBox =WIDGET.newListBox {name='listBox',x=20, y=180,w=280,h=526,font=30,lineH=35,drawF=function(item,id,ifSel) - -- Draw list box - -- Background + -- Background if ifSel then gc.setColor(1,1,1,.4) gc.rectangle('fill',0,0,280,35) end - - -- Name & color - local item=_getList()[id] + -- Name & color GC.shadedPrint(item.title,10,-3,'left',1,COLOR.D,typeColor[item.type]) - -- Draw list box / end} --- Drawing object / - - -- Necessary local functions -- Clear the result local function _clearResult() TABLE.cut(result) listBox.selected=1 - justSearched=true searchWait,lastSearch=0,false scene.widgetList.copy.hide=false end @@ -102,17 +86,16 @@ local function _search() end end + listBox:setList(_getList()) + if #result>0 then SFX.play('reach') end - justSearched=true lastSearch=input end -- Jump over n items local function _jumpover(key,n) - n=n or 1 - if key=='left' or key=='pageup' then - for _=1,n do scene.widgetList.listBox:arrowKey('up') end - else for _=1,n do scene.widgetList.listBox:arrowKey('down') end end + local dir=(key=='left' or key=='pageup') and 'up' or 'down' + for _=1,n or 1 do scene.widgetList.listBox:arrowKey(dir) end end -- Copy the content @@ -128,17 +111,16 @@ end local function _updateInfoBox(c) local _t,t if c==nil then - if showingHelp then + if listBox.selected==0 then if text.dict.helpText then - t,_t=text.dict.helpText:repD( - CHAR.key.up, CHAR.key.down, CHAR.key.left, CHAR.key.right, - CHAR.controller.dpadU,CHAR.controller.dpadD,CHAR.controller.dpadL,CHAR.controller.dpadR, - CHAR.controller.xboxX,CHAR.controller.xboxY,CHAR.controller.xboxA,CHAR.controller.xboxB, - - CHAR.icon.help,CHAR.icon.copy, CHAR.icon.globe, - CHAR.icon.toUp,CHAR.icon.toDown,CHAR.key.winMenu - ),true - else _t,t=true,{ + _t,t=true,text.dict.helpText:repD( + CHAR.key.up,CHAR.key.down,CHAR.key.left,CHAR.key.right, + CHAR.controller.dpadU,CHAR.controller.dpadD,CHAR.controller.dpadL,CHAR.controller.dpadR, + CHAR.controller.xboxX,CHAR.controller.xboxY,CHAR.controller.xboxA,CHAR.controller.xboxB, + CHAR.icon.help,CHAR.icon.copy,CHAR.icon.globe,CHAR.key.winMenu + ) + else + _t,t=true,{ "OUCH! I can't seem to find any translated Help text anywhere.", "\nI guess you'll have to switch to English and try again to read it instead!", "\n\nOn another note, you could make an issue on GitHub or send this to Techmino's Discord server.", @@ -146,7 +128,9 @@ local function _updateInfoBox(c) "\n\nOh, and it would be nice if you could let us know about it or you can fix it by yourself!", "\n\n-- Sea, the one who rewrote the Zictionary scene and left this message just in case." } end - else _t,t=pcall(function() return _getList()[listBox.selected].content end) end + else + _t,t=pcall(function() return _getList()[listBox.selected].content end) + end if _t then c=t else c={""} end _t,t=nil,nil end @@ -154,19 +138,7 @@ local function _updateInfoBox(c) infoBox:setTexts(c) end --- Show Help or not -local function _toggleHelp() - local listBox = scene.widgetList.listBox - showingHelp = not showingHelp - if not showingHelp then - listBox.selected=lastSelected - scene.widgetList.copy.hide=false - end - _updateInfoBox() -end - -- Zoom and reset zoom -local function _openZoom() zoomWait=2 end local function _resetZoom() currentFontSize,infoBox.font=25,25 infoBox.lineH,infoBox.capacity=35,math.ceil((infoBox.h-10)/35) @@ -180,43 +152,10 @@ local function _setZoom(z) infoBox.lineH=currentFontSize*7/5 -- Recalculate the line's height infoBox.capacity=math.ceil((infoBox.h-10)/infoBox.lineH) _updateInfoBox() - _openZoom() MES.new("check",text.dict.sizeChanged:repD(currentFontSize),1.26) end end --- Checking if waiting countdown reach 0 to run the function. --- --- currentCountdown: the variable that tracking waiting time --- timeEndF: run this function if the time reach 0 --- nTimeEndF: run this function if the time has not reached 0 --- --- NOTE: This function will return the modified value of currentcountdown -local function _waitingfor(currentcountdown, timeEndF, nTimeEndF) - currentcountdown = currentcountdown or 0 - timeEndF = timeEndF or function() end - nTimeEndF= nTimeEndF or function() end - - if currentcountdown>0 then - currentcountdown=currentcountdown-love.timer.getDelta() - if currentcountdown<=0 then timeEndF() else nTimeEndF() end - end - return currentcountdown -end - -local function fixScrollingByTouch(x,y,lastX,lastY) - if WIDGET.isFocus(listBox) then - if abs(lastScrollPos-listBox.scrollPos)>26 then - lastScrollPos=listBox.scrollPos - listBox.selected=lastSelected - else - lastSelected=listBox.selected - scene.widgetList.copy.hide=false - _updateInfoBox() - end - end -end - -- Reset everything when opening Zictionary function scene.enter() dict=require("parts.language.dict_"..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or SETTING.locale:find'vi' and 'vi' or 'en')) @@ -225,13 +164,10 @@ function scene.enter() inputBox:clear() result={} - if showingHelp then _toggleHelp() end - searchWait=0 lastSelected=0 listBox.selected=1 listBox.scrollPos=0 - lastScrollPos=0 lastSearch=false if not MOBILE then WIDGET.focus(inputBox) end @@ -244,52 +180,42 @@ end function scene.keyDown(key) -- Switching selected items if key=='up' or key=='down' then - if not showingHelp then - if love.mouse.isDown(2,3) then - listBox:arrowKey(key) - return - elseif WIDGET.isFocus(listBox) then - listBox:scroll(key=='up' and -1 or 1) - lastScrollPos=listBox.scrollPos - return - end + listBox:scroll(key=='up' and -1 or 1) + + elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then + _jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12) + + elseif key=='cC' or key=='c' and love.keyboard.isDown('lctrl','rctrl') then + if listBox.selected>0 then + _copy() end - infoBox:scroll(key=='up' and -3 or 3) - elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') - then - if love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') - then _jumpover(key,12) - else _jumpover(key,1) - end + elseif key=='-' or key=='=' then + _setZoom((key=='-' or key=='kp-') and -5 or 5) + elseif key=='0' then + _resetZoom() - -- Copy & Zoom - elseif key=='cC' then _copy() - elseif love.keyboard.isDown('lctrl','rctrl') then - if key == 'c' and not showingHelp then _copy() return - elseif love.keyboard.isDown('-','=','kp-','kp+') then _setZoom((key=='-' or key=='kp-') and -5 or 5) - elseif love.keyboard.isDown('0','kp0') then _resetZoom() end - - -- Clear search input, open URL - elseif key=='application' and not showingHelp then + elseif key=='application' and listBox.selected>=0 then local url=_getList()[listBox.selected].url if url then love.system.openURL(url) end - elseif key=='delete' and not showingHelp then + elseif key=='delete' then if inputBox:hasText() then _clearResult() inputBox:clear() SFX.play('hold') + _updateInfoBox() end - - -- Get out of Zictionary elseif key=='escape' then - if inputBox:hasText() then scene.keyDown('delete') - elseif showingHelp then _toggleHelp() - else SCN.back() + if inputBox:hasText() then + scene.keyDown('delete') + else + SCN.back() end - -- Calling Help - elseif key=='f1' then _toggleHelp() - -- Focus on the search box + elseif key=='f1' then + listBox.selected=0 + inputBox:clear() + searchWait=0 + _updateInfoBox() else if not WIDGET.isFocus(inputBox) then WIDGET.focus(inputBox) end return true @@ -299,105 +225,61 @@ end function scene.gamepadDown(key) local Joystick=love.joystick.getJoysticks()[love.joystick.getJoystickCount()] - -- Scrolling text & zooming - if (key=='dpup' or key=='dpdown') then - if Joystick:isGamepadDown('a') - then _setZoom(key=='dpup' and 5 or -5) - else infoBox:scroll(key=='dpup' and -3 or 3) + if key=='dpup' or key=='dpdown' then + if Joystick:isGamepadDown('a') then + _setZoom(key=='dpup' and 5 or -5) + else + infoBox:scroll(key=='dpup' and -3 or 3) end - -- Switching selected items elseif key=='dpleft' or key=='dpright' then - _jumpover(key:gsub('dp',''),Joystick:isGamepadDown('a') and 12 or 1) - -- Activate help - elseif key=='y' then _toggleHelp() - -- Exit - elseif key=='back' then SCN.back() + _jumpover(key:gsub('dp',''),Joystick:isGamepadDown('a') and 12) + elseif key=='y' then + listBox.selected=0 + inputBox:clear() + searchWait=0 + _updateInfoBox() + elseif key=='back' then + SCN.back() end end -function scene.mouseDown(mx,my) - lastMouseX,lastMouseY=mx,my -end -function scene.touchDown(mx,my) - lastTouchX,lastTouchY=mx,my -end - --- Check if left mouse key is released -function scene.mouseUp(mx,my) - fixScrollingByTouch(mx,my,lastMouseX,lastMouseY) -end -function scene.touchUp(mx,my) - fixScrollingByTouch(mx,my,lastTouchX,lastTouchY) -end - function scene.update(dt) - -- It's time to search? local input=inputBox:getText() if input~=lastTickInput then if #input==0 then _clearResult() + listBox:setList(_getList()) else searchWait=.8 end lastTickInput=input end - searchWait=_waitingfor( - searchWait, - function() if #input>0 and input~=lastSearch then _search() end end - ) - -- It's time to swap zoom buttons? - zoomWait=_waitingfor( - zoomWait, - function() - scene.widgetList.openzoom .hide=false - scene.widgetList.resetzoom.hide=false - scene.widgetList.zoomin .hide=true - scene.widgetList.zoomout .hide=true - end, - function() - scene.widgetList.openzoom .hide=true - scene.widgetList.resetzoom.hide=true - scene.widgetList.zoomin .hide=false - scene.widgetList.zoomout .hide=false + if searchWait>0 then + searchWait=searchWait-dt + if searchWait<=0 and #input>0 and input~=lastSearch then + _search() end - ) -end + end -local function listStencil() - GC.rectangle('fill',20,180,280,526) -end -function scene.draw() - -- Order: list, info, keys - -- Draw background - gc.setColor(COLOR.dX) - gc.rectangle('fill',1194,180,80,526,5) -- keys - -- Draw outline - gc.setLineWidth(2) - gc.setColor(COLOR.Z) - gc.rectangle('line',1194,180,80,526,5) -- keys - -- Draw key seperating outline - gc.rectangle('line',1194,260,80,1,0) -- A | B - gc.rectangle('line',1194,410,80,1,0) -- B | C - gc.rectangle('line',1194,560,80,1,0) -- C | D - - local list=_getList() - setFont(30) - - -- Showing Help? - if showingHelp then - listBox.selected=0 - scene.widgetList.copy.hide,scene.widgetList.link.hide=true,true - -- If not then, check the selected item if it is changed or not? - -- If yes, update lastSelected then update the textbox! - elseif justSearched then - listBox:setList(_getList()) - _updateInfoBox() - justSearched=false - elseif lastSelected~=listBox.selected and not love.mouse.isDown(1) then + if lastSelected~=listBox.selected then _updateInfoBox() lastSelected=listBox.selected scene.widgetList.copy.hide=false end +end + +function scene.draw() + -- Order: list, info, keys + -- Draw background + gc.setColor(COLOR.dX) + gc.rectangle('fill',1194,340,80,366,5) + -- Draw outline + gc.setLineWidth(2) + gc.setColor(COLOR.Z) + gc.rectangle('line',1194,340,80,366,5) + gc.line(1194,560,1274,560) + + setFont(30) if searchWait>0 then local r=TIME()*2 @@ -413,22 +295,14 @@ scene.widgetList={ listBox, inputBox, infoBox, - WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not ((not (showingHelp or listBox.selected==0)) and _getList()[listBox.selected].url) end}, - WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC'}, + WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not (listBox.selected>0 and _getList()[listBox.selected].url) end}, + WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC',hideF=function() return not (listBox.selected>0) end}, - WIDGET.newKey {name='openzoom', x=1234,y=300,w=60,font=30,fText="aA", code=function() _openZoom() end,hide=false}, - WIDGET.newKey {name='resetzoom',x=1234,y=370,w=60,font=25,fText="100%", code=function() _resetZoom() end,hide=false}, - WIDGET.newKey {name='zoomin', x=1234,y=300,w=60,font=40,fText="A", code=function() _setZoom(5) end,hide=true}, - WIDGET.newKey {name='zoomout', x=1234,y=370,w=60,font=40,fText="a", code=function() _setZoom(-5) end,hide=true}, + WIDGET.newKey {name='zoomin', x=1234,y=380,w=60,font=40,fText="A", code=function() _setZoom(5) end}, + WIDGET.newKey {name='zoomout', x=1234,y=450,w=60,font=40,fText="a", code=function() _setZoom(-5) end}, + WIDGET.newKey {name='resetzoom',x=1234,y=520,w=60,font=25,fText="100%", code=function() _resetZoom() end}, - WIDGET.newKey {name='pageup', x=1234,y=450,w=60,font=40,fText=CHAR.icon.toUp, hideF=function() return love.mouse.isDown(2,3) or showingHelp end,code=function() _jumpover('left') end}, - WIDGET.newKey {name='pagedown', x=1234,y=520,w=60,font=40,fText=CHAR.icon.toDown,hideF=function() return love.mouse.isDown(2,3) or showingHelp end,code=function() _jumpover('right') end}, - - WIDGET.newKey {name='pageup1', x=1234,y=450,w=60,font=40,fText=CHAR.key.up, hideF=function() return not love.mouse.isDown(2,3) or showingHelp end,color="A"}, - WIDGET.newKey {name='pagedown1',x=1234,y=520,w=60,font=40,fText=CHAR.key.down, hideF=function() return not love.mouse.isDown(2,3) or showingHelp end,color="A"}, - - WIDGET.newKey {name='help0', x=1234,y=220,w=60,font=40,fText=CHAR.icon.help, code=pressKey'f1',hideF=function() return showingHelp end}, - WIDGET.newKey {name='help1', x=1234,y=220,w=60,font=40,fText=CHAR.icon.help, code=pressKey'f1',hideF=function() return not showingHelp end,color='lF'}, + WIDGET.newKey {name='help', x=1234,y=220,w=60,font=40,fText=CHAR.icon.help, code=pressKey'f1'}, WIDGET.newButton{name='back', x=1165,y=60, w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, WIDGET.newText {name='buttontip',x=1274,y=110,w=762,h=60,font=40,align='R',fText=CHAR.controller.xboxY.."/[F1]: "..CHAR.icon.help} From 36522c71464f01543be90f1622257e30bb6290b9 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 3 Aug 2023 16:04:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=8D=E5=85=B8?= =?UTF-8?q?=E7=94=A8=E4=B8=8D=E4=BA=86=E6=BB=9A=E8=BD=AE=20=E6=95=B4?= =?UTF-8?q?=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_triple.lua | 10 ++++------ parts/scenes/dict.lua | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/parts/scenes/app_triple.lua b/parts/scenes/app_triple.lua index 21fbb33f..6e3a1c4d 100644 --- a/parts/scenes/app_triple.lua +++ b/parts/scenes/app_triple.lua @@ -152,11 +152,10 @@ function player:click(y,x) self.board[y][x]=rem(self.nexts,1) SFX.play('touch') - local merged - repeat-- ::REPEAT_merge:: - local repeating - local cur=self.board[y][x] + local cur,merged + repeat local b1=TABLE.shift(self.board) + cur=b1[y][x] self.mergedTiles={} local count=self:merge(b1,cur,y,x) if count>2 then @@ -178,9 +177,8 @@ function player:click(y,x) for i=1,#self.mergedTiles do newMergeFX(self.mergedTiles[i][1],self.mergedTiles[i][2],cur+1) end - repeating=true-- goto REPEAT_merge end - until not repeating + until count<=2 ins(self.nexts,self:newTile()) diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 68d5471d..e983caa5 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -51,7 +51,7 @@ local function _scanDict(D) end local function _getList() return result[1] and result or dict end -local infoBox =WIDGET.newTextBox {name='infoBox',x=320,y=180,w=862,h=526,font=25,fix=true} +local textBox =WIDGET.newTextBox {name='infoBox',x=320,y=180,w=862,h=526,font=25,fix=true} local inputBox=WIDGET.newInputBox{name='input', x=20, y=110,w=762,h=60, font=40,limit=32} local listBox =WIDGET.newListBox {name='listBox',x=20, y=180,w=280,h=526,font=30,lineH=35,drawF=function(item,id,ifSel) -- Background @@ -135,22 +135,22 @@ local function _updateInfoBox(c) _t,t=nil,nil end local _w,c=FONT.get(currentFontSize):getWrap(c,840) - infoBox:setTexts(c) + textBox:setTexts(c) end -- Zoom and reset zoom local function _resetZoom() - currentFontSize,infoBox.font=25,25 - infoBox.lineH,infoBox.capacity=35,math.ceil((infoBox.h-10)/35) + currentFontSize,textBox.font=25,25 + textBox.lineH,textBox.capacity=35,math.ceil((textBox.h-10)/35) _updateInfoBox() MES.new("check",text.dict.sizeReset,1.26) end local function _setZoom(z) if z~=0 then currentFontSize=MATH.clamp(currentFontSize+z,15,40) - infoBox.font=currentFontSize - infoBox.lineH=currentFontSize*7/5 -- Recalculate the line's height - infoBox.capacity=math.ceil((infoBox.h-10)/infoBox.lineH) + textBox.font=currentFontSize + textBox.lineH=currentFontSize*7/5 -- Recalculate the line's height + textBox.capacity=math.ceil((textBox.h-10)/textBox.lineH) _updateInfoBox() MES.new("check",text.dict.sizeChanged:repD(currentFontSize),1.26) end @@ -175,12 +175,16 @@ function scene.enter() end function scene.wheelMoved(_,y) - WHEELMOV(y) + if WIDGET.sel==listBox then + listBox:scroll(-y) + else + textBox:scroll(-y) + end end function scene.keyDown(key) -- Switching selected items if key=='up' or key=='down' then - listBox:scroll(key=='up' and -1 or 1) + textBox:scroll(key=='up' and -1 or 1) elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then _jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12) @@ -229,7 +233,7 @@ function scene.gamepadDown(key) if Joystick:isGamepadDown('a') then _setZoom(key=='dpup' and 5 or -5) else - infoBox:scroll(key=='dpup' and -3 or 3) + textBox:scroll(key=='dpup' and -3 or 3) end elseif key=='dpleft' or key=='dpright' then _jumpover(key:gsub('dp',''),Joystick:isGamepadDown('a') and 12) @@ -294,7 +298,7 @@ scene.widgetList={ WIDGET.newText {name='title', x=100, y=15, font=70,align='L'}, listBox, inputBox, - infoBox, + textBox, WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not (listBox.selected>0 and _getList()[listBox.selected].url) end}, WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC',hideF=function() return not (listBox.selected>0) end},