当前位置: 首页>>代码示例>>Golang>>正文


Golang UIState.ScanChan方法代码示例

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


在下文中一共展示了UIState.ScanChan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: endClickDiscovery

func endClickDiscovery(t touch.Event, u *uistate.UIState) {
	pressed := unpressButtons(u)
	for _, button := range pressed {
		if button == u.Buttons["newGame"] {
			gameStartData, logName := sync.CreateLogSyncgroup(u)
			settingsName := sync.CreateSettingsSyncgroup(u)
			if logName != "" && settingsName != "" {
				sync.LogSettingsName(settingsName, u)
				u.ScanChan <- true
				u.ScanChan = nil
				u.SGChan = make(chan bool)
				go sync.Advertise(logName, settingsName, gameStartData, u.SGChan, u.Ctx)
				view.LoadArrangeView(u)
			}
		} else {
			for _, b := range u.Buttons {
				if button == b {
					s := strings.Split(b.GetInfo(), "|")
					logAddr := s[0]
					creator, _ := strconv.ParseBool(s[1])
					fmt.Println("TRYING TO JOIN:", logAddr)
					success := sync.JoinLogSyncgroup(logAddr, creator, u)
					if success {
						sgName := sync.CreateSettingsSyncgroup(u)
						if sgName != "" {
							sync.LogSettingsName(sgName, u)
						}
						u.ScanChan <- true
						u.ScanChan = nil
						view.LoadArrangeView(u)
					} else {
						fmt.Println("Failed to join")
					}
				}
			}
		}
	}
}
开发者ID:vanadium,项目名称:croupier,代码行数:38,代码来源:touchhandler.go

示例2: onPaint

func onPaint(glctx gl.Context, sz size.Event, u *uistate.UIState) {
	if u.CurView == uistate.None {
		u.ScanChan = make(chan bool)
		go sync.ScanForSG(u.Ctx, u.ScanChan, u)
		view.LoadDiscoveryView(u)
	}
	glctx.ClearColor(1, 1, 1, 1)
	glctx.Clear(gl.COLOR_BUFFER_BIT)
	now := clock.Time(time.Since(u.StartTime) * 60 / time.Second)
	u.Eng.Render(u.Scene, now, sz)
	if u.Debug {
		fps.Draw(sz)
	}
}
开发者ID:vanadium,项目名称:croupier,代码行数:14,代码来源:main.go

示例3: endClickArrange

func endClickArrange(t touch.Event, u *uistate.UIState) {
	pressed := unpressButtons(u)
	for _, b := range pressed {
		if b == u.Buttons["exit"] {
			if u.SGChan != nil {
				u.SGChan <- true
				u.SGChan = nil
			}
			u.IsOwner = false
			u.DiscGroups = make(map[string]*uistate.DiscStruct)
			u.ScanChan = make(chan bool)
			go sync.ScanForSG(u.Ctx, u.ScanChan, u)
			view.LoadDiscoveryView(u)
		} else if b == u.Buttons["start"] {
			if u.CurTable.AllReadyForNewRound() {
				successStart := sync.LogGameStart(u)
				for !successStart {
					successStart = sync.LogGameStart(u)
				}
				newHands := u.CurTable.Deal()
				successDeal := sync.LogDeal(u, u.CurPlayerIndex, newHands)
				for !successDeal {
					successDeal = sync.LogDeal(u, u.CurPlayerIndex, newHands)
				}
			}
		} else {
			for key, button := range u.Buttons {
				if b == button && (u.CurPlayerIndex < 0 || u.Debug) {
					if key == "joinTable" {
						u.CurPlayerIndex = 4
						sync.LogPlayerNum(u)
					} else {
						playerNum := strings.Split(key, "-")[1]
						u.CurPlayerIndex, _ = strconv.Atoi(playerNum)
						sync.LogPlayerNum(u)
					}
				}
			}
		}
	}
}
开发者ID:vanadium,项目名称:croupier,代码行数:41,代码来源:touchhandler.go


注:本文中的hearts/img/uistate.UIState.ScanChan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。