示例#1
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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        public static BackUpObjectData GetOrNullObjectData(GameObject obj)
        {
            BackUpObjectData result = null;
            bool             flag   = BackUpData.objectDataDic.ContainsKey(obj);

            if (flag)
            {
                result = BackUpData.objectDataDic[obj];
            }
            return(result);
        }
示例#4
0
        public static void RefreshObject(GameObject obj)
        {
            BackUpObjectData orNullObjectData = BackUpData.GetOrNullObjectData(obj);
            bool             flag             = orNullObjectData == null;

            if (!flag)
            {
                orNullObjectData.boneDataDic = (from kvp in orNullObjectData.boneDataDic
                                                where kvp.Key != null && (kvp.Value.changedPos || kvp.Value.changedRot || kvp.Value.changedScl)
                                                select kvp).ToDictionary((KeyValuePair <Transform, BackUpBoneData> kvp) => kvp.Key, (KeyValuePair <Transform, BackUpBoneData> kvp) => kvp.Value);
            }
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
0
        public static BackUpObjectData GetOrNullMaidObjectData(Maid maid, int slotNo, GameObject obj)
        {
            BackUpObjectData result             = null;
            BackUpSlotData   orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotNo);
            bool             flag = orNullMaidSlotData != null && orNullMaidSlotData.objectDataDic.ContainsKey(obj);

            if (flag)
            {
                result = orNullMaidSlotData.objectDataDic[obj];
            }
            return(result);
        }
示例#8
0
        public static BackUpObjectData GetOrAddObjectData(GameObject obj)
        {
            bool             flag = BackUpData.objectDataDic.ContainsKey(obj);
            BackUpObjectData backUpObjectData;

            if (flag)
            {
                backUpObjectData = BackUpData.objectDataDic[obj];
            }
            else
            {
                backUpObjectData = new BackUpObjectData();
                BackUpData.objectDataDic.Add(obj, backUpObjectData);
            }
            return(backUpObjectData);
        }
示例#9
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);
        }
示例#10
0
        public static BackUpObjectData GetOrAddMaidObjectData(Maid maid, int slotNo, GameObject obj)
        {
            BackUpSlotData   orAddMaidSlotData = BackUpData.GetOrAddMaidSlotData(maid, slotNo);
            bool             flag = orAddMaidSlotData.objectDataDic.ContainsKey(obj);
            BackUpObjectData backUpObjectData;

            if (flag)
            {
                backUpObjectData = orAddMaidSlotData.objectDataDic[obj];
            }
            else
            {
                backUpObjectData = new BackUpObjectData();
                orAddMaidSlotData.objectDataDic.Add(obj, backUpObjectData);
            }
            return(backUpObjectData);
        }
示例#11
0
        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();
        }
示例#12
0
        public static void RestoreObject(GameObject obj)
        {
            BackUpObjectData orNullObjectData = BackUpData.GetOrNullObjectData(obj);
            bool             flag             = orNullObjectData == null;

            if (!flag)
            {
                List <Transform> list = new List <Transform>(orNullObjectData.boneDataDic.Keys);
                foreach (Transform transform in list)
                {
                    bool flag2 = !transform;
                    if (!flag2)
                    {
                        BackUpData.RestoreBone(obj, transform);
                    }
                }
                BackUpData.objectDataDic.Remove(obj);
            }
        }
        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);
        }