Example #1
0
 public bool MemberwiseEquals(ICharacterAppearance maybeOther)
 {
     if (maybeOther is not HumanoidCharacterAppearance other)
     {
         return(false);
     }
     if (HairStyleId != other.HairStyleId)
     {
         return(false);
     }
     if (!HairColor.Equals(other.HairColor))
     {
         return(false);
     }
     if (FacialHairStyleId != other.FacialHairStyleId)
     {
         return(false);
     }
     if (!FacialHairColor.Equals(other.FacialHairColor))
     {
         return(false);
     }
     if (!EyeColor.Equals(other.EyeColor))
     {
         return(false);
     }
     if (!SkinColor.Equals(other.SkinColor))
     {
         return(false);
     }
     return(true);
 }
Example #2
0
        public static void RefreshWeaponPartModels(ICharacterAppearance appearance, int weaponId,
                                                   WeaponPartsStruct oldParts, WeaponPartsStruct parts, EWeaponSlotType slot)
        {
            var weaponConfig = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(weaponId);

            if (null == weaponConfig)
            {
                return;
            }
            if (!((EWeaponType_Config)weaponConfig.Type).MayHasPart())
            {
                Logger.WarnFormat("weapon type {0} has no attachment by default ", weaponConfig.Type);
                return;
            }

            var pos = slot.ToWeaponInPackage();
            //  var oldArr = oldParts.ToAniLocation();
            var newArr = parts.ToAniLocation();

            for (WeaponPartLocation tmp = WeaponPartLocation.None + 1; tmp < WeaponPartLocation.EndOfTheWorld; tmp++)
            {
                if (newArr[(int)tmp] > 0)
                {
                    appearance.MountAttachment(pos, tmp, newArr[(int)tmp]);
                }
                else
                {
                    appearance.UnmountAttachment(pos, tmp);
                }
            }
        }
 public bool MemberwiseEquals(ICharacterAppearance maybeOther)
 {
     if (!(maybeOther is HumanoidCharacterAppearance other))
     {
         return(false);
     }
     if (HairStyleName != other.HairStyleName)
     {
         return(false);
     }
     if (HairColor != other.HairColor)
     {
         return(false);
     }
     if (FacialHairStyleName != other.FacialHairStyleName)
     {
         return(false);
     }
     if (FacialHairColor != other.FacialHairColor)
     {
         return(false);
     }
     if (EyeColor != other.EyeColor)
     {
         return(false);
     }
     if (SkinColor != other.SkinColor)
     {
         return(false);
     }
     return(true);
 }
        /// <summary>
        ///     ChangeBagToC4
        /// </summary>
        /// <param name="Appearance"></param>
        /// <param name="weaponId"></param>
        public static void MountC4(this ICharacterAppearance Appearance, int weaponId)
        {
            var c4AvatarId = SingletonManager.Get <WeaponResourceConfigManager>().GetAvatarByWeaponId(weaponId);

            Appearance.MountWeaponInPackage(WeaponInPackage.TacticWeapon, c4AvatarId);
            Appearance.ClearAvatar(Wardrobe.Bag);
        }
        /// <summary>
        /// ChangeC4ToBag
        /// </summary>
        /// <param name="playerEntity"></param>
        /// <param name="weaponId"></param>
        public static void UnmoutC4(this ICharacterAppearance Appearance, Utils.CharacterState.Sex sex)
        {
            Appearance.UnmountWeaponInPackage(WeaponInPackage.TacticWeapon);
            var c4ResId = SingletonManager.Get <RoleAvatarConfigManager>().GetResId(RoleAvatarConfigManager.C4, sex);

            Appearance.ChangeAvatar(c4ResId);
        }
Example #6
0
        /// <summary>
        /// 刷新武器的配件显示
        /// </summary>
        /// <param name="appearance"></param>
        /// <param name="weaponId">武器的Id</param>
        /// <param name="attachments">武器的配件信息</param>
        /// <param name="slot">武器的位置</param>
        public static void RefreshWeaponPartModels(ICharacterAppearance appearance, int weaponId, WeaponPartsStruct oldAttachment, WeaponPartsStruct attachments, EWeaponSlotType slot)
        {
            Logger.DebugFormat("RefreshAttachmnetModels {0}, old {1}, new {2}, slot {3}",
                               weaponId,
                               oldAttachment,
                               attachments,
                               slot);
            var weaponConfig = SingletonManager.Get <WeaponConfigManager>().GetConfigById(weaponId);

            if (null == weaponConfig)
            {
                return;
            }
            if (!((EWeaponType)weaponConfig.Type).MayHasPart())
            {
                Logger.WarnFormat("weapon type {0} has no attachment by default ", weaponConfig.Type);
                return;
            }
            PrepareDicsForAttach(oldAttachment, attachments);

            var pos = slot.ToWeaponInPackage();

            foreach (var pair in _attachmentsDic)
            {
                if (pair.Value > 0)
                {
                    if (!_oldAttachmentsDic.ContainsKey(pair.Key) || _oldAttachmentsDic[pair.Key] != pair.Value)
                    {
                        appearance.MountAttachment(pos, pair.Key, pair.Value);
                    }
                }
                else
                {
                    if (_oldAttachmentsDic.ContainsKey(pair.Key) && _oldAttachmentsDic[pair.Key] > 0)
                    {
                        appearance.UnmountAttachment(pos, pair.Key);
                    }
                }
            }
        }
 public static GameObject WeaponHandObject(this ICharacterAppearance Appearance)
 {
     return(Appearance.GetWeaponP1InHand());
 }
 public static void RemoveC4(this ICharacterAppearance Appearance)
 {
     Appearance.UnmountWeaponInPackage(WeaponInPackage.TacticWeapon);
     Appearance.ClearAvatar(Wardrobe.Bag);
 }