本文整理汇总了Golang中hearts/img/uistate.UIState.ViewOnTouch方法的典型用法代码示例。如果您正苦于以下问题:Golang UIState.ViewOnTouch方法的具体用法?Golang UIState.ViewOnTouch怎么用?Golang UIState.ViewOnTouch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hearts/img/uistate.UIState
的用法示例。
在下文中一共展示了UIState.ViewOnTouch方法的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
}