Beispiel #1
0
        public static BackUpBoneData GetOrAddMaidBoneData(Maid maid, int slotNo, GameObject obj, Transform bone)
        {
            BackUpObjectData orAddMaidObjectData = BackUpData.GetOrAddMaidObjectData(maid, slotNo, obj);
            bool             flag = orAddMaidObjectData.boneDataDic.ContainsKey(bone);
            BackUpBoneData   backUpBoneData;

            if (flag)
            {
                backUpBoneData = orAddMaidObjectData.boneDataDic[bone];
            }
            else
            {
                backUpBoneData = new BackUpBoneData();
                orAddMaidObjectData.boneDataDic.Add(bone, backUpBoneData);
            }
            return(backUpBoneData);
        }
Beispiel #2
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();
        }
        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;
                }
            }
        }
        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;
                        }
                    }
                }
            }
        }