1
This commit is contained in:
parent
1d9c4287fb
commit
adf774f543
18
timer.go
18
timer.go
@ -86,10 +86,10 @@ func (this *Timer) Update() {
|
|||||||
for this.getTickCount(this.context) >= this.timerTick {
|
for this.getTickCount(this.context) >= this.timerTick {
|
||||||
index := uint32(this.timerTick & TVR_MASK)
|
index := uint32(this.timerTick & TVR_MASK)
|
||||||
|
|
||||||
if index != 0 &&
|
if index == 0 &&
|
||||||
this.cascade(&this.tv2, this.getTimerIndex(0)) != 0 &&
|
this.cascade(&this.tv2, this.getTimerIndex(0)) == 0 &&
|
||||||
this.cascade(&this.tv3, this.getTimerIndex(1)) != 0 &&
|
this.cascade(&this.tv3, this.getTimerIndex(1)) == 0 &&
|
||||||
this.cascade(&this.tv4, this.getTimerIndex(2)) != 0 {
|
this.cascade(&this.tv4, this.getTimerIndex(2)) == 0 {
|
||||||
this.cascade(&this.tv5, this.getTimerIndex(3))
|
this.cascade(&this.tv5, this.getTimerIndex(3))
|
||||||
}
|
}
|
||||||
this.timerTick++
|
this.timerTick++
|
||||||
@ -143,7 +143,7 @@ func (this *Timer) AddDeadLineTimerEx(
|
|||||||
if init_func != nil {
|
if init_func != nil {
|
||||||
init_func(&timerList.params)
|
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 {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ func (this *Timer) AddRepeatTimerEx(
|
|||||||
if init_func != nil {
|
if init_func != nil {
|
||||||
init_func(&timerList.params)
|
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 {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ func (this *Timer) AddFixedTimerEx(
|
|||||||
if init_func != nil {
|
if init_func != nil {
|
||||||
init_func(&timerList.params)
|
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 {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ func (this *Timer) detachTimer(timerList *TimerList) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *Timer) addToFreeList(timerList *TimerList) {
|
func (this *Timer) addToFreeList(timerList *TimerList) {
|
||||||
timerList.Reset()
|
timerList.reset()
|
||||||
this.freeTimerList.AddTail(&timerList.entry)
|
this.freeTimerList.AddTail(&timerList.entry)
|
||||||
this.freeTimerNum++
|
this.freeTimerNum++
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ func (this *Timer) newTimerList() *TimerList {
|
|||||||
return timerList
|
return timerList
|
||||||
} else {
|
} else {
|
||||||
timerList := new(TimerList)
|
timerList := new(TimerList)
|
||||||
timerList.Init()
|
timerList.init()
|
||||||
return timerList
|
return timerList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ type TimerList struct {
|
|||||||
params XParams
|
params XParams
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) InitTimerList(
|
func (this *TimerList) initTimerList(
|
||||||
timer interface{},
|
timer interface{},
|
||||||
timerType int8,
|
timerType int8,
|
||||||
millSeconds int32,
|
millSeconds int32,
|
||||||
@ -36,7 +36,7 @@ func (this *TimerList) InitTimerList(
|
|||||||
this.timerFunc = timerFunc
|
this.timerFunc = timerFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) Reset() {
|
func (this *TimerList) reset() {
|
||||||
if !this.entry.Empty() {
|
if !this.entry.Empty() {
|
||||||
this.entry.DelInit()
|
this.entry.DelInit()
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ func (this *TimerList) Reset() {
|
|||||||
this.params.Reset()
|
this.params.Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TimerList) Init() {
|
func (this *TimerList) init() {
|
||||||
this.entry.Init()
|
this.entry.Init()
|
||||||
this.attachEntry.Init()
|
this.attachEntry.Init()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user