本文整理汇总了Golang中hearts/img/uistate.UIState.CurCard方法的典型用法代码示例。如果您正苦于以下问题:Golang UIState.CurCard方法的具体用法?Golang UIState.CurCard怎么用?Golang UIState.CurCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hearts/img/uistate.UIState
的用法示例。
在下文中一共展示了UIState.CurCard方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: beginClickSplit
func beginClickSplit(t touch.Event, u *uistate.UIState) {
u.CurCard = findClickedCard(t, u)
if u.CurCard != nil {
reposition.BringNodeToFront(u.CurCard.GetNode(), u)
}
buttonList := findClickedButton(t, u)
for _, b := range buttonList {
if b == u.Buttons["toggleSplit"] && !u.SwitchingViews {
ch := make(chan bool)
u.SwitchingViews = true
reposition.AnimateOutSplit(ch, u)
quit := make(chan bool)
u.AnimChans = append(u.AnimChans, quit)
go func() {
onDone := func() {
u.SwitchingViews = false
if u.CurView == uistate.Split {
view.LoadPlayView(false, u)
}
}
reposition.SwitchOnChan(ch, quit, onDone, u)
}()
} else if b == u.Buttons["takeTrick"] {
pressButton(b, u)
} else {
handleDebugButtonClick(b, u)
}
}
}
示例2: beginClickPass
func beginClickPass(t touch.Event, u *uistate.UIState) {
u.CurCard = findClickedCard(t, u)
if u.CurCard != nil {
reposition.BringNodeToFront(u.CurCard.GetNode(), u)
}
buttonList := findClickedButton(t, u)
for _, b := range buttonList {
if b == u.Buttons["pass"] {
pressButton(b, u)
} else {
handleDebugButtonClick(b, u)
}
}
}
示例3: beginClickPlay
func beginClickPlay(t touch.Event, u *uistate.UIState) {
u.CurCard = findClickedCard(t, u)
if u.CurCard != nil {
reposition.BringNodeToFront(u.CurCard.GetNode(), u)
}
buttonList := findClickedButton(t, u)
for _, b := range buttonList {
if b == u.Buttons["toggleSplit"] && !u.SwitchingViews {
view.LoadSplitView(false, u)
} else if b == u.Buttons["takeTrick"] {
pressButton(b, u)
} else {
handleDebugButtonClick(b, u)
}
}
}
示例4: endClickPass
func endClickPass(t touch.Event, u *uistate.UIState) {
if u.CurCard != nil {
if !dropCardOnTarget(u.CurCard, t, u) {
// check to see if card was removed from a drop target
sync.RemoveCardFromTarget(u.CurCard, u)
// add card back to hand
reposition.ResetCardPosition(u.CurCard, u.Eng)
reposition.RealignSuit(u.CurCard.GetSuit(), u.CurCard.GetInitial().Y, u)
}
// check to see whether pull tab should be displayed
readyToPass := true
for _, d := range u.DropTargets {
if d.GetCardHere() == nil {
readyToPass = false
}
}
passButton := u.Buttons["pass"]
if readyToPass {
if passButton.GetDisplayingImage() {
u.Eng.SetSubTex(passButton.GetNode(), passButton.GetImage())
passButton.SetHidden(false)
passButton.SetDisplayingImage(true)
}
for _, img := range u.Other {
if img.GetDisplayingImage() {
u.Eng.SetSubTex(img.GetNode(), img.GetAlt())
img.SetHidden(false)
img.SetDisplayingImage(false)
}
}
} else {
var emptyTex sprite.SubTex
u.Eng.SetSubTex(passButton.GetNode(), emptyTex)
passButton.SetHidden(true)
passButton.SetDisplayingImage(true)
for _, img := range u.Other {
if !img.GetDisplayingImage() {
u.Eng.SetSubTex(img.GetNode(), img.GetImage())
img.SetHidden(false)
img.SetDisplayingImage(true)
}
}
}
}
pressed := unpressButtons(u)
for _, p := range pressed {
if p == u.Buttons["pass"] {
ch := make(chan bool)
success := passCards(ch, u.CurPlayerIndex, u)
quit := make(chan bool)
u.AnimChans = append(u.AnimChans, quit)
go func() {
onDone := func() {
if !success {
fmt.Println("Invalid pass")
} else if u.CurView == uistate.Pass {
view.LoadTakeView(u)
}
}
reposition.SwitchOnChan(ch, quit, onDone, u)
}()
}
}
u.CurCard = nil
}