コード例 #1
0
            internal void Backup()
            {
                int _coordinateIndex = ChaControl.fileStatus.coordinateType;

                List <ChaFileAccessory.PartsInfo> _parts = MoreAccessoriesSupport.ListPartsInfo(ChaControl, _coordinateIndex);

                PartsInfo.Clear();
                PartsResolveInfo.Clear();

                for (int i = 0; i < _parts.Count; i++)
                {
                    ChaFileAccessory.PartsInfo _part = MoreAccessoriesSupport.GetPartsInfo(ChaControl, _coordinateIndex, i);
                    if (_part.type > 120)
                    {
                        byte[] _byte = MessagePackSerializer.Serialize(_part);
                        PartsInfo[i] = MessagePackSerializer.Deserialize <ChaFileAccessory.PartsInfo>(_byte);

                        PartsResolveInfo[i] = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)_part.type, _part.id);
                    }
                }

                foreach (string _name in SupportList)
                {
                    Traverse.Create(this).Field(_name).Method("Backup").GetValue();
                }
            }
コード例 #2
0
ファイル: Copy.cs プロジェクト: Madevil/CharacterAccessory
            internal void CopyPartsInfo()
            {
                DebugMsg(LogLevel.Warning, $"[CopyPartsInfo][{ChaControl.GetFullname()}] fired");

                if (!DuringLoading)
                {
                    TaskUnlock();
                    return;
                }
                if (!FunctionEnable)
                {
                    TaskUnlock();
                    return;
                }
                if (ReferralIndex == CurrentCoordinateIndex)
                {
                    TaskUnlock();
                    return;
                }

                List <ChaFileAccessory.PartsInfo> PartsInfo = MoreAccessoriesSupport.ListPartsInfo(ChaControl, ReferralIndex);
                List <int> SlotIndexes = new List <int>();

                for (int i = 0; i < PartsInfo.Count; i++)
                {
                    if (PartsInfo[i].type > 120)
                    {
                        SlotIndexes.Add(i);
                    }
                }
                DebugMsg(LogLevel.Warning, $"[CopyPartsInfo][{ChaControl.GetFullname()}][Slots: {string.Join(",", SlotIndexes.Select(Slot => Slot.ToString()).ToArray())}]");
                AccessoryCopyEventArgs ev = new AccessoryCopyEventArgs(SlotIndexes, (ChaFileDefine.CoordinateType)ReferralIndex, (ChaFileDefine.CoordinateType)CurrentCoordinateIndex);

                MoreAccessoriesSupport.CopyPartsInfo(ChaControl, ev);

                if (CharaStudio.Running)
                {
                    ChaControl.ChangeCoordinateTypeAndReload(false);
                    ChaControl.StartCoroutine(CopyPluginSettingCoroutine(ev));
                    return;
                }
                else
                {
                    foreach (string _name in SupportList)
                    {
                        Traverse.Create(this).Field(_name).Method("CopyPartsInfo", new object[] { ev }).GetValue();
                    }

                    ChaControl.StartCoroutine(RefreshCoroutine());
                }
            }