Exemplo n.º 1
0
        public PlayerScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/PlayerScreen");

            LoadContents(this, node);
            m_playerModel                     = Children.Find <PlayerModelWidget>("Model");
            m_playerClassButton               = Children.Find <ButtonWidget>("PlayerClassButton");
            m_nameTextBox                     = Children.Find <TextBoxWidget>("Name");
            m_characterSkinLabel              = Children.Find <LabelWidget>("CharacterSkinLabel");
            m_characterSkinButton             = Children.Find <ButtonWidget>("CharacterSkinButton");
            m_controlsLabel                   = Children.Find <LabelWidget>("ControlsLabel");
            m_controlsButton                  = Children.Find <ButtonWidget>("ControlsButton");
            m_descriptionLabel                = Children.Find <LabelWidget>("DescriptionLabel");
            m_addButton                       = Children.Find <ButtonWidget>("AddButton");
            m_addAnotherButton                = Children.Find <ButtonWidget>("AddAnotherButton");
            m_deleteButton                    = Children.Find <ButtonWidget>("DeleteButton");
            m_playButton                      = Children.Find <ButtonWidget>("PlayButton");
            m_characterSkinsCache             = new CharacterSkinsCache();
            m_playerModel.CharacterSkinsCache = m_characterSkinsCache;
            m_nameTextBox.FocusLost          += delegate
            {
                if (VerifyName())
                {
                    m_playerData.Name = m_nameTextBox.Text.Trim();
                }
                else
                {
                    m_nameWasInvalid = true;
                }
            };
        }
Exemplo n.º 2
0
 public PlayerModelWidget()
 {
     m_modelWidget = new ModelWidget
     {
         UseAlphaThreshold = true,
         IsPerspective     = true
     };
     Children.Add(m_modelWidget);
     IsHitTestVisible            = false;
     m_publicCharacterSkinsCache = new CharacterSkinsCache();
     m_characterSkinsCache       = m_publicCharacterSkinsCache;
 }
Exemplo n.º 3
0
        public PlayerWidget(PlayerData playerData, CharacterSkinsCache characterSkinsCache)
        {
            XElement node = ContentManager.Get <XElement>("Widgets/PlayerWidget");

            LoadContents(this, node);
            m_playerModel  = Children.Find <PlayerModelWidget>("PlayerModel");
            m_nameLabel    = Children.Find <LabelWidget>("Name");
            m_detailsLabel = Children.Find <LabelWidget>("Details");
            m_editButton   = Children.Find <ButtonWidget>("EditButton");
            m_playerModel.CharacterSkinsCache = characterSkinsCache;
            m_playerData = playerData;
        }
Exemplo n.º 4
0
 public override void MeasureOverride(Vector2 parentAvailableSize)
 {
     if (OuterClothing)
     {
         m_modelWidget.Model = CharacterSkinsManager.GetOuterClothingModel(PlayerClass);
     }
     else
     {
         m_modelWidget.Model = CharacterSkinsManager.GetPlayerModel(PlayerClass);
     }
     if (CameraShot == Shot.Body)
     {
         m_modelWidget.ViewPosition = ((PlayerClass == PlayerClass.Male) ? new Vector3(0f, 1.46f, -3.2f) : new Vector3(0f, 1.39f, -3.04f));
         m_modelWidget.ViewTarget   = ((PlayerClass == PlayerClass.Male) ? new Vector3(0f, 0.9f, 0f) : new Vector3(0f, 0.86f, 0f));
         m_modelWidget.ViewFov      = 0.57f;
     }
     else
     {
         if (CameraShot != Shot.Bust)
         {
             throw new InvalidOperationException("Unknown shot.");
         }
         m_modelWidget.ViewPosition = ((PlayerClass == PlayerClass.Male) ? new Vector3(0f, 1.5f, -1.05f) : new Vector3(0f, 1.43f, -1f));
         m_modelWidget.ViewTarget   = ((PlayerClass == PlayerClass.Male) ? new Vector3(0f, 1.5f, 0f) : new Vector3(0f, 1.43f, 0f));
         m_modelWidget.ViewFov      = 0.57f;
     }
     if (OuterClothing)
     {
         m_modelWidget.TextureOverride = OuterClothingTexture;
     }
     else
     {
         m_modelWidget.TextureOverride = ((CharacterSkinName != null) ? CharacterSkinsCache.GetTexture(CharacterSkinName) : CharacterSkinTexture);
     }
     if (AnimateHeadSeed != 0)
     {
         int     num    = (AnimateHeadSeed < 0) ? GetHashCode() : AnimateHeadSeed;
         float   num2   = (float)MathUtils.Remainder(Time.FrameStartTime + 1000.0 * (double)num, 10000.0);
         Vector2 vector = default(Vector2);
         vector.X = MathUtils.Lerp(-0.75f, 0.75f, SimplexNoise.OctavedNoise(num2 + 100f, 0.2f, 1, 2f, 0.5f));
         vector.Y = MathUtils.Lerp(-0.5f, 0.5f, SimplexNoise.OctavedNoise(num2 + 200f, 0.17f, 1, 2f, 0.5f));
         Matrix value = Matrix.CreateRotationX(vector.Y) * Matrix.CreateRotationZ(vector.X);
         m_modelWidget.SetBoneTransform(m_modelWidget.Model.FindBone("Head").Index, value);
     }
     if (!OuterClothing && AnimateHandsSeed != 0)
     {
         int     num3    = (AnimateHandsSeed < 0) ? GetHashCode() : AnimateHandsSeed;
         float   num4    = (float)MathUtils.Remainder(Time.FrameStartTime + 1000.0 * (double)num3, 10000.0);
         Vector2 vector2 = default(Vector2);
         vector2.X = MathUtils.Lerp(0.2f, 0f, SimplexNoise.OctavedNoise(num4 + 100f, 0.7f, 1, 2f, 0.5f));
         vector2.Y = MathUtils.Lerp(-0.3f, 0.3f, SimplexNoise.OctavedNoise(num4 + 200f, 0.7f, 1, 2f, 0.5f));
         Vector2 vector3 = default(Vector2);
         vector3.X = MathUtils.Lerp(-0.2f, 0f, SimplexNoise.OctavedNoise(num4 + 300f, 0.7f, 1, 2f, 0.5f));
         vector3.Y = MathUtils.Lerp(-0.3f, 0.3f, SimplexNoise.OctavedNoise(num4 + 400f, 0.7f, 1, 2f, 0.5f));
         Matrix value2 = Matrix.CreateRotationX(vector2.Y) * Matrix.CreateRotationY(vector2.X);
         Matrix value3 = Matrix.CreateRotationX(vector3.Y) * Matrix.CreateRotationY(vector3.X);
         m_modelWidget.SetBoneTransform(m_modelWidget.Model.FindBone("Hand1").Index, value2);
         m_modelWidget.SetBoneTransform(m_modelWidget.Model.FindBone("Hand2").Index, value3);
     }
     base.MeasureOverride(parentAvailableSize);
 }