Beispiel #1
0
        ushort FindUnusedID(StageDatabase staged)
        {
            ushort id = 0;

            var stage = staged.Stages.Where(c => c.Id == 0).FirstOrDefault();

            while (stage != null)
            {
                id++;
                stage = staged.Stages.Where(c => c.Id == id).FirstOrDefault();
            }
            Logs.WriteLine("new stage at id = " + id);
            return(id);
        }
Beispiel #2
0
    /**
     * Initializes the editor window. Loads the stage database
     * @return False on loading error, else true
     */
    public static bool LoadStageDatabase()
    {
        databaseInstance = (StageDatabase)Resources.Load("Databases/GD_Spawners/GD_StageDatabase") as StageDatabase;
        if (!databaseInstance)
        {
            EditorUtility.DisplayDialog(
                "Unable to load the stages database",
                "Please check if the database exist in the resources folder.", "Ok");

            return(false);
        }

        return(true);
    }
Beispiel #3
0
    private void PopulateMissionList()
    {
        StageDatabase stageDatabaseClone = GameDatabase.stageDatabase;

        missionDictionary = stageDatabaseClone[StageType.Mission];

        foreach (StageData mData in missionDictionary.Values)
        {
            missionPointDataList.Add(mData);
        }

        foreach (MissionPointModel mPointModel in transform.root.GetComponentsInChildren <MissionPointModel>())
        {
            missionPointModelsList.Add(mPointModel);
        }

        for (int i = 0; i < missionPointModelsList.Count; i++)
        {
            missionPointModelsList[i].SetStageData(missionPointDataList[i]);
        }
    }
Beispiel #4
0
    private void Start()
    {
        //ボタン作成
        stageDatabase = Resources.Load <StageDatabase>("stageDatabase");
        List <Stage> stageList    = new List <Stage>();
        List <Stage> tmpStageList = stageDatabase.stageList;

        //210514 キーコンフィグを初期化
        if (KeyConfigManager.configMap == null)
        {
            string configFilePath = Application.persistentDataPath + "/keyConfig";
            KeyConfigManager.InitKeyConfig(configFilePath);
        }

        //紅魔ルートと霊夢ルートを分ける
        if (ModeManager.route == Route.REIMU)
        {
            stageList = stageDatabase.stageList.FindAll(stage => stage.isReimuRoute == true);
        }
        else
        {
            stageList = stageDatabase.stageList.FindAll(stage => stage.isReimuRoute == false);
        }

        //210304 ゲーム進行度を反映
        foreach (Stage stage in stageList)
        {
            //chapterは数字で管理しているので、現在の進行度以下のステージを表示していく
            //210522 テストで全ステージを表示する場合はここをコメントアウト
            if (stage.chapter <= ChapterManager.chapter)
            {
                //Resources配下からボタンをロード
                var itemButton = (Instantiate(Resources.Load("Prefabs/StageButton")) as GameObject).transform;
                //ボタン初期化 今はテキストのみ
                itemButton.GetComponent <StageButton>().Init(stage.chapter, this);
                itemButton.name = itemButton.name.Replace("(Clone)", "");

                //partyWindowオブジェクト配下にprefab作成
                itemButton.transform.SetParent(stageWindow.transform);
            }
        }

        //210206 BGM再生
        GameObject bgmManager = GameObject.Find("BGMManager");

        if (bgmManager == null)
        {
            bgmManager      = (Instantiate(Resources.Load("Prefabs/BGMManager")) as GameObject);
            bgmManager.name = bgmManager.name.Replace("(Clone)", "");
        }
        bgmPlayer = bgmManager.GetComponent <BGMPlayer>();

        if (BGMType.STATUS != bgmPlayer.playingBGM)
        {
            bgmPlayer.ChangeBGM(BGMType.STATUS);
            bgmPlayer.PlayBGM();
        }

        //効果音再生用
        audioSource = GameObject.Find("BGMManager").GetComponent <AudioSource>();

        //フェードイン開始
        fadeInOutManager.FadeinStart();
    }
Beispiel #5
0
        public void GenerateObjSet(string filePath, Model stgpv, ObjectDatabase objdb, TextureDatabase texturedb, StageDatabase staged, string acpath, divamodgen divamods, bool doProcess = true, bool debug = false)
        {
            /*
             * var stgpv = new Model();
             * var textures = new MikuMikuLibrary.Textures.TextureSet();
             * var texdb = new TextureDatabase();
             *
             * using (var farcArchive = BinaryFile.Load<FarcArchive>(filePath))
             * using (var entryStream = farcArchive.Open(farcArchive.Entries.Where(c => c.Contains("txi")).First(), EntryStreamMode.MemoryStream))
             *  texdb.Load(entryStream);
             *
             * if (debug)
             * {
             *  string farcpath = acpath + "\\rom\\objset\\" + Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + ".farc";
             *
             *  using (var farcArchive = BinaryFile.Load<FarcArchive>(farcpath))
             *  using (var entryStream = farcArchive.Open(farcArchive.Entries.Where(c => c.Contains("tex")).First(), EntryStreamMode.MemoryStream))
             *      textures.Load(entryStream);
             *
             * }
             * else
             * {
             *  using (var farcArchive = BinaryFile.Load<FarcArchive>(filePath))
             *  using (var entryStream = farcArchive.Open(farcArchive.Entries.Where(c => c.Contains("txd")).First(), EntryStreamMode.MemoryStream))
             *      textures.Load(entryStream);
             *
             *  using (var farcArchive = BinaryFile.Load<FarcArchive>(filePath))
             *  using (var entryStream = farcArchive.Open(farcArchive.Entries.First(), EntryStreamMode.MemoryStream))
             *      stgpv.Load(entryStream, textures, texdb);
             * }
             *
             */

            if (Path.GetFileNameWithoutExtension(filePath).Contains("effpv"))
            {
                filePath = Path.GetDirectoryName(filePath) + "\\" + Path.GetFileNameWithoutExtension(filePath).Replace("effpv", "stgpv") + "hrc2.farc";
            }

            var texdb = new TextureDatabase();

            //using (var farcArchive = BinaryFile.Load<FarcArchive>(filePath))
            //using (var entryStream = farcArchive.Open(farcArchive.Entries.Where(c => c.Contains("txi")).First(), EntryStreamMode.MemoryStream))
            //   texdb.Load(entryStream);

            var objentry = new ObjectEntry();

            objentry.ArchiveFileName = Path.GetFileName(filePath).Replace("stgpv0", "stgpv8");
            objentry.FileName        = Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + "_obj.bin";
            objentry.Id              = FindUnusedID(objdb);
            objentry.Name            = Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8").ToUpper();
            objentry.TextureFileName = Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + "_tex.bin";

            int ground_id = -1;

            ushort counter = 1;

            foreach (var meshes in stgpv.Meshes)
            {
                meshes.SubMeshes.RemoveAll(x => x.Vertices == null || x.Vertices.Length == 0);
                meshes.Name = meshes.Name.Replace("STGPV0", "STGPV8");
                meshes.Name = meshes.Name.Replace("EFFPV", "STGPV");

                if (Path.GetFileName(filePath).Contains("hrc"))
                {
                    int pvid = int.Parse(Path.GetFileName(filePath).Substring(5, 3));

                    if (pvid < 200)
                    {
                        pvid = pvid + 800;
                    }

                    {
                        var check2 = divamods.Divamods.Where(c => c.pvid == pvid).FirstOrDefault();
                        if (check2 == null)
                        {
                            divamods.Divamods.Add(new pdaconversion.divamods(pvid));
                            Logs.WriteLine("objset: Created new PV at id " + pvid);
                            check2 = divamods.Divamods.Where(c => c.pvid == pvid).First();
                        }
                        check2.item_pv.Add(meshes.Name);
                        Logs.WriteLine("objset: Added item_pv for PV at id " + pvid + "," + meshes.Name);
                    }

                    if (pvid >= 800)
                    {
                        var check2 = divamods.Divamods.Where(c => c.pvid == (pvid - 100)).FirstOrDefault();
                        if (check2 == null)
                        {
                            divamods.Divamods.Add(new pdaconversion.divamods(pvid - 100));
                            Logs.WriteLine("objset: Created new PV at id " + (pvid - 100));
                            check2 = divamods.Divamods.Where(c => c.pvid == (pvid - 100)).First();
                        }
                        check2.item_pv.Add(meshes.Name);
                        Logs.WriteLine("objset: Added item_pv for PV at id " + (pvid - 100) + "," + meshes.Name);
                    }
                }

                var meshentry = new MeshEntry();
                meshes.Id      = counter;
                meshentry.Id   = (ushort)meshes.Id;
                meshentry.Name = meshes.Name;

                if (meshes.Name.Contains("GND"))
                {
                    ground_id = meshes.Id;
                }

                objentry.Meshes.Add(meshentry);

                if (doProcess)
                {
                    if (!debug)
                    {
                        /*
                         * foreach (var submeshes in meshes.SubMeshes)
                         * {
                         *  foreach (var indexTable in submeshes.IndexTables)
                         *  {
                         *      ushort[] triangleStrip = Stripifier.Stripify(indexTable.Indices);
                         *      if (triangleStrip != null)
                         *      {
                         *          indexTable.PrimitiveType = PrimitiveType.TriangleStrip;
                         *          indexTable.Indices = triangleStrip;
                         *      }
                         *  }
                         * }
                         */
                    }

                    //foreach (var textures in M)

                    foreach (var material in meshes.Materials)
                    {
                        if ((Path.GetFileName(filePath).Contains("hrc2")) || (Path.GetFileName(filePath).Contains("hrc")))
                        {
                            material.Shader         = "ITEM";
                            material.IsAlphaEnabled = false;
                            //material.Field00 = 0x00000001;
                            //material.Field02 = 0x00000A80;

                            //material.Diffuse.Field00 = 0x00000000;
                            //material.Diffuse.Field01 = 0x016400E1;
                            //material.Diffuse.Field02 = 0x000000F1;

                            MikuMikuLibrary.Misc.Color asdf = new MikuMikuLibrary.Misc.Color(0, 0, 0, 0);

                            material.SpecularColor = asdf;

                            //material.AmbientColor = asdf;
                            //material.EmissionColor = asdf;
                            //material.SpecularColor = asdf;

                            //material.Shininess = 1;

                            //material.Diffuse.Field00 = 0x00000000;
                            //material.Diffuse.Field01 = 0x002400E0;
                            //material.Diffuse.Field02 = 0x000000F1;

                            if (material.Ambient.TextureId == 1509989155)
                            {
                                material.Ambient.TextureId = -1;
                            }
                            if (material.Normal.TextureId == 1509989155)
                            {
                                material.Normal.TextureId = -1;
                            }
                            if (material.Specular.TextureId == 1509989155)
                            {
                                material.Specular.TextureId = -1;
                                material.SpecularColor      = asdf;
                            }
                            //else { material.Field00 = 0x0000002D; }

                            /*
                             *
                             * // this blacken the screen on STAGE SHADER
                             * material.Specular.Field01 = 0x002418C3;
                             * material.Specular.Field02 = 0x000000F3;
                             * material.Specular.Field05 = 1;
                             * material.Specular.Field06 = 1;
                             * material.Specular.Field11 = 1;
                             * material.Specular.Field16 = 1;
                             * material.Specular.Field21 = 1;
                             *
                             *
                             * material.Specular.TextureId = -1;
                             * material.Specular.Field01 = 0x00000000;
                             * material.Specular.Field02 = 0x000000F0;
                             * material.Specular.Field05 = 1;
                             * material.Specular.Field06 = 0;
                             * material.Specular.Field11 = 0;
                             * material.Specular.Field16 = 0;
                             * material.Specular.Field21 = 0;
                             *
                             * material.Reflection.TextureId = -1;
                             * material.Reflection.Field01 = 0x00000000;
                             * material.Reflection.Field02 = 0x000000F0;
                             * material.Reflection.Field05 = 1;
                             * material.Reflection.Field06 = 0;
                             * material.Reflection.Field11 = 0;
                             * material.Reflection.Field16 = 0;
                             * material.Reflection.Field21 = 0;
                             */

                            if (material.Reflection.TextureId == 1509989155)
                            {
                                material.Reflection.TextureId = -1;
                            }
                            if (material.ToonCurve.TextureId == 1509989155)
                            {
                                material.ToonCurve.TextureId = -1;
                            }
                            if (material.SpecularPower.TextureId == 1509989155)
                            {
                                material.SpecularPower.TextureId = -1;
                            }
                            if (material.Texture08.TextureId == 1509989155)
                            {
                                material.Texture08.TextureId = -1;
                            }
                        }
                        else
                        {
                            material.Shader = "BLINN";
                            //material.Field00 = 0x0000000D;
                            //material.Field02 = 0x00000A80;

                            MikuMikuLibrary.Misc.Color asdf = new MikuMikuLibrary.Misc.Color(0, 0, 0, 0);

                            //material.AmbientColor = asdf;
                            //material.EmissionColor = asdf;
                            //material.Shininess = 1;
                            //material.Diffuse.Field00 = 0x00000230;
                            //material.Diffuse.Field02 = 0x002418C3;

                            if (material.Ambient.TextureId == 1509989155)
                            {
                                material.Ambient.TextureId = -1;
                            }
                            if (material.Normal.TextureId == 1509989155)
                            {
                                material.Normal.TextureId = -1;
                            }
                            if (material.Specular.TextureId == 1509989155)
                            {
                                material.Specular.TextureId = -1;
                                material.SpecularColor      = asdf;
                            }
                            //else { material.Field00 = 0x0000002D; }

                            /*
                             *
                             * // this blacken the screen on STAGE SHADER
                             * material.Specular.Field01 = 0x002418C3;
                             * material.Specular.Field02 = 0x000000F3;
                             * material.Specular.Field05 = 1;
                             * material.Specular.Field06 = 1;
                             * material.Specular.Field11 = 1;
                             * material.Specular.Field16 = 1;
                             * material.Specular.Field21 = 1;
                             *
                             */

                            /*
                             * material.Specular.TextureId = -1;
                             * material.Specular.Field01 = 0x00000000;
                             * material.Specular.Field02 = 0x000000F0;
                             * material.Specular.Field05 = 5;
                             * material.Specular.Field06 = 0;
                             * material.Specular.Field11 = 0;
                             * material.Specular.Field16 = 0;
                             * material.Specular.Field21 = 0;
                             *
                             *
                             * material.Normal.Field01 = 0x00000000;
                             * material.Normal.Field02 = 0x000000F0;
                             * material.Normal.Field05 = 5;
                             * material.Normal.Field06 = 0;
                             * material.Normal.Field11 = 0;
                             * material.Normal.Field16 = 0;
                             * material.Normal.Field21 = 0;
                             *
                             *
                             * material.ToonCurve.TextureId = -1;
                             * material.ToonCurve.Field01 = 0x00000000;
                             * material.ToonCurve.Field02 = 0x000000F0;
                             * material.ToonCurve.Field05 = 5;
                             * material.ToonCurve.Field06 = 0;
                             * material.ToonCurve.Field11 = 0;
                             * material.ToonCurve.Field16 = 0;
                             * material.ToonCurve.Field21 = 0;
                             */

                            if (material.Reflection.TextureId == 1509989155)
                            {
                                material.Reflection.TextureId = -1;
                            }
                            if (material.ToonCurve.TextureId == 1509989155)
                            {
                                material.ToonCurve.TextureId = -1;
                            }
                            if (material.SpecularPower.TextureId == 1509989155)
                            {
                                material.SpecularPower.TextureId = -1;
                            }
                            if (material.Texture08.TextureId == 1509989155)
                            {
                                material.Texture08.TextureId = -1;
                            }
                        }
                    }
                }
                counter++;
            }

            stgpv.TextureSet.Format = BinaryFormat.DT;
            stgpv.Format            = BinaryFormat.DT;



            if (doProcess)
            {
                stgpv.Save("temp\\" + Path.GetFileNameWithoutExtension(filePath) + "_obj.bin", null, texturedb, null);
            }
            objdb.Objects.Add(objentry);

            if (Path.GetFileNameWithoutExtension(filePath).Count() == 8)
            {
                StageEntry stage = new StageEntry();
                stage.Id                  = FindUnusedID(staged);
                stage.Name                = Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8").ToUpper();
                stage.ObjectGroundId      = (short)ground_id;
                stage.ObjectGroundIdFlag  = (short)objentry.Id;
                stage.ObjectId3           = -1;
                stage.ObjectIdFlag3       = -1;
                stage.ObjectId5           = -1;
                stage.ObjectIdFlag5       = -1;
                stage.ObjectId7           = -1;
                stage.ObjectIdFlag7       = -1;
                stage.RingRectangleX      = -8;
                stage.RingRectangleY      = -8;
                stage.RingRectangleWidth  = 16;
                stage.RingRectangleHeight = 16;
                stage.RingRingHeight      = 0;
                stage.RingOutHeight       = -1000;
                stage.Field00             = 1;
                stage.Field11             = -1;
                stage.Field02             = -1;

                stage.LensFlareScaleX = -1;
                stage.LensFlareScaleY = -1;
                stage.LensFlareScaleZ = -1;

                stage.ObjectSkyId         = -1;
                stage.ObjectSkyIdFlag     = -1;
                stage.ObjectReflectId     = -1;
                stage.ObjectReflectIdFlag = -1;

                stage.CollisionFilePath = @"rom/STGTST_COLI.000.bin";

                stage.ObjectId1    = (short)objentry.Id;
                stage.StageEffect1 = StageEntry.StageEffect.Empty;
                stage.Auth3dName   = "EFF" + stage.Name;
                staged.Stages.Add(stage);
            }

            if (doProcess)
            {
                var newfarc = new FarcArchive();
                newfarc.Add(Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + "_obj.bin", "temp\\" + Path.GetFileNameWithoutExtension(filePath) + "_obj.bin");
                newfarc.Add(Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + "_tex.bin", "temp\\" + Path.GetFileNameWithoutExtension(filePath) + "_tex.bin");
                newfarc.Alignment    = 16;
                newfarc.IsCompressed = false;
                newfarc.Save(acpath + "\\rom\\objset\\" + Path.GetFileNameWithoutExtension(filePath).Replace("stgpv0", "stgpv8") + ".farc");
            }
        }