コード例 #1
0
        private void AddSliderGridItem(CASFacialBlendPanel ths, ItemGrid grid, ResourceKey itemKey, FacialBlendData sliderData)
        {
            WindowBase windowByExportID = UIManager.LoadLayout(itemKey).GetWindowByExportID(0x1);

            if (windowByExportID != null)
            {
                string caption = StringTable.GetLocalizedString(sliderData.mLocalizationKey);

                int dataValue = (int)Math.Round((double)(sliderData.Value * 256f));

                Text childByID = windowByExportID.GetChildByID(0x2, true) as Text;
                if (childByID != null)
                {
                    childByID.Caption = GetTitle(caption, dataValue);
                }

                Slider slider = windowByExportID.GetChildByID(0x4, true) as Slider;
                if (slider != null)
                {
                    slider.SliderValueChange += OnSliderChanged;
                    slider.MouseUp           += OnSliderMouseUp;

                    mSlidersToText.Add(slider, new Pair <Text, string>(childByID, caption));

                    if (sliderData.mBidirectional)
                    {
                        slider.MinValue = -256 * NRaas.MasterController.Settings.mSliderMultiple;
                    }
                    else
                    {
                        slider.MinValue = 0x0;
                    }

                    slider.MaxValue = 256 * NRaas.MasterController.Settings.mSliderMultiple;

                    slider.Value = dataValue;
                    if (CASController.Singleton.DebugTooltips)
                    {
                        windowByExportID.TooltipText = StringTable.GetLocalizedString(sliderData.mLocalizationKey);
                    }

                    grid.AddItem(new ItemGridCellItem(windowByExportID, sliderData));
                    if (ths.mNumSliders < ths.mSliderData.Length)
                    {
                        ths.mSliderData[ths.mNumSliders].mSlider = slider;
                        ths.mSliderData[ths.mNumSliders].mData   = sliderData;
                        ths.mNumSliders++;
                    }
                }
            }
        }
コード例 #2
0
        private bool PopulateSliderGrid(CASFacialBlendPanel ths, ItemGrid grid, FacialBlendRegions regionFilter, List <FacialBlendCategories> categoryFilter)
        {
            ResourceKey itemKey = ResourceKey.CreateUILayoutKey("CASBodySlider", 0x0);

            List <FacialBlendData> data = new List <FacialBlendData>();

            List <BlendUnit> list = new List <BlendUnit>(CASController.Singleton.BlendUnits);

            foreach (BlendUnit unit in list)
            {
                if ((unit.Region == regionFilter) && (categoryFilter.Contains(unit.Category)))
                {
                    FacialBlendData facialBlendData = ths.GetFacialBlendData(unit);
                    if (facialBlendData == null)
                    {
                        continue;
                    }

                    data.Add(facialBlendData);
                }
            }

            data.Sort(new Comparison <FacialBlendData>(OnBlendSort));

            foreach (FacialBlendData facialBlendData in data)
            {
                AddSliderGridItem(ths, grid, itemKey, facialBlendData);
            }

            grid.ForceCellTooltips = CASController.Singleton.DebugTooltips;
            if (grid.Count > grid.VisibleRows)
            {
                Window childByID = grid.GetChildByID(0x62ec8d0, false) as Window;
                if (childByID != null)
                {
                    childByID.Visible = true;
                }
            }

            if (grid.Count == 0x0)
            {
                grid.Clear();
            }
            return(true);
        }