using System; using System.Collections.Generic; using UnityEngine; using wf; public class FaceWindow : BaseMaidPhotoWindow { public override void Awake() { base.Awake(); PhotoFaceData.Create(); this.noCharaActive = base.GetComponentInChildren(); Dictionary>> dictionary = new Dictionary>>(); foreach (KeyValuePair> keyValuePair in PhotoFaceData.category_list) { if (!dictionary.ContainsKey(keyValuePair.Key)) { dictionary.Add(keyValuePair.Key, new List>()); } for (int i = 0; i < keyValuePair.Value.Count; i++) { dictionary[keyValuePair.Key].Add(new KeyValuePair(keyValuePair.Value[i].name, keyValuePair.Value[i])); } } this.PopupAndTabList.SetData(dictionary, false); this.PopupAndTabList.onChangePopUpListValue.Add(new Action>(this.OnChangePopUpList)); this.PopupAndTabList.onSelect.Add(new Action(this.OnSelectItem)); this.SliderFaceToX.onChangeValue.Add(new Action(this.OnChangeSliderXValue)); this.SliderFaceToY.onChangeValue.Add(new Action(this.OnChangeSliderYValue)); this.CheckBoxEyeToCamera.onClick.Add(new Action(this.OnClickCheckBox)); this.CheckBoxFaceToCamera.onClick.Add(new Action(this.OnClickCheckBox)); this.CheckOpenMouse.onClick.Add(new Action(this.OnClickCheckBox)); this.CheckMorphWindowVisible.onClick.Add(delegate(WFCheckBox check_box) { this.MorphSubWindow.visible = check_box.check; }); UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent().enabled = false; } public override void Start() { base.Start(); this.placement_window_ = (base.mgr.GetWindow(PhotoWindowManager.WindowType.Placement) as PlacementWindow); this.motion_window_ = (base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow); this.man_edit_mgr_ = new PhotoManEditManager(); List[] array = new List[] { this.man_edit_mgr_.man_head_menu_list, this.man_edit_mgr_.man_body_menu_list }; UIWFTabPanel[] array2 = new UIWFTabPanel[] { this.HeadItemTabPanel, this.BodyItemTabPanel }; EventDelegate.Callback[] array3 = new EventDelegate.Callback[] { new EventDelegate.Callback(this.OnSelectManHeadItem), new EventDelegate.Callback(this.OnSelectManHeadItem) }; for (int i = 0; i < array.Length; i++) { UIWFTabPanel uiwftabPanel = array2[i]; EventDelegate.Callback callback = array3[i]; foreach (SceneEdit.SMenuItem smenuItem in array[i]) { GameObject gameObject = Utility.CreatePrefab(uiwftabPanel.gameObject, "ScenePhotoMode/EditItemIcon", true); if (smenuItem.m_texIcon != null) { Sprite sprite2D = Sprite.Create(smenuItem.m_texIcon, new Rect(0f, 0f, (float)smenuItem.m_texIcon.width, (float)smenuItem.m_texIcon.height), default(Vector2)); UI2DSprite componentInChildren = gameObject.GetComponentInChildren(); componentInChildren.sprite2D = sprite2D; componentInChildren.SetDimensions(60, 60); } UIWFTabButton component = gameObject.GetComponent(); component.name = smenuItem.m_nMenuFileRID.ToString(); EventDelegate.Add(component.onSelect, callback); } Utility.ResetNGUI(uiwftabPanel.GetComponent()); Utility.ResetNGUI(uiwftabPanel.transform.parent.GetComponent()); uiwftabPanel.UpdateChildren(); } this.UpdateChildren(); WFCheckBox checkBoxEyeToCamera = this.CheckBoxEyeToCamera; bool flag = false; this.SliderFaceToY.enabled = flag; flag = flag; this.SliderFaceToX.enabled = flag; flag = flag; this.CheckOpenMouse.enabled = flag; flag = flag; this.CheckBoxFaceToCamera.enabled = flag; checkBoxEyeToCamera.enabled = flag; this.add_option_dic_ = new Dictionary(); Transform transform = UTY.GetChildObject(this.content_game_object.gameObject, "ContentParent/AddOption/Btns", false).transform; for (int j = 0; j < transform.childCount; j++) { WFCheckBox component2 = transform.GetChild(j).GetComponent(); component2.check = false; component2.enabled = false; this.add_option_dic_.Add(component2.GetComponentInChildren().text, component2); component2.onClick.Add(new Action(this.OnClickCheckBoxAddOption)); } this.CheckOpenMouse.check = false; WFCheckBox checkMorphWindowVisible = this.CheckMorphWindowVisible; flag = false; this.CheckMorphWindowVisible.enabled = flag; checkMorphWindowVisible.check = flag; this.MorphSubWindow.gameObject.SetActive(true); this.MorphSubWindow.SetButtonEnabled(BasePhotoSubWindow.BtnType.End, true, false); this.MorphSubWindow.GetButtonOnClickEventList(BasePhotoSubWindow.BtnType.End).Add(delegate { this.CheckMorphWindowVisible.check = false; foreach (Action action in this.CheckMorphWindowVisible.onClick) { action(this.CheckMorphWindowVisible); } }); this.ContentParentMan.SetActive(false); this.FaceMorphInput.SetFaceWindow(this); this.noCharaActive.ChangeMode(true, true); } public void OnDestroy() { if (this.man_edit_mgr_ != null) { this.man_edit_mgr_.Destroy(); } this.man_edit_mgr_ = null; } public void OnClickCheckBoxAddOption(WFCheckBox check_box) { Dictionary maidStoreData = base.GetMaidStoreData(base.mgr.select_maid); string[] array = new string[] { "頬染め1", "頬染め2", "頬染め3" }; string[] array2 = new string[] { "涙1", "涙2", "涙3" }; string[][] array3 = new string[][] { array, array2 }; foreach (KeyValuePair keyValuePair in this.add_option_dic_) { if (keyValuePair.Value == check_box) { maidStoreData[keyValuePair.Key] = check_box.check.ToString(); foreach (string array4 in array3) { if (0 <= Array.IndexOf(array4, keyValuePair.Key)) { for (int j = 0; j < array4.Length; j++) { if (!(array4[j] == keyValuePair.Key)) { if (this.add_option_dic_[array4[j]].check) { this.add_option_dic_[array4[j]].check = false; } maidStoreData[array4[j]] = false.ToString(); } } } } } } this.UpdateMaidAddOption(); } public void OnClickCheckBox(WFCheckBox check_box) { if (base.mgr.select_maid == null) { return; } Dictionary maidStoreData = base.GetMaidStoreData(base.mgr.select_maid); if (check_box == this.CheckBoxEyeToCamera) { maidStoreData["eye_to_camera"] = check_box.check.ToString(); } else if (check_box == this.CheckBoxFaceToCamera) { maidStoreData["face_to_camera"] = check_box.check.ToString(); } else if (check_box == this.CheckOpenMouse) { maidStoreData["open_mouse"] = check_box.check.ToString(); } WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX; bool enabled = !this.CheckBoxFaceToCamera.check; this.SliderFaceToY.enabled = enabled; sliderFaceToX.enabled = enabled; this.Apply(base.mgr.select_maid); } public void UpdateMaidAddOption() { if (base.mgr.select_maid == null) { return; } this.Apply(base.mgr.select_maid); } public void OnChangeSliderXValue(WindowPartsInputSliderSet.SliderAndInputSet obj, float val) { if (base.mgr.select_maid == null) { return; } Dictionary maidStoreData = base.GetMaidStoreData(base.mgr.select_maid); maidStoreData["face_to_x"] = val.ToString("G9"); WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX; bool enabled = !this.CheckBoxFaceToCamera.check; this.SliderFaceToY.enabled = enabled; sliderFaceToX.enabled = enabled; this.Apply(base.mgr.select_maid); } public void OnChangeSliderYValue(WindowPartsInputSliderSet.SliderAndInputSet obj, float val) { if (base.mgr.select_maid == null) { return; } Dictionary maidStoreData = base.GetMaidStoreData(base.mgr.select_maid); maidStoreData["face_to_y"] = val.ToString("G9"); WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX; bool enabled = !this.CheckBoxFaceToCamera.check; this.SliderFaceToY.enabled = enabled; sliderFaceToX.enabled = enabled; this.Apply(base.mgr.select_maid); } public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load) { base.OnMaidAddEvent(maid, is_deserialize_load); Dictionary maidStoreData = base.GetMaidStoreData(maid); if (maid.boMAN) { this.man_controller_ = new PhotoManEditManager.Controller(maid); if (!is_deserialize_load) { maidStoreData.Add("color", this.man_controller_.color.ToString()); maidStoreData.Add("fat", this.man_controller_.fat.ToString("G9")); maidStoreData.Add("parts_visible", true.ToString()); maidStoreData.Add("head_menu_rid", this.man_controller_.head_menu_rid.ToString()); maidStoreData.Add("body_menu_rid", this.man_controller_.body_menu_rid.ToString()); } else { this.man_controller_.color = Parse.Color(maidStoreData["color"]); this.man_controller_.fat = float.Parse(maidStoreData["fat"]); this.man_controller_.parts_visible = bool.Parse(maidStoreData["parts_visible"]); int num = int.Parse(maidStoreData["head_menu_rid"]); foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list) { if (num == smenuItem.m_nMenuFileRID) { this.man_controller_.SetMenu(smenuItem); break; } } int num2 = int.Parse(maidStoreData["body_menu_rid"]); foreach (SceneEdit.SMenuItem smenuItem2 in this.man_edit_mgr_.man_head_menu_list) { if (num2 == smenuItem2.m_nMenuFileRID) { this.man_controller_.SetMenu(smenuItem2); this.motion_window_.UpdateAnimationData(this.man_controller_.man); break; } } } this.man_controller_ = null; return; } maid.FaceBlend("オリジナル"); if (!is_deserialize_load) { maidStoreData.Clear(); maidStoreData.Add("id", PhotoFaceData.init_data.id.ToString()); maidStoreData.Add("eye_to_camera", true.ToString()); maidStoreData.Add("face_to_camera", true.ToString()); maidStoreData.Add("face_to_x", 0.ToString()); maidStoreData.Add("face_to_y", 0.ToString()); maidStoreData.Add("open_mouse", false.ToString()); foreach (KeyValuePair keyValuePair in this.add_option_dic_) { maidStoreData.Add(keyValuePair.Key, false.ToString()); } } else if (!maidStoreData.ContainsKey("open_mouse")) { maidStoreData.Add("open_mouse", false.ToString()); } this.FaceMorphInput.OnMaidAddEvent(maid, is_deserialize_load, maidStoreData); maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f); this.Apply(maid); } public override void OnMaidChangeEvent(Maid maid) { base.OnMaidChangeEvent(maid); this.PopupAndTabList.ResetSelect(); this.PopupAndTabList.gameObject.SetActive(true); this.ContentParentMan.SetActive(false); if (maid == null || maid.boMAN) { if (maid == null) { this.noCharaActive.ChangeMode(true, true); } else { this.noCharaActive.ChangeMode(false, true); } this.MorphSubWindow.gameObject.SetActive(false); WFCheckBox checkMorphWindowVisible = this.CheckMorphWindowVisible; bool flag = false; this.CheckMorphWindowVisible.check = flag; checkMorphWindowVisible.enabled = flag; UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent().enabled = false; this.head_transform_ = null; this.PopupAndTabList.popup_value_list = null; this.PopupAndTabList.SetPopupValue(this.PopupAndTabList.popup_value_list[0].Key); WFCheckBox checkBoxEyeToCamera = this.CheckBoxEyeToCamera; flag = false; this.SliderFaceToY.enabled = flag; flag = flag; this.SliderFaceToX.enabled = flag; flag = flag; this.CheckOpenMouse.enabled = flag; flag = flag; this.CheckBoxFaceToCamera.enabled = flag; checkBoxEyeToCamera.enabled = flag; foreach (KeyValuePair keyValuePair in this.add_option_dic_) { WFCheckBox value2 = keyValuePair.Value; flag = false; keyValuePair.Value.enabled = flag; value2.check = flag; } this.CheckOpenMouse.check = false; if (maid != null && maid.boMAN) { this.PopupAndTabList.gameObject.SetActive(false); this.ContentParentMan.SetActive(true); PlacementWindow.ManDataBackup manDataBackup = this.placement_window_.man_backup_data_dic[maid.status.guid]; Dictionary store_data = base.GetMaidStoreData(maid); this.man_controller_ = new PhotoManEditManager.Controller(maid); this.ManColor.onChangeValue.Clear(); this.ManColor.ResetNum = manDataBackup.color; this.ManColor.ColorPalette.SetColor(Parse.Color(store_data["color"])); Action item = delegate(WindowPartsInputColorrPalette parent, Color color) { if (this.man_controller_ != null) { this.man_controller_.color = color; } store_data["color"] = color.ToString(); }; this.ManColor.onChangeValue.Add(item); PhotoSliderAndInput sliderAndInput = this.ManFat.GetSliderAndInput("fat"); sliderAndInput.onChangeValue.Clear(); sliderAndInput.ResetNum = manDataBackup.fat; sliderAndInput.value = float.Parse(store_data["fat"]); Action item2 = delegate(float value) { if (this.man_controller_ != null) { this.man_controller_.fat = value; } store_data["fat"] = value.ToString("G9"); }; sliderAndInput.onChangeValue.Add(item2); this.PartVisibleCheckBox.onClick.Clear(); this.PartVisibleCheckBox.check = bool.Parse(store_data["parts_visible"]); Action item3 = delegate(WFCheckBox check_box) { bool check = check_box.check; if (this.man_controller_ != null) { this.man_controller_.parts_visible = check; } store_data["parts_visible"] = check.ToString(); }; this.PartVisibleCheckBox.onClick.Add(item3); UIWFTabButton[] componentsInChildren = this.HeadItemTabPanel.GetComponentsInChildren(); foreach (UIWFTabButton uiwftabButton in componentsInChildren) { if (uiwftabButton.name == store_data["head_menu_rid"]) { this.HeadItemTabPanel.Select(uiwftabButton); break; } } UIWFTabButton[] componentsInChildren2 = this.BodyItemTabPanel.GetComponentsInChildren(); foreach (UIWFTabButton uiwftabButton2 in componentsInChildren2) { if (uiwftabButton2.name == store_data["body_menu_rid"]) { this.BodyItemTabPanel.Select(uiwftabButton2); break; } } } } else { this.noCharaActive.ChangeMode(false, true); this.MorphSubWindow.gameObject.SetActive(true); this.CheckMorphWindowVisible.enabled = true; this.CheckMorphWindowVisible.check = this.MorphSubWindow.visible; UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent().enabled = true; this.head_transform_ = base.mgr.select_maid.body0.GetBone("Bip01 Head"); WFCheckBox checkBoxEyeToCamera2 = this.CheckBoxEyeToCamera; bool flag = true; this.SliderFaceToY.enabled = flag; flag = flag; this.SliderFaceToX.enabled = flag; flag = flag; this.CheckOpenMouse.enabled = flag; flag = flag; this.CheckBoxFaceToCamera.enabled = flag; checkBoxEyeToCamera2.enabled = flag; Transform transform = UTY.GetChildObject(this.content_game_object.gameObject, "ContentParent/AddOption/Btns", false).transform; for (int k = 0; k < transform.childCount; k++) { transform.GetChild(k).GetComponent().enabled = true; } Dictionary maidStoreData = base.GetMaidStoreData(maid); PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"])); this.PopupAndTabList.popup_value_list = PhotoFaceData.popup_category_list; this.PopupAndTabList.SetPopupValue(photoFaceData.category); this.PopupAndTabList.SetSelectButton(photoFaceData, false); this.CheckBoxEyeToCamera.check = bool.Parse(maidStoreData["eye_to_camera"]); this.CheckBoxFaceToCamera.check = bool.Parse(maidStoreData["face_to_camera"]); this.SliderFaceToX.SetValue("x", float.Parse(maidStoreData["face_to_x"])); this.SliderFaceToY.enabled = true; this.SliderFaceToY.SetValue("y", float.Parse(maidStoreData["face_to_y"])); this.CheckOpenMouse.check = bool.Parse(maidStoreData["open_mouse"]); foreach (KeyValuePair keyValuePair2 in this.add_option_dic_) { keyValuePair2.Value.check = bool.Parse(maidStoreData[keyValuePair2.Key]); } if (this.CheckBoxFaceToCamera.check) { WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX; flag = false; this.SliderFaceToY.enabled = flag; sliderFaceToX.enabled = flag; } this.Apply(base.mgr.select_maid); } } public override void OnMaidRemoveEventPrev(Maid maid) { if (!maid.boMAN) { return; } PlacementWindow.ManDataBackup manDataBackup = this.placement_window_.man_backup_data_dic[maid.status.guid]; PhotoManEditManager.Controller controller = new PhotoManEditManager.Controller(maid); controller.color = manDataBackup.color; controller.fat = manDataBackup.fat; controller.parts_visible = true; foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list) { if (manDataBackup.head_item_rid == smenuItem.m_nMenuFileRID) { controller.SetMenu(smenuItem); break; } } } public void OnSelectManHeadItem() { UIWFSelectButton current = UIWFSelectButton.current; if (this.man_controller_ == null || !current.isSelected) { return; } int num = int.Parse(current.name); foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list) { if (num == smenuItem.m_nMenuFileRID) { this.man_controller_.SetMenu(smenuItem); Dictionary maidStoreData = base.GetMaidStoreData(this.man_controller_.man); maidStoreData["head_menu_rid"] = smenuItem.m_nMenuFileRID.ToString(); break; } } foreach (SceneEdit.SMenuItem smenuItem2 in this.man_edit_mgr_.man_body_menu_list) { if (num == smenuItem2.m_nMenuFileRID) { bool flag = this.man_controller_.SetMenu(smenuItem2); if (flag) { Dictionary maidStoreData2 = this.motion_window_.GetMaidStoreData(this.man_controller_.man); PhotoMotionData motion_data = PhotoMotionData.Get(long.Parse(maidStoreData2["id"])); this.motion_window_.Apply(motion_data, this.man_controller_.man); } Dictionary maidStoreData3 = base.GetMaidStoreData(this.man_controller_.man); maidStoreData3["body_menu_rid"] = smenuItem2.m_nMenuFileRID.ToString(); break; } } } protected void OnChangePopUpList(KeyValuePair popup_val) { } private void OnSelectItem(object select_data_obj) { if (base.mgr.select_maid == null || select_data_obj == null) { return; } PhotoFaceData photoFaceData = select_data_obj as PhotoFaceData; Dictionary maidStoreData = base.GetMaidStoreData(base.mgr.select_maid); maidStoreData["id"] = photoFaceData.id.ToString(); this.FaceMorphInput.ApplyBackupData(base.mgr.select_maid); photoFaceData.Apply(base.mgr.select_maid); this.Apply(base.mgr.select_maid); } private void Apply(Maid maid) { if (maid == null || maid.boMAN) { return; } Dictionary maidStoreData = base.GetMaidStoreData(maid); PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"])); photoFaceData.Apply(maid); TMorph.AddBlendType addBlendType = TMorph.AddBlendType.None; Dictionary dictionary = new Dictionary { { "頬染め1", TMorph.AddBlendType.Cheek1 }, { "頬染め2", TMorph.AddBlendType.Cheek2 }, { "頬染め3", TMorph.AddBlendType.Cheek3 }, { "涙1", TMorph.AddBlendType.Tear1 }, { "涙2", TMorph.AddBlendType.Tear2 }, { "涙3", TMorph.AddBlendType.Tear3 }, { "涙(玉)", TMorph.AddBlendType.TearBig }, { "涎", TMorph.AddBlendType.Yodare }, { "赤面", TMorph.AddBlendType.Blush }, { "ショック", TMorph.AddBlendType.Shock } }; foreach (KeyValuePair keyValuePair in dictionary) { if (maidStoreData.ContainsKey(keyValuePair.Key) && bool.Parse(maidStoreData[keyValuePair.Key])) { addBlendType |= keyValuePair.Value; } } maid.body0.Face.morph.SetValueOriginalBlendSet(addBlendType); if (bool.Parse(maidStoreData["face_to_camera"])) { maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f); } else { Transform bone = maid.body0.GetBone("Bip01 Head"); if (bone.Find("face_to_object") == null) { GameObject gameObject = new GameObject(); gameObject.name = "face_to_object"; gameObject.transform.SetParent(bone); gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = Vector3.one; } Transform transform = bone.Find("face_to_object"); Vector3 localPosition = new Vector3(float.Parse(maidStoreData["face_to_y"]) * -1f * 0.2f, 0.2f, float.Parse(maidStoreData["face_to_x"]) * 0.2f); transform.localPosition = localPosition; maid.EyeToTargetObject(transform, 0f); } maid.OpenMouth(bool.Parse(maidStoreData["open_mouse"])); maid.body0.boEyeToCam = bool.Parse(maidStoreData["eye_to_camera"]); this.FaceMorphInput.SetPhotoFaceData(photoFaceData); this.FaceMorphInput.UpdateGui(maid); } public override void OnDeserializeEvent() { List maidStoreGuidList = base.mgr.GetMaidStoreGuidList(); for (int i = 0; i < maidStoreGuidList.Count; i++) { Dictionary maidStoreData = base.GetMaidStoreData(maidStoreGuidList[i]); if (maidStoreData.Count > 0) { if (maidStoreData.ContainsKey("id")) { PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"])); if (photoFaceData == null) { photoFaceData = PhotoFaceData.init_data; } maidStoreData["id"] = photoFaceData.id.ToString(); } } } } public PopupAndTabList PopupAndTabList; public WFCheckBox CheckBoxEyeToCamera; public WFCheckBox CheckBoxFaceToCamera; public WindowPartsInputSliderSet SliderFaceToX; public WindowPartsInputSliderSet SliderFaceToY; public WFCheckBox CheckOpenMouse; [SerializeField] [Header("モーフオプション")] public BasePhotoSubWindow MorphSubWindow; public WindowPartsFaceMorph FaceMorphInput; public WFCheckBox CheckMorphWindowVisible; [SerializeField] [Header("男オプション")] public GameObject ContentParentMan; public WindowPartsInputColorrPalette ManColor; public WindowPartsInputSliderSet ManFat; public WFCheckBox PartVisibleCheckBox; public UIWFTabPanel HeadItemTabPanel; public UIWFTabPanel BodyItemTabPanel; private PhotoNoCharaActive noCharaActive; private PlacementWindow placement_window_; private MotionWindow motion_window_; private Dictionary add_option_dic_; private Transform head_transform_; private PhotoManEditManager man_edit_mgr_; private PhotoManEditManager.Controller man_controller_; }