Пример #1
0
        public MercenaryEditor(MercenaryItem selectedMerc)
        {
            InitializeComponent();
            mercenary = selectedMerc;

            Owner = Application.Current.MainWindow; // Set MainWindow as owner, so it'll make proper use of WindowStartupLocation.Owner
            #region Update colours to fit the active theme + alternating colors for readability
            Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);
            if (appStyle.Item1.Name == "BaseDark")
            {
                gBackground.Background = new SolidColorBrush(Color.FromRgb(55, 55, 55));
                dgValueList.AlternatingRowBackground = new SolidColorBrush(Color.FromRgb(55, 55, 55));
            }
            else
            {
                gBackground.Background = new SolidColorBrush(Color.FromRgb(245, 245, 245));
                dgValueList.AlternatingRowBackground = new SolidColorBrush(Color.FromRgb(235, 235, 235));
            }
            #endregion

            string[] nameValue =
            { "Mouth - Middle",                  "Mouth - Edges",          "Maxilla",           "Left Eyebrow",         "Unknown Value [1]",     "Right Eyebrow",         "Right Eye",
              "Unknown Value [2]",           "Unknown Value [3]",      "Unknown Value [4]", "Mouth",                "Left Eye",              "Lips - Left Edge",      "Lips - Right Edge",
              "Chin",                        "Jaw - Left",             "Jaw - Right",       "Lower Lip",            "Lower Lip - Left",      "Lower Lip - Right",     "Infraorbital Margin - Left",
              "Medial Cleft",                "Lip - Left",             "Lip - Right",       "Philtrum",             "Nose - Tip",            "Nose Bridge",           "Nose Bridge - Top",
              "Infraorbital Margin - Right", "Cheek - Left",           "Cheek - Right",     "Left Eyebrow - Inner", "Right Eyebrow - Inner", "Left Eyebrow - Middle", "Right Eyebrow - Middle",
              "Left Eyebrow - Outter",       "Right Eyebrow - Outter", "Ear - Left",        "Ear - Right",          "Unknown Value [5]",     "Unknown Value [6]",     "Left Eyelid - Top",
              "Left Eyelid - Bottom",        "Unknown Value [7]",      "Unknown Value [8]", "Right Eyelid - Top",   "Right Eyelid - Bottom", "Cheekbone - Left",      "Cheekbone - Right" };

            // Create 49 sliders, it consists of 3 separate sliders - one for each value
            dgValueList.ItemsSource = _sliders;
            for (int i = 0; i < 49; i++)
            {
                var newSlider = new FaceValueSliderItem();
                newSlider.Translation = selectedMerc.FaceValues[i].Translation;
                newSlider.Rotation    = selectedMerc.FaceValues[i].Rotation;
                newSlider.Scale       = selectedMerc.FaceValues[i].Scale;
                //newSlider.UpdateDescription(String.Format("{0}: Unknown Value", (i + 1)));
                newSlider.UpdateDescription(string.Format(nameValue[i]));
                _sliders.Add(newSlider);
            }
            tbNewName.IsEnabled = !mercenary.isHordeMercenary;
        }
        public MercenaryEditor(MercenaryItem selectedMerc)
        {
            InitializeComponent();
            mercenary = selectedMerc;

            Owner = Application.Current.MainWindow; // Set MainWindow as owner, so it'll make proper use of WindowStartupLocation.Owner
            #region Update colours to fit the active theme + alternating colors for readability
            Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);
            if (appStyle.Item1.Name == "BaseDark")
            {
                gBackground.Background = new SolidColorBrush(Color.FromRgb(69, 69, 69));
                dgValueList.AlternatingRowBackground = new SolidColorBrush(Color.FromRgb(69, 69, 69));
            }
            else
            {
                gBackground.Background = new SolidColorBrush(Color.FromRgb(245, 245, 245));
                dgValueList.AlternatingRowBackground = new SolidColorBrush(Color.FromRgb(245, 245, 245));
            }
            #endregion

            // Create 49 sliders, it consists of 3 separate sliders - one for each value
            dgValueList.ItemsSource = _sliders;

            string[] nameValue =
            { "middle part of mouth",          "left&right part of mouth", "nose to bottom",     "left eyebrow",         "(to test)nothing",      "right eyebrow",          "right eye",
              "(to test)nothing",          "(to test)nothing",         "(to test)nothing",   "mouth",                "left eye",              "left lip commissure",    "right lip commissure",
              "chin",                      "bottom left cheek",        "bottom right cheek", "bottom of lip",        "bottom left of lip",    "bottom right of lip",    "top left cheek",
              "bottom philtrum",           "left lip",                 "right lip",          "top philtrum",         "nose to top",           "bottom glabella",        "top glabella",
              "right infraorbital margin", "middle cheek left",        "middle cheek right", "head of left eyebrow", "head of right eyebrow", "middle of left eyebrow", "middle of right eyebrow",
              "tail of left eyebrow",      "tail of right eyebrow",    "left hear",          "right hear",           "(to test)nothing",      "top left eyelid",        "left bottom eyelid",
              "(to test)nothing",          "(to test)nothing",         "(to test)nothing",   "top right eyelid",     "bottom right eyelid",   "left cheek #4",          "right cheek #4" };
            for (int i = 0; i < 49; i++)
            {
                var newSlider = new FaceValueSliderItem();
                newSlider.Translation = selectedMerc.FaceValues[i].Translation;
                newSlider.Rotation    = selectedMerc.FaceValues[i].Rotation;
                newSlider.Scale       = selectedMerc.FaceValues[i].Scale;
                newSlider.UpdateDescription(String.Format(nameValue[i]));
                _sliders.Add(newSlider);
            }
            tbNewName.IsEnabled = !mercenary.isHordeMercenary;
        }