From adf774f54309c78298dec30c20e88e81799b50dd Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 26 Oct 2020 14:56:17 +0800 Subject: [PATCH] 1 --- timer.go | 18 +++++++++--------- timerlist.go | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/timer.go b/timer.go index 55c4d9b..699fc1c 100644 --- a/timer.go +++ b/timer.go @@ -86,10 +86,10 @@ func (this *Timer) Update() { for this.getTickCount(this.context) >= this.timerTick { index := uint32(this.timerTick & TVR_MASK) - if index != 0 && - this.cascade(&this.tv2, this.getTimerIndex(0)) != 0 && - this.cascade(&this.tv3, this.getTimerIndex(1)) != 0 && - this.cascade(&this.tv4, this.getTimerIndex(2)) != 0 { + if index == 0 && + this.cascade(&this.tv2, this.getTimerIndex(0)) == 0 && + this.cascade(&this.tv3, this.getTimerIndex(1)) == 0 && + this.cascade(&this.tv4, this.getTimerIndex(2)) == 0 { this.cascade(&this.tv5, this.getTimerIndex(3)) } this.timerTick++ @@ -143,7 +143,7 @@ func (this *Timer) AddDeadLineTimerEx( if init_func != nil { init_func(&timerList.params) } - timerList.InitTimerList(this, DEADLINE_TIMER, milli_seconds, timer_func) + timerList.initTimerList(this, DEADLINE_TIMER, milli_seconds, timer_func) if install_func != nil { install_func(timerList, &timerList.params) } @@ -167,7 +167,7 @@ func (this *Timer) AddRepeatTimerEx( if init_func != nil { init_func(&timerList.params) } - timerList.InitTimerList(this, REPEAT_TIMER, milli_seconds, timer_func) + timerList.initTimerList(this, REPEAT_TIMER, milli_seconds, timer_func) if install_func != nil { install_func(timerList, &timerList.params) } @@ -191,7 +191,7 @@ func (this *Timer) AddFixedTimerEx( if init_func != nil { init_func(&timerList.params) } - timerList.InitTimerList(this, FIXED_TIMER, milli_seconds, timer_func) + timerList.initTimerList(this, FIXED_TIMER, milli_seconds, timer_func) if install_func != nil { install_func(timerList, &timerList.params) } @@ -267,7 +267,7 @@ func (this *Timer) detachTimer(timerList *TimerList) { } func (this *Timer) addToFreeList(timerList *TimerList) { - timerList.Reset() + timerList.reset() this.freeTimerList.AddTail(&timerList.entry) this.freeTimerNum++ } @@ -329,7 +329,7 @@ func (this *Timer) newTimerList() *TimerList { return timerList } else { timerList := new(TimerList) - timerList.Init() + timerList.init() return timerList } } diff --git a/timerlist.go b/timerlist.go index 75fcac2..51e7599 100644 --- a/timerlist.go +++ b/timerlist.go @@ -26,7 +26,7 @@ type TimerList struct { params XParams } -func (this *TimerList) InitTimerList( +func (this *TimerList) initTimerList( timer interface{}, timerType int8, millSeconds int32, @@ -36,7 +36,7 @@ func (this *TimerList) InitTimerList( this.timerFunc = timerFunc } -func (this *TimerList) Reset() { +func (this *TimerList) reset() { if !this.entry.Empty() { this.entry.DelInit() } @@ -48,7 +48,7 @@ func (this *TimerList) Reset() { this.params.Reset() } -func (this *TimerList) Init() { +func (this *TimerList) init() { this.entry.Init() this.attachEntry.Init() }