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


Golang Client.Send方法代码示例

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


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

示例1: handle_client_context_infos

func handle_client_context_infos(ctx frontend.Service, client frontend.Client, m *msg.ContextInfosReq) {
	// todo send current map actors
	client.Send(&msg.SetMapLoaded{})
	client.Send(&msg.SetNumberOfFights{
		Fights: 0,
	})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:7,代码来源:handler.go

示例2: handle_client_create_player

func handle_client_create_player(ctx frontend.Service, client frontend.Client, m *msg.CreatePlayerReq) {
	player := ctx.Players().NewPlayer(uint(client.UserInfos().Id), m.Name, m.Breed, m.Gender, m.Colors.First, m.Colors.Second, m.Colors.Third)

	if inserted, success := ctx.Players().Persist(player); inserted && success {
		client_send_player_list(ctx, client)
	} else {
		client.Send(&msg.CreatePlayerErrorResp{})
	}
}
开发者ID:Emudofus,项目名称:gofus,代码行数:9,代码来源:realm.go

示例3: handle_client_player_selection

func handle_client_player_selection(ctx frontend.Service, client frontend.Client, m *msg.PlayerSelectionReq) {
	player, ok := ctx.Players().GetById(m.PlayerId)
	if !ok {
		client.CloseWith(&msg.PlayerSelectionErrorResp{})
		return
	}

	client.SetPlayer(player)
	client.Send(&msg.PlayerSelectionResp{player})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:10,代码来源:realm.go

示例4: handle_client_login

func handle_client_login(ctx frontend.Service, client frontend.Client, m *msg.RealmLoginReq) {
	if infos, ok := ctx.Backend().GetUserInfos(m.Ticket); ok {
		client.SetUserInfos(*infos)
		ctx.Backend().NotifyUserConnection(infos.Id, true)

		client.Send(&msg.RealmLoginSuccess{ctx.Config().CommunityId})
	} else {
		client.CloseWith(&msg.RealmLoginError{})
	}
}
开发者ID:Emudofus,项目名称:gofus,代码行数:10,代码来源:realm.go

示例5: client_send_player_list

func client_send_player_list(ctx frontend.Service, client frontend.Client) {
	var players []*db.Player
	var ok bool
	if players, ok = ctx.Players().GetByOwnerId(uint(client.UserInfos().Id)); !ok {
		players = make([]*db.Player, 0, 0)
	}

	client.Send(&msg.PlayersResp{
		ServerId:        ctx.Config().ServerId,
		SubscriptionEnd: client.UserInfos().SubscriptionEnd,
		Players:         players,
	})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:13,代码来源:realm.go

示例6: handle_client_game_context_create

func handle_client_game_context_create(ctx frontend.Service, client frontend.Client, m *msg.GameContextCreateReq) {
	switch m.Type {
	case msg.SoloContextType:
		client.Send(&msg.GameContextCreateResp{msg.SoloContextType})

		p := client.Player()
		client.Send(&msg.SetPlayerStats{
			Experience:            p.Experience.Experience,
			LowerExperienceLevel:  0,
			HigherExperienceLevel: 1,

			Kamas: 0,

			BoostStatsPts:  0,
			BoostSpellsPts: 0,

			AlignId:    0,
			AlignLevel: 0,
			AlignGrade: 0,
			Honor:      0,
			Dishonor:   0,
			EnabledPvp: false,

			Life:    0,
			MaxLife: 1,

			Energy:    0,
			MaxEnergy: 1,

			Stats: p.Stats,
		})

		m := client.Player().Position.Map
		client.Send(&msg.SetCurrentMapData{
			Id:   m.Id,
			Date: m.Date,
			Key:  m.Key,
		})

	case msg.FightContextType:
		fallthrough
	default:
		log.Print("context type %d is not implemented yet", m.Type)
	}
}
开发者ID:Emudofus,项目名称:gofus,代码行数:45,代码来源:handler.go

示例7: handle_client_current_date

func handle_client_current_date(ctx frontend.Service, client frontend.Client, m *msg.CurrentDateReq) {
	client.Send(&msg.CurrentDateResp{
		Current: time.Now(),
	})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:5,代码来源:handler.go

示例8: HandleClientConnection

func HandleClientConnection(ctx frontend.Service, client frontend.Client) {
	log.Printf("[frontend-net-client-%04d] CONN", client.Id())

	client.Send(&msg.HelloGame{})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:5,代码来源:handler.go

示例9: handle_client_rand_name

func handle_client_rand_name(ctx frontend.Service, client frontend.Client, m *msg.RandNameReq) {
	client.Send(&msg.RandNameResp{Name: "Gofus"})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:3,代码来源:realm.go

示例10: handle_client_regional_version

func handle_client_regional_version(ctx frontend.Service, client frontend.Client, m *msg.RegionalVersionReq) {
	client.Send(&msg.RegionalVersionResp{ctx.Config().CommunityId})
}
开发者ID:Emudofus,项目名称:gofus,代码行数:3,代码来源:realm.go


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