using System; using System.Collections.Generic; using UnityEngine; public class WindowPartsBoneCheckBox : MonoBehaviour { public void Awake() { foreach (WindowPartsBoneCheckBox.Data data in this.data) { this.data_dic_.Add(data.BoneType, data.CheckBox); data.CheckBox.name = data.BoneType.ToString(); data.CheckBox.onClick.Add(delegate(WFCheckBox check_box) { this.OnClickCheck((IKManager.BoneType)Enum.Parse(typeof(IKManager.BoneType), check_box.name)); }); } if (this.CheckBoxMuneLPhysics != null) { this.CheckBoxMuneLPhysics.onClick.Add(new Action(this.OnClickCheckBoxMunePhysics)); } if (this.CheckBoxMuneRPhysics != null) { this.CheckBoxMuneRPhysics.onClick.Add(new Action(this.OnClickCheckBoxMunePhysics)); } if (this.BtnAllOFF != null) { EventDelegate.Add(this.BtnAllOFF.onClick, new EventDelegate.Callback(this.AllCheckBoxOFF)); } } public void AllCheckBoxOFF() { if (!this.enabled || this.pose_edit_window_ == null) { return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); foreach (KeyValuePair keyValuePair in this.data_dic_) { maidStoreData["rotate_visible_" + keyValuePair.Key.ToString()] = false.ToString(); keyValuePair.Value.check = false; foreach (Action action in keyValuePair.Value.onClick) { action(keyValuePair.Value); } } } public void AllCheckBoxEnabled(bool enabled) { foreach (KeyValuePair keyValuePair in this.data_dic_) { keyValuePair.Value.enabled = enabled; } } public void OnClickCheckBoxMunePhysics(WFCheckBox check_box) { if (!this.enabled || this.pose_edit_window_ == null) { return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); if (check_box == this.CheckBoxMuneLPhysics) { this.mgr.select_maid.body0.jbMuneL.enabled = !check_box.check; this.mgr.select_maid.body0.MuneYureL((float)((!this.mgr.select_maid.body0.jbMuneL.enabled) ? 0 : 1)); maidStoreData["use_mune_key_l"] = check_box.check.ToString(); } else { this.mgr.select_maid.body0.jbMuneR.enabled = !check_box.check; this.mgr.select_maid.body0.MuneYureR((float)((!this.mgr.select_maid.body0.jbMuneR.enabled) ? 0 : 1)); maidStoreData["use_mune_key_r"] = check_box.check.ToString(); } this.OnMotionUpdate(); } public void OnMaidAddEvent(Maid maid, bool is_deserialize_load) { if (this.pose_edit_window_ == null) { this.pose_edit_window_ = (this.mgr.GetWindow(PhotoWindowManager.WindowType.PoseEdit) as PoseEditWindow); } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(maid); foreach (KeyValuePair keyValuePair in this.data_dic_) { string key = "rotate_visible_" + keyValuePair.Key.ToString(); if (!maidStoreData.ContainsKey(key)) { maidStoreData[key] = false.ToString(); } } } public void ChangeEnabeled(bool use) { if (!use || this.mgr.select_maid == null) { foreach (KeyValuePair keyValuePair in this.data_dic_) { keyValuePair.Value.check = false; } return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); foreach (KeyValuePair keyValuePair2 in this.data_dic_) { keyValuePair2.Value.enabled = true; keyValuePair2.Value.check = bool.Parse(maidStoreData["rotate_visible_" + keyValuePair2.Key.ToString()]); } if (this.CheckBoxMuneLPhysics != null || this.CheckBoxMuneRPhysics != null) { maidStoreData["use_mune_key_l"] = (this.mgr.select_maid.body0.GetMuneYureL() == 0f).ToString(); maidStoreData["use_mune_key_r"] = (this.mgr.select_maid.body0.GetMuneYureR() == 0f).ToString(); this.OnMotionUpdate(); } else { this.Apply(); } } public void OnMotionUpdate() { if (this.pose_edit_window_ == null) { return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); if (this.data_dic_.ContainsKey(IKManager.BoneType.Bust_L)) { if (!bool.Parse(maidStoreData["use_mune_key_l"])) { WFCheckBox wfcheckBox = this.data_dic_[IKManager.BoneType.Bust_L]; bool flag = false; this.data_dic_[IKManager.BoneType.Bust_L].check = flag; wfcheckBox.enabled = flag; maidStoreData["rotate_visible_" + IKManager.BoneType.Bust_L.ToString()] = false.ToString(); } else { this.data_dic_[IKManager.BoneType.Bust_L].enabled = true; } } if (this.data_dic_.ContainsKey(IKManager.BoneType.Bust_R)) { if (!bool.Parse(maidStoreData["use_mune_key_r"])) { WFCheckBox wfcheckBox2 = this.data_dic_[IKManager.BoneType.Bust_R]; bool flag2 = false; this.data_dic_[IKManager.BoneType.Bust_R].check = flag2; wfcheckBox2.enabled = flag2; maidStoreData["rotate_visible_" + IKManager.BoneType.Bust_R.ToString()] = false.ToString(); } else { this.data_dic_[IKManager.BoneType.Bust_R].enabled = true; } } foreach (KeyValuePair keyValuePair in this.data_dic_) { keyValuePair.Value.check = bool.Parse(maidStoreData["rotate_visible_" + keyValuePair.Key.ToString()]); } if (this.CheckBoxMuneLPhysics != null || this.CheckBoxMuneRPhysics != null) { this.CheckBoxMuneLPhysics.check = bool.Parse(maidStoreData["use_mune_key_l"]); this.CheckBoxMuneRPhysics.check = bool.Parse(maidStoreData["use_mune_key_r"]); } this.Apply(); } public void OnClickCheck(IKManager.BoneType bone_type) { WFCheckBox wfcheckBox = this.GetData(bone_type); if (this.mgr.select_maid == null || this.pose_edit_window_ == null) { return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); maidStoreData["rotate_visible_" + bone_type.ToString()] = wfcheckBox.check.ToString(); this.pose_edit_window_.ik_mgr.SetRotateVisibleBone(bone_type, wfcheckBox.check); if (this.BoneSetType == IKManager.BoneSetType.Body || !wfcheckBox.check) { return; } WindowPartsFingerBlend windowPartsFingerBlend = this.pose_edit_window_.GetWindowPartsFingerBlend(this.BoneSetType); if (windowPartsFingerBlend != null && windowPartsFingerBlend.CheckBoxEnabled.check) { windowPartsFingerBlend.OnClickEnter(); } } public void Apply() { if (this.mgr.select_maid == null) { return; } Dictionary maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid); if (!bool.Parse(maidStoreData["use"])) { return; } if (this.BoneSetType == IKManager.BoneSetType.Body) { this.mgr.select_maid.body0.jbMuneL.enabled = !bool.Parse(maidStoreData["use_mune_key_l"]); this.mgr.select_maid.body0.jbMuneR.enabled = !bool.Parse(maidStoreData["use_mune_key_r"]); } if (this.pose_edit_window_.ik_mgr != null) { foreach (KeyValuePair keyValuePair in this.data_dic_) { bool visible = bool.Parse(maidStoreData["rotate_visible_" + keyValuePair.Key.ToString()]); this.pose_edit_window_.ik_mgr.SetRotateVisibleBone(keyValuePair.Key, visible); } } } public new bool enabled { get { using (Dictionary.Enumerator enumerator = this.data_dic_.GetEnumerator()) { if (enumerator.MoveNext()) { KeyValuePair keyValuePair = enumerator.Current; return keyValuePair.Value.enabled; } } return false; } } public WFCheckBox GetData(IKManager.BoneType bone_type) { WFCheckBox result; this.data_dic_.TryGetValue(bone_type, out result); return result; } [HideInInspector] public PhotoWindowManager mgr; public WFCheckBox CheckBoxMuneLPhysics; public WFCheckBox CheckBoxMuneRPhysics; public UIButton BtnAllOFF; public IKManager.BoneSetType BoneSetType; public WindowPartsBoneCheckBox.Data[] data; private Dictionary data_dic_ = new Dictionary(); private PoseEditWindow pose_edit_window_; [Serializable] public class Data { public IKManager.BoneType BoneType; public WFCheckBox CheckBox; } }