Skip to content

Commit

Permalink
给所有场景添加类型注释,widgetList终于可以自动补全了
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Apr 25, 2024
1 parent 0c067f3 commit 84e458b
Show file tree
Hide file tree
Showing 48 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Zenitha
2 changes: 2 additions & 0 deletions assets/scene/about_out.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---@type Zenitha.Scene
---@type Zenitha.Scene
local scene={}

local modules={
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_15p.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local gc=love.graphics

local floor,rnd=math.floor,math.random

---@type Zenitha.Scene
local scene={}

local scale=1.4
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_2048.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local setColor,rectangle=gc.setColor,gc.rectangle
local floor,abs=math.floor,math.abs
local rnd,min=math.random,math.min

---@type Zenitha.Scene
local scene={}

local invis,tapControl
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_AtoZ.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local levels={
BPW="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA",
}

---@type Zenitha.Scene
local scene={}

local levelName="A_Z"
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_UTTT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ local function place(X,x)
round=1-round
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_calc.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local gc=love.graphics
local kb=love.keyboard

---@type Zenitha.Scene
local scene={}

local reg -- register
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_cubefield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ local function hurt(i)
end
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_dropper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local perfect={"Perfect!","Excellent!","Nice!","Good!","Great!","Just!","300"}
local great={"Pay attention!","Be carefully!","Teacher behind you!","Feel tired?","You are in danger!"," Do your homework!","A good game!","Minecraft!","y=ax^2+bx+c!","No music?","Internet unavailable.","It's raining!","Too hard!","Shorter?","Higher!","English messages!","Hi!","^_^","Drop!","Colorful!",":)","100$","~~~wave~~~","★★★","中文!","NOW!!!!!","Also try the TEN!","I'm a programer!","Also try minesweeperZ!","This si Dropper!","Hold your calculatoor!","Look! UFO!","Bonjour!","[string]","Author:MrZ","Boom!","PvZ!","China!","TI-nspire!","I love LUA!"}
local miss={"Oops!","Uh-oh","Ouch!","Oh no."}

---@type Zenitha.Scene
local scene={}

local highScore,highFloor=0,0
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_dtw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ function reset()
diePos=false
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ local function tap(x,y)
end
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_mahjong.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ local function _throwCard()
end
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_memorize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local showTime
local input
local inputTime

---@type Zenitha.Scene
local scene={}

local function newNum(lv)
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_piano.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local activeEventMap={}
local inst
local offset

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_polyforge.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local function new()
end
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_pong.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local abs=math.abs
local max,min=math.max,math.min
local rnd=math.random

---@type Zenitha.Scene
local scene={}

local state
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_schulteG.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local floor,rnd=math.floor,math.random
local rem=table.remove
local setFont,mStr=FONT.set,GC.mStr

---@type Zenitha.Scene
local scene={}

local board,rank
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_stopwatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local function release()
end
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_tap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local max=math.max
local ins=table.insert
local setFont,mStr=FONT.set,GC.mStr

---@type Zenitha.Scene
local scene={}

local lastKey,keyTime
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_ten.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local floor,rnd=math.floor,math.random
local ins,rem=table.insert,table.remove
local setFont,mStr=FONT.set,GC.mStr

---@type Zenitha.Scene
local scene={}

local previewX={245,186,129,78,35}
Expand Down
1 change: 1 addition & 0 deletions assets/scene/app_triple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ function player:drawBoard()
gc.pop()
end

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/dictionary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local gc_translate,gc_replaceTransform=GC.translate,GC.replaceTransform

local ins=table.insert
local kbIsDown=love.keyboard.isDown
---@type Zenitha.Scene
local scene={}

local categoryColor={
Expand Down
1 change: 1 addition & 0 deletions assets/scene/error.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local texts={
"問題が発生!ゲームを再起動してください、できるならエラーログを開発者に送ってください。",
"Techmino终端被高能粒子射线击中产生错误,需要重新启动。你可以将上面的错误信息反馈给作者。",
}
---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/game_in.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local gc=love.graphics

---@type Zenitha.Scene
local scene={}

local function startGame(modeName)
Expand Down
1 change: 1 addition & 0 deletions assets/scene/game_out.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local gc=love.graphics
local tc=love.touch

---@type Zenitha.Scene
local scene={}

local repMode=false
Expand Down
1 change: 1 addition & 0 deletions assets/scene/hello.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- Welcome scene with animation

local t
---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/keyset_in.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local gc=love.graphics

---@type Zenitha.Scene
local scene={}

local sysKeyInfo={
Expand Down
1 change: 1 addition & 0 deletions assets/scene/keyset_out.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local gc=love.graphics

---@type Zenitha.Scene
local scene={}

local keyMode='sys'
Expand Down
1 change: 1 addition & 0 deletions assets/scene/keyset_press.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local mode,act
Expand Down
1 change: 1 addition & 0 deletions assets/scene/keyset_touch_in.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/keyset_touch_out.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/lang_in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local languages={
}
local curLang=1

---@type Zenitha.Scene
local scene={}

function scene.leave()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/lang_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local languages={
}
local curLang=1

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/main_in.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local consoleClickCount
local settingHint

---@type Zenitha.Scene
local scene={}
function scene.enter()
consoleClickCount=0
Expand Down
1 change: 1 addition & 0 deletions assets/scene/main_out.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local textOffset=6
Expand Down
1 change: 1 addition & 0 deletions assets/scene/mode_mino_stdMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ local panel={
end
}

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/musicroom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ local progressBar=WIDGET.new{type='slider_progress',pos={.5,.5},x=-700,y=230,w=1
}


---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/pause_in.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local pauseText
Expand Down
1 change: 1 addition & 0 deletions assets/scene/pause_out.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local sin=math.sin
local floor=math.floor

---@type Zenitha.Scene
local scene={}

local pauseText,textScale
Expand Down
1 change: 1 addition & 0 deletions assets/scene/result_in.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local time
Expand Down
1 change: 1 addition & 0 deletions assets/scene/result_out.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local time
Expand Down
1 change: 1 addition & 0 deletions assets/scene/setting_in.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local settingHint

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
3 changes: 2 additions & 1 deletion assets/scene/setting_out.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}
local page
--[[ Pages:
Expand Down Expand Up @@ -68,7 +69,7 @@ scene.widgetList={
{name='1',type='button', pos={0,0},x=500, y=700,w=360, h=80,cornerR=10, fontSize=40,text=LANG'setting_touching', code=WIDGET.c_goScn'keyset_touch_out',visibleTick=function() return page=='1' and SETTINGS.system.touchControl end},

-- Audio
{name='2',type='slider_fill',pos={0,0},x=340, y=220,w=650, fontSize=40,text=LANG'setting_mainVol', widthLimit=260, disp=TABLE.func_getVal(SETTINGS.system,'mainVol'), code=TABLE.func_setVal(SETTINGS.system,'mainVol')},
{name='2',type='slider_fill',pos={0,0},x=340, y=220,w=650, lineDist=10,fontSize=40,text=LANG'setting_mainVol', widthLimit=260, disp=TABLE.func_getVal(SETTINGS.system,'mainVol'), code=TABLE.func_setVal(SETTINGS.system,'mainVol')},
{name='2',type='slider_fill',pos={0,0},x=340, y=300,w=650, fontSize=40,text=LANG'setting_bgm', widthLimit=260, disp=TABLE.func_getVal(SETTINGS.system,'bgmVol'), code=TABLE.func_setVal(SETTINGS.system,'bgmVol')},
{name='2',type='slider_fill',pos={0,0},x=340, y=380,w=650, fontSize=40,text=LANG'setting_sfx', widthLimit=260, disp=TABLE.func_getVal(SETTINGS.system,'sfxVol'), code=TABLE.func_setVal(SETTINGS.system,'sfxVol')},
{name='2',type='slider_fill',pos={0,0},x=340, y=460,w=650, fontSize=40,text=LANG'setting_vib', widthLimit=260, disp=TABLE.func_getVal(SETTINGS.system,'vibVol'), code=TABLE.func_setVal(SETTINGS.system,'vibVol')},
Expand Down
1 change: 1 addition & 0 deletions assets/scene/simulation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ local sims={
---@type integer|false
local subjectFocused=false

---@type Zenitha.Scene
local scene={}

function scene.enter()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/tutorial_in.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@type Zenitha.Scene
local scene={}

local function B(t)
Expand Down
1 change: 1 addition & 0 deletions assets/scene/tutorial_rotate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ local shapes do
}
end

---@type Zenitha.Scene
local scene={}

local function newQuestion()
Expand Down
1 change: 1 addition & 0 deletions assets/scene/tutorial_shape.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ end

local rnd=math.random

---@type Zenitha.Scene
local scene={}

local function flipPiece(name)
Expand Down
1 change: 1 addition & 0 deletions assets/scene/zeta_input_method.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local pi=math.pi

local areaX,areaY,areaR=800,400,300

---@type Zenitha.Scene
local scene={}

local widgetList_ui
Expand Down

0 comments on commit 84e458b

Please sign in to comment.