Example #1
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);
            }
        }
Example #2
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);
        }
Example #3
0
        public static BackUpSlotData GetOrNullMaidSlotData(Maid maid, int slotNo)
        {
            BackUpSlotData result         = null;
            BackUpMaidData orNullMaidData = BackUpData.GetOrNullMaidData(maid);
            bool           flag           = orNullMaidData != null && orNullMaidData.slotDataDic.ContainsKey(slotNo);

            if (flag)
            {
                result = orNullMaidData.slotDataDic[slotNo];
            }
            return(result);
        }
Example #4
0
        public static void RefreshSlot(Maid maid, int slotNo)
        {
            BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotNo);
            bool           flag = orNullMaidSlotData == null;

            if (!flag)
            {
                foreach (GameObject obj in orNullMaidSlotData.objectDataDic.Keys)
                {
                    BackUpData.RefreshObject(maid, slotNo, obj);
                }
                orNullMaidSlotData.objectDataDic = (from kvp in orNullMaidSlotData.objectDataDic
                                                    where kvp.Key != null && (kvp.Value.changedYure || kvp.Value.boneDataDic.Count != 0)
                                                    select kvp).ToDictionary((KeyValuePair <GameObject, BackUpObjectData> kvp) => kvp.Key, (KeyValuePair <GameObject, BackUpObjectData> kvp) => kvp.Value);
            }
        }
Example #5
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);
        }
Example #6
0
        public static BackUpSlotData GetOrAddMaidSlotData(Maid maid, int slotNo)
        {
            BackUpMaidData orAddMaidData = BackUpData.GetOrAddMaidData(maid);
            bool           flag          = orAddMaidData.slotDataDic.ContainsKey(slotNo);
            BackUpSlotData backUpSlotData;

            if (flag)
            {
                backUpSlotData = orAddMaidData.slotDataDic[slotNo];
            }
            else
            {
                backUpSlotData = new BackUpSlotData();
                orAddMaidData.slotDataDic.Add(slotNo, backUpSlotData);
            }
            return(backUpSlotData);
        }
Example #7
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();
        }
Example #8
0
        public static void RestoreSlot(Maid maid, int slotNo)
        {
            BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotNo);
            bool           flag = orNullMaidSlotData == null;

            if (!flag)
            {
                List <GameObject> list = new List <GameObject>(orNullMaidSlotData.objectDataDic.Keys);
                foreach (GameObject gameObject in list)
                {
                    bool flag2 = !gameObject;
                    if (!flag2)
                    {
                        BackUpData.RestoreObject(maid, slotNo, gameObject);
                    }
                }
                BackUpMaidData orNullMaidData = BackUpData.GetOrNullMaidData(maid);
                orNullMaidData.slotDataDic.Remove(slotNo);
            }
        }
        private static XElement GetSlotData(Maid maid, int slotID)
        {
            bool       flag = slotID == -1;
            TBodySkin  tbodySkin;
            GameObject gameObject;

            if (flag)
            {
                tbodySkin  = maid.body0.goSlot[0];
                gameObject = maid.body0.m_Bones.gameObject;
            }
            else
            {
                tbodySkin  = maid.body0.GetSlot(slotID);
                gameObject = tbodySkin.obj;
            }
            bool     flag2 = !gameObject;
            XElement result;

            if (flag2)
            {
                result = null;
            }
            else
            {
                BackUpSlotData orNullMaidSlotData = BackUpData.GetOrNullMaidSlotData(maid, slotID);
                bool           flag3 = orNullMaidSlotData == null;
                if (flag3)
                {
                    result = null;
                }
                else
                {
                    bool flag4 = !orNullMaidSlotData.objectDataDic.ContainsKey(gameObject);
                    if (flag4)
                    {
                        result = null;
                    }
                    else
                    {
                        XElement xelement  = new XElement("Slot");
                        XElement xelement2 = new XElement("Category");
                        bool     flag5     = slotID == -1;
                        if (flag5)
                        {
                            xelement2.Add("base");
                        }
                        else
                        {
                            XContainer   xcontainer = xelement2;
                            TBody.SlotID slotID2    = (TBody.SlotID)slotID;
                            xcontainer.Add(slotID2.ToString());
                        }
                        xelement.Add(xelement2);
                        XElement xelement3 = new XElement("ModelFileName");
                        xelement3.Add(tbodySkin.m_strModelFileName);
                        xelement.Add(xelement3);
                        XElement maidObjectData = SceneDataManager.GetMaidObjectData(maid, slotID);
                        xelement.Add(maidObjectData);
                        result = xelement;
                    }
                }
            }
            return(result);
        }
        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);
        }