clock - escaco95/Warcraft-III-Libraries GitHub Wiki

μ ν•©ν•œ μ›Œν¬λž˜ν”„νŠΈ 버전

1.28.5

링크

μ†ŒμŠ€ μ½”λ“œ(vJass)

TESH μΈν…”λ¦¬μ„ΌμŠ€(txt)

κ°œμš”

κΈ°μ‘΄ jassμ—μ„œ timer와 timerdialog의 ν˜•νƒœλ‘œ μ§€μ›λ˜μ—ˆλ˜ 타이머, 타이머 μ°½ κΈ°λŠ₯을 ν•˜λ‚˜λ‘œ ν†΅ν•©ν•˜μ—¬ 관리할 수 μžˆλŠ” κ°œμ²΄μž…λ‹ˆλ‹€.

local timer t = CreateTimer()
local timerdialog td = CreateTimerDialog(t)

μœ„ jass μ½”λ“œλŠ” clock μΈμŠ€ν„΄μŠ€λ₯Ό μ‚¬μš©ν•˜μ—¬ λ‹€μŒκ³Ό 같이 κ΅¬ν˜„ν•˜λŠ” κ²ƒμœΌλ‘œ, λ™μΌν•œ 결과물을 얻을 수 μžˆμŠ΅λ‹ˆλ‹€.

local clock c = CreateClock()

λ˜ν•œ, μ‚¬μš©μžμ˜ 개발 μ·¨ν–₯에 맞게 struct method와 function을 μ‚¬μš©ν•˜μ—¬ μΈμŠ€ν„΄μŠ€λ₯Ό μ œμ–΄ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

//
// ν•¨μˆ˜ ν˜ΈμΆœμ„ 기반으둜 ν•œ clock 개체 μž‘μ—…
//
scope UsingClockWithFunction initializer main
    private function OnClockExpired takes nothing returns nothing
        call DestroyClock( GetExpiredClock() )
    endfunction
    private function main takes nothing returns nothing
        local clock c = CreateClock()
        call ClockSetTitle( c, "μž„μ˜μ˜ 타이머 μ°½ 제λͺ©" )
        call StartClock( c, 20.0, false, function OnClockExpired )
        call ClockDisplay( c, true ) // λ˜λŠ”, ShowClock( c )
    endfunction
endscope

//
// λ©”μ†Œλ“œ ν˜ΈμΆœμ„ 기반으둜 ν•œ clock 개체 μž‘μ—…
//
scope UsingClockWithMethod initializer main
    private function OnClockExpired takes nothing returns nothing
        call clock.expired.destroy() // λ˜λŠ”, clock.getExpired()
    endfunction
    private function main takes nothing returns nothing
        local clock c = clock.create()
        set c.title = "μž„μ˜μ˜ 타이머 μ°½ 제λͺ©" // λ˜λŠ”, c.setTitle( "μž„μ˜μ˜ 타이머 μ°½ 제λͺ©" )
        call c.start( 20.0, false, function OnClockExpired )
        set c.visible = true  // λ˜λŠ”, c.display( true ), c.show()
    endfunction
endscope

λŒ€λ¬ΈμœΌλ‘œ