123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using I2.Loc;
- using UnityEngine;
- public class PoseEditWindow : BaseMaidPhotoWindow
- {
- public static IKManager GetMaidIKManager(Maid maid)
- {
- GameObject gameObject = GameObject.Find("PoseEditWorkParent");
- if (gameObject == null)
- {
- gameObject = new GameObject("PoseEditWorkParent");
- }
- if (maid == null || maid.boMAN)
- {
- return null;
- }
- GameObject gameObject2 = GameObject.Find("PoseEditWorkParent/" + maid.status.guid);
- if (gameObject2 != null && gameObject2.GetComponent<IKManager>() != null)
- {
- return gameObject2.GetComponent<IKManager>();
- }
- if (gameObject2 == null)
- {
- gameObject2 = new GameObject(maid.status.guid);
- gameObject2.transform.SetParent(gameObject.transform, false);
- }
- IKManager ikmanager = gameObject2.AddComponent<IKManager>();
- ikmanager.SetMaid(maid);
- IEnumerator enumerator = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
- ikmanager.SetRotateVisibleBoneSet(bone_set_type, false);
- ikmanager.SetTransAxisVisibleBoneSet(bone_set_type, false);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- ikmanager.SetTransAxisVisibleRoot(false);
- return ikmanager;
- }
- public override void Awake()
- {
- base.Awake();
- this.noCharaActive = base.GetComponentInChildren<PhotoNoCharaActive>();
- EventDelegate.Add(this.BtnSave.onClick, new EventDelegate.Callback(this.OnBtnSave));
- if (this.BtnReversal != null)
- {
- EventDelegate.Add(this.BtnReversal.onClick, new EventDelegate.Callback(this.OnBtnReversal));
- }
- this.ControlSelectBtnTab.UpdateChildren();
- foreach (UIWFTabButton uiwftabButton in this.ControlSelectBtnTab.button_list)
- {
- EventDelegate.Add(uiwftabButton.onSelect, new EventDelegate.Callback(this.OnSelectControlSelectBtn));
- }
- for (int i = 0; i < this.FingerBlendArray.Length; i++)
- {
- this.FingerBlendArray[i].mgr = base.mgr;
- this.FingerBlendArray[i].OnClickFingerBlendEnabledEvent = delegate(WindowPartsFingerBlend.Type blend_type, bool blend_enabled)
- {
- IKManager.BoneSetType boneSetType = IKManager.BoneSetType.Body;
- WFCheckBox wfcheckBox = null;
- if (blend_type == WindowPartsFingerBlend.Type.RightArm)
- {
- wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_RightArmFinger"];
- boneSetType = IKManager.BoneSetType.RightArmFinger;
- }
- else if (blend_type == WindowPartsFingerBlend.Type.LeftArm)
- {
- wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_LeftArmFinger"];
- boneSetType = IKManager.BoneSetType.LeftArmFinger;
- }
- else if (blend_type == WindowPartsFingerBlend.Type.RightLeg)
- {
- wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_RightLegFinger"];
- boneSetType = IKManager.BoneSetType.RightLegFinger;
- }
- else if (blend_type == WindowPartsFingerBlend.Type.LeftLeg)
- {
- wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_LeftLegFinger"];
- boneSetType = IKManager.BoneSetType.LeftLegFinger;
- }
- if (!blend_enabled)
- {
- wfcheckBox.enabled = true;
- for (int l = 0; l < this.RotateCheckBoxArray.Length; l++)
- {
- if (this.RotateCheckBoxArray[l].BoneSetType == boneSetType)
- {
- this.RotateCheckBoxArray[l].AllCheckBoxEnabled(true);
- }
- }
- return;
- }
- WFCheckBox wfcheckBox2 = wfcheckBox;
- bool flag = false;
- wfcheckBox.enabled = flag;
- wfcheckBox2.check = flag;
- foreach (Action<WFCheckBox> action in wfcheckBox.onClick)
- {
- action(wfcheckBox);
- }
- for (int m = 0; m < this.RotateCheckBoxArray.Length; m++)
- {
- if (this.RotateCheckBoxArray[m].BoneSetType == boneSetType)
- {
- this.RotateCheckBoxArray[m].AllCheckBoxOFF();
- this.RotateCheckBoxArray[m].AllCheckBoxEnabled(false);
- }
- }
- };
- }
- for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
- {
- this.RotateCheckBoxArray[j].mgr = base.mgr;
- }
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body).SetActive(true);
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand).SetActive(true);
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg).SetActive(true);
- List<KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>> list = new List<KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>>();
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Body, new KeyValuePair<string, string>("ik_box_visible_Root", "CheckCenterVisible")));
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Body, new KeyValuePair<string, string>("ik_box_visible_Body", "CheckLimbVisible")));
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Hand, new KeyValuePair<string, string>("ik_box_visible_RightArmFinger", "RightSet/Parent/CheckIKVisible")));
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Hand, new KeyValuePair<string, string>("ik_box_visible_LeftArmFinger", "LeftSet/Parent/CheckIKVisible")));
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Leg, new KeyValuePair<string, string>("ik_box_visible_RightLegFinger", "RightSet/Parent/CheckIKVisible")));
- list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Leg, new KeyValuePair<string, string>("ik_box_visible_LeftLegFinger", "LeftSet/Parent/CheckIKVisible")));
- for (int k = 0; k < list.Count; k++)
- {
- WFCheckBox component = UTY.GetChildObject(this.GetControlPanelParentObject(list[k].Key), list[k].Value.Value, false).GetComponent<WFCheckBox>();
- component.name = list[k].Value.Key;
- component.onClick.Add(new Action<WFCheckBox>(this.OnIKBOXVixibleCheckBox));
- this.ikbox_visible_dic_.Add(component.name, component);
- }
- }
- public override void Start()
- {
- base.Start();
- this.UpdateChildren();
- this.CheckbtnUse.onClick.Add(new Action<WFCheckBox>(this.OnClickUseCheck));
- this.noCharaActive.ChangeMode(true, true);
- }
- public new void Update()
- {
- if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN || !this.CheckbtnUse.check)
- {
- return;
- }
- bool flag = false;
- bool flag2 = false;
- if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Z))
- {
- flag = true;
- }
- if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Y))
- {
- flag2 = true;
- }
- if (flag || flag2)
- {
- bool flag3 = true;
- string draw_text = string.Empty;
- for (int i = 0; i < this.FingerBlendArray.Length; i++)
- {
- if (this.FingerBlendArray[i].CheckBoxEnabled.enabled && this.FingerBlendArray[i].CheckBoxEnabled.check)
- {
- if (flag)
- {
- draw_text = "指先ブレンド中はUndoできません";
- }
- else
- {
- draw_text = "指先ブレンド中はRedoできません";
- }
- flag3 = false;
- break;
- }
- }
- if (GizmoRender.control_lock || IKDragPoint.IsDrag)
- {
- if (flag)
- {
- draw_text = "操作中はUndoできません";
- }
- else
- {
- draw_text = "操作中はRedoできません";
- }
- flag3 = false;
- }
- MouseExposition @object = MouseExposition.GetObject();
- if (flag3)
- {
- bool flag4 = (!flag) ? this.ik_mgr.HistoryRedo() : this.ik_mgr.HistoryUndo();
- if (flag4)
- {
- @object.SetText((!flag) ? "Redo" : "Undo", 0.5f);
- }
- }
- else
- {
- @object.SetText(draw_text, 3f);
- }
- }
- }
- public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
- {
- base.OnMaidAddEvent(maid, is_deserialize_load);
- if (maid.boMAN)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
- if (!maidStoreData.ContainsKey("use"))
- {
- maidStoreData["use"] = false.ToString();
- }
- if (!maidStoreData.ContainsKey("select_control_type"))
- {
- maidStoreData["select_control_type"] = PoseEditWindow.ControlType.Body.ToString();
- }
- if (!maidStoreData.ContainsKey("pose_binary"))
- {
- maidStoreData["pose_binary"] = string.Empty;
- }
- if (!maidStoreData.ContainsKey("use_mune_key_l"))
- {
- Dictionary<string, string> dictionary = maidStoreData;
- string key = "use_mune_key_l";
- string value = false.ToString();
- maidStoreData["use_mune_key_r"] = value;
- dictionary[key] = value;
- }
- foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.ikbox_visible_dic_)
- {
- if (!maidStoreData.ContainsKey(keyValuePair.Value.name))
- {
- maidStoreData[keyValuePair.Value.name] = false.ToString();
- }
- }
- maidStoreData["ik_box_visible_Body"] = true.ToString();
- for (int i = 0; i < this.FingerBlendArray.Length; i++)
- {
- this.FingerBlendArray[i].OnMaidAddEvent(maid, is_deserialize_load);
- }
- for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
- {
- this.RotateCheckBoxArray[j].OnMaidAddEvent(maid, is_deserialize_load);
- }
- if (is_deserialize_load && !string.IsNullOrEmpty(maidStoreData["pose_binary"]))
- {
- IKManager maidIKManager = PoseEditWindow.GetMaidIKManager(maid);
- KeyValuePair<bool, bool> keyValuePair2 = maidIKManager.cache_bone_data.SetFrameBinary(Convert.FromBase64String(maidStoreData["pose_binary"]));
- bool key2 = keyValuePair2.Key;
- bool value2 = keyValuePair2.Value;
- maid.body0.MuneYureL((float)((!key2) ? 1 : 0));
- maid.body0.MuneYureR((float)((!value2) ? 1 : 0));
- maid.body0.jbMuneL.enabled = !key2;
- maid.body0.jbMuneR.enabled = !value2;
- }
- }
- public void OnMotionUpdate(Maid maid)
- {
- if (base.mgr.select_maid == null || base.mgr.select_maid != maid || maid.boMAN)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
- if (!bool.Parse(maidStoreData["use"]))
- {
- return;
- }
- bool flag = maid.body0.GetMuneYureL() == 0f;
- bool flag2 = maid.body0.GetMuneYureR() == 0f;
- maidStoreData["use_mune_key_l"] = flag.ToString();
- maidStoreData["use_mune_key_r"] = flag2.ToString();
- maid.body0.jbMuneL.enabled = !flag;
- maid.body0.jbMuneR.enabled = !flag2;
- for (int i = 0; i < this.RotateCheckBoxArray.Length; i++)
- {
- this.RotateCheckBoxArray[i].OnMotionUpdate();
- }
- if (this.ik_mgr_ != null)
- {
- IKManager.BoneSetType[] array = new IKManager.BoneSetType[0];
- if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Body)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.RightArmFinger,
- IKManager.BoneSetType.LeftArmFinger,
- IKManager.BoneSetType.RightLegFinger,
- IKManager.BoneSetType.LeftLegFinger
- };
- }
- else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Hand)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.Body,
- IKManager.BoneSetType.RightLegFinger,
- IKManager.BoneSetType.LeftLegFinger
- };
- }
- else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Leg)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.Body,
- IKManager.BoneSetType.RightArmFinger,
- IKManager.BoneSetType.LeftArmFinger
- };
- }
- foreach (IKManager.BoneSetType bone_set_type in array)
- {
- this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
- }
- }
- for (int k = 0; k < this.FingerBlendArray.Length; k++)
- {
- this.FingerBlendArray[k].OnMotionUpdate();
- }
- if (this.ik_mgr_ != null)
- {
- this.ik_mgr.HistoryClear();
- this.ik_mgr.HistoryNew();
- }
- }
- public void OnSelectControlSelectBtn()
- {
- if (this.ControlSelectBtnTab.GetSelectButtonObject() == null || base.mgr.select_maid == null || base.mgr.select_maid.boMAN || !UIWFSelectButton.current.isSelected)
- {
- return;
- }
- Localize componentInChildren = this.ControlSelectBtnTab.GetSelectButtonObject().GetComponentInChildren<Localize>();
- if (componentInChildren == null)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- string key = "select_control_type";
- if (componentInChildren.Term.IndexOf("胴体") != -1)
- {
- this.ctrl_type_ = PoseEditWindow.ControlType.Body;
- }
- else if (componentInChildren.Term.IndexOf("手") != -1)
- {
- this.ctrl_type_ = PoseEditWindow.ControlType.Hand;
- }
- else
- {
- this.ctrl_type_ = PoseEditWindow.ControlType.Leg;
- }
- maidStoreData[key] = this.ctrl_type_.ToString();
- this.SetControlPanel(this.ctrl_type_);
- IKManager.BoneSetType[] array = new IKManager.BoneSetType[0];
- bool flag = false;
- if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Body)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.RightArmFinger,
- IKManager.BoneSetType.LeftArmFinger,
- IKManager.BoneSetType.RightLegFinger,
- IKManager.BoneSetType.LeftLegFinger
- };
- flag = true;
- }
- else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Hand)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.Body,
- IKManager.BoneSetType.RightLegFinger,
- IKManager.BoneSetType.LeftLegFinger
- };
- }
- else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Leg)
- {
- array = new IKManager.BoneSetType[]
- {
- IKManager.BoneSetType.Body,
- IKManager.BoneSetType.RightArmFinger,
- IKManager.BoneSetType.LeftArmFinger
- };
- }
- foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.ikbox_visible_dic_)
- {
- keyValuePair.Value.check = bool.Parse(maidStoreData[keyValuePair.Value.name]);
- keyValuePair.Value.onClick[0](keyValuePair.Value);
- }
- foreach (IKManager.BoneSetType bone_set_type in array)
- {
- this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
- this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
- }
- if (!flag)
- {
- this.ik_mgr_.SetTransAxisVisibleRoot(false);
- }
- List<IKManager.BoneSetType> list = new List<IKManager.BoneSetType>(array);
- for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
- {
- if (0 > list.IndexOf(this.RotateCheckBoxArray[j].BoneSetType))
- {
- this.RotateCheckBoxArray[j].Apply();
- }
- }
- }
- public void OnClickUseCheck(WFCheckBox check_box)
- {
- if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
- {
- return;
- }
- if (!check_box.check && GameMain.Instance.SysDlg.IsDecided)
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/Pエディット/ダイアログ/セーブしていないデータは失われます。OFFにしますか?", null, SystemDialog.TYPE.YES_NO, delegate
- {
- check_box.check = false;
- this.OnClickUseCheckRun(false);
- GameMain.Instance.SysDlg.Close();
- }, null);
- check_box.check = true;
- return;
- }
- this.OnClickUseCheckRun(true);
- }
- public void OnClickUseCheckRun(bool check)
- {
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- maidStoreData["use"] = check.ToString();
- if (!check)
- {
- maidStoreData["pose_binary"] = string.Empty;
- }
- this.ChangeEnabeled(check);
- this.ik_mgr.HistoryClear();
- this.ik_mgr.HistoryNew();
- MaidColliderCollect component = base.mgr.select_maid.GetComponent<MaidColliderCollect>();
- List<CapsuleCollider> collider = component.GetCollider(MaidColliderCollect.ColliderType.Grab);
- foreach (CapsuleCollider capsuleCollider in collider)
- {
- capsuleCollider.gameObject.SetActive(!check);
- }
- }
- public void OnIKBOXVixibleCheckBox(WFCheckBox check_box)
- {
- if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN || this.ik_mgr_ == null)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- maidStoreData[check_box.name] = check_box.check.ToString();
- string text = check_box.name.Replace("ik_box_visible_", string.Empty);
- if (text == "Root")
- {
- this.ik_mgr_.SetTransAxisVisibleRoot(check_box.check);
- }
- else
- {
- IKManager.BoneSetType boneSetType = (IKManager.BoneSetType)Enum.Parse(typeof(IKManager.BoneSetType), text);
- this.ik_mgr_.SetTransAxisVisibleBoneSet(boneSetType, check_box.check);
- if (check_box.check && boneSetType != IKManager.BoneSetType.Body)
- {
- WindowPartsFingerBlend windowPartsFingerBlend = this.GetWindowPartsFingerBlend(boneSetType);
- if (windowPartsFingerBlend != null && windowPartsFingerBlend.CheckBoxEnabled.check)
- {
- windowPartsFingerBlend.OnClickEnter();
- }
- }
- }
- }
- public void ChangeEnabeled(bool use)
- {
- if (use && (base.mgr.select_maid == null || base.mgr.select_maid.boMAN))
- {
- use = false;
- }
- if (use)
- {
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- this.BtnSave.isEnabled = true;
- MotionWindow motionWindow = base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow;
- if (!motionWindow.CheckbtnStop.check)
- {
- motionWindow.CheckbtnStop.check = true;
- motionWindow.OnClickStopCheck(motionWindow.CheckbtnStop);
- }
- base.mgr.select_maid.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- base.mgr.select_maid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- this.ControlSelectBtnTab.ResetSelect();
- Dictionary<PoseEditWindow.ControlType, UIWFTabButton> dictionary = new Dictionary<PoseEditWindow.ControlType, UIWFTabButton>();
- foreach (UIWFTabButton uiwftabButton in this.ControlSelectBtnTab.button_list)
- {
- uiwftabButton.SetSelect(false);
- uiwftabButton.isEnabled = true;
- dictionary.Add((PoseEditWindow.ControlType)Enum.Parse(typeof(PoseEditWindow.ControlType), uiwftabButton.transform.parent.name), uiwftabButton);
- }
- for (int i = 0; i < this.RotateCheckBoxArray.Length; i++)
- {
- this.RotateCheckBoxArray[i].ChangeEnabeled(use);
- }
- for (int j = 0; j < this.FingerBlendArray.Length; j++)
- {
- this.FingerBlendArray[j].ChangeEnabeled(use);
- }
- this.ControlSelectBtnTab.Select(dictionary[this.ctrl_type_]);
- }
- else
- {
- this.ControlSelectBtnTab.ResetSelect();
- foreach (UIWFTabButton uiwftabButton2 in this.ControlSelectBtnTab.button_list)
- {
- uiwftabButton2.SetSelect(false);
- uiwftabButton2.isEnabled = false;
- }
- this.BtnSave.isEnabled = false;
- MotionWindow motionWindow2 = base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow;
- motionWindow2.UpdateAnimationData(base.mgr.select_maid);
- this.SetControlPanel(PoseEditWindow.ControlType.Null);
- if (this.ik_mgr_ != null)
- {
- IEnumerator enumerator3 = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
- try
- {
- while (enumerator3.MoveNext())
- {
- object obj = enumerator3.Current;
- IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
- this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
- this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator3 as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- this.ik_mgr_.SetTransAxisVisibleRoot(false);
- }
- if (base.mgr.select_maid != null && base.mgr.select_maid.body0 != null && !base.mgr.select_maid.boMAN)
- {
- base.mgr.select_maid.body0.MuneYureL(1f);
- base.mgr.select_maid.body0.MuneYureR(1f);
- base.mgr.select_maid.body0.jbMuneL.enabled = true;
- base.mgr.select_maid.body0.jbMuneR.enabled = true;
- }
- if (this.ik_mgr != null)
- {
- this.ik_mgr.HistoryClear();
- }
- for (int k = 0; k < this.RotateCheckBoxArray.Length; k++)
- {
- this.RotateCheckBoxArray[k].ChangeEnabeled(use);
- }
- for (int l = 0; l < this.FingerBlendArray.Length; l++)
- {
- this.FingerBlendArray[l].ChangeEnabeled(use);
- }
- }
- this.Apply();
- }
- public void Apply()
- {
- if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- if (!bool.Parse(maidStoreData["use"]))
- {
- return;
- }
- for (int i = 0; i < this.FingerBlendArray.Length; i++)
- {
- this.FingerBlendArray[i].Apply();
- }
- }
- public void OnBtnSave()
- {
- if (this.ik_mgr_ == null || base.mgr.select_maid == null)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- this.PanelSave.OpenPoseSaveMode(this.ik_mgr_.cache_bone_data.GetAnmBinary(bool.Parse(maidStoreData["use_mune_key_l"]), bool.Parse(maidStoreData["use_mune_key_r"])));
- }
- public void OnBtnReversal()
- {
- this.ik_mgr.Flip();
- }
- public override void OnMaidRemoveEvent(Maid maid)
- {
- if (maid != null && maid.boMAN)
- {
- maid = null;
- }
- this.DeleteIKManager(maid);
- }
- public override void OnMaidChangeEvent(Maid maid)
- {
- base.OnMaidChangeEvent(maid);
- if (maid == null)
- {
- this.ik_mgr_ = null;
- }
- Dictionary<string, string> dictionary;
- if (this.ik_mgr_ != null)
- {
- dictionary = base.GetMaidStoreData(this.ik_mgr_.maid);
- byte[] frameBinary = this.ik_mgr_.cache_bone_data.GetFrameBinary(bool.Parse(dictionary["use_mune_key_l"]), bool.Parse(dictionary["use_mune_key_r"]));
- if (bool.Parse(dictionary["use"]))
- {
- dictionary["pose_binary"] = Convert.ToBase64String(frameBinary);
- }
- else
- {
- dictionary["pose_binary"] = string.Empty;
- }
- IEnumerator enumerator = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
- this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
- this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- this.ik_mgr_.SetTransAxisVisibleRoot(false);
- }
- this.ik_mgr_ = PoseEditWindow.GetMaidIKManager(maid);
- dictionary = null;
- bool flag = maid != null && !maid.boMAN;
- if (flag)
- {
- dictionary = base.GetMaidStoreData(base.mgr.select_maid);
- this.CheckbtnUse.check = bool.Parse(dictionary["use"]);
- this.ctrl_type_ = (PoseEditWindow.ControlType)Enum.Parse(typeof(PoseEditWindow.ControlType), dictionary["select_control_type"]);
- }
- else
- {
- this.CheckbtnUse.check = false;
- this.ctrl_type_ = PoseEditWindow.ControlType.Null;
- }
- this.CheckbtnUse.enabled = flag;
- if (this.ik_mgr_ != null && this.CheckbtnUse.check && dictionary["pose_binary"] != string.Empty)
- {
- KeyValuePair<bool, bool> keyValuePair = this.ik_mgr_.cache_bone_data.SetFrameBinary(Convert.FromBase64String(dictionary["pose_binary"]));
- bool key = keyValuePair.Key;
- bool value = keyValuePair.Value;
- maid.body0.MuneYureL((float)((!key) ? 1 : 0));
- maid.body0.MuneYureR((float)((!value) ? 1 : 0));
- maid.body0.jbMuneL.enabled = !key;
- maid.body0.jbMuneR.enabled = !value;
- }
- this.ChangeEnabeled(this.CheckbtnUse.check);
- if (this.ik_mgr_ != null && this.CheckbtnUse.check)
- {
- this.Apply();
- this.ik_mgr.HistoryNew();
- }
- this.noCharaActive.ChangeMode(maid == null, true);
- }
- public override void OnDeserializeEvent()
- {
- List<string> maidStoreGuidList = base.mgr.GetMaidStoreGuidList();
- for (int i = 0; i < maidStoreGuidList.Count; i++)
- {
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maidStoreGuidList[i]);
- }
- }
- public override void OnSerializeEvent()
- {
- base.OnSerializeEvent();
- if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
- {
- return;
- }
- Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
- byte[] frameBinary = this.ik_mgr_.cache_bone_data.GetFrameBinary(bool.Parse(maidStoreData["use_mune_key_l"]), bool.Parse(maidStoreData["use_mune_key_r"]));
- maidStoreData = base.GetMaidStoreData(this.ik_mgr_.maid);
- if (bool.Parse(maidStoreData["use"]))
- {
- maidStoreData["pose_binary"] = Convert.ToBase64String(frameBinary);
- }
- else
- {
- maidStoreData["pose_binary"] = string.Empty;
- }
- }
- public WindowPartsFingerBlend GetWindowPartsFingerBlend(IKManager.BoneSetType bone_set_type)
- {
- Dictionary<IKManager.BoneSetType, WindowPartsFingerBlend.Type> dictionary = new Dictionary<IKManager.BoneSetType, WindowPartsFingerBlend.Type>();
- dictionary.Add(IKManager.BoneSetType.RightArmFinger, WindowPartsFingerBlend.Type.RightArm);
- dictionary.Add(IKManager.BoneSetType.LeftArmFinger, WindowPartsFingerBlend.Type.LeftArm);
- dictionary.Add(IKManager.BoneSetType.RightLegFinger, WindowPartsFingerBlend.Type.RightLeg);
- dictionary.Add(IKManager.BoneSetType.LeftLegFinger, WindowPartsFingerBlend.Type.LeftLeg);
- WindowPartsFingerBlend result = null;
- for (int i = 0; i < this.FingerBlendArray.Length; i++)
- {
- if (dictionary[bone_set_type] == this.FingerBlendArray[i].BlendType)
- {
- result = this.FingerBlendArray[i];
- break;
- }
- }
- return result;
- }
- private void DeleteIKManager(Maid maid)
- {
- GameObject x = GameObject.Find("PoseEditWorkParent");
- if (x == null)
- {
- x = new GameObject("PoseEditWorkParent");
- }
- if (maid == null)
- {
- return;
- }
- GameObject gameObject = GameObject.Find("PoseEditWorkParent/" + maid.status.guid);
- if (gameObject != null)
- {
- if (this.ik_mgr_ != null && this.ik_mgr_.maid == maid)
- {
- this.ik_mgr_ = null;
- }
- UnityEngine.Object.DestroyImmediate(gameObject);
- }
- }
- private void SetControlPanel(PoseEditWindow.ControlType type)
- {
- if (type == PoseEditWindow.ControlType.Null)
- {
- this.WindowSize = new Vector2(480f, 120f);
- GameObject[] array = new GameObject[]
- {
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand),
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
- };
- foreach (GameObject gameObject in array)
- {
- gameObject.SetActive(false);
- }
- }
- else if (type == PoseEditWindow.ControlType.Body)
- {
- this.WindowSize = new Vector2(513f, 850f);
- GameObject[] array3 = new GameObject[]
- {
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand),
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
- };
- foreach (GameObject gameObject2 in array3)
- {
- gameObject2.SetActive(false);
- }
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body).SetActive(true);
- }
- else if (type == PoseEditWindow.ControlType.Hand)
- {
- this.WindowSize = new Vector2(765f, 890f);
- GameObject[] array5 = new GameObject[]
- {
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
- };
- foreach (GameObject gameObject3 in array5)
- {
- gameObject3.SetActive(false);
- }
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand).SetActive(true);
- }
- else if (type == PoseEditWindow.ControlType.Leg)
- {
- this.WindowSize = new Vector2(765f, 710f);
- GameObject[] array7 = new GameObject[]
- {
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand)
- };
- foreach (GameObject gameObject4 in array7)
- {
- gameObject4.SetActive(false);
- }
- this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg).SetActive(true);
- }
- base.ResizeWindow();
- }
- private GameObject GetControlPanelParentObject(PoseEditWindow.ControlType type)
- {
- if (type == PoseEditWindow.ControlType.Body)
- {
- return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/BodyPanel", false);
- }
- if (type == PoseEditWindow.ControlType.Hand)
- {
- return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/HandPanel", false);
- }
- if (type == PoseEditWindow.ControlType.Leg)
- {
- return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/LegPanel", false);
- }
- return null;
- }
- public IKManager ik_mgr
- {
- get
- {
- return this.ik_mgr_;
- }
- }
- public UIButton BtnSave;
- public PhotoModePoseSave PanelSave;
- public WFCheckBox CheckbtnUse;
- public UIWFTabPanel ControlSelectBtnTab;
- public UIButton BtnReversal;
- public WindowPartsBoneCheckBox[] RotateCheckBoxArray;
- public WindowPartsFingerBlend[] FingerBlendArray;
- private Dictionary<string, WFCheckBox> ikbox_visible_dic_ = new Dictionary<string, WFCheckBox>();
- private PhotoNoCharaActive noCharaActive;
- private PoseEditWindow.ControlType ctrl_type_;
- private IKManager ik_mgr_;
- private Dictionary<string, string> store_type_name_map_ = new Dictionary<string, string>();
- private enum ControlType
- {
- Null,
- Body,
- Hand,
- Leg
- }
- }
|