Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Name string // 事件名稱
Period int // timer時間
IsRepeat bool // 是否重複,是的話會塞回channel的末端
Action func() error // timer時間到,要執行的method
PNRandPlusTime int // 隨機增加時間,+-指定秒數,ex:10 ---> -10 ~ 10
PositivePlusTime int // 隨機增加時間,ex:10 ---> 0 ~ 10
// 補正秒數
// 到這個事件之前預計經過多少時間,差值在這個事件發生時間做補正
// ex:1 預期到這事件之前,N個事件是總共經過120秒,實際上因為前面事件有新增隨機秒數的關係,只花了115秒,
// 則在這個事件timer多+5秒
// ex2: 預期到這事件之前,N個事件是總共經過120秒,實際上因為前面事件有新增隨機秒數的關係,花了132秒,
// 則在這個事件timer做-12秒的處理
PatchTime int
ExtendEvent []*Event // 延伸事件
IsTripBegan bool // 是否為每個trip的起點
// contains filtered or unexported fields
}
Event 事件資料 1. 新增指定隨機秒數(範圍是指定值的正負值) 2. 新增指定隨機秒數(正值) 3. 新增補正秒數(0的話不需補正)
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
EventManager 事件管理 類樹狀結構管理器(只有一個根節點事件) 每個事件可以用ExtendEvent掛載延伸事件(開枝散葉) 有trip的概念,多個event組合成一個trip ex : 事件A,事件B,事件C 一個trip 可以是 ABABC 自由搭配組合 以上範例,只要在第一個A塞入時,指定IsTripBegan = true 頭一個事件有設IsTripBegan,就會形成trip, 每重新執行到第一個event,trip的tripProcessingTime參數會重置
func (*EventManager) GetCountDown ¶
func (em *EventManager) GetCountDown() int
GetCountDown 取得事件倒數經過時間
func (*EventManager) GetJobName ¶
func (em *EventManager) GetJobName() string
GetJobName 取得正在倒數的事件名稱
Click to show internal directories.
Click to hide internal directories.