public static void RestoreObject(Maid maid, int slotNo, GameObject obj) { BackUpObjectData orNullMaidObjectData = BackUpData.GetOrNullMaidObjectData(maid, slotNo, obj); bool flag = orNullMaidObjectData == null; if (!flag) { bool changedYure = orNullMaidObjectData.changedYure; if (changedYure) { bool flag2 = slotNo != -1; if (flag2) { YureUtil.SetYureState(maid, slotNo, orNullMaidObjectData.bYure); } } List <Transform> list = new List <Transform>(orNullMaidObjectData.boneDataDic.Keys); foreach (Transform transform in list) { bool flag3 = !transform; if (!flag3) { BackUpData.RestoreBone(maid, slotNo, obj, transform); } } BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotNo); orNullMaidSlotData.objectDataDic.Remove(obj); } }
private void DrawYure() { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Label("揺れボーン", UIParams.Instance.lStyle, new GUILayoutOption[0]); GUILayout.FlexibleSpace(); bool flag = !YureUtil.GetYureAble(CommonUIData.maid, CommonUIData.slotNo); if (flag) { GUI.enabled = false; GUILayout.Toggle(false, "", UIParams.Instance.tStyle, new GUILayoutOption[0]); GUI.enabled = true; } else { bool yureState = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo); bool flag2 = GUILayout.Toggle(yureState, "", UIParams.Instance.tStyle, new GUILayoutOption[0]); bool flag3 = flag2 != yureState; if (flag3) { YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, flag2); BackUpObjectData orAddMaidObjectData = BackUpData.GetOrAddMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj); bool flag4 = orAddMaidObjectData.changedYure && flag2 == orAddMaidObjectData.bYure; if (flag4) { bool flag5 = orAddMaidObjectData.boneDataDic.Count == 0; if (flag5) { BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(CommonUIData.maid, CommonUIData.slotNo); orNullMaidSlotData.objectDataDic.Remove(CommonUIData.obj); } else { orAddMaidObjectData.changedYure = false; } BackUpData.Refresh(); } else { orAddMaidObjectData.changedYure = true; orAddMaidObjectData.bYure = yureState; } } } GUILayout.EndHorizontal(); }
private static void ApplyObjectDataToObject(ObjectData objectData) { bool flag = Setting.targetSelectMode == 0; BackUpObjectData backUpObjectData; BackUpBoneData backUpBoneData; if (flag) { backUpObjectData = BackUpData.GetOrAddMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj); backUpBoneData = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.obj.transform); } else { backUpObjectData = BackUpData.GetOrAddObjectData(CommonUIData.obj); backUpBoneData = BackUpData.GetOrAddBoneData(CommonUIData.obj, CommonUIData.obj.transform); } bool flag2 = Setting.targetSelectMode == 0; if (flag2) { bool flag3 = CommonUIData.slotNo != -1; if (flag3) { bool changedYure = backUpObjectData.changedYure; if (changedYure) { bool flag4 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure; if (flag4) { backUpObjectData.changedYure = false; backUpObjectData.bYure = true; YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure); } } else { bool flag5 = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo) != objectData.bYure; if (flag5) { backUpObjectData.changedYure = true; backUpObjectData.bYure = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo); YureUtil.SetYureState(CommonUIData.maid, CommonUIData.slotNo, objectData.bYure); } } } bool bMaidParts = objectData.bMaidParts; if (bMaidParts) { bool flag6 = !backUpBoneData.changedPos; if (flag6) { backUpBoneData.position = CommonUIData.obj.transform.localPosition; backUpBoneData.changedPos = true; } CommonUIData.obj.transform.localPosition = objectData.rootData.position; bool flag7 = !backUpBoneData.changedRot; if (flag7) { backUpBoneData.rotation = CommonUIData.obj.transform.localRotation; backUpBoneData.changedRot = true; } CommonUIData.obj.transform.localRotation = objectData.rootData.rotation; } } bool flag8 = !backUpBoneData.changedScl; if (flag8) { backUpBoneData.scale = CommonUIData.obj.transform.localScale; backUpBoneData.changedScl = true; } CommonUIData.obj.transform.localScale = objectData.rootData.scale; foreach (ObjectData.TransformData transformData in objectData.transformDataList) { bool flag9 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1; Transform transform; if (flag9) { transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, true); } else { transform = CMT.SearchObjName(CommonUIData.obj.transform, transformData.name, false); } bool flag10 = !transform; if (!flag10) { bool flag11 = Setting.targetSelectMode == 0; BackUpBoneData backUpBoneData2; if (flag11) { backUpBoneData2 = BackUpData.GetOrAddMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, transform); } else { backUpBoneData2 = BackUpData.GetOrAddBoneData(CommonUIData.obj, transform); } bool flag12 = !backUpBoneData2.changedPos; if (flag12) { backUpBoneData2.position = transform.localPosition; backUpBoneData2.changedPos = true; } transform.localPosition = transformData.position; bool flag13 = !backUpBoneData2.changedRot; if (flag13) { backUpBoneData2.rotation = transform.localRotation; backUpBoneData2.changedRot = true; } transform.localRotation = transformData.rotation; bool flag14 = !backUpBoneData2.changedScl; if (flag14) { backUpBoneData2.scale = transform.localScale; backUpBoneData2.changedScl = true; } transform.localScale = transformData.scale; } } }
public static ObjectData GetObjectDataFromObject() { PresetManager.trsHash = new HashSet <Transform>(); ObjectData objectData = new ObjectData(); objectData.version = "0.1.6"; objectData.bMaidParts = (Setting.targetSelectMode == 0); ObjectData.TransformData transformData = new ObjectData.TransformData(); transformData.name = CommonUIData.obj.name; bool flag = Setting.targetSelectMode == 0; if (flag) { transformData.position = CommonUIData.obj.transform.localPosition; transformData.rotation = CommonUIData.obj.transform.localRotation; } transformData.scale = CommonUIData.obj.transform.localScale; objectData.rootData = transformData; bool flag2 = Setting.targetSelectMode == 0; if (flag2) { bool flag3 = CommonUIData.slotNo == -1; if (flag3) { objectData.bYure = false; objectData.slotName = "base"; } else { objectData.bYure = YureUtil.GetYureState(CommonUIData.maid, CommonUIData.slotNo); objectData.slotName = SlotUtil.GetSlotName(CommonUIData.slotNo); } } else { objectData.bYure = false; } bool flag4 = Setting.targetSelectMode == 0 && CommonUIData.slotNo == -1; Transform[] array; if (flag4) { SkinnedMeshRenderer componentInChildren = CommonUIData.maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren.bones where bone != null select CMT.SearchObjName(CommonUIData.obj.transform, bone.name, true) into bone where bone != null select bone).ToArray <Transform>(); } else { SkinnedMeshRenderer componentInChildren2 = CommonUIData.obj.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren2.bones where bone != null select bone).ToArray <Transform>(); } foreach (Transform transform in array) { Transform transform2 = transform; while (transform2 != CommonUIData.obj.transform) { bool flag5 = !transform2; if (flag5) { Debug.Log("ルートオブジェクト配下にありません:" + transform.name); return(null); } bool flag6 = PresetManager.trsHash.Contains(transform2); if (flag6) { break; } ObjectData.TransformData transformData2 = new ObjectData.TransformData(); transformData2.name = transform2.name; transformData2.scale = transform2.localScale; transformData2.position = transform2.localPosition; transformData2.rotation = transform2.localRotation; objectData.transformDataList.Add(transformData2); PresetManager.trsHash.Add(transform2); transform2 = transform2.parent; } } return(objectData); }
private static void SetMaidObjectData(Maid maid, int slotID, XElement objectXml) { bool flag = slotID == -1; GameObject gameObject; if (flag) { TBodySkin tbodySkin = maid.body0.goSlot[0]; gameObject = maid.body0.m_Bones.gameObject; } else { TBodySkin tbodySkin = maid.body0.GetSlot(slotID); gameObject = tbodySkin.obj; } XElement xelement = objectXml.Element("Yure"); bool flag2 = xelement != null; if (flag2) { bool flag3 = (bool)xelement; bool yureAble = YureUtil.GetYureAble(maid, slotID); if (yureAble) { bool flag4 = YureUtil.GetYureState(maid, slotID) != flag3; if (flag4) { BackUpObjectData orAddMaidObjectData = BackUpData.GetOrAddMaidObjectData(maid, slotID, gameObject); bool changedYure = orAddMaidObjectData.changedYure; if (changedYure) { orAddMaidObjectData.changedYure = false; orAddMaidObjectData.bYure = true; } else { orAddMaidObjectData.changedYure = true; orAddMaidObjectData.bYure = YureUtil.GetYureState(maid, slotID); } YureUtil.SetYureState(maid, slotID, flag3); } } } IEnumerable <XElement> enumerable = objectXml.Elements("TransformData"); bool flag5 = enumerable != null; if (flag5) { foreach (XElement xelement2 in enumerable) { XElement xelement3 = xelement2.Element("Name"); bool flag6 = xelement3 == null; if (flag6) { break; } bool flag7 = slotID == -1; Transform transform; if (flag7) { transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, true); } else { transform = CMT.SearchObjName(gameObject.transform, (string)xelement3, false); } bool flag8 = transform == null; if (!flag8) { BackUpBoneData orAddMaidBoneData = BackUpData.GetOrAddMaidBoneData(maid, slotID, gameObject, transform); XElement xelement4 = xelement2.Element("Scale"); bool flag9 = xelement4 != null; if (flag9) { bool flag10 = !orAddMaidBoneData.changedScl; if (flag10) { orAddMaidBoneData.changedScl = true; orAddMaidBoneData.scale = transform.localScale; } Vector3 vectorData = SceneDataManager.GetVectorData(xelement4); transform.localScale = vectorData; } XElement xelement5 = xelement2.Element("Position"); bool flag11 = xelement5 != null; if (flag11) { bool flag12 = !orAddMaidBoneData.changedPos; if (flag12) { orAddMaidBoneData.changedPos = true; orAddMaidBoneData.position = transform.localPosition; } Vector3 vectorData2 = SceneDataManager.GetVectorData(xelement5); transform.localPosition = vectorData2; } XElement xelement6 = xelement2.Element("Rotation"); bool flag13 = xelement6 != null; if (flag13) { bool flag14 = !orAddMaidBoneData.changedRot; if (flag14) { orAddMaidBoneData.changedRot = true; orAddMaidBoneData.rotation = transform.localRotation; } Vector3 vectorData3 = SceneDataManager.GetVectorData(xelement6); transform.localEulerAngles = vectorData3; } } } } }
private static XElement GetMaidObjectData(Maid maid, int slotID) { SceneDataManager.trsHash = new HashSet <Transform>(); bool flag = false; bool flag2 = slotID == -1; GameObject gameObject; if (flag2) { TBodySkin tbodySkin = maid.body0.goSlot[0]; gameObject = maid.body0.m_Bones.gameObject; } else { TBodySkin tbodySkin = maid.body0.GetSlot(slotID); gameObject = tbodySkin.obj; } bool flag3 = !gameObject; XElement result; if (flag3) { result = null; } else { BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotID); bool flag4 = orNullMaidSlotData == null; if (flag4) { result = null; } else { bool flag5 = !orNullMaidSlotData.objectDataDic.ContainsKey(gameObject); if (flag5) { result = null; } else { BackUpObjectData backUpObjectData = orNullMaidSlotData.objectDataDic[gameObject]; XElement xelement = new XElement("ObjectData"); bool changedYure = backUpObjectData.changedYure; if (changedYure) { XElement xelement2 = new XElement("Yure"); bool yureState = YureUtil.GetYureState(maid, slotID); xelement2.Add(yureState); xelement.Add(xelement2); bool flag6 = !yureState; if (flag6) { flag = true; } } bool flag7 = slotID == -1; Transform rootBone; Transform[] array; if (flag7) { SkinnedMeshRenderer componentInChildren = maid.body0.goSlot[0].obj.GetComponentInChildren <SkinnedMeshRenderer>(); rootBone = maid.body0.m_Bones.transform; array = (from bone in componentInChildren.bones where bone != null select CMT.SearchObjName(rootBone, bone.name, true) into bone where bone != null select bone).ToArray <Transform>(); } else { rootBone = maid.body0.goSlot[slotID].obj_tr; SkinnedMeshRenderer componentInChildren2 = rootBone.gameObject.GetComponentInChildren <SkinnedMeshRenderer>(); array = (from bone in componentInChildren2.bones where bone != null select bone).ToArray <Transform>(); } foreach (Transform transform in array) { Transform transform2 = transform; while (transform2 != rootBone) { bool flag8 = !transform2; if (flag8) { Debug.Log("ルートオブジェクト配下にありません:" + transform.name); return(null); } bool flag9 = SceneDataManager.trsHash.Contains(transform2); if (flag9) { break; } bool flag10 = flag || BackUpData.GetOrNullMaidBoneData(maid, slotID, gameObject, transform2) != null; if (flag10) { XElement xelement3 = new XElement("TransformData"); XElement xelement4 = new XElement("Name"); xelement4.Add(transform2.name); xelement3.Add(xelement4); xelement3.Add(SceneDataManager.GetVector3Data("Scale", transform2.localScale)); xelement3.Add(SceneDataManager.GetVector3Data("Position", transform2.localPosition)); xelement3.Add(SceneDataManager.GetVector3Data("Rotation", transform2.localEulerAngles)); xelement.Add(xelement3); } SceneDataManager.trsHash.Add(transform2); transform2 = transform2.parent; } } result = xelement; } } } return(result); }