當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Hood.Find方法代碼示例

本文整理匯總了Golang中github.com/eaigner/hood.Hood.Find方法的典型用法代碼示例。如果您正苦於以下問題:Golang Hood.Find方法的具體用法?Golang Hood.Find怎麽用?Golang Hood.Find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/eaigner/hood.Hood的用法示例。


在下文中一共展示了Hood.Find方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: LoadWorldmap

func LoadWorldmap(_hood *hood.Hood) {
	if loaded {
		panic("Worldmap has already been loaded!")
	}

	// Load maps
	var maps []entities.Map
	if err := _hood.Find(&maps); err != nil {
		panic(err)
	}

	if len(maps) > 0 {
		for _, mapEntity := range maps {
			mapId := int(mapEntity.MapId)
			worldmap[mapId] = NewTilePointTable(mapEntity.Name)
		}

		numOfProcessRoutines = len(maps)
		go internalLoadWorldmap(_hood)

		waitForLoadComplete()
	} else {
		log.Warning("World", "LoadWorldmap", "No maps found in the database")
	}

	loaded = true
}
開發者ID:toophy,項目名稱:go-gameserver,代碼行數:27,代碼來源:World.go

示例2: loadMoves

func loadMoves(_hood *hood.Hood) {
	log.Verbose("Pokemon.Manager", "loadMoves", "Loading pokemon moves from database")

	var moves []entities.Move
	if err := _hood.Find(&moves); err != nil {
		log.Error("Pokemon.Manager", "loadMoves", "Error while loading moves: %s", err.Error())
	} else {
		for _, moveEntity := range moves {
			move := NewMove(&moveEntity)
			movesStore[move.GetMoveId()] = move
		}
	}
}
開發者ID:toophy,項目名稱:go-gameserver,代碼行數:13,代碼來源:Manager.go

示例3: GetWorkers

func GetWorkers(tx *hood.Hood) []*Worker {
	var results []Worker
	err := tx.Find(&results)
	if err != nil {
		panic(err)
	}

	// Should return pointers to the result objects so that
	// they can be mutated
	pointerResults := make([]*Worker, len(results))
	for i := range results {
		pointerResults[i] = &results[i]
	}

	return pointerResults
}
開發者ID:jtwarren,項目名稱:Hurricane,代碼行數:16,代碼來源:queries.go

示例4: loadMap

func loadMap(_hood *hood.Hood, _mapId int, _tilePointTable *TilePointTable) {
	// Create select query to get all tilepoints and layers as one result
	_hood.Select("tilepoint", "tilepoint.x", "tilepoint.y", "tilepointlayer.level", "tilepointlayer.blocking", "tilepointtilelayer.layer", "tilepointtilelayer.tileId")
	_hood.Join(hood.LeftJoin, "tilepointlayer", "tilepointlayer.tilePointId", "tilepoint.tilePointId")
	_hood.Join(hood.LeftJoin, "tilepointtilelayer", "tilepointtilelayer.tilePointLayerId", "tilepointlayer.tilePointLayerId")

	var tilePointRows []TilePointRow
	if err := _hood.Find(&tilePointRows); err != nil {
		log.Error("World", "loadMap", "Error fetching tilepoints from database:\n%s", err.Error())
	} else {
		for _, row := range tilePointRows {
			processTilePoints(row, _tilePointTable)
		}
	}

	processExitChan <- true
}
開發者ID:toophy,項目名稱:go-gameserver,代碼行數:17,代碼來源:World.go

示例5: loadPokemon

func loadPokemon(_hood *hood.Hood) {
	log.Verbose("Pokemon.Manager", "loadPokemon", "Loading pokemon from database")

	var pokemon []entities.Pokemon
	if err := _hood.Find(&pokemon); err != nil {
		log.Error("Pokemon.Manager", "loadPokemon", "Error while loading pokemon: %s", err.Error())
	} else {
		for _, pokemonEntity := range pokemon {
			poke := NewPokemon(&pokemonEntity)

			if err := poke.LinkMoves(_hood); err != nil {
				log.Error("Pokemon.Manager", "loadPokemon", "Failed to link moves to Pokemon %d. Error: %s", poke.GetPokemonId(), err.Error())
			} else {
				pokemonStore[poke.GetPokemonId()] = poke
			}
		}
	}
}
開發者ID:toophy,項目名稱:go-gameserver,代碼行數:18,代碼來源:Manager.go


注:本文中的github.com/eaigner/hood.Hood.Find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。