private void UpdatePawn(object sender, object value) { if (sender != null) { Pawn pawn = this.dresserDto.Pawn; if (sender is ApparelColorSelectionDTO) { if (this.ApparelWithColorChange != null) { ApparelColorSelectionDTO dto = (ApparelColorSelectionDTO)sender; CompColorableUtility.SetColor(dto.Apparel, dto.SelectedColor, true); if (!this.ApparelWithColorChange.Contains(dto.Apparel)) { this.ApparelWithColorChange.Add(dto.Apparel); } } } if (sender is BodyTypeSelectionDTO) { pawn.story.bodyType = (BodyTypeDef)value; } else if (sender is GenderSelectionDTO) { pawn.gender = (Gender)value; } else if (sender is HairColorSelectionDTO) { pawn.story.hairColor = (Color)value; } else if (sender is HairStyleSelectionDTO) { pawn.story.hairDef = (HairDef)value; } else if (sender is HeadTypeSelectionDTO) { if (value.ToString().IndexOf("Narrow") >= 0 || value.ToString().IndexOf("narrow") >= 0) { dresserDto.Pawn.story.crownType = CrownType.Narrow; } else { dresserDto.Pawn.story.crownType = CrownType.Average; } typeof(Pawn_StoryTracker).GetField("headGraphicPath", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(dresserDto.Pawn.story, value); } else if (sender is SliderWidgetDTO) { pawn.story.melanin = (float)value; } } rerenderPawn = true; }
private void UpdatePawn(object sender, object value) { if (sender != null) { Pawn pawn = this.dresserDto.Pawn; if (sender is ApparelColorSelectionDTO) { ApparelColorSelectionDTO dto = (ApparelColorSelectionDTO)sender; CompColorableUtility.SetColor(dto.Apparel, dto.SelectedColor, true); } if (sender is BodyTypeSelectionDTO) { pawn.story.bodyType = (BodyType)value; } else if (sender is GenderSelectionDTO) { pawn.gender = (Gender)value; } else if (sender is HairColorSelectionDTO) { pawn.story.hairColor = (Color)value; } else if (sender is HairStyleSelectionDTO) { pawn.story.hairDef = (HairDef)value; } else if (sender is HeadTypeSelectionDTO) { typeof(Pawn_StoryTracker).GetField("headGraphicPath", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(dresserDto.Pawn.story, value); } else if (sender is SliderWidgetDTO) { pawn.story.melanin = (float)value; } } rerenderPawn = true; }
public static void AddAppararelColorSelectionWidget(float left, float top, float width, ApparelColorSelectionsContainer apparelSelectionsContainer, ClearColorLayers clearColorLayers) { Text.Anchor = TextAnchor.MiddleCenter; if (apparelSelectionsContainer.Count == 0) { GUI.Label(new Rect(left, top, width, SelectionRowHeight), "ChangeMirror.NoClothingIsWorn".Translate(), MiddleCenter); } else { const float cellHeight = 40f; Rect apparelListRect = new Rect(left, top, width, 250f); Rect apparelScrollRect = new Rect(0f, 0f, width - 16f, apparelSelectionsContainer.Count * cellHeight + SelectionRowHeight); GUI.BeginGroup(apparelListRect); scrollPos = GUI.BeginScrollView(new Rect(GenUI.AtZero(apparelListRect)), scrollPos, apparelScrollRect); GUI.color = Color.white; Text.Font = GameFont.Small; if (Widgets.ButtonText(new Rect(10, 0, 100, SelectionRowHeight), "ChangeMirror.SelectAll".Translate())) { apparelSelectionsContainer.SelectAll(); } if (Widgets.ButtonText(new Rect(apparelScrollRect.width - 140, 0, 100, SelectionRowHeight), "ChangeMirror.DeselectAll".Translate())) { apparelSelectionsContainer.DeselectAll(); } if (clearColorLayers != null && Widgets.ButtonText(new Rect(apparelScrollRect.width - SelectionRowHeight, 0, SelectionRowHeight, SelectionRowHeight), "X")) { clearColorLayers(); } Text.Font = GameFont.Medium; for (int i = 0; i < apparelSelectionsContainer.Count; ++i) { ApparelColorSelectionDTO dto = apparelSelectionsContainer[i]; Apparel apparel = dto.Apparel; GUI.BeginGroup(new Rect(0, SelectionRowHeight + 5f + i * cellHeight, apparelListRect.width, cellHeight)); Widgets.ThingIcon(new Rect(0f, 0f, 40f, cellHeight), apparel); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; Rect textRect = new Rect(45f, 0f, apparelScrollRect.width - 90f, cellHeight); if (apparelSelectionsContainer.IsSelected(dto)) { GUI.color = Color.white; } else { GUI.color = Color.gray; } Widgets.Label(textRect, new GUIContent(apparel.Label, "ChangeMirror.SelectMultipleApparel".Translate())); if (Widgets.ButtonInvisible(textRect, false)) { apparelSelectionsContainer.Select(dto, Event.current.shift); } GUI.color = Color.white; if (Widgets.ButtonImage(new Rect(apparelScrollRect.width - 40f, 0, 32f, 16f), copyIconTexture)) { apparelSelectionsContainer.CopyColor = apparel.DrawColor; } if (apparelSelectionsContainer.CopyColorSelected) { if (Widgets.ButtonImage(new Rect(apparelScrollRect.width - 40f, 16f, 32f, 16f), pasteIconTexture)) { dto.SelectedColor = apparelSelectionsContainer.CopyColor; } } GUI.EndGroup(); } GUI.EndScrollView(); GUI.EndGroup(); /*if (Settings.UseColorPickerV2) * { * AddColorSelectorV2Widget(left, top + apparelListRect.height + 10f, width, apparelSelectionsContainer.SelectedApparel, apparelSelectionsContainer.ColorPresetsDTO); * } * else * {*/ AddColorSelectorWidget(left, top + apparelListRect.height + 10f, width, apparelSelectionsContainer.SelectedApparel, apparelSelectionsContainer.ColorPresetsDTO); //} } Text.Anchor = TextAnchor.UpperLeft; }
private void UpdatePawn(object sender, object value) { if (sender != null) { Pawn pawn = this.dresserDto.Pawn; if (sender is ApparelColorSelectionDTO) { if (this.ApparelWithColorChange == null) { this.ApparelWithColorChange = new List <Apparel>(); } ApparelColorSelectionDTO dto = (ApparelColorSelectionDTO)sender; CompColorableUtility.SetColor(dto.Apparel, dto.SelectedColor, true); if (!this.ApparelWithColorChange.Contains(dto.Apparel)) { this.ApparelWithColorChange.Add(dto.Apparel); } } else if (sender is ApparelLayerColorSelectionDTO) { if (this.ApparelWithColorChange == null) { this.ApparelWithColorChange = new List <Apparel>(); } ApparelLayerColorSelectionDTO dto = (ApparelLayerColorSelectionDTO)sender; foreach (Apparel a in this.dresserDto.Pawn.apparel.WornApparel) { Color c = a.DrawColor; if (a.DrawColor != c && !this.ApparelWithColorChange.Contains(a)) { this.ApparelWithColorChange.Add(a); } } } else if (sender is BodyTypeSelectionDTO) { pawn.story.bodyType = (BodyTypeDef)value; } else if (sender is GenderSelectionDTO) { pawn.gender = (Gender)value; } else if (sender is HairColorSelectionDTO) { if ((sender as HairColorSelectionDTO).IsGradientEnabled) { GradientHairColorUtil.SetGradientHair(pawn, true, (Color)value); } else { pawn.story.hairColor = (Color)value; } } else if (sender is HairStyleSelectionDTO) { pawn.story.hairDef = (HairDef)value; } else if (sender is HeadTypeSelectionDTO) { dresserDto.SetCrownType(value); } else if (sender is SliderWidgetDTO) { pawn.story.melanin = (float)value; } } rerenderPawn = true; }
private void UpdatePawn(object sender, object value) { if (sender != null) { Pawn pawn = this.dresserDto.Pawn; if (sender is ApparelColorSelectionDTO) { if (this.ApparelWithColorChange == null) { this.ApparelWithColorChange = new List <Apparel>(); } ApparelColorSelectionDTO dto = (ApparelColorSelectionDTO)sender; CompColorableUtility.SetColor(dto.Apparel, dto.SelectedColor, true); if (!this.ApparelWithColorChange.Contains(dto.Apparel)) { this.ApparelWithColorChange.Add(dto.Apparel); } } else if (sender is ApparelLayerColorSelectionDTO) { if (this.ApparelWithColorChange == null) { this.ApparelWithColorChange = new List <Apparel>(); } ApparelLayerColorSelectionDTO dto = (ApparelLayerColorSelectionDTO)sender; dto.PawnOutfitTracker.SetLayerColor(dto.ApparelLayerDef, dto.SelectedColor); foreach (Apparel a in this.dresserDto.Pawn.apparel.WornApparel) { Color c = a.DrawColor; dto.PawnOutfitTracker.ApplyApparelColor(a); if (a.DrawColor != c && !this.ApparelWithColorChange.Contains(a)) { this.ApparelWithColorChange.Add(a); } } } else if (sender is BodyTypeSelectionDTO) { pawn.story.bodyType = (BodyTypeDef)value; } else if (sender is GenderSelectionDTO) { pawn.gender = (Gender)value; } else if (sender is HairColorSelectionDTO) { if ((sender as HairColorSelectionDTO).IsGradientEnabled) { GradientHairColorUtil.SetGradientHair(pawn, true, (Color)value); } else { pawn.story.hairColor = (Color)value; } } else if (sender is HairStyleSelectionDTO) { pawn.story.hairDef = (HairDef)value; } else if (sender is HeadTypeSelectionDTO) { if (value.ToString().IndexOf("Narrow") >= 0 || value.ToString().IndexOf("narrow") >= 0) { dresserDto.Pawn.story.crownType = CrownType.Narrow; } else { dresserDto.Pawn.story.crownType = CrownType.Average; } typeof(Pawn_StoryTracker).GetField("headGraphicPath", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(dresserDto.Pawn.story, value); } else if (sender is SliderWidgetDTO) { pawn.story.melanin = (float)value; } } rerenderPawn = true; }