/// <summary>
 /// 玩家武器背包添加
 /// </summary>
 /// <param name="player"></param>
 public static void AttachPlayerWeaponBags(this PlayerEntity player)
 {
     if (!player.hasPlayerWeaponBagSet)
     {
         player.AddPlayerWeaponBagSet(WeaponUtil.CreateEmptyBagContainers());
     }
 }
Beispiel #2
0
 public static void AttachGrenadeCacheData(this PlayerEntity player, List <int> ids)
 {
     if (!player.hasGrenadeCacheData)
     {
         var arrs = WeaponUtil.CreateEmptyGrenadeCacheArrs(ids);
         player.AddGrenadeCacheData(arrs);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 获取手雷信息
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 private static GrenadeCacheDataComponent FindGrenadeCacheData(this PlayerEntity player)
 {
     if (!player.hasGrenadeCacheData)
     {
         var greandeIds = WeaponUtil.ForeachFilterGreandeIds();
         var arrs       = WeaponUtil.CreateEmptyGrenadeCacheArrs(greandeIds);
         player.AddGrenadeCacheData(arrs);
     }
     return(player.grenadeCacheData);
 }
        public static void SetHeldSlotIndex(this PlayerWeaponBagSetComponent component, int bagIndex, int nowSlot)
        {
            var bag = component[bagIndex];

            if (bag.HeldSlotPointer == nowSlot)
            {
                return;
            }
            if (!WeaponUtil.VertifyEweaponSlotIndex(nowSlot, true))
            {
                return;
            }
            bag.ChangeSlotPointer(nowSlot);
        }
Beispiel #5
0
        public static EntityKey CreateCustomizeWeapon(EntityKey lastKey, EntityKey owner, int configId)
        {
            if (lastKey.IsValid())
            {
                WeaponEntity currWeapon = WeaponEntityFactory.GetWeaponEntity(lastKey);
                if (currWeapon != null)
                {
                    WeaponEntityFactory.RemoveWeaponEntity(currWeapon);
                }
            }
            WeaponEntity newWeapon = WeaponEntityFactory.CreateEntity(WeaponUtil.CreateScan(configId));

            newWeapon.SetRetain(owner);
            return(newWeapon.entityKey.Value);
        }
Beispiel #6
0
        /// <summary>
        /// 玩家武器背包添加
        /// </summary>
        /// <param name="player"></param>
        public static void AttachPlayerWeaponBags(this PlayerEntity player, Contexts context)
        {
            var containers = WeaponUtil.CreateEmptyBagContainers();

            player.AddPlayerWeaponBagSet(containers);
        }
Beispiel #7
0
 public static void SyncSelf(this WeaponObjectComponent weaponSceneObject, WeaponScanStruct weaponInfo)
 {
     weaponSceneObject.WeaponKey = WeaponUtil.IsWeaponKeyVaild(weaponInfo.WeaponKey)? weaponInfo.WeaponKey:EntityKey.Default;
     weaponSceneObject.ConfigId  = weaponInfo.ConfigId;
 }