Beispiel #1
0
    private IEnumerator initialize()
    {
        base.Initialize();

        masterGameRule.Load(textMasterGameRule);

        if (masterGameRule.Read("charamode") == "multi")
        {
            chara_control.m_multiSprite.enabled  = true;
            chara_control.m_singleSprite.enabled = false;
        }
        else
        {
            chara_control.m_multiSprite.enabled  = false;
            chara_control.m_singleSprite.enabled = true;
        }

        adsbanner_top.Show(masterGameRule.Read("adbanner_top"));
        adsbanner_bottom.Show(masterGameRule.Read("adbanner_bottom"));



        masterItem.Load(textMasterItem);
        masterEnemy.Load(textMasterEnemy);
        masterFloor.Load(textMasterFloor);
        masterDungeon.Load(textMasterDungeon);
        masterMedalPrize.Load(textMasterMedalPrize);
        masterSkin.Load(textMasterSkin);
        masterAccessary.Load(textMasterAccessary);

#if UNITY_EDITOR
        if (bUseSSData)
        {
            yield return(StartCoroutine(masterItem.SpreadSheet(SS_MASTER, "item", () => { })));

            yield return(StartCoroutine(masterSkin.SpreadSheet(SS_MASTER, "skin", () => { })));

            yield return(StartCoroutine(masterEnemy.SpreadSheet(SS_MASTER, "enemy", () => { })));

            yield return(StartCoroutine(masterDungeon.SpreadSheet(SS_MASTER, "dungeon", () => { })));

            yield return(StartCoroutine(masterFloor.SpreadSheet(SS_MASTER, "floor", () => { })));

            yield return(StartCoroutine(masterMedalPrize.SpreadSheet(SS_MASTER, "medal_prize", () => { })));
        }
#else
        bUseSSData = false;
#endif


        string data_item = string.Format("{0}/{1}", floder_name, "data_item");
        dataItem = new DataItem();
        dataItem.SetSaveFilename(data_item);
        if (false == dataItem.LoadMulti(data_item))
        {
            List <MasterItemParam> initiali_data_list = masterItem.list.FindAll(p => p.item_id / MasterItem.LargeCategory <= MasterItem.CategoryMagic);
            foreach (MasterItemParam param in initiali_data_list)
            {
                if (0 < param.item_id / 10)
                {
                    dataItem.AddItem(param.item_id, 0);
                }
            }
            dataItem.Save();
        }
        dataItem.list.Sort((a, b) => a.item_id - b.item_id);

        string strUserData = string.Format("{0}/{1}", floder_name, "user_data");
        user_data.SetSaveFilename(strUserData);
        if (false == user_data.LoadMulti(strUserData))
        {
            // ユーザーデータの初期化処理
            floor_current = 1;
            floor_best    = 1;
            floor_restart = 1;

            user_data.WriteInt(Defines.KeyCoin, 0);
            user_data.WriteInt(Defines.KeyGem, 0);


            user_data.Write(Defines.KEY_SOUND_BGM, 1.0f.ToString());
            user_data.Write(Defines.KEY_SOUND_SE, 1.0f.ToString());

            user_data.WriteInt(Defines.KEY_GAMESPEEDMETER, 1);

            user_data.Save();
        }
        if (user_data.HasKey(Defines.KEY_SOUND_BGM) == false)
        {
            user_data.Write(Defines.KEY_SOUND_BGM, 1.0f.ToString());
        }
        if (user_data.HasKey(Defines.KEY_SOUND_SE) == false)
        {
            user_data.Write(Defines.KEY_SOUND_SE, 1.0f.ToString());
        }

        if (user_data.HasKey(Defines.KEY_CHARA_LEVEL))
        {
            Debug.Log("chara_restore");
            dataChara.Restore(user_data.ReadInt(Defines.KEY_CHARA_LEVEL));
        }
        else
        {
            // リスタートフロアをセットする
            //user_data.WriteInt(Defines.KEY_CHARA_FLOOR_CURRENT, Instance.floor_restart);
            Instance.floor_current = Instance.floor_restart;
            dataChara.Build(1);

            user_data.Save();
        }


        SetSpeedMeter(user_data.ReadInt(Defines.KEY_GAMESPEEDMETER));

        if (user_data.HasKey(Defines.KEY_GAMESPEED_LEVEL))
        {
            int game_speed_level = user_data.ReadInt(Defines.KEY_GAMESPEED_LEVEL);
            //Debug.Log(game_speed_level);
            gameSpeedControl.SetSpeedLevel(game_speed_level);
        }

        //Debug.Log(user_data.list.Count);
        foreach (CsvKvsParam p in user_data.list)
        {
            //Debug.Log(p.key);
        }
        Debug.Log("datamanager.initialized");

        Initialized = true;

        yield return(null);
    }
Beispiel #2
0
    IEnumerator Start()
    {
        m_goAutoCloseMessage.SetActive(false);

        Time.timeScale = 1.0f;
        masterItem.Load(textMasterItem);
        masterDungeon.Load(textMasterDungeon);
        masterSkin.Load(textMasterSkin);

        string data_item = string.Format("{0}/{1}", floder_name, "data_item");

        dataItem = new DataItem();
        dataItem.LoadMulti(data_item);
        dataItem.SetSaveFilename(data_item);
        dataItem.list.Sort((a, b) => a.item_id - b.item_id);

        string strUserData = string.Format("{0}/{1}", floder_name, "user_data");

        user_data = new DataKvs();
        user_data.SetSaveFilename(strUserData);
        user_data.LoadMulti(strUserData);

        yield return(null);

        int skin_id = 1;

        if (user_data.HasKey(Defines.KEY_USE_SKIN_ID))
        {
            skin_id = user_data.ReadInt(Defines.KEY_USE_SKIN_ID);
        }

        // クソみたいな修正
        if (skin_id == 0)
        {
            skin_id = 1;
        }

        MasterSkinParam skin = masterSkin.list.Find(p => p.skin_id == skin_id);

        chara.overrideTexture = TextureManager.Instance.Get(skin.texture_name);


        MasterDungeonParam dungeon = masterDungeon.list.Find(p => p.dungeon_id == user_data.Read(Defines.KEY_DUNGEON_ID));

        bg.sprite = SpriteManager.Instance.Get(dungeon.background);


        string[] arr = dungeon.clear_comment.Split(new string[] { "\\n" }, StringSplitOptions.None);
        //Debug.Log(arr.Length);
        foreach (string p in arr)
        {
            m_txtClearComment.text += p;
            m_txtClearComment.text += "\n";
        }
        //Debug.Log(dungeon.prize_id_1);

        string KeyClearedDungeon = string.Format("cleared_dungeon_{0}", dungeon.dungeon_id);

        if (user_data.HasKey(KeyClearedDungeon) == false)
        {
            user_data.WriteInt(KeyClearedDungeon, 1);
            //Debug.Log(dungeon.prize_id_1);
            if (dungeon.prize_id_1 != 0)
            {
                MasterItemParam master_item_prize1 = masterItem.list.Find(p => p.item_id == dungeon.prize_id_1);

                dataItem.AddItem(master_item_prize1, dungeon.prize_id_1, 1);
            }
            if (dungeon.prize_id_2 != 0)
            {
                MasterItemParam master_item_prize2 = masterItem.list.Find(p => p.item_id == dungeon.prize_id_2);
                dataItem.AddItem(master_item_prize2, dungeon.prize_id_2, 1);
            }
            dataItem.Save();
        }
        else
        {
            m_goAutoCloseMessage.SetActive(true);
            StartCoroutine(AutoClose());
        }
        user_data.Save();
    }