private void ResetTransform()
        {
            Transform      bone = CommonUIData.bone;
            BackUpBoneData orNullMaidBoneData = BackUpData.GetOrNullMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, bone);
            bool           flag = orNullMaidBoneData == null;

            if (!flag)
            {
                bool changedPos = orNullMaidBoneData.changedPos;
                if (changedPos)
                {
                    bone.localPosition = orNullMaidBoneData.position;
                }
                bool changedRot = orNullMaidBoneData.changedRot;
                if (changedRot)
                {
                    bone.localRotation = orNullMaidBoneData.rotation;
                }
                bool changedScl = orNullMaidBoneData.changedScl;
                if (changedScl)
                {
                    bone.localScale = orNullMaidBoneData.scale;
                }
                BackUpData.GetOrNullMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj).boneDataDic.Remove(bone);
            }
        }
Exemple #2
0
        public static void RestoreBone(GameObject obj, Transform bone)
        {
            BackUpBoneData orNullBoneData = BackUpData.GetOrNullBoneData(obj, bone);
            bool           flag           = orNullBoneData == null;

            if (!flag)
            {
                bool changedPos = orNullBoneData.changedPos;
                if (changedPos)
                {
                    bone.localPosition = orNullBoneData.position;
                }
                bool changedRot = orNullBoneData.changedRot;
                if (changedRot)
                {
                    bone.localRotation = orNullBoneData.rotation;
                }
                bool changedScl = orNullBoneData.changedScl;
                if (changedScl)
                {
                    bone.localScale = orNullBoneData.scale;
                }
                BackUpObjectData orNullObjectData = BackUpData.GetOrNullObjectData(obj);
                orNullObjectData.boneDataDic.Remove(bone);
            }
        }
Exemple #3
0
        public static BackUpBoneData GetOrNullBoneData(GameObject obj, Transform bone)
        {
            BackUpBoneData   result           = null;
            BackUpObjectData orNullObjectData = BackUpData.GetOrNullObjectData(obj);
            bool             flag             = orNullObjectData != null && orNullObjectData.boneDataDic.ContainsKey(bone);

            if (flag)
            {
                result = orNullObjectData.boneDataDic[bone];
            }
            return(result);
        }
Exemple #4
0
        public static BackUpBoneData GetOrNullMaidBoneData(Maid maid, int slotNo, GameObject obj, Transform bone)
        {
            BackUpBoneData   result = null;
            BackUpObjectData orNullMaidObjectData = BackUpData.GetOrNullMaidObjectData(maid, slotNo, obj);
            bool             flag = orNullMaidObjectData != null && orNullMaidObjectData.boneDataDic.ContainsKey(bone);

            if (flag)
            {
                result = orNullMaidObjectData.boneDataDic[bone];
            }
            return(result);
        }
Exemple #5
0
        public static BackUpBoneData GetOrAddBoneData(GameObject obj, Transform bone)
        {
            BackUpObjectData orAddObjectData = BackUpData.GetOrAddObjectData(obj);
            bool             flag            = orAddObjectData.boneDataDic.ContainsKey(bone);
            BackUpBoneData   backUpBoneData;

            if (flag)
            {
                backUpBoneData = orAddObjectData.boneDataDic[bone];
            }
            else
            {
                backUpBoneData = new BackUpBoneData();
                orAddObjectData.boneDataDic.Add(bone, backUpBoneData);
            }
            return(backUpBoneData);
        }
Exemple #6
0
        public static void RestoreScale(GameObject obj, Transform bone)
        {
            BackUpBoneData orNullBoneData = BackUpData.GetOrNullBoneData(obj, bone);
            bool           flag           = orNullBoneData == null;

            if (!flag)
            {
                bool changedScl = orNullBoneData.changedScl;
                if (changedScl)
                {
                    bone.localScale = orNullBoneData.scale;
                    bool flag2 = orNullBoneData.changedPos || orNullBoneData.changedRot;
                    if (flag2)
                    {
                        orNullBoneData.changedScl = false;
                    }
                    else
                    {
                        BackUpData.GetOrNullObjectData(obj).boneDataDic.Remove(bone);
                    }
                }
            }
        }
Exemple #7
0
        public static void RestorePosition(GameObject obj, Transform bone)
        {
            BackUpBoneData orNullBoneData = BackUpData.GetOrNullBoneData(obj, bone);
            bool           flag           = orNullBoneData == null;

            if (!flag)
            {
                bool changedPos = orNullBoneData.changedPos;
                if (changedPos)
                {
                    bone.localPosition = orNullBoneData.position;
                    bool flag2 = orNullBoneData.changedRot || orNullBoneData.changedScl;
                    if (flag2)
                    {
                        orNullBoneData.changedPos = false;
                    }
                    else
                    {
                        BackUpData.GetOrNullObjectData(obj).boneDataDic.Remove(bone);
                    }
                }
            }
        }
Exemple #8
0
        public static void RestoreRotation(Maid maid, int slotNo, GameObject obj, Transform bone)
        {
            BackUpBoneData orNullMaidBoneData = BackUpData.GetOrNullMaidBoneData(maid, slotNo, obj, bone);
            bool           flag = orNullMaidBoneData == null;

            if (!flag)
            {
                bool changedRot = orNullMaidBoneData.changedRot;
                if (changedRot)
                {
                    bone.localRotation = orNullMaidBoneData.rotation;
                    bool flag2 = orNullMaidBoneData.changedPos || orNullMaidBoneData.changedScl;
                    if (flag2)
                    {
                        orNullMaidBoneData.changedRot = false;
                    }
                    else
                    {
                        BackUpData.GetOrNullMaidObjectData(maid, slotNo, obj).boneDataDic.Remove(bone);
                    }
                }
            }
        }
        private void ResetScale()
        {
            Transform      bone = CommonUIData.bone;
            BackUpBoneData orNullMaidBoneData = BackUpData.GetOrNullMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, bone);
            bool           flag = orNullMaidBoneData == null;

            if (!flag)
            {
                bool changedScl = orNullMaidBoneData.changedScl;
                if (changedScl)
                {
                    bone.localScale = orNullMaidBoneData.scale;
                }
                bool flag2 = orNullMaidBoneData.changedPos || orNullMaidBoneData.changedRot;
                if (flag2)
                {
                    orNullMaidBoneData.changedScl = false;
                }
                else
                {
                    BackUpData.GetOrNullMaidObjectData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj).boneDataDic.Remove(bone);
                }
            }
        }
Exemple #10
0
        private void DrawTransform()
        {
            BackUpBoneData backUpBoneData = null;
            bool           flag           = CommonUIData.bone;

            if (flag)
            {
                backUpBoneData = BackUpData.GetOrNullMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("位置", UIParams.Instance.lStyle, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool flag2 = backUpBoneData == null || !backUpBoneData.changedPos;

            if (flag2)
            {
                GUI.enabled = false;
            }
            bool flag3 = GUILayout.Button("R", UIParams.Instance.bStyle, new GUILayoutOption[0]);

            if (flag3)
            {
                BackUpData.RestorePosition(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
                BackUpData.Refresh();
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("回転", UIParams.Instance.lStyle, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool flag4 = backUpBoneData == null || !backUpBoneData.changedRot;

            if (flag4)
            {
                GUI.enabled = false;
            }
            bool flag5 = GUILayout.Button("R", UIParams.Instance.bStyle, new GUILayoutOption[0]);

            if (flag5)
            {
                BackUpData.RestoreRotation(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
                BackUpData.Refresh();
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label("拡縮", UIParams.Instance.lStyle, new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool flag6 = backUpBoneData == null || !backUpBoneData.changedScl;

            if (flag6)
            {
                GUI.enabled = false;
            }
            bool flag7 = GUILayout.Button("R", UIParams.Instance.bStyle, new GUILayoutOption[0]);

            if (flag7)
            {
                BackUpData.RestoreScale(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
                BackUpData.Refresh();
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();
        }
        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;
                        }
                    }
                }
            }
        }
        public void Draw()
        {
            GUILayout.Label("ボーン編集", new GUILayoutOption[0]);
            UIUtil.BeginIndentArea();
            bool flag = CommonUIData.bone;

            if (flag)
            {
                bool maidBoneDataExist = BackUpData.GetMaidBoneDataExist(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
                if (maidBoneDataExist)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    bool flag2 = GUILayout.Button("トランスフォームリセット", UIParams.Instance.bStyle, new GUILayoutOption[0]);
                    if (flag2)
                    {
                        this.ResetTransform();
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    UIUtil.BeginIndentArea();
                    BackUpBoneData orNullMaidBoneData = BackUpData.GetOrNullMaidBoneData(CommonUIData.maid, CommonUIData.slotNo, CommonUIData.obj, CommonUIData.bone);
                    bool           flag3 = orNullMaidBoneData != null;
                    if (flag3)
                    {
                        bool changedPos = orNullMaidBoneData.changedPos;
                        if (changedPos)
                        {
                            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                            bool flag4 = GUILayout.Button("位置リセット", UIParams.Instance.bStyle, new GUILayoutOption[0]);
                            if (flag4)
                            {
                                this.ResetPosition();
                            }
                            GUILayout.FlexibleSpace();
                            GUILayout.EndHorizontal();
                        }
                        bool changedRot = orNullMaidBoneData.changedRot;
                        if (changedRot)
                        {
                            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                            bool flag5 = GUILayout.Button("回転リセット", UIParams.Instance.bStyle, new GUILayoutOption[0]);
                            if (flag5)
                            {
                                this.ResetRotation();
                            }
                            GUILayout.FlexibleSpace();
                            GUILayout.EndHorizontal();
                        }
                        bool changedScl = orNullMaidBoneData.changedScl;
                        if (changedScl)
                        {
                            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                            bool flag6 = GUILayout.Button("拡縮リセット", UIParams.Instance.bStyle, new GUILayoutOption[0]);
                            if (flag6)
                            {
                                this.ResetScale();
                            }
                            GUILayout.FlexibleSpace();
                            GUILayout.EndHorizontal();
                        }
                    }
                    UIUtil.EndoIndentArea();
                }
            }
            UIUtil.EndoIndentArea();
        }