示例#1
0
func (ls *Logic) ConnectFromIni(c *iniconfig.ConfigFile) {
	gts.Trace("connect from ini")
	//make some connection to game server
	for i := 1; i < 50; i++ {
		section := "Agent" + strconv.Itoa(i)
		if !c.HasSection(section) {
			continue
		}

		enabled, err := c.GetBool(section, "enabled")
		if err == nil && !enabled {
			continue
		}

		/*
		   serverId, err := c.GetInt(section, "serverId")
		   if err != nil {
		       gts.Error(err.Error())
		       continue
		   }

		   gname, err := c.GetString(section, "name")
		   if err != nil {
		       gts.Error(err.Error())
		       continue
		   }
		*/

		tcpAddr, err := c.GetString(section, "tcpAddr")
		if err != nil {
			gts.Error(err.Error())
			continue
		}

		ls.ConnectAgent(tcpAddr)
	}
}