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++; } } } }
private new void PopulateDestinationGrids(List <IDestinationInfo> destinations) { foreach (IDestinationInfo info in destinations) { WindowBase windowByExportID = UIManager.LoadLayout(ResourceKey.CreateUILayoutKey("TripPlannerDestinationEntry", 0x0)).GetWindowByExportID(0x1); if (windowByExportID != null) { windowByExportID.TooltipText = info.Name; Window childByID = windowByExportID.GetChildByID(0xa0, true) as Window; // Stops the game from darkening the image using a transperancy childByID.ShadeColor = new Color(0xffffffff); ImageDrawable drawable = childByID.Drawable as ImageDrawable; if (drawable != null) { drawable.Image = WorldData.GetConfirmImage(info.Index); childByID.Invalidate(); } mDestinationGrid.AddItem(new ItemGridCellItem(windowByExportID, info)); } } mDestinationGrid.SelectedItem = 0x0; UpdateDestination(mDestinationGrid.SelectedTag as IDestinationInfo); }
private static void PopulateTypesGrid(CASHair ths) { if (ths == null) { return; } ICASModel cASModel = Responder.Instance.CASModel; Color[] colors = new Color[] { new Color(0x0), new Color(0x0), new Color(0x0), new Color(0x0) }; ths.mHairTypesGrid.Clear(); CASPart wornPart = ths.GetWornPart(); ResourceKey resKey = ResourceKey.CreateUILayoutKey("GenericCasItem", 0x0); bool isHat = false; bool flag = false; if (ths.mHairType == CASHair.HairType.Hat) { ths.mHatsShareButton.Enabled = false; ths.mHatsDeleteButton.Enabled = false; ths.mDesignButton.Enabled = CASHair.PartIsHat(wornPart); isHat = true; } bool shouldEnableCatalogProductFilter = false; List <object> objectList = Responder.Instance.StoreUI.GetCASFeaturedStoreItems(BodyTypes.Hair, cASModel.OutfitCategory, (cASModel.Age | cASModel.Species) | cASModel.Gender, isHat); ths.mContentTypeFilter.FilterObjects(objectList, out shouldEnableCatalogProductFilter); if (!MasterController.Settings.mCompactHatCAS) { foreach (object obj2 in objectList) { IFeaturedStoreItem item = obj2 as IFeaturedStoreItem; if ((ths.mHairType == CASHair.HairType.Hat) == (0x0 != (item.CategoryFlags & 0x400000))) { WindowBase windowByExportID = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (windowByExportID != null) { windowByExportID.Tag = item; windowByExportID.GetChildByID(0x23, true); Window childByID = windowByExportID.GetChildByID(0x20, true) as Window; if (childByID != null) { ImageDrawable drawable = childByID.Drawable as ImageDrawable; if (drawable != null) { drawable.Image = UIUtils.GetUIImageFromThumbnailKey(item.ThumbKey); childByID.Invalidate(); } } childByID = windowByExportID.GetChildByID(0x300, true) as Window; childByID.Tag = item; childByID.CreateTooltipCallbackFunction = ths.StoreItemCreateTooltip; childByID.Visible = true; childByID = windowByExportID.GetChildByID(0x303, true) as Window; childByID.Visible = item.IsSale; Button button = windowByExportID.GetChildByID(0x301, true) as Button; button.Caption = item.PriceString; button.Tag = windowByExportID; button.Click += ths.OnBuyButtonClick; button.FocusAcquired += ths.OnBuyButtonFocusAcquired; button.FocusLost += ths.OnBuyButtonFocusLost; ths.mHairTypesGrid.AddItem(new ItemGridCellItem(windowByExportID, item)); } } } } foreach (CASPart part2 in ths.mPartsList) { bool isWardrobePart = Responder.Instance.CASModel.ActiveWardrobeContains(part2); uint num3 = CASUtils.PartDataNumPresets(part2.Key); ResourceKeyContentCategory customContentType = UIUtils.GetCustomContentType(part2.Key); if (!UIUtils.IsContentTypeDisabled(UIUtils.GetCustomContentType(part2.Key))) { ObjectDesigner.SetCASPart(part2.Key); string designPreset = ObjectDesigner.GetDesignPreset(ObjectDesigner.GetDesignPresetIndexFromId(ObjectDesigner.DefaultPresetId)); if (string.IsNullOrEmpty(designPreset)) { ResourceKey key2 = new ResourceKey(part2.Key.InstanceId, 0x333406c, part2.Key.GroupId); designPreset = Simulator.LoadXMLString(key2); } CASPartPreset preset = new CASPartPreset(part2, designPreset); string str2 = ""; string str3 = ""; if (wornPart.Key == preset.mPart.Key) { str2 = Responder.Instance.CASModel.GetDesignPreset(wornPart); str3 = CASUtils.ReplaceHairColors(str2, colors); } if (preset.Valid && ((ths.mHairType == CASHair.HairType.Hair) || (ObjectDesigner.DefaultPresetId == uint.MaxValue))) { ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((preset.mPart.Key == wornPart.Key) && ((ths.mHairType == CASHair.HairType.Hair) || CASUtils.DesignPresetCompare(str2, designPreset))) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; flag = true; } } if (ths.mHairType == CASHair.HairType.Hat) { if (MasterController.Settings.mCompactHatCAS) { num3 = 1; } for (int i = 0x0; i < num3; i++) { uint presetId = CASUtils.PartDataGetPresetId(part2.Key, (uint)i); customContentType = UIUtils.GetCustomContentType(part2.Key, presetId); preset = new CASPartPreset(part2, presetId, CASUtils.PartDataGetPreset(part2.Key, (uint)i)); if (preset.Valid) { bool flag4 = ths.AddHairTypeGridItem(ths.mHairTypesGrid, resKey, preset, isWardrobePart, ref shouldEnableCatalogProductFilter); if ((wornPart.Key == preset.mPart.Key) && CASUtils.DesignPresetCompare(str3, CASUtils.ReplaceHairColors(preset.mPresetString, colors))) { ths.mSavedPresetId = preset.mPresetId; flag = true; if (flag4) { ths.mHairTypesGrid.SelectedItem = ths.mHairTypesGrid.Count - 1; if (ObjectDesigner.IsUserDesignPreset((uint)i)) { ths.mHatsShareButton.Enabled = true; ths.mHatsDeleteButton.Enabled = true; } } } } } } } } ths.mHairTypesGrid.Tag = shouldEnableCatalogProductFilter; if (ths.mHairStylesGrid.Tag == null) { ths.mHairStylesGrid.Tag = false; } ths.mSortButton.Tag = ((bool)ths.mHairTypesGrid.Tag) ? (true) : (bool)ths.mHairStylesGrid.Tag; if (flag) { ths.mSaveButton.Enabled = false; } else if ((ths.mHairType == CASHair.HairType.Hat) && CASHair.PartIsHat(wornPart)) { WindowBase win = UIManager.LoadLayout(resKey).GetWindowByExportID(0x1); if (win != null) { Window window2 = win.GetChildByID(0x20, true) as Window; if (window2 != null) { window2.Visible = false; } window2 = win.GetChildByID(0x24, true) as Window; if (window2 != null) { window2.Visible = true; } ths.mHairTypesGrid.AddTempItem(new ItemGridCellItem(win, null)); } ths.mSaveButton.Enabled = true; } ths.mUndoOnDelete = false; ths.mContentTypeFilter.UpdateFilterButtonState(); }
protected override bool OnPerform() { RelationshipsPanel panel = RelationshipsPanel.Instance; if (panel == null) { return(true); } if (!panel.Visible) { return(true); } if (panel.mHudModel != null) { if (!(panel.mHudModel is HudModelProxy)) { panel.mHudModel.SimChanged -= panel.OnSimChanged; panel.mHudModel.SimAgeChanged -= panel.OnSimAgeChanged; panel.mHudModel.CareerUpdated -= panel.OnCareerUpdated; panel.mHudModel.OccultUpdated -= panel.OnOccultChanged; panel.mHudModel.RelationshipsChanged -= panel.OnRelationshipsChanged; panel.mHudModel.SimAppearanceChanged -= panel.OnSimAppearanceChanged; panel.mHudModel.VisitorsChanged -= panel.OnVisitorsChanged; panel.mHudModel.SimCurrentWorldChanged -= panel.OnSimCurrentWorldChanged; panel.mHudModel = new HudModelProxy(panel.mHudModel); panel.mHudModel.SimChanged += panel.OnSimChanged; panel.mHudModel.SimAgeChanged += panel.OnSimAgeChanged; panel.mHudModel.CareerUpdated += panel.OnCareerUpdated; panel.mHudModel.OccultUpdated += panel.OnOccultChanged; panel.mHudModel.RelationshipsChanged += panel.OnRelationshipsChanged; panel.mHudModel.SimAppearanceChanged += panel.OnSimAppearanceChanged; panel.mHudModel.VisitorsChanged += panel.OnVisitorsChanged; panel.mHudModel.SimCurrentWorldChanged += panel.OnSimCurrentWorldChanged; panel.Repopulate(panel.mHudModel.CurrentRelationships); } } if ((panel.mRelItemGrid != null) && (panel.mRelItemGrid.mGrid != null)) { for (int i = 0; i < panel.mRelItemGrid.mGrid.ColumnCount; i++) { WindowBase window = panel.mRelItemGrid.mGrid.GetCellWindow(i, 0); Window childByID = window.GetChildByID(0x2, true) as Window; childByID.MouseUp -= panel.OnSimOnLotMouseUp; childByID.MouseUp -= panel.OnSimNotOnLotMouseUp; childByID.MouseUp -= OnSimMouseUp; childByID.MouseUp += OnSimMouseUp; float value = 0; FillBarController controller = window.GetChildByID(0x5, true) as FillBarController; if (controller != null) { value = controller.Value; } childByID = window.GetChildByID(0x24, true) as Window; if (childByID != null) { if ((childByID.TooltipText != null) && (!childByID.TooltipText.EndsWith(")"))) { childByID.TooltipText += " (" + EAText.GetNumberString(value) + ")"; } } } } return(true); }