private static void CopyCharState(HEdit.ADVPart.CharState cs_src, HEdit.ADVPart.CharState cs_dest) { //cs_dest.id = cs_src.id; cs_dest.visible = cs_src.visible; cs_dest.posAndRot.pos = cs_src.posAndRot.pos; cs_dest.posAndRot.rot = cs_src.posAndRot.rot; cs_dest.pose.Copy(cs_src.pose); cs_dest.face.Copy(cs_src.face); cs_dest.neckAdd = cs_src.neckAdd; cs_dest.coordinate.Copy(cs_src.coordinate); for (int i = 0; i < cs_dest.clothes.Length; i++) { cs_dest.clothes[i] = cs_src.clothes[i]; } for (int j = 0; j < cs_dest.accessory.Length; j++) { cs_dest.accessory[j] = cs_src.accessory[j]; } for (int k = 0; k < cs_dest.liquid.Length; k++) { cs_dest.liquid[k] = cs_src.liquid[k]; } cs_dest.visibleSun = cs_src.visibleSun; cs_dest.voice.Copy(cs_src.voice); }
/// <summary> /// ADVパートのキャラ数を調整 /// </summary> /// <param name="part"></param> private bool CheckADVPart(HEdit.ADVPart part, string partName) { Logger.LogDebug("check start"); CheckMap(part); int charaNum = 0; // キャラチェック foreach (HEdit.ADVPart.Cut c in part.cuts) { int diff = HEditData.Instance.charas.Count - c.charStates.Count; if (diff == 0) { continue; } charaNum = c.charStates.Count; Logger.LogDebug("Chara num:" + charaNum); if (diff > 0) { //キャラが不足しているので追加 for (int i = 0; i < diff; i++) { //非表示に設定して追加 HEdit.ADVPart.CharState cs = new HEdit.ADVPart.CharState(); cs.visible = false; c.charStates.Add(cs); } } else if (diff < 0) { #if USE_BEPINEX_50 //キャラが多いので削除 if (EnableCharaRemove.Value) { c.charStates.RemoveRange(c.charStates.Count + diff, -diff); } else #endif { //キャラが多い場合はエラーで抜ける Logger.Log(BepInEx.Logging.LogLevel.Message, "Error: The number of charas (" + c.charStates.Count + ") is over in ADV part." + partName); return(false); } } } if (charaNum != 0) { Logger.Log(BepInEx.Logging.LogLevel.Message, charaNum + " charactors in ADV part:" + partName); } return(true); }
private bool SwapChara() { Logger.LogDebug("Swap"); if (!this.m_charaToggle.isOn) { return(false); } ChaControl ctrl = ADVCreate.ADVPartUICtrl.Instance.chaControl; if (ctrl == null) { return(false); } if (m_tmpCopyIndex < 0) { return(false); } if (m_tmpCopyIndex == ctrl.chaID) { return(false); } var tmpState = new HEdit.ADVPart.CharState(); CopyCharState(ADVCreate.ADVPartUICtrl.Instance.cut.charStates[ctrl.chaID], tmpState); CopyCharState(m_tmpCopyIndex, ctrl.chaID); CopyCharState(tmpState, m_tmpCopyIndex); Illusion.Game.Utils.Sound.Play(Illusion.Game.SystemSE.sel); Logger.LogMessage("Swap " + GetCharaName(m_tmpCopyIndex) + " and " + GetCharaName(ctrl.chaID)); m_chUI.Adapt(); //CharStateのデータをキャラに反映 return(true); }
private static void CopyCharState(HEdit.ADVPart.CharState cs_src, int idx) { CopyCharState(cs_src, ADVCreate.ADVPartUICtrl.Instance.cut.charStates[idx]); }