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


Golang frontend.Client類代碼示例

本文整理匯總了Golang中github.com/Blackrush/gofus/realm/network/frontend.Client的典型用法代碼示例。如果您正苦於以下問題:Golang Client類的具體用法?Golang Client怎麽用?Golang Client使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Client類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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_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

示例4: HandleClientDisconnection

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

	if client.UserInfos() != nil {
		ctx.Backend().NotifyUserConnection(client.UserInfos().Id, false)
	}
}
開發者ID:Emudofus,項目名稱:gofus,代碼行數:7,代碼來源:handler.go

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。