123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- 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<WFCheckBox>(this.OnClickCheckBoxMunePhysics));
- }
- if (this.CheckBoxMuneRPhysics != null)
- {
- this.CheckBoxMuneRPhysics.onClick.Add(new Action<WFCheckBox>(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<string, string> maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid);
- foreach (KeyValuePair<IKManager.BoneType, WFCheckBox> keyValuePair in this.data_dic_)
- {
- maidStoreData["rotate_visible_" + keyValuePair.Key.ToString()] = false.ToString();
- keyValuePair.Value.check = false;
- foreach (Action<WFCheckBox> action in keyValuePair.Value.onClick)
- {
- action(keyValuePair.Value);
- }
- }
- }
- public void AllCheckBoxEnabled(bool enabled)
- {
- foreach (KeyValuePair<IKManager.BoneType, WFCheckBox> 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<string, string> 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<string, string> maidStoreData = this.pose_edit_window_.GetMaidStoreData(maid);
- foreach (KeyValuePair<IKManager.BoneType, WFCheckBox> 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<IKManager.BoneType, WFCheckBox> keyValuePair in this.data_dic_)
- {
- keyValuePair.Value.check = false;
- }
- return;
- }
- Dictionary<string, string> maidStoreData = this.pose_edit_window_.GetMaidStoreData(this.mgr.select_maid);
- foreach (KeyValuePair<IKManager.BoneType, WFCheckBox> 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<string, string> 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<IKManager.BoneType, WFCheckBox> 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<string, string> 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<string, string> 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<IKManager.BoneType, WFCheckBox> 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<IKManager.BoneType, WFCheckBox>.Enumerator enumerator = this.data_dic_.GetEnumerator())
- {
- if (enumerator.MoveNext())
- {
- KeyValuePair<IKManager.BoneType, WFCheckBox> 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<IKManager.BoneType, WFCheckBox> data_dic_ = new Dictionary<IKManager.BoneType, WFCheckBox>();
- private PoseEditWindow pose_edit_window_;
- [Serializable]
- public class Data
- {
- public IKManager.BoneType BoneType;
- public WFCheckBox CheckBox;
- }
- }
|