Skip to content

Commit

Permalink
整理代码
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Oct 15, 2024
1 parent 26a1a73 commit 17f07a0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions assets/game/basePlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local sign,expApproach=MATH.sign,MATH.expApproach
---@field texts Zenitha.Text
---@field particles Techmino.ParticleSystems
---
---@field updateFrame function
---@field tickStep function
---@field scriptCmd function
---@field decodeScript function
---@field checkScriptSyntax function
Expand Down Expand Up @@ -505,7 +505,7 @@ function P:update(dt)
self.time=self.time+1
end

self:updateFrame()
self:tickStep()
end
for _,v in next,self.particles do v:update(dt) end
self.texts:update(dt)
Expand Down
8 changes: 4 additions & 4 deletions assets/game/brikPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ function BP:popNext(ifHold)
self:brikDropped()
end
end
---@return Techmino.Cell
---@return Techmino.Brik.Cell
function BP:newCell(color,id)
self.totalCellCount=self.totalCellCount+1
return {
Expand Down Expand Up @@ -693,7 +693,7 @@ function BP:getBrik(shapeData)
self.pieceCount=self.pieceCount+1

-- Generate cell matrix from bool matrix
---@cast shapeMat Mat<Techmino.Cell>
---@cast shapeMat Mat<Techmino.Brik.Cell>
for y=1,#shapeMat do for x=1,#shapeMat[1] do
shapeMat[y][x]=shapeMat[y][x] and self:newCell(shapeColor,self.pieceCount)
end end
Expand Down Expand Up @@ -1397,7 +1397,7 @@ function BP:changeFieldWidth(w,origPos)
if not origPos then origPos=1 end
local w0=self.settings.fieldW
for y=1,#self.field:getHeight() do
local L=TABLE.new(false,w) ---@type Techmino.Cell[]
local L=TABLE.new(false,w) ---@type Techmino.Brik.Cell[]
for x=1,w0 do
local newX=origPos+x-1
if newX>=1 and newX<=w then
Expand Down Expand Up @@ -1434,7 +1434,7 @@ end
--------------------------------------------------------------
-- Press & Release & Update & Render

function BP:updateFrame()
function BP:tickStep()
local SET=self.settings

-- Hard-drop lock
Expand Down
2 changes: 1 addition & 1 deletion assets/game/gelaPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ end
--------------------------------------------------------------
-- Press & Release & Update & Render

function GP:updateFrame()
function GP:tickStep()
local SET=self.settings

-- Hard-drop lock
Expand Down
2 changes: 1 addition & 1 deletion assets/game/mode/brik/exterior/sprint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ return {
beforeClear={
function(P,lines) -- Infinite Sprint Core
local CLEAR=P.modeData.infSprint_clears
---@type Techmino.Cell[][]
---@type Techmino.Brik.Cell[][]
local mat=P.field._matrix
for i=1,#lines do
local l={[0]=P.time}
Expand Down
6 changes: 4 additions & 2 deletions assets/game/pubClass.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
---@alias Techmino.Event.Gela string | {[1]:number, [2]:fun(P:Techmino.Player.Gela):...} | fun(P:Techmino.Player.Gela):...
---@alias Techmino.Event.Acry string | {[1]:number, [2]:fun(P:Techmino.Player.Acry):...} | fun(P:Techmino.Player.Acry):...

---@class Techmino.Cell


---@class Techmino.Brik.Cell
---@field id number piece id
---@field did number drop id (exist when hand piece locks)
---@field cid string cell id (unique) (already exist when piece display in next queue)
Expand All @@ -76,7 +78,7 @@
---@field diggable boolean Gela only
---@field connClear boolean Gela only

---@alias Techmino.RectPiece Mat<Techmino.Cell|false>
---@alias Techmino.RectPiece Mat<Techmino.Brik.Cell|false>

---@class Techmino.Piece
---@field id Techmino.Brik.ID
Expand Down
4 changes: 2 additions & 2 deletions assets/game/rectField.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local gc=love.graphics

---@class Techmino.RectField
---@field _width number
---@field _matrix Mat<Techmino.Cell|false>
---@field _matrix Mat<Techmino.Brik.Cell|false>
local F={}

--------------------------------------------------------------
Expand Down Expand Up @@ -99,7 +99,7 @@ function F:getHeight()
end

local wallCell=setmetatable({},{__newIndex=NULL,__metatable=true})
---@return Techmino.Cell|false
---@return Techmino.Brik.Cell|false
function F:getCell(x,y)
if x<=0 or x>self._width or y<=0 then return wallCell end
if y>#self._matrix then return false end
Expand Down
16 changes: 8 additions & 8 deletions assets/skin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ local function _getTime() return SKIN.time end
---@field base string
---@field getTime function
---@field drawFieldBackground fun(fieldW:number)
---@field drawFieldCell fun(C:Techmino.Cell, F:Techmino.RectField, x:number, y:number)
---@field drawGhostCell fun(C:Techmino.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawHandCellStroke fun(C:Techmino.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawHandCell fun(C:Techmino.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawFloatHoldCell fun(C:Techmino.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawFieldCell fun(C:Techmino.Brik.Cell, F:Techmino.RectField, x:number, y:number)
---@field drawGhostCell fun(C:Techmino.Brik.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawHandCellStroke fun(C:Techmino.Brik.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawHandCell fun(C:Techmino.Brik.Cell, B:Techmino.RectPiece, x:number, y:number)
---@field drawFloatHoldCell fun(C:Techmino.Brik.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawFloatHoldMark fun(n:number, disabled:boolean)
---@field drawHeightLines fun(fieldW:number, maxSpawnH:number, spawnH:number, lockoutH:number, deathH:number, voidH:number)
---@field drawFieldBorder fun()
Expand All @@ -22,17 +22,17 @@ local function _getTime() return SKIN.time end
---@field drawGarbageBuffer fun(garbageBuffer:table)
---@field drawLockDelayIndicator fun(freshCondition:string, freshChance:number, maxFreshTime:number, freshTime:number)
---@field drawNextBorder fun(slot:number)
---@field drawNextCell fun(C:Techmino.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawNextCell fun(C:Techmino.Brik.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawHoldBorder fun(mode:string, slot:number)
---@field drawHoldCell fun(C:Techmino.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawHoldCell fun(C:Techmino.Brik.Cell, disabled:boolean, B:Techmino.RectPiece, x:number, y:number)
---@field drawTime fun(time:number)
---@field drawStartingCounter fun(readyDelay:number)
---@field drawInfoPanel fun(x:number, y:number, w:number, h:number) Only called by mode

---@class Techmino.Skin.Brik: Techmino.Skin

---@class Techmino.Skin.Gela: Techmino.Skin
---@field drawFieldCell fun(C:Techmino.Cell, F:Techmino.RectField, x:number, y:number, connH?:number)
---@field drawFieldCell fun(C:Techmino.Brik.Cell, F:Techmino.RectField, x:number, y:number, connH?:number)

---@class Techmino.Skin.Acry: Techmino.Skin
---@field drawSwapCursor fun(cx:number, cy:number, lock:boolean)
Expand Down

0 comments on commit 17f07a0

Please sign in to comment.