Пример #1
0
 /// <summary>
 /// Removes an Appearance instance from this avatar.
 /// </summary>
 /// <param name="appearance">The Appearance instance to remove.</param>
 /// <param name="dispose">Should the appearance be disposed?</param>
 public void RemoveAppearance(AvatarAppearanceInstance appearance, bool dispose)
 {
     foreach (var binding in appearance.Bindings)
     {
         RemoveBinding(binding, dispose);
     }
 }
Пример #2
0
        /// <summary>
        /// Adds an Appearance instance to this avatar.
        /// </summary>
        /// <param name="appearance">The Appearance instance to add.</param>
        /// <returns>An AvatarAppearanceInstance instance.</returns>
        protected AvatarAppearanceInstance AddAppearance(Appearance appearance, string texOverride)
        {
            var result = new AvatarAppearanceInstance();

            result.Bindings = new List <AvatarBindingInstance>();

            int i = 0;

            foreach (var bindingReference in appearance.Bindings)
            {
                var binding = bindingReference.RealBinding ?? FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID);
                if (binding == null)
                {
                    continue;
                }
                if ((i++ == 0) && texOverride != null)
                {
                    binding             = binding.TS1Copy();
                    binding.TextureName = texOverride;
                }
                result.Bindings.Add(AddBinding(binding));
            }

            return(result);
        }
Пример #3
0
        /// <summary>
        /// Adds an Appearance instance to this avatar.
        /// </summary>
        /// <param name="appearance">The Appearance instance to add.</param>
        /// <returns>An AvatarAppearanceInstance instance.</returns>
        protected AvatarAppearanceInstance AddAppearance(Appearance appearance, string texOverride)
        {
            var result = new AvatarAppearanceInstance();

            result.Original = appearance;
            result.Bindings = new List <AvatarBindingInstance>();

            int i            = 0;
            int replaced     = 0;
            var realBindings = appearance.Bindings.Select(bindingReference =>
                                                          bindingReference.RealBinding ?? FSO.Content.Content.Get().AvatarBindings?.Get(bindingReference.TypeID, bindingReference.FileID)).ToList();

            if (Content.Content.Get().TS1)
            {
                foreach (var binding in realBindings)
                {
                    if (binding == null)
                    {
                        continue;
                    }
                    var mesh = Content.Content.Get().AvatarMeshes.Get(binding.MeshName);
                    if (texOverride != null &&
                        mesh.TextureName.ToLowerInvariant() == texOverride.ToLowerInvariant()
                        .Replace("lgt", "")
                        .Replace("med", "")
                        .Replace("drk", "") ||
                        mesh.TextureName.ToLowerInvariant() == "x")
                    {
                        replaced = i;
                    }
                    i++;
                }

                if (texOverride != null)
                {
                    realBindings[replaced]             = realBindings[replaced].TS1Copy();
                    realBindings[replaced].TextureName = texOverride;
                }
            }

            foreach (var binding in realBindings)
            {
                if (binding == null)
                {
                    continue;
                }
                result.Bindings.Add(AddBinding(binding));
            }

            return(result);
        }
Пример #4
0
 /// <summary>
 /// Removes an Appearance instance from this avatar.
 /// </summary>
 /// <param name="appearance">The Appearance instance to remove.</param>
 /// <param name="dispose">Should the appearance be disposed?</param>
 public void RemoveAppearance(AvatarAppearanceInstance appearance, bool dispose)
 {
     lock (Bindings)
     {
         if (appearance == null)
         {
             return;
         }
         foreach (var binding in appearance.Bindings)
         {
             RemoveBinding(binding, dispose);
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Reloads the head mesh.
 /// </summary>
 private void ReloadHead()
 {
     if (m_HeadInstance != null){
         base.RemoveAppearance(m_HeadInstance, true);
     }
     if (m_Head != null)
     {
         var AppearanceID = m_Head.GetAppearance(m_Appearance);
         var Appearance = FSO.Content.Content.Get().AvatarAppearances.Get(AppearanceID);
         if (Appearance != null)
         {
             m_HeadInstance = base.AddAppearance(Appearance, m_Head.TS1TextureID);
         }
     }
 }
Пример #6
0
 /// <summary>
 /// Reloads the body mesh.
 /// </summary>
 private void ReloadBody()
 {
     if (m_BodyInstance != null)
     {
         base.RemoveAppearance(m_BodyInstance, true);
     }
     if (m_Body != null)
     {
         var AppearanceID = m_Body.GetAppearance(m_Appearance);
         var Appearance   = FSO.Content.Content.Get().AvatarAppearances.Get(AppearanceID);
         if (Appearance != null)
         {
             m_BodyInstance = base.AddAppearance(Appearance);
         }
     }
 }
Пример #7
0
        /// <summary>
        /// Adds an Appearance instance to this avatar.
        /// </summary>
        /// <param name="appearance">The Appearance instance to add.</param>
        /// <returns>An AvatarAppearanceInstance instance.</returns>
        protected AvatarAppearanceInstance AddAppearance(Appearance appearance)
        {
            var result = new AvatarAppearanceInstance();

            result.Bindings = new List <AvatarBindingInstance>();

            foreach (var bindingReference in appearance.Bindings)
            {
                var binding = FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID);
                if (binding == null)
                {
                    continue;
                }
                result.Bindings.Add(AddBinding(binding));
            }

            return(result);
        }
Пример #8
0
        /// <summary>
        /// Reloads the hand meshes.
        /// </summary>
        private void ReloadHandgroup()
        {
            if (m_LeftHandInstance != null)
                base.RemoveAppearance(m_LeftHandInstance, true);
            if(m_RightHandInstance != null)
                base.RemoveAppearance(m_RightHandInstance, true);

            if (m_Handgroup != null)
            {
                var hgroup = m_Handgroup.LiteralHandgroup;
                if (hgroup == null)
                {
                    var HandgroupID = m_Handgroup.GetHandgroup();
                    if (HandgroupID.FileID == 0) HandgroupID.FileID = (int)(158913789970 >> 32);
                    hgroup = FSO.Content.Content.Get().AvatarHandgroups.Get(HandgroupID.TypeID, HandgroupID.FileID);
                }

                FSO.Vitaboy.HandSet HSet = null;
                if (hgroup.TS1HandSet) HSet = hgroup.LightSkin;
                else {
                    switch (m_Appearance)
                    {
                        case AppearanceType.Light:
                            HSet = hgroup.LightSkin;
                            break;
                        case AppearanceType.Medium:
                            HSet = hgroup.MediumSkin;
                            break;
                        case AppearanceType.Dark:
                            HSet = hgroup.DarkSkin;
                            break;
                    }
                }

                Appearance LeftApr, RightApr;
                string LeftTex = null, RightTex = null;
                if (hgroup.TS1HandSet)
                {
                    string LeftID = null;
                    string RightID = null;
                    switch (m_LeftHandGesture)
                    {
                        case SimHandGesture.Idle:
                            LeftID = HSet.LeftHand.Idle.Name;
                            LeftTex = HSet.LeftHand.Idle.TexName;
                            break;
                        case SimHandGesture.Fist:
                            LeftID = HSet.LeftHand.Fist.Name;
                            LeftTex = HSet.LeftHand.Fist.TexName;
                            break;
                        case SimHandGesture.Pointing:
                            LeftID = HSet.LeftHand.Pointing.Name;
                            LeftTex = HSet.LeftHand.Pointing.TexName;
                            break;
                    }

                    switch (m_RightHandGesture)
                    {
                        case SimHandGesture.Idle:
                            RightID = HSet.RightHand.Idle.Name;
                            RightTex = HSet.RightHand.Idle.TexName;
                            break;
                        case SimHandGesture.Fist:
                            RightID = HSet.RightHand.Fist.Name;
                            RightTex = HSet.RightHand.Idle.TexName;
                            break;
                        case SimHandGesture.Pointing:
                            RightID = HSet.RightHand.Pointing.Name;
                            RightTex = HSet.RightHand.Idle.TexName;
                            break;
                    }

                    LeftApr = FSO.Content.Content.Get().AvatarAppearances.Get(LeftID);
                    RightApr = FSO.Content.Content.Get().AvatarAppearances.Get(RightID);
                }
                else
                {
                    FSO.Common.Content.ContentID LeftID = null;
                    FSO.Common.Content.ContentID RightID = null;

                    switch (m_LeftHandGesture)
                    {
                        case SimHandGesture.Idle:
                            LeftID = HSet.LeftHand.Idle.ID;
                            break;
                        case SimHandGesture.Fist:
                            LeftID = HSet.LeftHand.Fist.ID;
                            break;
                        case SimHandGesture.Pointing:
                            LeftID = HSet.LeftHand.Pointing.ID;
                            break;
                    }

                    switch (m_RightHandGesture)
                    {
                        case SimHandGesture.Idle:
                            RightID = HSet.RightHand.Idle.ID;
                            break;
                        case SimHandGesture.Fist:
                            RightID = HSet.RightHand.Fist.ID;
                            break;
                        case SimHandGesture.Pointing:
                            RightID = HSet.RightHand.Pointing.ID;
                            break;
                    }

                    LeftApr = FSO.Content.Content.Get().AvatarAppearances.Get(LeftID);
                    RightApr = FSO.Content.Content.Get().AvatarAppearances.Get(RightID);
                }

                if (LeftApr != null)
                    m_LeftHandInstance = base.AddAppearance(LeftApr, LeftTex);
                if (RightApr != null)
                    m_RightHandInstance = base.AddAppearance(RightApr, RightTex);
            }
        }
Пример #9
0
        /// <summary>
        /// Adds an Appearance instance to this avatar.
        /// </summary>
        /// <param name="appearance">The Appearance instance to add.</param>
        /// <returns>An AvatarAppearanceInstance instance.</returns>
        protected AvatarAppearanceInstance AddAppearance(Appearance appearance)
        {
            var result = new AvatarAppearanceInstance();
            result.Bindings = new List<AvatarBindingInstance>();

            foreach (var bindingReference in appearance.Bindings)
            {
                var binding = FSO.Content.Content.Get().AvatarBindings.Get(bindingReference.TypeID, bindingReference.FileID);
                if (binding == null) { continue; }
                result.Bindings.Add(AddBinding(binding));
            }

            return result;
        }
Пример #10
0
 /// <summary>
 /// Removes an Appearance instance from this avatar.
 /// </summary>
 /// <param name="appearance">The Appearance instance to remove.</param>
 /// <param name="dispose">Should the appearance be disposed?</param>
 public void RemoveAppearance(AvatarAppearanceInstance appearance, bool dispose)
 {
     foreach (var binding in appearance.Bindings)
     {
         RemoveBinding(binding, dispose);
     }
 }
Пример #11
0
        /// <summary>
        /// Reloads the hand meshes.
        /// </summary>
        private void ReloadHandgroup()
        {
            if (m_LeftHandInstance != null)
            {
                base.RemoveAppearance(m_LeftHandInstance, true);
            }
            if (m_RightHandInstance != null)
            {
                base.RemoveAppearance(m_RightHandInstance, true);
            }

            if (m_Handgroup != null)
            {
                var HandgroupID = m_Handgroup.GetHandgroup();
                if (HandgroupID.FileID == 0)
                {
                    HandgroupID.FileID = (int)(158913789970 >> 32);
                }
                var Handgroup = FSO.Content.Content.Get().AvatarHandgroups.Get(HandgroupID.TypeID, HandgroupID.FileID);

                FSO.Common.Content.ContentID LeftID  = null;
                FSO.Common.Content.ContentID RightID = null;

                FSO.Vitaboy.HandSet HSet = null;

                switch (m_Appearance)
                {
                case AppearanceType.Light:
                    HSet = Handgroup.LightSkin;
                    break;

                case AppearanceType.Medium:
                    HSet = Handgroup.MediumSkin;
                    break;

                case AppearanceType.Dark:
                    HSet = Handgroup.DarkSkin;
                    break;
                }

                switch (m_LeftHandGesture)
                {
                case SimHandGesture.Idle:
                    LeftID = HSet.LeftHand.Idle.ID;
                    break;

                case SimHandGesture.Fist:
                    LeftID = HSet.LeftHand.Fist.ID;
                    break;

                case SimHandGesture.Pointing:
                    LeftID = HSet.LeftHand.Pointing.ID;
                    break;
                }

                switch (m_RightHandGesture)
                {
                case SimHandGesture.Idle:
                    RightID = HSet.RightHand.Idle.ID;
                    break;

                case SimHandGesture.Fist:
                    RightID = HSet.RightHand.Fist.ID;
                    break;

                case SimHandGesture.Pointing:
                    RightID = HSet.RightHand.Pointing.ID;
                    break;
                }

                Appearance LeftApr  = FSO.Content.Content.Get().AvatarAppearances.Get(LeftID);
                Appearance RightApr = FSO.Content.Content.Get().AvatarAppearances.Get(RightID);

                if (LeftApr != null)
                {
                    m_LeftHandInstance = base.AddAppearance(LeftApr);
                }
                if (RightApr != null)
                {
                    m_RightHandInstance = base.AddAppearance(RightApr);
                }
            }
        }
Пример #12
0
 /// <summary>
 /// Reloads the head mesh.
 /// </summary>
 private void ReloadHead()
 {
     if (m_HeadInstance != null){
         base.RemoveAppearance(m_HeadInstance, true);
     }
     if (m_Head != null)
     {
         var AppearanceID = m_Head.GetAppearance(m_Appearance);
         var Appearance = FSO.Content.Content.Get().AvatarAppearances.Get(AppearanceID);
         if (Appearance != null)
         {
             m_HeadInstance = base.AddAppearance(Appearance);
         }
     }
 }
Пример #13
0
        /// <summary>
        /// Reloads the hand meshes.
        /// </summary>
        private void ReloadHandgroup()
        {
            if (m_LeftHandInstance != null)
                base.RemoveAppearance(m_LeftHandInstance, true);
            if(m_RightHandInstance != null)
                base.RemoveAppearance(m_RightHandInstance, true);

            if (m_Handgroup != null)
            {
                var HandgroupID = m_Handgroup.GetHandgroup();
                if (HandgroupID.FileID == 0) HandgroupID.FileID = (int)(158913789970>>32);
                var Handgroup = FSO.Content.Content.Get().AvatarHandgroups.Get(HandgroupID.TypeID, HandgroupID.FileID);

                FSO.Common.Content.ContentID LeftID = null;
                FSO.Common.Content.ContentID RightID = null;

                FSO.Vitaboy.HandSet HSet = null;

                switch (m_Appearance)
                {
                    case AppearanceType.Light:
                        HSet = Handgroup.LightSkin;
                        break;
                    case AppearanceType.Medium:
                        HSet = Handgroup.MediumSkin;
                        break;
                    case AppearanceType.Dark:
                        HSet = Handgroup.DarkSkin;
                        break;
                }

                switch (m_LeftHandGesture)
                {
                    case SimHandGesture.Idle:
                        LeftID = HSet.LeftHand.Idle.ID;
                        break;
                    case SimHandGesture.Fist:
                        LeftID = HSet.LeftHand.Fist.ID;
                        break;
                    case SimHandGesture.Pointing:
                        LeftID = HSet.LeftHand.Pointing.ID;
                        break;
                }

                switch (m_RightHandGesture)
                {
                    case SimHandGesture.Idle:
                        RightID = HSet.RightHand.Idle.ID;
                        break;
                    case SimHandGesture.Fist:
                        RightID = HSet.RightHand.Fist.ID;
                        break;
                    case SimHandGesture.Pointing:
                        RightID = HSet.RightHand.Pointing.ID;
                        break;
                }

                Appearance LeftApr = FSO.Content.Content.Get().AvatarAppearances.Get(LeftID);
                Appearance RightApr = FSO.Content.Content.Get().AvatarAppearances.Get(RightID);

                if (LeftApr != null)
                    m_LeftHandInstance = base.AddAppearance(LeftApr);
                if(RightApr != null)
                    m_RightHandInstance = base.AddAppearance(RightApr);
            }
        }