API Basic Timers ko - LIHACHTETAN/ClassicUO-BadNewbie-BasicIDE GitHub Wiki
CreateTimer / script timers
ClassicUO โข Basic
CreateTimer๋ ์ ์งํ ์ฝ๋ฐฑ ํ์ด๋จธ๋ฅผ ๋ง๋ญ๋๋ค. Start๋ ๊ฐ์ ์คํฌ๋ฆฝํธ ์คํ ์ค๋ ๋์์ Sub๋ฅผ ์์ฝํฉ๋๋ค. ์ด ํ๋ก์ ํธ ํ์ฅ์ ๊ฒฝ๊ณผ ์ด๋ฅผ ์ฝ๋ Basic Timer()์ ๋ณ๊ฐ์ ๋๋ค.
์ ํํ ๊ตฌ๋ฌธ
CreateTimer(milliseconds, handler) -> Object (ScriptTimer)
CreateTimer(milliseconds, handler, repeating) -> Object (ScriptTimer)
timer.Start() -> Unit
timer.Stop() -> Unit
timer.Dispose() -> Unit
timer.Enabled() -> Integer (0/1)
timer.Interval() -> Integer (ms)
timer.SetInterval(milliseconds) -> Unit
Using timer ... End Using
๋งค๊ฐ๋ณ์
millisecondsโ milliseconds๋ 1..2147483647 ๋ฒ์์ Integer ๋ฐ๋ฆฌ์ด์ ๋๋ค. ๋ฌธ์์ด, ์์, 0, ์์๋ ์ค๋ฅ์ ๋๋ค. SetInterval๋ ๊ฐ์ ๊ท์น์ ๋๋ค. Interval()์ ์ค์ ํ ๊ฐ๊ฒฉ์ด์ง ๋จ์ ์๊ฐ์ด ์๋๋๋ค.handlerโ ๋งค๊ฐ๋ณ์๊ฐ ์ ํ ์๋ ๊ณ ์ ํ Sub์ AddressOf ๋๋ ํ์ฌ ์คํฌ๋ฆฝํธ์ ์ฝ๋ฐฑ ๋ณ์/ํฉํฐ๋ฆฌ์ ๋๋ค. Function, Optional/ParamArray, ์ด๋ฆ ๋ฌธ์์ด, ๋ค๋ฅธ ์คํฌ๋ฆฝํธ ์ฐธ์กฐ๋ ๊ฑฐ๋ถ๋ฉ๋๋ค. ๊ณต์ ์ํ๋ Module ํ๋์ ์ ์ฅํ๋ฉฐ ์ง์ญ ํด๋ก์ ๋ ์บก์ฒํ์ง ์์ต๋๋ค.repeatingโ ์ ํ์ ์ธ ์ธ ๋ฒ์งธ ์ธ์: True/1์ ๋ฐ๋ณต, False/0์ ํ ๋ฒ ์คํ์ ๋๋ค. ๊ธฐ๋ณธ๊ฐ์ True์ด๋ฉฐ ์ด๋ฆ ์๋ ์ธ์๋ repeating:=์ ๋๋ค. ๋ค๋ฅธ ์ซ์์ ๋ฌธ์์ด์ ์ค๋ฅ์ ๋๋ค. ์ผํ์ฑ ํ์ด๋จธ๋ ์ฒ๋ฆฌ๊ธฐ๋ฅผ ํธ์ถํ๊ธฐ ์ ์ ๋นํ์ฑํ๋ฉ๋๋ค.timer / Start / Stop / Dispose / SetIntervalโ ๋ฉ์๋: Start, Stop, Dispose, Enabled, Interval, SetInterval(milliseconds). ํ์ฑ ํ์ด๋จธ์ Start๋ ์๋ฌด๊ฒ๋ ๋ฐ๊พธ์ง ์์ต๋๋ค. Stop ํ Startํ ์ ์์ต๋๋ค. SetInterval์ ํ์ฑ ์ํ์ด๋ฉด ์ง๊ธ๋ถํฐ ๋ค์ ์ธ๊ณ , ์ ์ง ์ํ์ด๋ฉด ์ ์ง๋ฅผ ์ ์งํฉ๋๋ค. Dispose๋ ๋ฐ๋ณต ํธ์ถํ ์ ์๋ ์๊ตฌ ํด์ ์ด๋ฉฐ ์ดํ Start/SetInterval์ ์คํจํฉ๋๋ค. Using์ ์ข ๋ฃ ์ ์บก์ฒํ ๊ฐ์ฒด๋ฅผ ํด์ ํฉ๋๋ค.
๋ฐํ๊ฐ
CreateTimer๋ Object(ScriptTimer)๋ฅผ ๋ฐํํ๋ฉฐ ์์ดํ ID๋ ์คํฌ๋ฆฝํธ ์ธ๋ฑ์ค๊ฐ ์๋๋๋ค. Start/Stop/Dispose/SetInterval์ Unit์ ๋๋ค. Enabled๋ Integer 1=True ๋๋ 0=False๋ก ๋ ๋ค ๋น๊ตํ ์ ์์ต๋๋ค. Interval์ ๋ฐ๋ฆฌ์ด์ด๋ฉฐ Boolean์ด ์๋๋๋ค. ์์ ๊ฒฐ๊ณผ๋ String "3:0", "ready:0", "tick failed:0"์ ๋๋ค.
๋์
- ๋ช ๋ น ์ฌ์ด์ Basic Wait/Sleep ๋ฐ Wait Until ์์์ ๋จ์กฐ ๊ฒฝ๊ณผ ์๊ฐ์ ๊ฒ์ฌํฉ๋๋ค. ํ์ฑ ํ์ด๋จธ๊ฐ ์์ผ๋ฉด Wait๋ฅผ ์ต๋25๋ฐ๋ฆฌ์ด ๋จ์๋ก ๋๋๋๋ค. ๊ฒ์ API๋ ๋ค๋ฅธ ์ฐจ๋จ ๋ค์ดํฐ๋ธ ํธ์ถ์ ๋จผ์ ๋ฐํํด์ผ ํฉ๋๋ค. ์ค์๊ฐ ์ ๋ฐ๋๋ ๋ณด์ฅํ์ง ์์ผ๋ฉฐ ์ ์ค๋ ๋๋ฅผ ๋ง๋ค์ง ์์ต๋๋ค.
- ๊ธฐํ์, ๊ฐ์ผ๋ฉด ์์ฑ์์ด๋ฉฐ ๊ฒ์ฌ๋น ์ต๋64๊ฐ ์ฒ๋ฆฌ๊ธฐ๋ฅผ ํธ์ถํ๊ณ ๋๋จธ์ง๋ ๋ค์ ๊ฒ์ฌ์์ ์คํํฉ๋๋ค. ์ฒ๋ฆฌ๊ธฐ ์์์๋ Wait๋ฅผ ์จ๋ ๋ค๋ฅธ ํ์ด๋จธ๊ฐ ์ฌ์ง์ ํ์ง ์์ต๋๋ค. ๋ฐ๋ณต ๊ฐ๊ฒฉ์ ์๋ฃ ํ ์์ํ๋ฉฐ ๋์น ํ์๋ ์์ง ์์ต๋๋ค. ์ผ์์ ์ง๋ ํธ์ถ์ ๋ฉ์ถ๊ณ ์ฌ๊ฐ ์ ์ง์ฐ๋ ํ์ด๋จธ๋ฅผ ํ ๋ฒ ์คํํฉ๋๋ค.
- ์ฒ๋ฆฌ๊ธฐ ์ค๋ฅ๋ ํ์ด๋จธ๋ฅผ ๋๊ณ ํธ์ถ์์ Catch/Finally๋ก ์ ๋ฌ๋ฉ๋๋ค. ์ฒ๋ฆฌ๊ธฐ ์์ Stop/SetInterval์ ๋ฐ์๋ฉ๋๋ค. ๋น์์ ์ง๋ ์ผ๋ฐ Catch๊ฐ ์ผํค์ง ์์ต๋๋ค. ์ต์์ ์คํ์ ์ข ๋ฃยท์ค๋ฅยท์ ์ง๋ ๋ชจ๋ ํ์ด๋จธ๋ฅผ ํด์ ํ๋ฉฐ ์ฌ์คํ/์ฌ๋ก๋ ์ ๋ค์ ๋ง๋ค์ด์ผ ํฉ๋๋ค. IDE๋ง ๋ซ์ผ๋ฉด ์คํ ์ค ์คํฌ๋ฆฝํธ์ ํ์ด๋จธ๋ ์ ์ง๋ฉ๋๋ค. ๋ฏธํด์ ํ์ด๋จธ๋ ์ต๋1024๊ฐ์ด๋ฉฐ Dispose๊ฐ ์๋ฆฌ๋ฅผ ๋ฐํํฉ๋๋ค.
- RunThreePulses์ GetHandler๋ ์ ์ฒด ์ฝ๋๊ฐ ์๋ ์์ ๋ณด์กฐ ํจ์์ ๋๋ค. ๋ด๋ถ CreateTimer๋ ์ธ์์ ์์ ์๋ฅผ ๊ฒ์ฌํ๊ณ Start๋ ๊ธฐํ์ ๊ธฐ๋กํ๋ฉฐ Pump๋ Sub๋ฅผ ํธ์ถํฉ๋๋ค. Fire๋ ์๋ฃ ํ ๋ค์ ๊ธฐํ์ ์ค์ ํ๊ณ Release๋ ๋ฃจํธ ์คํ ์ข ๋ฃ ์ ํด์ ํฉ๋๋ค. ์ข ๋ฃ ํ ๋ ๋ฆฝ ์๋น์ค๋ ๋จ์ง ์์ต๋๋ค.
์์
1. ์ธ ๋ฒ ํธ์ถ ํ ์ ๋ฆฌ
# RunThreePulses๋20๋ฐ๋ฆฌ์ด์ ๊ธฐ๋ณธ repeating=True๋ฅผ ์ฌ์ฉํฉ๋๋ค. CountPulse๋ State.count๋ฅผ ์ฆ๊ฐ์ํค๊ณ 3์์ ๋ฉ์ถฅ๋๋ค. Wait Until์3000๋ฐ๋ฆฌ์ด ์ ํ์ผ๋ก ์ํ์ ํ์ด๋จธ๋ฅผ ๊ฒ์ฌํฉ๋๋ค. Enabled()=0์ด๋ฏ๋ก "3:0"์
๋๋ค. Returnํด๋ Using์ด ํด์ ํฉ๋๋ค.
Option Explicit On
Module State
Public Dim count As Integer = 0
Public Dim pulse
End Module
Sub CountPulse()
State.count += 1
If State.count >= 3 Then
State.pulse.Stop()
End If
End Sub
Function RunThreePulses() As String
State.pulse = CreateTimer(20, AddressOf CountPulse)
Using State.pulse
State.pulse.Start()
Wait Until State.count >= 3 Timeout 3000
Return CStr(State.count) & ":" & CStr(State.pulse.Enabled())
End Using
End Function
Sub Main()
Return RunThreePulses()
End Sub
๋งค๊ฐ๋ณ์ ๋ฐ ์คํ ์ค๋ช :
RunThreePulses๋20๋ฐ๋ฆฌ์ด์ ๊ธฐ๋ณธ repeating=True๋ฅผ ์ฌ์ฉํฉ๋๋ค. CountPulse๋ State.count๋ฅผ ์ฆ๊ฐ์ํค๊ณ 3์์ ๋ฉ์ถฅ๋๋ค. Wait Until์3000๋ฐ๋ฆฌ์ด ์ ํ์ผ๋ก ์ํ์ ํ์ด๋จธ๋ฅผ ๊ฒ์ฌํฉ๋๋ค. Enabled()=0์ด๋ฏ๋ก "3:0"์ ๋๋ค. Returnํด๋ Using์ด ํด์ ํฉ๋๋ค.
2. ์ด๋ฆ ์๋ ์ธ์์ ์ผํ์ฑ ํธ์ถ
# GetHandler๋ AddressOf SetReady๋ฅผ ๋ฐํํฉ๋๋ค. ์ด๋ฆ ์๋ ์ธ์๋5๋ฐ๋ฆฌ์ด, callback, repeating=False์
๋๋ค. SetInterval์ด Start ์ ์10์ผ๋ก ๋ฐ๊ฟ๋๋ค. SetReady๊ฐ "ready"๋ฅผ ์ ์ฅํ ๋ ํ์ด๋จธ๋ ์ด๋ฏธ ๊บผ์ก์ต๋๋ค. Main์ ์ต๋3000๋ฐ๋ฆฌ์ด ๊ธฐ๋ค๋ฆฌ๊ณ "ready:0"์ ๋ฐํํฉ๋๋ค. ๋ชจ๋ ๋ณด์กฐ ํจ์๊ฐ ํฌํจ๋ฉ๋๋ค.
Option Explicit On
Module State
Public Dim message As String = ""
End Module
Sub SetReady()
State.message = "ready"
End Sub
Function GetHandler()
Return AddressOf SetReady
End Function
Sub Main()
Dim callback = GetHandler()
Dim notice = CreateTimer(repeating:=False, handler:=callback, milliseconds:=5)
Using notice
notice.SetInterval(10)
notice.Start()
Wait Until State.message = "ready" Timeout 3000
Return State.message & ":" & CStr(notice.Enabled())
End Using
End Sub
๋งค๊ฐ๋ณ์ ๋ฐ ์คํ ์ค๋ช :
GetHandler๋ AddressOf SetReady๋ฅผ ๋ฐํํฉ๋๋ค. ์ด๋ฆ ์๋ ์ธ์๋5๋ฐ๋ฆฌ์ด, callback, repeating=False์ ๋๋ค. SetInterval์ด Start ์ ์10์ผ๋ก ๋ฐ๊ฟ๋๋ค. SetReady๊ฐ "ready"๋ฅผ ์ ์ฅํ ๋ ํ์ด๋จธ๋ ์ด๋ฏธ ๊บผ์ก์ต๋๋ค. Main์ ์ต๋3000๋ฐ๋ฆฌ์ด ๊ธฐ๋ค๋ฆฌ๊ณ "ready:0"์ ๋ฐํํฉ๋๋ค. ๋ชจ๋ ๋ณด์กฐ ํจ์๊ฐ ํฌํจ๋ฉ๋๋ค.
3. Wait ์ค ์ค๋ฅ ์ฒ๋ฆฌ
# FailingPulse๊ฐ "tick failed"๋ฅผ ๋์ง๋๋ค. 5๋ฐ๋ฆฌ์ด ํ์ด๋จธ๊ฐ Wait(2000) ์์์ ์คํ๋๊ณ ๊บผ์ง๋ฉฐ ๋๊ธฐ๋ฅผ ์ค๋จํฉ๋๋ค. Catch๋ ๋ฌธ์์ด๊ณผ Enabled()=0์ ์ ์ฅํ๊ณ Finally๊ฐ ํด์ ํฉ๋๋ค. "tick failed:0"์ ๋ฉ์์ง์ ์ํ์
๋๋ค. ๋น์์ ์ง๋ ์์ง์ด ์ฒ๋ฆฌํฉ๋๋ค.
Option Explicit On
Sub FailingPulse()
Throw "tick failed"
End Sub
Sub Main()
Dim pulse = CreateTimer(5, AddressOf FailingPulse)
Dim problemText As String = ""
Dim enabledAfterError As Boolean = True
Try
pulse.Start()
Wait(2000)
Catch problem
problemText = problem
enabledAfterError = pulse.Enabled()
Finally
pulse.Dispose()
End Try
Return problemText & ":" & CStr(enabledAfterError)
End Sub
๋งค๊ฐ๋ณ์ ๋ฐ ์คํ ์ค๋ช :
FailingPulse๊ฐ "tick failed"๋ฅผ ๋์ง๋๋ค. 5๋ฐ๋ฆฌ์ด ํ์ด๋จธ๊ฐ Wait(2000) ์์์ ์คํ๋๊ณ ๊บผ์ง๋ฉฐ ๋๊ธฐ๋ฅผ ์ค๋จํฉ๋๋ค. Catch๋ ๋ฌธ์์ด๊ณผ Enabled()=0์ ์ ์ฅํ๊ณ Finally๊ฐ ํด์ ํฉ๋๋ค. "tick failed:0"์ ๋ฉ์์ง์ ์ํ์ ๋๋ค. ๋น์์ ์ง๋ ์์ง์ด ์ฒ๋ฆฌํฉ๋๋ค.
๋ด๋ถ ํจ์: ํธ์ถ๋ถํฐ ๊ฒฐ๊ณผ๊น์ง
RunThreePulses์ GetHandler๋ ์ ์ฒด ์ฝ๋๊ฐ ์๋ ์์ ๋ณด์กฐ ํจ์์ ๋๋ค. ๋ด๋ถ CreateTimer๋ ์ธ์์ ์์ ์๋ฅผ ๊ฒ์ฌํ๊ณ Start๋ ๊ธฐํ์ ๊ธฐ๋กํ๋ฉฐ Pump๋ Sub๋ฅผ ํธ์ถํฉ๋๋ค. Fire๋ ์๋ฃ ํ ๋ค์ ๊ธฐํ์ ์ค์ ํ๊ณ Release๋ ๋ฃจํธ ์คํ ์ข ๋ฃ ์ ํด์ ํฉ๋๋ค. ์ข ๋ฃ ํ ๋ ๋ฆฝ ์๋น์ค๋ ๋จ์ง ์์ต๋๋ค.
1. CreateTimer
milliseconds๋ 1..2147483647 ๋ฒ์์ Integer ๋ฐ๋ฆฌ์ด์ ๋๋ค. ๋ฌธ์์ด, ์์, 0, ์์๋ ์ค๋ฅ์ ๋๋ค. SetInterval๋ ๊ฐ์ ๊ท์น์ ๋๋ค. Interval()์ ์ค์ ํ ๊ฐ๊ฒฉ์ด์ง ๋จ์ ์๊ฐ์ด ์๋๋๋ค.
๋งค๊ฐ๋ณ์๊ฐ ์ ํ ์๋ ๊ณ ์ ํ Sub์ AddressOf ๋๋ ํ์ฌ ์คํฌ๋ฆฝํธ์ ์ฝ๋ฐฑ ๋ณ์/ํฉํฐ๋ฆฌ์ ๋๋ค. Function, Optional/ParamArray, ์ด๋ฆ ๋ฌธ์์ด, ๋ค๋ฅธ ์คํฌ๋ฆฝํธ ์ฐธ์กฐ๋ ๊ฑฐ๋ถ๋ฉ๋๋ค. ๊ณต์ ์ํ๋ Module ํ๋์ ์ ์ฅํ๋ฉฐ ์ง์ญ ํด๋ก์ ๋ ์บก์ฒํ์ง ์์ต๋๋ค.
์ ํ์ ์ธ ์ธ ๋ฒ์งธ ์ธ์: True/1์ ๋ฐ๋ณต, False/0์ ํ ๋ฒ ์คํ์ ๋๋ค. ๊ธฐ๋ณธ๊ฐ์ True์ด๋ฉฐ ์ด๋ฆ ์๋ ์ธ์๋ repeating:=์ ๋๋ค. ๋ค๋ฅธ ์ซ์์ ๋ฌธ์์ด์ ์ค๋ฅ์ ๋๋ค. ์ผํ์ฑ ํ์ด๋จธ๋ ์ฒ๋ฆฌ๊ธฐ๋ฅผ ํธ์ถํ๊ธฐ ์ ์ ๋นํ์ฑํ๋ฉ๋๋ค.
CreateTimer๋ Object(ScriptTimer)๋ฅผ ๋ฐํํ๋ฉฐ ์์ดํ ID๋ ์คํฌ๋ฆฝํธ ์ธ๋ฑ์ค๊ฐ ์๋๋๋ค. Start/Stop/Dispose/SetInterval์ Unit์ ๋๋ค. Enabled๋ Integer 1=True ๋๋ 0=False๋ก ๋ ๋ค ๋น๊ตํ ์ ์์ต๋๋ค. Interval์ ๋ฐ๋ฆฌ์ด์ด๋ฉฐ Boolean์ด ์๋๋๋ค. ์์ ๊ฒฐ๊ณผ๋ String "3:0", "ready:0", "tick failed:0"์ ๋๋ค.
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/Interpreter.Timers.cs; ํจ์ CreateTimer.
2. Start
๋ฉ์๋: Start, Stop, Dispose, Enabled, Interval, SetInterval(milliseconds). ํ์ฑ ํ์ด๋จธ์ Start๋ ์๋ฌด๊ฒ๋ ๋ฐ๊พธ์ง ์์ต๋๋ค. Stop ํ Startํ ์ ์์ต๋๋ค. SetInterval์ ํ์ฑ ์ํ์ด๋ฉด ์ง๊ธ๋ถํฐ ๋ค์ ์ธ๊ณ , ์ ์ง ์ํ์ด๋ฉด ์ ์ง๋ฅผ ์ ์งํฉ๋๋ค. Dispose๋ ๋ฐ๋ณต ํธ์ถํ ์ ์๋ ์๊ตฌ ํด์ ์ด๋ฉฐ ์ดํ Start/SetInterval์ ์คํจํฉ๋๋ค. Using์ ์ข ๋ฃ ์ ์บก์ฒํ ๊ฐ์ฒด๋ฅผ ํด์ ํฉ๋๋ค.
Due = now + interval; enabled = true;
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/ObjectTypes/ScriptTimerObject.cs; ํจ์ Start.
3. WaitWithTimers
๋ช ๋ น ์ฌ์ด์ Basic Wait/Sleep ๋ฐ Wait Until ์์์ ๋จ์กฐ ๊ฒฝ๊ณผ ์๊ฐ์ ๊ฒ์ฌํฉ๋๋ค. ํ์ฑ ํ์ด๋จธ๊ฐ ์์ผ๋ฉด Wait๋ฅผ ์ต๋25๋ฐ๋ฆฌ์ด ๋จ์๋ก ๋๋๋๋ค. ๊ฒ์ API๋ ๋ค๋ฅธ ์ฐจ๋จ ๋ค์ดํฐ๋ธ ํธ์ถ์ ๋จผ์ ๋ฐํํด์ผ ํฉ๋๋ค. ์ค์๊ฐ ์ ๋ฐ๋๋ ๋ณด์ฅํ์ง ์์ผ๋ฉฐ ์ ์ค๋ ๋๋ฅผ ๋ง๋ค์ง ์์ต๋๋ค.
checkpoint -> Pump -> min(remaining, nextDue, 25 ms) -> Wait
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/Interpreter.Timers.cs; ํจ์ WaitWithTimers.
4. Pump
๊ธฐํ์, ๊ฐ์ผ๋ฉด ์์ฑ์์ด๋ฉฐ ๊ฒ์ฌ๋น ์ต๋64๊ฐ ์ฒ๋ฆฌ๊ธฐ๋ฅผ ํธ์ถํ๊ณ ๋๋จธ์ง๋ ๋ค์ ๊ฒ์ฌ์์ ์คํํฉ๋๋ค. ์ฒ๋ฆฌ๊ธฐ ์์์๋ Wait๋ฅผ ์จ๋ ๋ค๋ฅธ ํ์ด๋จธ๊ฐ ์ฌ์ง์ ํ์ง ์์ต๋๋ค. ๋ฐ๋ณต ๊ฐ๊ฒฉ์ ์๋ฃ ํ ์์ํ๋ฉฐ ๋์น ํ์๋ ์์ง ์์ต๋๋ค. ์ผ์์ ์ง๋ ํธ์ถ์ ๋ฉ์ถ๊ณ ์ฌ๊ฐ ์ ์ง์ฐ๋ ํ์ด๋จธ๋ฅผ ํ ๋ฒ ์คํํฉ๋๋ค.
snapshot -> deadline / sequence -> checkpoint -> Fire; limit = 64
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/ScriptTimerScheduler.cs; ํจ์ Pump.
5. Fire
์ฒ๋ฆฌ๊ธฐ ์ค๋ฅ๋ ํ์ด๋จธ๋ฅผ ๋๊ณ ํธ์ถ์์ Catch/Finally๋ก ์ ๋ฌ๋ฉ๋๋ค. ์ฒ๋ฆฌ๊ธฐ ์์ Stop/SetInterval์ ๋ฐ์๋ฉ๋๋ค. ๋น์์ ์ง๋ ์ผ๋ฐ Catch๊ฐ ์ผํค์ง ์์ต๋๋ค. ์ต์์ ์คํ์ ์ข ๋ฃยท์ค๋ฅยท์ ์ง๋ ๋ชจ๋ ํ์ด๋จธ๋ฅผ ํด์ ํ๋ฉฐ ์ฌ์คํ/์ฌ๋ก๋ ์ ๋ค์ ๋ง๋ค์ด์ผ ํฉ๋๋ค. IDE๋ง ๋ซ์ผ๋ฉด ์คํ ์ค ์คํฌ๋ฆฝํธ์ ํ์ด๋จธ๋ ์ ์ง๋ฉ๋๋ค. ๋ฏธํด์ ํ์ด๋จธ๋ ์ต๋1024๊ฐ์ด๋ฉฐ Dispose๊ฐ ์๋ฆฌ๋ฅผ ๋ฐํํฉ๋๋ค.
callback -> completion -> next Due; error -> disabled -> throw
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/ObjectTypes/ScriptTimerObject.cs; ํจ์ Fire.
6. Dispose
๋ฉ์๋: Start, Stop, Dispose, Enabled, Interval, SetInterval(milliseconds). ํ์ฑ ํ์ด๋จธ์ Start๋ ์๋ฌด๊ฒ๋ ๋ฐ๊พธ์ง ์์ต๋๋ค. Stop ํ Startํ ์ ์์ต๋๋ค. SetInterval์ ํ์ฑ ์ํ์ด๋ฉด ์ง๊ธ๋ถํฐ ๋ค์ ์ธ๊ณ , ์ ์ง ์ํ์ด๋ฉด ์ ์ง๋ฅผ ์ ์งํฉ๋๋ค. Dispose๋ ๋ฐ๋ณต ํธ์ถํ ์ ์๋ ์๊ตฌ ํด์ ์ด๋ฉฐ ์ดํ Start/SetInterval์ ์คํจํฉ๋๋ค. Using์ ์ข ๋ฃ ์ ์บก์ฒํ ๊ฐ์ฒด๋ฅผ ํด์ ํฉ๋๋ค.
Release -> scheduler.Remove -> Changed
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/ObjectTypes/ScriptTimerObject.cs; ํจ์ Dispose.
7. Release
์ฒ๋ฆฌ๊ธฐ ์ค๋ฅ๋ ํ์ด๋จธ๋ฅผ ๋๊ณ ํธ์ถ์์ Catch/Finally๋ก ์ ๋ฌ๋ฉ๋๋ค. ์ฒ๋ฆฌ๊ธฐ ์์ Stop/SetInterval์ ๋ฐ์๋ฉ๋๋ค. ๋น์์ ์ง๋ ์ผ๋ฐ Catch๊ฐ ์ผํค์ง ์์ต๋๋ค. ์ต์์ ์คํ์ ์ข ๋ฃยท์ค๋ฅยท์ ์ง๋ ๋ชจ๋ ํ์ด๋จธ๋ฅผ ํด์ ํ๋ฉฐ ์ฌ์คํ/์ฌ๋ก๋ ์ ๋ค์ ๋ง๋ค์ด์ผ ํฉ๋๋ค. IDE๋ง ๋ซ์ผ๋ฉด ์คํ ์ค ์คํฌ๋ฆฝํธ์ ํ์ด๋จธ๋ ์ ์ง๋ฉ๋๋ค. ๋ฏธํด์ ํ์ด๋จธ๋ ์ต๋1024๊ฐ์ด๋ฉฐ Dispose๊ฐ ์๋ฆฌ๋ฅผ ๋ฐํํฉ๋๋ค.
timer.Release for each handle -> timers.Clear -> no pending deadline
ํ๋ก์ ํธ ์์ค: external/InjectionScript/src/InjectionScript/Runtime/ScriptTimerScheduler.cs; ํจ์ Release.
RunThreePulses๋20๋ฐ๋ฆฌ์ด์ ๊ธฐ๋ณธ repeating=True๋ฅผ ์ฌ์ฉํฉ๋๋ค. CountPulse๋ State.count๋ฅผ ์ฆ๊ฐ์ํค๊ณ 3์์ ๋ฉ์ถฅ๋๋ค. Wait Until์3000๋ฐ๋ฆฌ์ด ์ ํ์ผ๋ก ์ํ์ ํ์ด๋จธ๋ฅผ ๊ฒ์ฌํฉ๋๋ค. Enabled()=0์ด๋ฏ๋ก "3:0"์ ๋๋ค. Returnํด๋ Using์ด ํด์ ํฉ๋๋ค.