Esempio n. 1
0
        private void Ribbon_Loaded(object sender, RoutedEventArgs e)
        {
            Grid child = VisualTreeHelper.GetChild((DependencyObject)sender, 0) as Grid;

            if (child != null)
            {
                reducedHeight = (int)child.RowDefinitions[0].ActualHeight;
                child.RowDefinitions[0].Height = new GridLength(0);
            }

            // Load map simulator resolutions
            foreach (RenderResolution val in Enum.GetValues(typeof(RenderResolution)))
            {
                ComboBoxItem comboBoxItem = new ComboBoxItem
                {
                    Tag     = val,
                    Content = RenderResolutionExtensions.ToReadableString(val)
                };

                comboBox_Resolution.Items.Add(comboBoxItem);
            }
            //comboBox_Resolution.DisplayMemberPath = "Content";

            int i = 0;

            foreach (ComboBoxItem item in comboBox_Resolution.Items)
            {
                if ((RenderResolution)item.Tag == UserSettings.SimulateResolution)
                {
                    comboBox_Resolution.SelectedIndex = i;
                    break;
                }
                i++;
            }
        }
        public BackgroundInstanceEditor(BackgroundInstance item)
        {
            InitializeComponent();

            this.item    = item;
            xInput.Value = item.BaseX;
            yInput.Value = item.BaseY;
            if (item.Z == -1)
            {
                zInput.Enabled = false;
            }
            else
            {
                zInput.Value = item.Z;
            }

            pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item);
            typeBox.Items.AddRange((object[])Tables.BackgroundTypeNames.Cast <object>());
            typeBox.SelectedIndex = (int)item.type;
            alphaBox.Value        = item.a;
            front.Checked         = item.front;

            rxBox.Value = item.rx;
            trackBar_parallaxX.Value = item.rx;
            ryBox.Value = item.ry;
            trackBar_parallaxY.Value = item.ry;

            cxBox.Value = item.cx;
            cyBox.Value = item.cy;

            // Resolutions
            foreach (RenderResolution val in Enum.GetValues(typeof(RenderResolution)))
            {
                ComboBoxItem comboBoxItem = new ComboBoxItem
                {
                    Tag     = val,
                    Content = RenderResolutionExtensions.ToReadableString(val)
                };

                comboBox_screenMode.Items.Add(comboBoxItem);
            }
            comboBox_screenMode.DisplayMember = "Content";

            int i = 0;

            foreach (ComboBoxItem citem in comboBox_screenMode.Items)
            {
                if ((int)((RenderResolution)citem.Tag) == item.screenMode)
                {
                    comboBox_screenMode.SelectedIndex = i;
                    break;
                }
                i++;
            }
            if (item.screenMode < 0)
            {
                comboBox_screenMode.SelectedIndex = 0;
            }

            // Spine
            BackgroundInfo baseInfo = (BackgroundInfo)item.BaseInfo;

            if (baseInfo.WzSpineAnimationItem == null)
            {
                groupBox_spine.Enabled = false; // disable editing
            }
            else
            {
                groupBox_spine.Enabled = true; // editing

                foreach (Animation ani in baseInfo.WzSpineAnimationItem.SkeletonData.Animations)
                {
                    ComboBoxItem comboBoxItem = new ComboBoxItem();
                    comboBoxItem.Tag     = ani;
                    comboBoxItem.Content = ani.Name;

                    comboBox_spineAnimation.Items.Add(comboBoxItem);
                }
                comboBox_spineAnimation.DisplayMember = "Content";

                int i_animation = 0;
                foreach (ComboBoxItem citem in comboBox_spineAnimation.Items)
                {
                    if (((Animation)citem.Tag).Name == item.SpineAni)
                    {
                        comboBox_spineAnimation.SelectedIndex = i_animation;
                        break;
                    }
                    i_animation++;
                }

                // spineRandomStart checkbox
                checkBox_spineRandomStart.Checked = item.SpineRandomStart;
            }
        }