本文整理汇总了Golang中github.com/runningwild/cgf.Engine.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang Engine.Id方法的具体用法?Golang Engine.Id怎么用?Golang Engine.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/runningwild/cgf.Engine
的用法示例。
在下文中一共展示了Engine.Id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: debugHookup
func debugHookup(version string) *cgf.Engine {
var err error
for false && len(sys.GetActiveDevices()[gin.DeviceTypeController]) < 2 {
time.Sleep(time.Millisecond * 100)
sys.Think()
}
var engine *cgf.Engine
if version != "host" {
engine, err = cgf.NewClientEngine(17, "thunderingvictory.dyndns.org", 20007, base.EmailCrashReport, base.Log())
if err != nil {
base.Log().Printf("Unable to connect: %v", err)
base.Error().Fatalf("%v", err.Error())
}
} else {
sys.Think()
g := game.MakeGame()
if version == "host" {
engine, err = cgf.NewHostEngine(g, 17, "", 20007, base.EmailCrashReport, base.Log())
if err != nil {
panic(err)
}
err = cgf.Host(20007, "thunderball")
if err != nil {
panic(err)
}
} else {
engine, err = cgf.NewLocalEngine(g, 17, base.EmailCrashReport, base.Log())
}
if err != nil {
base.Error().Fatalf("%v", err.Error())
}
}
engine.Pause()
engine.GetState().(*game.Game).SetSystem(sys)
engine.Unpause()
base.Log().Printf("Engine Id: %v", engine.Id())
base.Log().Printf("All Ids: %v", engine.Ids())
return engine
}
示例2: debugHookup
func debugHookup(version string) (*cgf.Engine, *game.LocalData) {
// if version != "standard" && version != "moba" && version != "host" && version != "client" {
// base.Log().Fatalf("Unable to handle Version() == '%s'", Version())
// }
for false && len(sys.GetActiveDevices()[gin.DeviceTypeController]) < 2 {
time.Sleep(time.Millisecond * 100)
sys.Think()
}
var engine *cgf.Engine
var room game.Room
generated := generator.GenerateRoom(1024, 1024, 100, 64, 64522029961391019)
data, err := json.Marshal(generated)
if err != nil {
base.Error().Fatalf("%v", err)
}
err = json.Unmarshal(data, &room)
// err = base.LoadJson(filepath.Join(base.GetDataDir(), "rooms/basic.json"), &room)
if err != nil {
base.Error().Fatalf("%v", err)
}
var players []game.Gid
var localData *game.LocalData
var g *game.Game
if version != "host" {
res, err := cgf.SearchLANForHosts(20007, 20002, 500)
if err != nil || len(res) == 0 {
base.Log().Printf("Unable to connect: %v", err)
base.Error().Fatalf("%v", err.Error())
}
engine, err = cgf.NewClientEngine(17, res[0].Ip, 20007, base.EmailCrashReport, base.Log())
if err != nil {
base.Log().Printf("Unable to connect: %v", err)
base.Error().Fatalf("%v", err.Error())
}
localData = game.NewLocalDataArchitect(engine, sys)
g = engine.GetState().(*game.Game)
for _, ent := range g.Ents {
if _, ok := ent.(*game.PlayerEnt); ok {
players = append(players, ent.Id())
}
}
} else {
sys.Think()
g = game.MakeGame()
if version == "host" {
engine, err = cgf.NewHostEngine(g, 17, "", 20007, base.EmailCrashReport, base.Log())
if err != nil {
panic(err)
}
err = cgf.Host(20007, "thunderball")
if err != nil {
panic(err)
}
} else {
engine, err = cgf.NewLocalEngine(g, 17, base.EmailCrashReport, base.Log())
}
if err != nil {
base.Error().Fatalf("%v", err.Error())
}
}
localData = game.NewLocalDataMoba(engine, gin.DeviceIndexAny, sys)
// localData = game.NewLocalDataInvaders(engine, sys)
// Hook the players up regardless of in we're architect or not, since we can
// switch between the two in debug mode.
// d := sys.GetActiveDevices()
// n := 0
// for _, index := range d[gin.DeviceTypeController] {
// localData.SetLocalPlayer(g.Ents[players[n]], index)
// n++
// if n > len(players) {
// break
// }
// }
// if len(d[gin.DeviceTypeController]) == 0 {
// localData.SetLocalPlayer(g.Ents[players[0]], 0)
// }
base.Log().Printf("Engine Id: %v", engine.Id())
base.Log().Printf("All Ids: %v", engine.Ids())
return engine, localData
}