internal void CopyAccessoriesHandler(AccessoryCopyEventArgs e) { if (!HairAccessories.ContainsKey((int)e.CopySource)) { HairAccessories[(int)e.CopySource] = new Dictionary <int, HairAccessoryInfo>(); } if (!HairAccessories.ContainsKey((int)e.CopyDestination)) { HairAccessories[(int)e.CopyDestination] = new Dictionary <int, HairAccessoryInfo>(); } foreach (int x in e.CopiedSlotIndexes) { if (HairAccessories[(int)e.CopySource].TryGetValue(x, out var hairAccessoryInfo)) { //copy hair accessory info to the destination coordinate and slot var newHairAccessoryInfo = new HairAccessoryInfo(); newHairAccessoryInfo.ColorMatch = hairAccessoryInfo.ColorMatch; newHairAccessoryInfo.HairGloss = hairAccessoryInfo.HairGloss; newHairAccessoryInfo.OutlineColor = hairAccessoryInfo.OutlineColor; newHairAccessoryInfo.AccessoryColor = hairAccessoryInfo.AccessoryColor; newHairAccessoryInfo.HairLength = hairAccessoryInfo.HairLength; HairAccessories[(int)e.CopyDestination][x] = newHairAccessoryInfo; } else { //not a hair accessory, remove hair accessory info from the destination slot HairAccessories[(int)e.CopyDestination].Remove(x); } } }
internal void AccessoriesCopiedEvent(object sender, AccessoryCopyEventArgs e) { foreach (int slot in e.CopiedSlotIndexes) { AccessoryDynamicBoneData.RemoveAll(x => x.CoordinateIndex == (int)e.CopyDestination && x.Slot == slot); List <DynamicBoneData> newAccessoryDynamicBoneData = new List <DynamicBoneData>(); foreach (var dbData in AccessoryDynamicBoneData.Where(x => x.CoordinateIndex == (int)e.CopySource && x.Slot == slot)) { var newDBData = new DynamicBoneData((int)e.CopyDestination, slot, dbData.BoneName); dbData.CopyTo(newDBData); newAccessoryDynamicBoneData.Add(newDBData); } AccessoryDynamicBoneData.AddRange(newAccessoryDynamicBoneData); if (MakerAPI.InsideAndLoaded) { if ((int)e.CopyDestination == CurrentCoordinateIndex) { UI.Visible = false; } } } }
internal void AccessoryCopyEvent(AccessoryCopyEventArgs ev) { int srcIdx = (int)ev.CopySource; int dstIdx = (int)ev.CopyDestination; List <int> copySlots = ev.CopiedSlotIndexes.ToList(); if (!OutfitTriggers.ContainsKey(srcIdx)) { OutfitTriggers[srcIdx] = new List <RouteRule>(); } if (!OutfitTriggers.ContainsKey(dstIdx)) { OutfitTriggers[dstIdx] = new List <RouteRule>(); } foreach (int slot in copySlots) { string name = $"/ca_slot{slot:00}/"; OutfitTriggers[dstIdx].RemoveAll(x => x.GameObjectPath.Contains(name)); List <RouteRule> rules = OutfitTriggers[srcIdx].Where(x => x.GameObjectPath.Contains(name)).ToList(); if (rules?.Count > 0) { OutfitTriggers[dstIdx].AddRange(rules); } } BuildCheckList(); }
internal void AccessoriesCopiedEvent(object sender, AccessoryCopyEventArgs e) { foreach (int slot in e.CopiedSlotIndexes) { RendererPropertyList.RemoveAll(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopyDestination && x.Slot == slot); MaterialFloatPropertyList.RemoveAll(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopyDestination && x.Slot == slot); MaterialColorPropertyList.RemoveAll(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopyDestination && x.Slot == slot); List <RendererProperty> newAccessoryRendererPropertyList = new List <RendererProperty>(); List <MaterialFloatProperty> newAccessoryMaterialFloatPropertyList = new List <MaterialFloatProperty>(); List <MaterialColorProperty> newAccessoryMaterialColorPropertyList = new List <MaterialColorProperty>(); foreach (var property in RendererPropertyList.Where(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopySource && x.Slot == slot)) { newAccessoryRendererPropertyList.Add(new RendererProperty(property.ObjectType, (int)e.CopyDestination, slot, property.RendererName, property.Property, property.Value, property.ValueOriginal)); } foreach (var property in MaterialFloatPropertyList.Where(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopySource && x.Slot == slot)) { newAccessoryMaterialFloatPropertyList.Add(new MaterialFloatProperty(property.ObjectType, (int)e.CopyDestination, slot, property.MaterialName, property.Property, property.Value, property.ValueOriginal)); } foreach (var property in MaterialColorPropertyList.Where(x => x.ObjectType == ObjectType.Accessory && x.CoordinateIndex == (int)e.CopySource && x.Slot == slot)) { newAccessoryMaterialColorPropertyList.Add(new MaterialColorProperty(property.ObjectType, (int)e.CopyDestination, slot, property.MaterialName, property.Property, property.Value, property.ValueOriginal)); } RendererPropertyList.AddRange(newAccessoryRendererPropertyList); MaterialFloatPropertyList.AddRange(newAccessoryMaterialFloatPropertyList); MaterialColorPropertyList.AddRange(newAccessoryMaterialColorPropertyList); } if ((int)e.CopyDestination == CurrentCoordinateIndex) { UISystem.gameObject.SetActive(false); } }
internal static void CopyPartsInfo(ChaControl _chaCtrl, AccessoryCopyEventArgs ev) { foreach (int SlotIndex in ev.CopiedSlotIndexes) { ChaFileAccessory.PartsInfo _part = GetPartsInfo(_chaCtrl, (int)ev.CopySource, SlotIndex); SetPartsInfo(_chaCtrl, (int)ev.CopyDestination, SlotIndex, _part); } }
internal void CopyPartsInfo(AccessoryCopyEventArgs ev) { if (!_installed) { return; } Traverse.Create(_pluginCtrl).Method("CopyAccessoriesHandler", new object[] { ev }).GetValue(); }
private static void AccessoriesApi_AccessoriesCopied(object sender, AccessoryCopyEventArgs e) { var controller = GetCharaController(MakerAPI.GetCharacterControl()); if (controller != null) { controller.AccessoriesCopiedEvent(sender, e); } }
private void AccessoriesApi_AccessoriesCopied(object sender, AccessoryCopyEventArgs e) { var controller = GetMakerCharaController(); if (controller != null) { controller.AccessoriesCopiedEvent(sender, e); } UI.ToggleButtonVisibility(); }
internal IEnumerator CopyPluginSettingCoroutine(AccessoryCopyEventArgs ev) { DebugMsg(LogLevel.Warning, $"[CopyPluginSettingCoroutine][{ChaControl.GetFullname()}] fired"); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); CopyPluginSetting(ev); }
internal void CopyPluginSetting(AccessoryCopyEventArgs ev) { DebugMsg(LogLevel.Warning, $"[CopyPluginSetting][{ChaControl.GetFullname()}] fired"); foreach (string _name in SupportList) { Traverse.Create(this).Field(_name).Method("CopyPartsInfo", new object[] { ev }).GetValue(); } ChaControl.StartCoroutine(RefreshCoroutine()); }
internal void CopyPartsInfo(AccessoryCopyEventArgs ev) { if (!_installed) { return; } foreach (int _slotIndex in ev.CopiedSlotIndexes) { Traverse.Create(_pluginCtrl).Method("CloneSlotTriggerProperty", new object[] { _slotIndex, _slotIndex, (int)ev.CopySource, (int)ev.CopyDestination }).GetValue(); } return; }
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()); } }
private void AccessoriesApi_AccessoriesCopied(object sender, AccessoryCopyEventArgs e) => HideUI();
private void AccessoriesApi_AccessoriesCopied(object sender, AccessoryCopyEventArgs e) => MaterialEditorPlugin.GetCharaController(MakerAPI.GetCharacterControl())?.AccessoriesCopiedEvent(sender, e);
private void AccessoriesApi_AccessoriesCopied(object sender, AccessoryCopyEventArgs e) => GetController(MakerAPI.GetCharacterControl()).CopyAccessoriesHandler(e);
internal void CopyPartsInfo(AccessoryCopyEventArgs ev) { Traverse.Create(_pluginCtrl).Method("AccessoriesCopiedEvent", new object[] { null, ev }).GetValue(); }