Пример #1
0
 public virtual void OnWeaponPickup(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     if (controller.AudioController != null)
     {
         controller.AudioController.PlaySimpleAudio(EAudioUniqueId.PikcupWeapon);
     }
 }
Пример #2
0
        public int GetReservedBullet(IPlayerWeaponProcessor controller, EBulletCaliber caliber)
        {
            var relatedAmmunition = (controller as PlayerWeaponController).RelatedAmmunition;

            switch (caliber)
            {
            case EBulletCaliber.E12No:
                return(relatedAmmunition.ReservedBullet12);

            case EBulletCaliber.E300Mag:
                return(relatedAmmunition.ReservedBullet300);

            case EBulletCaliber.E45apc:
                return(relatedAmmunition.ReservedBullet45);

            case EBulletCaliber.E50AE:
                return(relatedAmmunition.ReservedBullet50);

            case EBulletCaliber.E556mm:
                return(relatedAmmunition.ReservedBullet556);

            case EBulletCaliber.E762mm:
                return(relatedAmmunition.ReservedBullet762);

            case EBulletCaliber.E9mm:
                return(relatedAmmunition.ReservedBullet9);

            case EBulletCaliber.E57mm:
                return(relatedAmmunition.ReservedBullet57);

            default:
                Logger.ErrorFormat("Illegal caliber {0}", caliber);
                return(0);
            }
        }
Пример #3
0
        public int SetReservedBullet(IPlayerWeaponProcessor controller, EBulletCaliber caliber, int count)
        {
            var relatedAmmunition = (controller as PlayerWeaponController).RelatedAmmunition;

            switch (caliber)
            {
            case EBulletCaliber.E12No:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet12, count));

            case EBulletCaliber.E300Mag:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet300, count));

            case EBulletCaliber.E45apc:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet45, count));

            case EBulletCaliber.E50AE:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet50, count));

            case EBulletCaliber.E556mm:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet556, count));

            case EBulletCaliber.E762mm:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet762, count));

            case EBulletCaliber.E9mm:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet9, count));

            case EBulletCaliber.E57mm:
                return(DoSetReserveBullet(ref relatedAmmunition.ReservedBullet57, count));

            default:
                //Logger.ErrorFormat("Illegal caliber {0}", caliber);
                return(0);
            }
        }
Пример #4
0
        public void OnSwitch(IPlayerWeaponProcessor controller, int weaponId, EInOrOff op)
        {
            var uniqueId = op == EInOrOff.In ? EAudioUniqueId.WeaponIn : EAudioUniqueId.WeaponOff;

            controller.AudioController.StopPullBoltAudio();
            controller.AudioController.PlaySimpleAudio(uniqueId, true);
        }
Пример #5
0
        public int SetReservedBullet(IPlayerWeaponProcessor controller, EWeaponSlotType slot, int count)
        {
            var relatedAmmunition = (controller as PlayerWeaponController).RelatedAmmunition;

            var caliber = GetCaliber(controller as PlayerWeaponController, slot);

            return(SetReservedBullet(controller, caliber, count));
        }
 public override void SendPickup(IPlayerWeaponProcessor weaponProcessor, int entityId, int itemId, int category, int count)
 {
     _userCmdGenerator.SetUserCmd((cmd) =>
     {
         cmd.IsManualPickUp    = true;
         cmd.ManualPickUpEquip = entityId;
     });
 }
Пример #7
0
        private void GenerateBagWeaponByIndex(PlayerWeaponBagData srcBagData, IPlayerWeaponProcessor controller, List <int> reservedSubType)
        {
            var removedList = new List <EWeaponSlotType>();

            for (EWeaponSlotType j = EWeaponSlotType.None + 1; j < EWeaponSlotType.Length; j++)
            {
                removedList.Add(j);
            }
            controller.GrenadeHandler.ClearCache();
            foreach (PlayerWeaponData weapon in srcBagData.weaponList)
            {
                Logger.InfoFormat("[[[[[ServerInitialize data]]]]] BagIndex:{0}|In:{1}", srcBagData.BagIndex, weapon.ToString());
                var  weaponAllConfig = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(weapon.WeaponTplId);
                bool needReserved    = true;
                if (null != reservedSubType && reservedSubType.Count != 0)
                {
                    if (weaponAllConfig.NewWeaponCfg.Type == (int)EWeaponType_Config.ThrowWeapon)
                    {
                        needReserved = reservedSubType.Contains((int)EWeaponSubType.Throw);
                    }
                    else
                    {
                        needReserved = reservedSubType.Contains(weaponAllConfig.NewWeaponCfg.SubType);
                    }
                }
                if (!needReserved)
                {
                    continue;
                }

                var slot = PlayerWeaponBagData.Index2Slot(weapon.Index);

                var weaponType = (EWeaponType_Config)weaponAllConfig.NewWeaponCfg.Type;
                if (weaponType != EWeaponType_Config.ThrowWeapon)
                {
                    var orient = WeaponUtil.CreateScan(weapon);
                    orient.Bullet         = weaponAllConfig.PropertyCfg.Bullet;
                    orient.ReservedBullet = weaponAllConfig.PropertyCfg.Bulletmax;
                    if (orient.Magazine > 0)
                    {
                        orient.Bullet += SingletonManager.Get <WeaponPartsConfigManager>().GetConfigById(orient.Magazine).Bullet;
                    }
                    controller.ReplaceWeaponToSlot(slot, srcBagData.BagIndex, orient);
                }
                else
                {
                    controller.GrenadeHandler.AddCache(weapon.WeaponTplId);
                }
                removedList.Remove(slot);
            }
            foreach (var i in removedList)
            {
                controller.DestroyWeapon(i, 0);
            }
        }
Пример #8
0
 public override void OnExpend(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     base.OnExpend(controller, slot);
     if (!slot.IsSlotChangeByCost())
     {
         return;
     }
     if (Logger.IsDebugEnabled)
     {
         Logger.DebugFormat("{0} OnExpend", controller.Owner);
     }
     controller.BagLockState = true;
 }
Пример #9
0
        public void OnExpend(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
        {
            //TODO:音频播放
            //GameAudioMedium.PlayWeaponAudio(controller., RelatedAppearence.WeaponHandObject(), (item) => item.Fire);

            if (!slot.IsSlotChangeByCost())
            {
                return;
            }
            if (Logger.IsDebugEnabled)
            {
                Logger.DebugFormat("{0} OnExpend", controller.Owner);
            }
            controller.BagLockState = true;
        }
Пример #10
0
        public virtual void OnExpend(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
        {
            AudioGrp_ShotMode shotMode;

            if (controller.HeldWeaponAgent.HasSilencerPart)
            {
                shotMode = AudioGrp_ShotMode.Silencer;
            }
            else
            {
                shotMode = ((EFireMode)controller.HeldWeaponAgent.BaseComponent.RealFireModel).ToAudioGrpShotMode();
            }

            controller.AudioController.PlayFireAudio(controller.HeldConfigId, shotMode);
        }
Пример #11
0
 private void GenerateGrenadeList(List <PlayerWeaponBagData> sortedList, IPlayerWeaponProcessor processor)
 {
     processor.GrenadeHandler.ClearCache();
     foreach (var value in sortedList)
     {
         foreach (var weapon in value.weaponList)
         {
             var slot = PlayerWeaponBagData.Index2Slot(weapon.Index);
             if (slot == EWeaponSlotType.ThrowingWeapon)
             {
                 processor.GrenadeHandler.AddCache(weapon.WeaponTplId);
             }
         }
     }
 }
Пример #12
0
        public void OnItemPickup(IPlayerWeaponProcessor controller, int itemId, int category, int count)
        {
            switch ((ECategory)category)
            {
            case ECategory.Weapon:
                break;

            default:
                var audioUniqueId = AudioUtil.ToAudioUniqueId((ECategory)category, itemId);
                if (audioUniqueId != EAudioUniqueId.None && controller.AudioController != null)
                {
                    controller.AudioController.PlaySimpleAudio(audioUniqueId, true);
                }
                break;
            }
        }
Пример #13
0
        public override void SendPickup(IPlayerWeaponProcessor weaponProcessor, int entityId, int itemId, int category, int count)
        {
            var player = _contexts.player.flagSelfEntity;

            if (null == player)
            {
                return;
            }

            SimpleProto pickUp = FreePool.Allocate();

            pickUp.Key = FreeMessageConstant.PickUpItem;
            pickUp.Ins.Add(entityId);
            pickUp.Ins.Add(category);
            pickUp.Ins.Add(itemId);
            pickUp.Ins.Add(count);
            player.network.NetworkChannel.SendReliable((int)EClient2ServerMessage.FreeEvent, pickUp);
            if (Logger.IsDebugEnabled)
            {
                Logger.DebugFormat("send pick up message entityId {0}, category {1}, itemid {2}, count {3}", entityId, category, itemId, count);
            }
        }
Пример #14
0
        private void GenerateInitialWeapons(PlayerWeaponBagData srcBagData, IPlayerWeaponProcessor controller)
        {
            PlayerWeaponBagData bagData = BagTaticsCache.CombineOverridedBagData(controller, srcBagData);
            var helper = controller.GrenadeHelper;

            helper.ClearCache();

            foreach (var weapon in bagData.weaponList)
            {
                DebugUtil.MyLog("BagIndex:{0}|In:{1}", DebugUtil.DebugColor.Blue, bagData.BagIndex, weapon.ToString());

                var slot = PlayerWeaponBagData.Index2Slot(weapon.Index);

                var weaponAllConfig = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(weapon.WeaponTplId);
                var weaponType      = (EWeaponType_Config)weaponAllConfig.NewWeaponCfg.Type;
                if (weaponType != EWeaponType_Config.ThrowWeapon)
                {
                    var orient = WeaponUtil.CreateScan(weapon);
                    orient.Bullet         = weaponAllConfig.PropertyCfg.Bullet;
                    orient.ReservedBullet = weaponAllConfig.PropertyCfg.Bulletmax;
                    if (orient.Magazine > 0)
                    {
                        orient.Bullet += SingletonManager.Get <WeaponPartsConfigManager>().GetConfigById(orient.Magazine).Bullet;
                    }
                    orient.ClipSize = orient.Bullet;
                    controller.ReplaceWeaponToSlot(slot, srcBagData.BagIndex, orient);
                    //if(isdefaultBag)
                    //    controller.PickUpWeapon(weaponInfo);
                    //else
                    //    controller.ReplaceWeaponToSlot(slot)
                }
                else
                {
                    controller.GrenadeHelper.AddCache(weapon.WeaponTplId);
                }
            }
        }
Пример #15
0
 public override void OnWeaponPickup(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     Logger.DebugFormat("{0} OnPickup", controller.Owner);
     base.OnWeaponPickup(controller, slot);
     controller.BagLockState = true;
 }
Пример #16
0
 public void OnDrop(IPlayerWeaponProcessor controller, EWeaponSlotType slot, EntityKey key)
 {
     Logger.DebugFormat("{0} OnDrop", controller.Owner);
     controller.BagLockState = true;
 }
Пример #17
0
 public void OnSwitch(IPlayerWeaponProcessor controller, int weaponId, EInOrOff op)
 {
     ProcessListener.OnSwitch(controller, weaponId, op);
 }
Пример #18
0
 public void SendPickup(IPlayerWeaponProcessor weaponProcessor, int entityId, int itemId, int category,
                        int count)
 {
     PickupHandler.SendPickup(weaponProcessor, entityId, itemId, category, count);
     ProcessListener.OnItemPickup(weaponProcessor, itemId, category, count);
 }
Пример #19
0
 public int GetReservedBullet(IPlayerWeaponProcessor controller, EBulletCaliber caliber)
 {
     return(ReservedBulletHandler.GetReservedBullet(controller, caliber));
 }
Пример #20
0
 public int GetReservedBullet(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     return(ReservedBulletHandler.GetReservedBullet(controller, slot));
 }
Пример #21
0
 public void OnDrop(IPlayerWeaponProcessor controller, EWeaponSlotType slot, EntityKey dropedWeapon)
 {
     ProcessListener.OnDrop(controller, slot, dropedWeapon);
 }
 public virtual void SendPickup(IPlayerWeaponProcessor weaponProcessor, int entityId, int itemId, int category,
                                int count)
 {
 }
Пример #23
0
 public virtual void OnDrop(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
 }
Пример #24
0
        public int GetReservedBullet(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
        {
            var caliber = GetCaliber(controller as PlayerWeaponController, slot);

            return(GetReservedBullet(controller, caliber));
        }
Пример #25
0
 public int GetReservedBullet(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     return(controller.HeldWeaponAgent.BaseComponent.ReservedBullet);
 }
Пример #26
0
 public int SetReservedBullet(IPlayerWeaponProcessor controller, EWeaponSlotType slot, int count)
 {
     controller.HeldWeaponAgent.BaseComponent.ReservedBullet = count;
     return(count);
 }
Пример #27
0
 private void LockPlayerBag(IPlayerWeaponProcessor controller)
 {
     Logger.DebugFormat("{0} LockPlayerBag", controller.Owner);
     controller.BagLockState = true;
 }
Пример #28
0
 public int SetReservedBullet(IPlayerWeaponProcessor controller, EBulletCaliber caliber, int count)
 {
     return(ReservedBulletHandler.SetReservedBullet(controller, caliber, count));
 }
Пример #29
0
 public void OnDrop(IPlayerWeaponProcessor controller, EWeaponSlotType slot, EntityKey dropedWeapon)
 {
 }
Пример #30
0
 public void OnExpend(IPlayerWeaponProcessor controller, EWeaponSlotType slot)
 {
     ProcessListener.OnExpend(controller, slot);
 }