Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="br"></param>
        /// <param name="f"></param>
        /// <param name="aPart"></param>
        /// <param name="partTitle"></param>
        /// <returns></returns>
        private bool ReadPart(BinaryReader br, FileInfo f, out BasePart aPart, out string partTitle)
        {
            Logger.LogDebug("ReadPart " + f.FullName);

            aPart     = null;
            partTitle = null;

            // マジック
            string tmpMagic = br.ReadString();

            if (tmpMagic != SceneExport.MAGIC)
            {
                Logger.Log(BepInEx.Logging.LogLevel.Message, "Error: Invalid file format:" + f.FullName);
                return(false);
            }
            // 名前
            partTitle = br.ReadString();

            // Kind
            int kind = br.ReadInt32();

            //キー
            string sb_key = br.ReadString();

            if (kind == 0)
            {
                //H パート
                aPart = new HEdit.HPart();
                aPart.Load(br, HEditData.Instance.dataVersion);
                if (this.CheckHPart((HEdit.HPart)aPart, f.Name) == false)
                {
                    //読み込めないデータ
                    return(false);
                }
            }
            else
            {
                //ADV パート
                aPart = new HEdit.ADVPart(0);
                aPart.Load(br, HEditData.Instance.dataVersion);

                if (this.CheckADVPart((HEdit.ADVPart)aPart, f.Name) == false)
                {
                    //読み込めないデータ
                    return(false);
                }
            }

            return(true);
        }