本文整理匯總了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
}