Ejemplo n.º 1
0
        public static WeaponScanStruct Explicit(PlayerWeaponData weaponData)
        {
            WeaponScanStruct scan = new WeaponScanStruct();

            scan.ConfigId = weaponData.WeaponTplId;

            scan.AvatarId  = weaponData.WeaponAvatarTplId;
            scan.Muzzle    = weaponData.Muzzle;
            scan.Stock     = weaponData.Stock;
            scan.Magazine  = weaponData.Magazine;
            scan.UpperRail = weaponData.UpperRail;
            scan.LowerRail = weaponData.LowerRail;
            return(scan);
        }
Ejemplo n.º 2
0
        public static WeaponScanStruct Explicit(PlayerWeaponData weaponData)
        {
            WeaponScanStruct scan = new WeaponScanStruct();

            scan.ConfigId = weaponData.WeaponTplId;

            scan.AvatarId  = weaponData.WeaponAvatarTplId;
            scan.Muzzle    = weaponData.Muzzle;
            scan.Stock     = weaponData.Stock;
            scan.Magazine  = weaponData.Magazine;
            scan.UpperRail = weaponData.UpperRail;
            scan.LowerRail = weaponData.LowerRail;
            scan.SideRail  = weaponData.SideRail;
            scan.Bore      = weaponData.Bore;
            scan.Feed      = weaponData.Feed;
            scan.Trigger   = weaponData.Trigger;
            scan.Interlock = weaponData.Interlock;
            scan.Brake     = weaponData.Brake;
            return(scan);
        }
Ejemplo n.º 3
0
        private PlayerInfo AddPlayerToRoom(RoomPlayer roomPlayer)
        {
            string token = tokenGenerator.GenerateToken(roomPlayer.Id);

            int[] avatarIds       = RepeatedField2IntArray(roomPlayer.AvatarIds);
            int[] weaponAvatarIds = RepeatedField2IntArray(roomPlayer.WeaponAvatarIds);
            int[] sprayLacquers   = RepeatedField2IntArray(roomPlayer.SprayLacquers);
            int   num             = hallRoom.MaxNum(roomPlayer.TeamId);
            /*JobAttrbute默认人类,其他职业根据模式,在房间里设置*/
            PlayerInfo playerInfo = new PlayerInfo(token, RoomId, roomPlayer.Id, roomPlayer.Name, roomPlayer.RoleModelId, roomPlayer.TeamId, num, roomPlayer.Level,
                                                   roomPlayer.BackId, roomPlayer.TitleId, roomPlayer.BadgeId, avatarIds, weaponAvatarIds, sprayLacquers, false, 0, CampInfoConvert(roomPlayer.CampInfo));

            playerInfo.RankScore     = roomPlayer.RankScore;
            playerInfo.IsKing        = roomPlayer.IsKing;
            playerInfo.CreateTime    = DateTime.Now.Ticks / 10000;
            playerInfo.GameStartTime = (int)DateTime.Now.Ticks / 10000;
            playerInfo.IsLogin       = false;
            playerInfo.Camp          = roomPlayer.Camp;
            if (playerInfo.Camp > 0 && playerInfo.TeamId <= 0)
            {
                playerInfo.TeamId = playerInfo.Camp;
            }
            foreach (var bag in roomPlayer.WeaponBags)
            {
                playerInfo.WeaponBags[bag.BagIndex] = new Core.Room.PlayerWeaponBagData
                {
                    BagIndex   = bag.BagIndex,
                    weaponList = new List <Core.Room.PlayerWeaponData>(bag.WeaponList.Count),
                };
                foreach (var weapon in bag.WeaponList)
                {
                    var weaponData = new Core.Room.PlayerWeaponData
                    {
                        Index             = weapon.Index,
                        WeaponTplId       = weapon.WeaponTplId,
                        WeaponAvatarTplId = weapon.WeaponAvatarTplId,
                    };
                    foreach (var part in weapon.WeaponPartTplId)
                    {
                        var type = SingletonManager.Get <WeaponPartsConfigManager>().GetPartType(part);
                        switch (type)
                        {
                        case XmlConfig.EWeaponPartType.LowerRail:
                            weaponData.LowerRail = part;
                            break;

                        case XmlConfig.EWeaponPartType.Magazine:
                            weaponData.Magazine = part;
                            break;

                        case XmlConfig.EWeaponPartType.Muzzle:
                            weaponData.Muzzle = part;
                            break;

                        case XmlConfig.EWeaponPartType.SideRail:
                            break;

                        case XmlConfig.EWeaponPartType.Stock:
                            weaponData.Stock = part;
                            break;

                        case XmlConfig.EWeaponPartType.UpperRail:
                            weaponData.UpperRail = part;
                            break;
                        }
                    }
                    playerInfo.WeaponBags[bag.BagIndex].weaponList.Add(weaponData);
                }
            }

            hallRoom.AddPlayer(playerInfo);
            return(playerInfo);
        }