本文整理匯總了Golang中hearts/img/uistate.UIState.Debug方法的典型用法代碼示例。如果您正苦於以下問題:Golang UIState.Debug方法的具體用法?Golang UIState.Debug怎麽用?Golang UIState.Debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hearts/img/uistate.UIState
的用法示例。
在下文中一共展示了UIState.Debug方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OnTouch
func OnTouch(t touch.Event, u *uistate.UIState) {
if t.Type == touch.TypeBegin {
u.ViewOnTouch = u.CurView
beganTouchX = t.X
beganTouchY = t.Y
} else if u.CurView != u.ViewOnTouch {
return
}
// tap 5 times to trigger debug mode
if t.Type == touch.TypeEnd {
if t.X == beganTouchX && t.Y == beganTouchY && time.Since(timeStartedTapping).Seconds() <= 5.0 {
numTaps++
if numTaps == 5 {
fmt.Println("TOGGLING DEBUG")
u.Debug = !u.Debug
view.ReloadView(u)
numTaps = 0
}
} else {
numTaps = 0
timeStartedTapping = time.Now()
}
}
switch u.CurView {
case uistate.Discovery:
switch t.Type {
case touch.TypeBegin:
beginClickDiscovery(t, u)
case touch.TypeMove:
moveClickDiscovery(t, u)
case touch.TypeEnd:
endClickDiscovery(t, u)
}
case uistate.Arrange:
switch t.Type {
case touch.TypeBegin:
beginClickArrange(t, u)
case touch.TypeMove:
moveClickArrange(t, u)
case touch.TypeEnd:
endClickArrange(t, u)
}
case uistate.Table:
switch t.Type {
case touch.TypeBegin:
beginClickTable(t, u)
case touch.TypeMove:
moveClickTable(t, u)
case touch.TypeEnd:
endClickTable(t, u)
}
case uistate.Pass:
switch t.Type {
case touch.TypeBegin:
beginClickPass(t, u)
case touch.TypeMove:
moveClickPass(t, u)
case touch.TypeEnd:
endClickPass(t, u)
}
case uistate.Take:
switch t.Type {
case touch.TypeBegin:
beginClickTake(t, u)
case touch.TypeMove:
moveClickTake(t, u)
case touch.TypeEnd:
endClickTake(t, u)
}
case uistate.Play:
switch t.Type {
case touch.TypeBegin:
beginClickPlay(t, u)
case touch.TypeMove:
moveClickPlay(t, u)
case touch.TypeEnd:
endClickPlay(t, u)
}
case uistate.Split:
switch t.Type {
case touch.TypeBegin:
beginClickSplit(t, u)
case touch.TypeMove:
moveClickSplit(t, u)
case touch.TypeEnd:
endClickSplit(t, u)
}
case uistate.Score:
switch t.Type {
case touch.TypeBegin:
beginClickScore(t, u)
case touch.TypeMove:
moveClickScore(t, u)
case touch.TypeEnd:
endClickScore(t, u)
}
}
u.LastMouseXY.X = t.X
u.LastMouseXY.Y = t.Y
}