Ejemplo n.º 1
0
        protected Dictionary <BlendUnit, float> GetBlendAmounts(SimDescription sim)
        {
            Dictionary <BlendUnit, float> blends;

            if (!sValues.TryGetValue(sim.SimDescriptionId, out blends))
            {
                using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(sim, CASParts.sPrimary))
                {
                    if (builder.OutfitValid)
                    {
                        blends = new Dictionary <BlendUnit, float>();
                        sValues.Add(sim.SimDescriptionId, blends);

                        foreach (BlendUnit blend in FacialBlends.BlendUnits)
                        {
                            FacialBlendData data = new FacialBlendData(blend);

                            blends.Add(blend, FacialBlends.GetValue(builder.Builder, data));
                        }

                        builder.Invalidate();
                    }
                }
            }

            return(blends);
        }
Ejemplo n.º 2
0
        public static int OnBlendSort(FacialBlendData left, FacialBlendData right)
        {
            string leftText  = StringTable.GetLocalizedString(left.mLocalizationKey);
            string rightText = StringTable.GetLocalizedString(right.mLocalizationKey);

            if ((leftText == null) || (rightText == null))
            {
                return(0);
            }

            leftText  = leftText.ToLower().Trim();
            rightText = rightText.ToLower().Trim();

            return(leftText.CompareTo(rightText));
        }
Ejemplo n.º 3
0
        public static float GetValue(SimBuilder builder, FacialBlendData unit)
        {
            if (unit.mBlend2 != null)
            {
                float num2 = GetBlendAmount(builder, unit.mBlend2);
                if (num2 > 0f)
                {
                    return(-num2);
                }
            }

            if (unit.mBlend1 != null)
            {
                return(GetBlendAmount(builder, unit.mBlend1));
            }
            return(0);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        protected override void SetAdvanced(CASEyebrows panel)
        {
            Slider slider = panel.GetChildByID(0x5db9715, true) as Slider;

            slider.MinValue = 0x0;
            slider.MaxValue = 256 * NRaas.MasterController.Settings.mSliderMultiple;

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

            foreach (BlendUnit unit in list)
            {
                if ((unit.Region == FacialBlendRegions.Eyelashes) && (unit.Category == FacialBlendCategories.Global))
                {
                    FacialBlendData facialBlendData = panel.GetFacialBlendData(unit);

                    slider.Value = (int)Math.Round((double)(facialBlendData.Value * 256f));
                    break;
                }
            }
        }
Ejemplo n.º 6
0
 public static void SetValue(SimBuilder builder, FacialBlendData unit, float value)
 {
     if (unit.mBlend2 == null)
     {
         if (value < 0)
         {
             value = 0;
         }
         SetBlendAmount(builder, unit.mBlend1, value);
     }
     else if (value >= 0)
     {
         SetBlendAmount(builder, unit.mBlend1, value);
         SetBlendAmount(builder, unit.mBlend2, 0);
     }
     else
     {
         SetBlendAmount(builder, unit.mBlend1, 0);
         SetBlendAmount(builder, unit.mBlend2, -value);
     }
 }
Ejemplo n.º 7
0
 public static void SetValue(SimBuilder builder, FacialBlendData unit, float value)
 {
     if (unit.mBlend2 == null)
     {
         if (value < 0)
         {
             value = 0;
         }
         SetBlendAmount(builder, unit.mBlend1, value);
     }
     else if (value >= 0)
     {
         SetBlendAmount(builder, unit.mBlend1, value);
         SetBlendAmount(builder, unit.mBlend2, 0);
     }
     else
     {
         SetBlendAmount(builder, unit.mBlend1, 0);
         SetBlendAmount(builder, unit.mBlend2, -value);
     }
 }
Ejemplo n.º 8
0
        public static float GetValue(SimBuilder builder, FacialBlendData unit)
        {
            if (unit.mBlend2 != null)
            {
                float num2 = GetBlendAmount(builder, unit.mBlend2);
                if (num2 > 0f)
                {
                    return -num2;
                }
            }

            if (unit.mBlend1 != null)
            {
                return GetBlendAmount(builder, unit.mBlend1);
            }
            return 0;
        }
Ejemplo n.º 9
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++;
                    }
                }
            }
        }