1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- namespace ET.Server
- {
- /// <summary>
- /// 玩家工具类
- /// </summary>
- public static class PlayerHelper
- {
- /// <summary>
- /// 玩家基础信息转proto
- /// </summary>
- /// <param name="playerInfo"></param>
- /// <returns></returns>
- public static PlayerBasic PlayerInfoToPlayerBasicProto(PlayerInfo playerInfo)
- {
- return new PlayerBasic()
- {
- id = playerInfo.Id.ToString(),
- uid = playerInfo.UserId.ToString(),
- name = playerInfo.Name,
- level = playerInfo.Level,
- exp = playerInfo.Exp,
- };
- }
- /// <summary>
- /// 玩家信息转proto
- /// </summary>
- /// <param name="player"></param>
- /// <returns></returns>
- public static Player PlayerInfoToProto(WNPlayer player)
- {
- return new Player()
- {
- id = player.GetId().ToString(),
- uid = player.GetUserId().ToString(),
- name = player.GetName(),
- level = player.GetLevel(),
- exp = player.GetExp(),
- vip = 0,
- hp = 1000,
- mp = 0,
- fightPower = 5,
- gold = player.GetGold(),
- diamond = 77,
- energy = 0,
- };
- }
- }
- }
|