feat: 添加数据记录|排行榜,优化项目结构
parent
ddbb363898
commit
c256f6b3df
@ -0,0 +1,34 @@
|
||||
Server:
|
||||
Debug: false
|
||||
Listen: 0.0.0.0:8888
|
||||
Command:
|
||||
Keys: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
|
||||
UserCenterRpc:
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
Key: usercenter.rpc.dev
|
||||
Kafka:
|
||||
Danmaku:
|
||||
Addr: [ "127.0.0.1:9093" ]
|
||||
Topic: "danmaku"
|
||||
Gift:
|
||||
Addr: [ "127.0.0.1:9093" ]
|
||||
Topic: "gift"
|
||||
ConsumerGroupId:
|
||||
GiftToPush: "giftToPush-Dev"
|
||||
MsgToPush: "msgToPush-Dev"
|
||||
Log:
|
||||
Console:
|
||||
Level: debug
|
||||
Format: console
|
||||
File:
|
||||
Enabled: false
|
||||
Level: info
|
||||
Format: json
|
||||
Path: ./logs
|
||||
Filename: dcg.log
|
||||
FileMaxSize: 10 # 10mb
|
||||
FileMaxBackups: 30 #
|
||||
MaxAge: 7 # 保留7天
|
||||
Compress: true # 压缩日志
|
@ -0,0 +1,52 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"dcg/game/logic/rank"
|
||||
"dcg/game/logic/room"
|
||||
"dcg/game/logic/statistics"
|
||||
"dcg/game/svc"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var GameLogic *Logics
|
||||
|
||||
type Logics struct {
|
||||
Services *component.Components
|
||||
|
||||
RoomManager *room.Manager
|
||||
StatisticsPvP *statistics.PvP
|
||||
Rank *rank.Rank
|
||||
}
|
||||
|
||||
func Init(svcCtx *svc.ServiceContext) {
|
||||
services := &component.Components{}
|
||||
|
||||
roomManager := room.NewRoomManager()
|
||||
services.Register(roomManager,
|
||||
component.WithName(roomManager.CMD()),
|
||||
component.WithNameFunc(func(s string) string {
|
||||
return strings.ToLower(s)
|
||||
}))
|
||||
|
||||
statisticsPvP := statistics.NewStatisticsPvP(svcCtx)
|
||||
services.Register(statisticsPvP,
|
||||
component.WithName(statisticsPvP.CMD()),
|
||||
component.WithNameFunc(func(s string) string {
|
||||
return statisticsPvP.Prefix() + "." + strings.ToLower(s)
|
||||
}))
|
||||
|
||||
rk := rank.NewRank(svcCtx)
|
||||
services.Register(rk,
|
||||
component.WithName(rk.CMD()),
|
||||
component.WithNameFunc(func(s string) string {
|
||||
return strings.ToLower(s)
|
||||
}))
|
||||
|
||||
GameLogic = &Logics{
|
||||
Services: services,
|
||||
RoomManager: roomManager,
|
||||
StatisticsPvP: statisticsPvP,
|
||||
Rank: rk,
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package rank
|
||||
|
||||
import (
|
||||
"dcg/app/user_center/usercenter"
|
||||
pbRank "dcg/game/pb/rank"
|
||||
"dcg/game/svc"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"git.noahlan.cn/northlan/ngs/session"
|
||||
)
|
||||
|
||||
type Rank struct {
|
||||
component.Base
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewRank(svcCtx *svc.ServiceContext) *Rank {
|
||||
return &Rank{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Rank) Init() {
|
||||
}
|
||||
|
||||
func (p *Rank) Shutdown() {
|
||||
}
|
||||
|
||||
func (p *Rank) CMD() string {
|
||||
return "rank"
|
||||
}
|
||||
|
||||
func (p *Rank) Prefix() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Pvp pvp排行榜获取
|
||||
func (p *Rank) Pvp(s *session.Session, msg *pbRank.RankPvpReq) error {
|
||||
result, err := p.svcCtx.UserCenterRpc.RankPvp(p.svcCtx.Ctx, &usercenter.RankPvpReq{
|
||||
Type: msg.Type,
|
||||
TopN: msg.TopN,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
items := make([]*pbRank.RankPvpResp_Item, 0, len(result.Items))
|
||||
for _, item := range result.Items {
|
||||
items = append(items, &pbRank.RankPvpResp_Item{
|
||||
Uid: item.Uid,
|
||||
Uname: item.Uname,
|
||||
Score: item.Score,
|
||||
Avatar: item.Avatar,
|
||||
})
|
||||
}
|
||||
return s.Response(&pbRank.RankPvpResp{
|
||||
Type: result.Type,
|
||||
Items: items,
|
||||
})
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package statistics
|
||||
|
||||
import (
|
||||
"dcg/app/user_center/usercenter"
|
||||
pbStat "dcg/game/pb/stat"
|
||||
"dcg/game/svc"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"git.noahlan.cn/northlan/ngs/session"
|
||||
)
|
||||
|
||||
type PvP struct {
|
||||
component.Base
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewStatisticsPvP(svcCtx *svc.ServiceContext) *PvP {
|
||||
return &PvP{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PvP) CMD() string {
|
||||
return "statistics"
|
||||
}
|
||||
|
||||
func (p *PvP) Prefix() string {
|
||||
return "pvp"
|
||||
}
|
||||
|
||||
func (p *PvP) Init() {
|
||||
}
|
||||
|
||||
func (p *PvP) Shutdown() {
|
||||
}
|
||||
|
||||
// Damage 伤害记录
|
||||
func (p *PvP) Damage(s *session.Session, msg *pbStat.StatPvPDamage) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.StatPvpDamage(p.svcCtx.Ctx, &usercenter.StatPvPDamageReq{
|
||||
Uid: msg.Uid,
|
||||
TargetUid: msg.TargetUid,
|
||||
Damage: msg.Damage,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// KillUnit 击杀单位
|
||||
func (p *PvP) KillUnit(s *session.Session, msg *pbStat.StatPvPKillUnit) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.StatPvpKillUnit(p.svcCtx.Ctx, &usercenter.StatPvPKillUnitReq{
|
||||
Uid: msg.Uid,
|
||||
TargetUid: msg.TargetUid,
|
||||
Attacker: msg.Attacker,
|
||||
Victim: msg.Victim,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Kill 击杀玩家
|
||||
func (p *PvP) Kill(s *session.Session, msg *pbStat.StatPvPKill) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.StatPvpKill(p.svcCtx.Ctx, &usercenter.StatPvPKillReq{
|
||||
Uid: msg.Uid,
|
||||
TargetUid: msg.TargetUid,
|
||||
IsGeneral: msg.IsGeneral,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// First 一血
|
||||
func (p *PvP) First(s *session.Session, msg *pbStat.StatPvPFirstBlood) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.StatPvpFirstBlood(p.svcCtx.Ctx, &usercenter.StatPvPFirstBloodReq{
|
||||
Uid: msg.Uid,
|
||||
Type: msg.Type,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Report 战报
|
||||
func (p *PvP) Report(s *session.Session, msg *pbStat.StatPvPReport) error {
|
||||
_, err := p.svcCtx.UserCenterRpc.StatPvpReport(p.svcCtx.Ctx, &usercenter.StatPvPReportReq{
|
||||
WinCamp: msg.WinCamp,
|
||||
GeneralUid: msg.GeneralUid,
|
||||
WinUids: msg.WinUids,
|
||||
LostUids: msg.LostUids,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pb;
|
||||
|
||||
option go_package = "/pbNotify";
|
||||
|
||||
// 通知-PvP伤害
|
||||
message NotifyPvPDamage {
|
||||
int64 uid = 1; // 造成伤害的用户ID
|
||||
int64 targetUid = 2; // 目标用户ID
|
||||
float damage = 3; // 造成的伤害量
|
||||
int32 type = 4; // 造成伤害类型 1-兵种造成伤害 2-技能伤害
|
||||
string unit = 5; // 造成伤害的兵种
|
||||
string skill = 6; // 造成伤害的技能
|
||||
}
|
||||
|
||||
// 通知-PvP击杀单位
|
||||
message NotifyPvPKillUnit {
|
||||
int64 uid = 1; // 用户ID
|
||||
int64 targetUid = 2; // 目标用户
|
||||
string unit = 3; // 击杀单位种类 player:玩家 U0001-xx兵
|
||||
}
|
||||
|
||||
message NotifyPvPKill {
|
||||
int64 uid = 1; // 用户ID
|
||||
int64 targetUid = 2; // 目标用户
|
||||
}
|
||||
|
||||
// 通知-PvP一血
|
||||
message NotifyPvPFirstBlood {
|
||||
int64 uid = 1; // 用户ID
|
||||
int32 type = 2; // 1-拿到一血 2-被破一血
|
||||
}
|
||||
|
||||
// 通知-PvP战报
|
||||
message NotifyPvPReport {
|
||||
message Report {
|
||||
int64 uid = 1; // 用户ID
|
||||
string uname = 2; // 用户名
|
||||
int64 score = 3; // 分数
|
||||
int64 damage = 4; // 伤害
|
||||
}
|
||||
int32 winCamp = 1; // 获胜阵营 1-蓝 2-红
|
||||
repeated Report winReport = 2; // 战胜方上榜数据
|
||||
repeated Report lostReport = 3; // 战败方上榜数据
|
||||
}
|
@ -0,0 +1,827 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: rank.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021
|
||||
#region Designer generated code
|
||||
|
||||
using pb = global::Google.Protobuf;
|
||||
using pbc = global::Google.Protobuf.Collections;
|
||||
using pbr = global::Google.Protobuf.Reflection;
|
||||
using scg = global::System.Collections.Generic;
|
||||
namespace PbClient {
|
||||
|
||||
/// <summary>Holder for reflection information generated from rank.proto</summary>
|
||||
public static partial class RankReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for rank.proto</summary>
|
||||
public static pbr::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbr::FileDescriptor descriptor;
|
||||
|
||||
static RankReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CgpyYW5rLnByb3RvEghwYkNsaWVudCIoCgpSYW5rUHZwUmVxEgwKBHR5cGUY",
|
||||
"ASABKAUSDAoEdG9wThgCIAEoBSKJAQoLUmFua1B2cFJlc3ASDAoEdHlwZRgB",
|
||||
"IAEoBRIpCgVpdGVtcxgCIAMoCzIaLnBiQ2xpZW50LlJhbmtQdnBSZXNwLkl0",
|
||||
"ZW0aQQoESXRlbRILCgN1aWQYASABKAMSDQoFdW5hbWUYAiABKAkSDQoFc2Nv",
|
||||
"cmUYAyABKAMSDgoGYXZhdGFyGAQgASgJKk4KCFJhbmtUeXBlEgsKB1Vua25v",
|
||||
"d24QABIKCgZEYW1hZ2UQARILCgdHZW5lcmFsEAISDAoIS2lsbFVuaXQQAxIO",
|
||||
"CgpLaWxsUGxheWVyEARCCVoHL3BiUmFua2IGcHJvdG8z"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::PbClient.RankType), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::PbClient.RankPvpReq), global::PbClient.RankPvpReq.Parser, new[]{ "Type", "TopN" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::PbClient.RankPvpResp), global::PbClient.RankPvpResp.Parser, new[]{ "Type", "Items" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::PbClient.RankPvpResp.Types.Item), global::PbClient.RankPvpResp.Types.Item.Parser, new[]{ "Uid", "Uname", "Score", "Avatar" }, null, null, null, null)})
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Enums
|
||||
public enum RankType {
|
||||
[pbr::OriginalName("Unknown")] Unknown = 0,
|
||||
[pbr::OriginalName("Damage")] Damage = 1,
|
||||
[pbr::OriginalName("General")] General = 2,
|
||||
[pbr::OriginalName("KillUnit")] KillUnit = 3,
|
||||
[pbr::OriginalName("KillPlayer")] KillPlayer = 4,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Messages
|
||||
/// <summary>
|
||||
/// RankPvpReq 获取排行榜 request > rank.pvp
|
||||
/// </summary>
|
||||
public sealed partial class RankPvpReq : pb::IMessage<RankPvpReq>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<RankPvpReq> _parser = new pb::MessageParser<RankPvpReq>(() => new RankPvpReq());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<RankPvpReq> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::PbClient.RankReflection.Descriptor.MessageTypes[0]; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
pbr::MessageDescriptor pb::IMessage.Descriptor {
|
||||
get { return Descriptor; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpReq() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpReq(RankPvpReq other) : this() {
|
||||
type_ = other.type_;
|
||||
topN_ = other.topN_;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpReq Clone() {
|
||||
return new RankPvpReq(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "type" field.</summary>
|
||||
public const int TypeFieldNumber = 1;
|
||||
private int type_;
|
||||
/// <summary>
|
||||
/// rank类型
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int Type {
|
||||
get { return type_; }
|
||||
set {
|
||||
type_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "topN" field.</summary>
|
||||
public const int TopNFieldNumber = 2;
|
||||
private int topN_;
|
||||
/// <summary>
|
||||
/// TopN
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int TopN {
|
||||
get { return topN_; }
|
||||
set {
|
||||
topN_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as RankPvpReq);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(RankPvpReq other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Type != other.Type) return false;
|
||||
if (TopN != other.TopN) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override int GetHashCode() {
|
||||
int hash = 1;
|
||||
if (Type != 0) hash ^= Type.GetHashCode();
|
||||
if (TopN != 0) hash ^= TopN.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override string ToString() {
|
||||
return pb::JsonFormatter.ToDiagnosticString(this);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void WriteTo(pb::CodedOutputStream output) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
output.WriteRawMessage(this);
|
||||
#else
|
||||
if (Type != 0) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt32(Type);
|
||||
}
|
||||
if (TopN != 0) {
|
||||
output.WriteRawTag(16);
|
||||
output.WriteInt32(TopN);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(output);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
|
||||
if (Type != 0) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt32(Type);
|
||||
}
|
||||
if (TopN != 0) {
|
||||
output.WriteRawTag(16);
|
||||
output.WriteInt32(TopN);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(ref output);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int CalculateSize() {
|
||||
int size = 0;
|
||||
if (Type != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type);
|
||||
}
|
||||
if (TopN != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(TopN);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(RankPvpReq other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.Type != 0) {
|
||||
Type = other.Type;
|
||||
}
|
||||
if (other.TopN != 0) {
|
||||
TopN = other.TopN;
|
||||
}
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(pb::CodedInputStream input) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
input.ReadRawMessage(this);
|
||||
#else
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 8: {
|
||||
Type = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
TopN = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 8: {
|
||||
Type = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
TopN = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RankPvpResp 排行榜数据 response > rank.pvp
|
||||
/// </summary>
|
||||
public sealed partial class RankPvpResp : pb::IMessage<RankPvpResp>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<RankPvpResp> _parser = new pb::MessageParser<RankPvpResp>(() => new RankPvpResp());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<RankPvpResp> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::PbClient.RankReflection.Descriptor.MessageTypes[1]; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
pbr::MessageDescriptor pb::IMessage.Descriptor {
|
||||
get { return Descriptor; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpResp() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpResp(RankPvpResp other) : this() {
|
||||
type_ = other.type_;
|
||||
items_ = other.items_.Clone();
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public RankPvpResp Clone() {
|
||||
return new RankPvpResp(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "type" field.</summary>
|
||||
public const int TypeFieldNumber = 1;
|
||||
private int type_;
|
||||
/// <summary>
|
||||
/// rank类型
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int Type {
|
||||
get { return type_; }
|
||||
set {
|
||||
type_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "items" field.</summary>
|
||||
public const int ItemsFieldNumber = 2;
|
||||
private static readonly pb::FieldCodec<global::PbClient.RankPvpResp.Types.Item> _repeated_items_codec
|
||||
= pb::FieldCodec.ForMessage(18, global::PbClient.RankPvpResp.Types.Item.Parser);
|
||||
private readonly pbc::RepeatedField<global::PbClient.RankPvpResp.Types.Item> items_ = new pbc::RepeatedField<global::PbClient.RankPvpResp.Types.Item>();
|
||||
/// <summary>
|
||||
/// rank数据
|
||||
/// </summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public pbc::RepeatedField<global::PbClient.RankPvpResp.Types.Item> Items {
|
||||
get { return items_; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as RankPvpResp);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(RankPvpResp other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Type != other.Type) return false;
|
||||
if(!items_.Equals(other.items_)) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override int GetHashCode() {
|
||||
int hash = 1;
|
||||
if (Type != 0) hash ^= Type.GetHashCode();
|
||||
hash ^= items_.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override string ToString() {
|
||||
return pb::JsonFormatter.ToDiagnosticString(this);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void WriteTo(pb::CodedOutputStream output) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
output.WriteRawMessage(this);
|
||||
#else
|
||||
if (Type != 0) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt32(Type);
|
||||
}
|
||||
items_.WriteTo(output, _repeated_items_codec);
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(output);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
|
||||
if (Type != 0) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt32(Type);
|
||||
}
|
||||
items_.WriteTo(ref output, _repeated_items_codec);
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(ref output);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int CalculateSize() {
|
||||
int size = 0;
|
||||
if (Type != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type);
|
||||
}
|
||||
size += items_.CalculateSize(_repeated_items_codec);
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(RankPvpResp other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.Type != 0) {
|
||||
Type = other.Type;
|
||||
}
|
||||
items_.Add(other.items_);
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(pb::CodedInputStream input) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
input.ReadRawMessage(this);
|
||||
#else
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 8: {
|
||||
Type = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
items_.AddEntriesFrom(input, _repeated_items_codec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 8: {
|
||||
Type = input.ReadInt32();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
items_.AddEntriesFrom(ref input, _repeated_items_codec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Nested types
|
||||
/// <summary>Container for nested types declared in the RankPvpResp message type.</summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static partial class Types {
|
||||
public sealed partial class Item : pb::IMessage<Item>
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
, pb::IBufferMessage
|
||||
#endif
|
||||
{
|
||||
private static readonly pb::MessageParser<Item> _parser = new pb::MessageParser<Item>(() => new Item());
|
||||
private pb::UnknownFieldSet _unknownFields;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pb::MessageParser<Item> Parser { get { return _parser; } }
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public static pbr::MessageDescriptor Descriptor {
|
||||
get { return global::PbClient.RankPvpResp.Descriptor.NestedTypes[0]; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
pbr::MessageDescriptor pb::IMessage.Descriptor {
|
||||
get { return Descriptor; }
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Item() {
|
||||
OnConstruction();
|
||||
}
|
||||
|
||||
partial void OnConstruction();
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Item(Item other) : this() {
|
||||
uid_ = other.uid_;
|
||||
uname_ = other.uname_;
|
||||
score_ = other.score_;
|
||||
avatar_ = other.avatar_;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Item Clone() {
|
||||
return new Item(this);
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "uid" field.</summary>
|
||||
public const int UidFieldNumber = 1;
|
||||
private long uid_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public long Uid {
|
||||
get { return uid_; }
|
||||
set {
|
||||
uid_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "uname" field.</summary>
|
||||
public const int UnameFieldNumber = 2;
|
||||
private string uname_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Uname {
|
||||
get { return uname_; }
|
||||
set {
|
||||
uname_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "score" field.</summary>
|
||||
public const int ScoreFieldNumber = 3;
|
||||
private long score_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public long Score {
|
||||
get { return score_; }
|
||||
set {
|
||||
score_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "avatar" field.</summary>
|
||||
public const int AvatarFieldNumber = 4;
|
||||
private string avatar_ = "";
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string Avatar {
|
||||
get { return avatar_; }
|
||||
set {
|
||||
avatar_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override bool Equals(object other) {
|
||||
return Equals(other as Item);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool Equals(Item other) {
|
||||
if (ReferenceEquals(other, null)) {
|
||||
return false;
|
||||
}
|
||||
if (ReferenceEquals(other, this)) {
|
||||
return true;
|
||||
}
|
||||
if (Uid != other.Uid) return false;
|
||||
if (Uname != other.Uname) return false;
|
||||
if (Score != other.Score) return false;
|
||||
if (Avatar != other.Avatar) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override int GetHashCode() {
|
||||
int hash = 1;
|
||||
if (Uid != 0L) hash ^= Uid.GetHashCode();
|
||||
if (Uname.Length != 0) hash ^= Uname.GetHashCode();
|
||||
if (Score != 0L) hash ^= Score.GetHashCode();
|
||||
if (Avatar.Length != 0) hash ^= Avatar.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public override string ToString() {
|
||||
return pb::JsonFormatter.ToDiagnosticString(this);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void WriteTo(pb::CodedOutputStream output) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
output.WriteRawMessage(this);
|
||||
#else
|
||||
if (Uid != 0L) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt64(Uid);
|
||||
}
|
||||
if (Uname.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Uname);
|
||||
}
|
||||
if (Score != 0L) {
|
||||
output.WriteRawTag(24);
|
||||
output.WriteInt64(Score);
|
||||
}
|
||||
if (Avatar.Length != 0) {
|
||||
output.WriteRawTag(34);
|
||||
output.WriteString(Avatar);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(output);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
|
||||
if (Uid != 0L) {
|
||||
output.WriteRawTag(8);
|
||||
output.WriteInt64(Uid);
|
||||
}
|
||||
if (Uname.Length != 0) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(Uname);
|
||||
}
|
||||
if (Score != 0L) {
|
||||
output.WriteRawTag(24);
|
||||
output.WriteInt64(Score);
|
||||
}
|
||||
if (Avatar.Length != 0) {
|
||||
output.WriteRawTag(34);
|
||||
output.WriteString(Avatar);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
_unknownFields.WriteTo(ref output);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public int CalculateSize() {
|
||||
int size = 0;
|
||||
if (Uid != 0L) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Uid);
|
||||
}
|
||||
if (Uname.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Uname);
|
||||
}
|
||||
if (Score != 0L) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Score);
|
||||
}
|
||||
if (Avatar.Length != 0) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Avatar);
|
||||
}
|
||||
if (_unknownFields != null) {
|
||||
size += _unknownFields.CalculateSize();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(Item other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
if (other.Uid != 0L) {
|
||||
Uid = other.Uid;
|
||||
}
|
||||
if (other.Uname.Length != 0) {
|
||||
Uname = other.Uname;
|
||||
}
|
||||
if (other.Score != 0L) {
|
||||
Score = other.Score;
|
||||
}
|
||||
if (other.Avatar.Length != 0) {
|
||||
Avatar = other.Avatar;
|
||||
}
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void MergeFrom(pb::CodedInputStream input) {
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
input.ReadRawMessage(this);
|
||||
#else
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||
break;
|
||||
case 8: {
|
||||
Uid = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Uname = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
Score = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
Avatar = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
|
||||
uint tag;
|
||||
while ((tag = input.ReadTag()) != 0) {
|
||||
switch(tag) {
|
||||
default:
|
||||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
|
||||
break;
|
||||
case 8: {
|
||||
Uid = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
Uname = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
Score = input.ReadInt64();
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
Avatar = input.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion Designer generated code
|
@ -0,0 +1,2 @@
|
||||
protoc --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --go-grpc_opt=require_unimplemented_servers=false --go_out=. --go-grpc_out=. --proto_path=. *.proto
|
||||
protoc --csharp_out=. --proto_path=. *.proto
|
@ -0,0 +1,380 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.4
|
||||
// source: rank.proto
|
||||
|
||||
package pbRank
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type RankType int32
|
||||
|
||||
const (
|
||||
RankType_Unknown RankType = 0
|
||||
RankType_Damage RankType = 1
|
||||
RankType_General RankType = 2
|
||||
RankType_KillUnit RankType = 3
|
||||
RankType_KillPlayer RankType = 4
|
||||
)
|
||||
|
||||
// Enum value maps for RankType.
|
||||
var (
|
||||
RankType_name = map[int32]string{
|
||||
0: "Unknown",
|
||||
1: "Damage",
|
||||
2: "General",
|
||||
3: "KillUnit",
|
||||
4: "KillPlayer",
|
||||
}
|
||||
RankType_value = map[string]int32{
|
||||
"Unknown": 0,
|
||||
"Damage": 1,
|
||||
"General": 2,
|
||||
"KillUnit": 3,
|
||||
"KillPlayer": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x RankType) Enum() *RankType {
|
||||
p := new(RankType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x RankType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (RankType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_rank_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (RankType) Type() protoreflect.EnumType {
|
||||
return &file_rank_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x RankType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RankType.Descriptor instead.
|
||||
func (RankType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rank_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
// RankPvpReq 获取排行榜 request > rank.pvp
|
||||
type RankPvpReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型
|
||||
TopN int32 `protobuf:"varint,2,opt,name=topN,proto3" json:"topN,omitempty"` // TopN
|
||||
}
|
||||
|
||||
func (x *RankPvpReq) Reset() {
|
||||
*x = RankPvpReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rank_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RankPvpReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RankPvpReq) ProtoMessage() {}
|
||||
|
||||
func (x *RankPvpReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rank_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RankPvpReq.ProtoReflect.Descriptor instead.
|
||||
func (*RankPvpReq) Descriptor() ([]byte, []int) {
|
||||
return file_rank_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RankPvpReq) GetType() int32 {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RankPvpReq) GetTopN() int32 {
|
||||
if x != nil {
|
||||
return x.TopN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// RankPvpResp 排行榜数据 response > rank.pvp
|
||||
type RankPvpResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` // rank类型
|
||||
Items []*RankPvpResp_Item `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` // rank数据
|
||||
}
|
||||
|
||||
func (x *RankPvpResp) Reset() {
|
||||
*x = RankPvpResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rank_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RankPvpResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RankPvpResp) ProtoMessage() {}
|
||||
|
||||
func (x *RankPvpResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rank_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RankPvpResp.ProtoReflect.Descriptor instead.
|
||||
func (*RankPvpResp) Descriptor() ([]byte, []int) {
|
||||
return file_rank_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RankPvpResp) GetType() int32 {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RankPvpResp) GetItems() []*RankPvpResp_Item {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RankPvpResp_Item struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"`
|
||||
Score int64 `protobuf:"varint,3,opt,name=score,proto3" json:"score,omitempty"`
|
||||
Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) Reset() {
|
||||
*x = RankPvpResp_Item{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rank_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RankPvpResp_Item) ProtoMessage() {}
|
||||
|
||||
func (x *RankPvpResp_Item) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rank_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RankPvpResp_Item.ProtoReflect.Descriptor instead.
|
||||
func (*RankPvpResp_Item) Descriptor() ([]byte, []int) {
|
||||
return file_rank_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) GetUid() int64 {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) GetUname() string {
|
||||
if x != nil {
|
||||
return x.Uname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) GetScore() int64 {
|
||||
if x != nil {
|
||||
return x.Score
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RankPvpResp_Item) GetAvatar() string {
|
||||
if x != nil {
|
||||
return x.Avatar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_rank_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rank_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x62,
|
||||
0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x22, 0x34, 0x0a, 0x0a, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76,
|
||||
0x70, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x6f, 0x70, 0x4e,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x6f, 0x70, 0x4e, 0x22, 0xb1, 0x01, 0x0a,
|
||||
0x0b, 0x52, 0x61, 0x6e, 0x6b, 0x50, 0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
|
||||
0x12, 0x30, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x1a, 0x2e, 0x70, 0x62, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x50,
|
||||
0x76, 0x70, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65,
|
||||
0x6d, 0x73, 0x1a, 0x5c, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74,
|
||||
0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72,
|
||||
0x2a, 0x4e, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07,
|
||||
0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x61, 0x6d,
|
||||
0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c,
|
||||
0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x10, 0x03,
|
||||
0x12, 0x0e, 0x0a, 0x0a, 0x4b, 0x69, 0x6c, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x04,
|
||||
0x42, 0x09, 0x5a, 0x07, 0x2f, 0x70, 0x62, 0x52, 0x61, 0x6e, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_rank_proto_rawDescOnce sync.Once
|
||||
file_rank_proto_rawDescData = file_rank_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_rank_proto_rawDescGZIP() []byte {
|
||||
file_rank_proto_rawDescOnce.Do(func() {
|
||||
file_rank_proto_rawDescData = protoimpl.X.CompressGZIP(file_rank_proto_rawDescData)
|
||||
})
|
||||
return file_rank_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rank_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_rank_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_rank_proto_goTypes = []interface{}{
|
||||
(RankType)(0), // 0: pbClient.RankType
|
||||
(*RankPvpReq)(nil), // 1: pbClient.RankPvpReq
|
||||
(*RankPvpResp)(nil), // 2: pbClient.RankPvpResp
|
||||
(*RankPvpResp_Item)(nil), // 3: pbClient.RankPvpResp.Item
|
||||
}
|
||||
var file_rank_proto_depIdxs = []int32{
|
||||
3, // 0: pbClient.RankPvpResp.items:type_name -> pbClient.RankPvpResp.Item
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_rank_proto_init() }
|
||||
func file_rank_proto_init() {
|
||||
if File_rank_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rank_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RankPvpReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rank_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RankPvpResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rank_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RankPvpResp_Item); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_rank_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_rank_proto_goTypes,
|
||||
DependencyIndexes: file_rank_proto_depIdxs,
|
||||
EnumInfos: file_rank_proto_enumTypes,
|
||||
MessageInfos: file_rank_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rank_proto = out.File
|
||||
file_rank_proto_rawDesc = nil
|
||||
file_rank_proto_goTypes = nil
|
||||
file_rank_proto_depIdxs = nil
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pbClient;
|
||||
|
||||
option go_package = "/pbRank";
|
||||
|
||||
enum RankType {
|
||||
Unknown = 0;
|
||||
Damage = 1;
|
||||
General = 2;
|
||||
KillUnit = 3;
|
||||
KillPlayer = 4;
|
||||
}
|
||||
|
||||
// RankPvpReq 获取排行榜 request > rank.pvp
|
||||
message RankPvpReq {
|
||||
int32 type = 1; // rank类型
|
||||
int32 topN = 2; // TopN
|
||||
}
|
||||
|
||||
// RankPvpResp 排行榜数据 response > rank.pvp
|
||||
message RankPvpResp {
|
||||
message Item {
|
||||
int64 uid = 1;
|
||||
string uname = 2;
|
||||
int64 score = 3;
|
||||
string avatar = 4;
|
||||
}
|
||||
int32 type = 1; // rank类型
|
||||
repeated Item items = 2; // rank数据
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
||||
protoc --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --go-grpc_opt=require_unimplemented_servers=false --go_out=. --go-grpc_out=. --proto_path=. *.proto
|
||||
protoc --csharp_out=. --proto_path=. *.proto
|
@ -1,35 +1,22 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"dcg/app/user_center/usercenter"
|
||||
"dcg/config"
|
||||
"dcg/game/room"
|
||||
"git.noahlan.cn/northlan/ngs/component"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Services *component.Components
|
||||
RoomManager *room.Manager
|
||||
|
||||
Ctx context.Context
|
||||
UserCenterRpc usercenter.UserCenter
|
||||
}
|
||||
|
||||
func NewServiceContext() *ServiceContext {
|
||||
services := &component.Components{}
|
||||
|
||||
roomManager := room.NewRoomManager()
|
||||
services.Register(roomManager,
|
||||
component.WithName("room"),
|
||||
component.WithNameFunc(func(s string) string {
|
||||
return strings.ToLower(s)
|
||||
}))
|
||||
|
||||
return &ServiceContext{
|
||||
Services: services,
|
||||
RoomManager: roomManager,
|
||||
svc := &ServiceContext{
|
||||
Ctx: context.Background(),
|
||||
// rpc
|
||||
UserCenterRpc: usercenter.NewUserCenter(zrpc.MustNewClient(config.Config.UserCenterRpc)),
|
||||
}
|
||||
return svc
|
||||
}
|
||||
|
Loading…
Reference in New Issue