예제 #1
0
        public override void Initialize()
        {
            base.Initialize();
            master_quest = new MasterQuest();
            master_quest.Load(m_taMasterQuest);
            master_item = new MasterItem();
            master_item.Load(m_taMasterItem);
            master_chara = new MasterChara();
            master_chara.Load(m_taMasterChara);

            data_quest = new DataQuest();
            data_quest.SetSaveFilename("data/data_quest");
            if (data_quest.Load() == false)
            {
                Debug.Log("loaderror.data_quest");
            }

            data_item_consume = new DataItem();
            data_item_consume.SetSaveFilename("data/data_item_consume");
            if (data_item_consume.Load() == false)
            {
                DataItemParam item = new DataItemParam
                {
                    item_id = 1
                };
                data_item_consume.AddItem(item);
                DataItemParam item2 = new DataItemParam
                {
                    item_id = 1
                };
                data_item_consume.AddItem(item2);
                Debug.Log("loaderror.data_item_consume");
            }
            data_item_equip = new DataItem();
            data_item_equip.SetSaveFilename("data/data_item_equip");
            if (data_item_equip.Load() == false)
            {
                Debug.Log("loaderror.data_item_equip");
            }

            data_chara = new DataChara();
            data_chara.SetSaveFilename("data/data_chara");
            if (data_chara.Load() == false)
            {
                DataCharaParam slime = new DataCharaParam
                {
                    chara_id = 1,
                    position = 1
                };
                slime.Build(1, master_chara.list.Find(p => p.chara_id == 1));
                data_chara.list.Add(slime);
                DataCharaParam fairy = new DataCharaParam
                {
                    chara_id = 3,
                    position = 2
                };
                fairy.Build(1, master_chara.list.Find(p => p.chara_id == 3));
                data_chara.list.Add(fairy);
            }

            gold = 100;

            Initialized = true;
        }
예제 #2
0
    IEnumerator init_network()
    {
        Debug.Log("init_network start");
        yield return(StartCoroutine(config.SpreadSheet(Defines.SS_MASTER, "config", () => { })));

        masterChara.SetSaveFilename(Defines.FILENAME_MASTERCHARA);

        masterChara.Load(m_textAssetHolder.Get("master_chara"));
        masterWeapon.Load(m_textAssetHolder.Get("master_weapon"));
        masterArmor.Load(m_textAssetHolder.Get("master_armor"));
        masterSkill.Load(m_textAssetHolder.Get("master_skill"));
        masterPotion.Load(m_textAssetHolder.Get("master_potion"));
        masterTreasure.Load(m_textAssetHolder.Get("master_treasure"));
        masterEnemy.Load(m_textAssetHolder.Get("master_enemy"));
        masterItem.Load(m_textAssetHolder.Get("master_item"));
        masterStage.Load(m_textAssetHolder.Get("master_stage"));
        masterFloor.Load(m_textAssetHolder.Get("master_floor"));
        masterHelp.Load(m_textAssetHolder.Get("master_help"));

#if UNITY_EDITOR
        if (m_bLoadNetworkData)
        {
            #region 通信初期化
            yield return(StartCoroutine(masterChara.SpreadSheet(Defines.SS_MASTER, "chara", () => { })));

            yield return(StartCoroutine(masterWeapon.SpreadSheet(Defines.SS_MASTER, "weapon", () => { })));

            yield return(StartCoroutine(masterArmor.SpreadSheet(Defines.SS_MASTER, "armor", () => { })));

            yield return(StartCoroutine(masterSkill.SpreadSheet(Defines.SS_MASTER, "skill", () => { })));

            yield return(StartCoroutine(masterPotion.SpreadSheet(Defines.SS_MASTER, "potion", () => { })));

            yield return(StartCoroutine(masterTreasure.SpreadSheet(Defines.SS_MASTER, "treasure", () =>
            {
                /*
                 * foreach( MasterTreasureParam master in masterTreasure.list)
                 * {
                 *      Debug.Log(string.Format("id:{0} name:{1} sprite:{2}", master.treasure_id , master.name , master.sprite_name));
                 * }
                 */
            })));

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

            yield return(StartCoroutine(masterItem.SpreadSheet(Defines.SS_MASTER, "item", () => { })));

            yield return(StartCoroutine(masterStage.SpreadSheet(Defines.SS_MASTER, "stage", () => { })));

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

            yield return(StartCoroutine(masterHelp.SpreadSheet(Defines.SS_MASTER, "help", () => { })));

            #endregion
        }
#endif
        // 未初期化扱い
        if (!user_data.HasKey(Defines.KEY_AUTOPOTION_RATE))
        {
            user_data.WriteInt(Defines.KEY_USE_AUTOMOVE, 1);
            user_data.WriteInt(Defines.KEY_USE_AUTOPOTION, 1);

            user_data.WriteFloat(Defines.KEY_AUTOPOTION_RATE, Defines.DEFAULT_AUTOPOTION_RATE);
            user_data.WriteFloat(Defines.KEY_SOUNDVOLUME_BGM, Defines.SOUND_VOLME_DEFAULT);
            user_data.WriteFloat(Defines.KEY_SOUNDVOLUME_SE, Defines.SOUND_VOLME_DEFAULT);
        }


        game_data.SetSaveFilename(Defines.FILENAME_GAMEDATA);
        if (game_data.LoadMulti() == false)
        {
            // なんかする
            // なにもしなくてok
        }
        dataChara.SetSaveFilename(Defines.FILENAME_DATACHARA);
        if (dataChara.LoadMulti() == false)
        {
            // 初期データ的ななにか保存はしない
            DataCharaParam slime = new DataCharaParam();
            slime.chara_id = 1;
            slime.status   = DataChara.STATUS.USING.ToString();
            dataChara.list.Add(slime);
        }
        dataWeapon.SetSaveFilename(Defines.FILENAME_DATAWEAPON);
        if (dataWeapon.LoadMulti() == false)
        {
            DataWeaponParam add_weapon = new DataWeaponParam();
            add_weapon.weapon_id = 1;
            add_weapon.level     = 1;
            add_weapon.equip     = 1;           // 武器はtfで良いのでは?
            dataWeapon.Add(add_weapon);
        }
        dataWeaponAlbum.SetSaveFilename(Defines.FILENAME_DATAWEAPONALBUM);
        if (dataWeaponAlbum.LoadMulti() == false)
        {
            dataWeaponAlbum.AddAlbum(1);
        }


        dataArmor.SetSaveFilename(Defines.FILENAME_DATAARMOR);
        if (dataArmor.LoadMulti() == false)
        {
            for (int i = 0; i < MasterArmor.ArmorPositionArr.Length; i++)
            {
                DataArmorParam add = new DataArmorParam();
                add.position = MasterArmor.ArmorPositionArr[i];
                add.level    = 1;
                MasterArmorParam mas = masterArmor.list.Find(p => p.position == add.position && p.level == add.level);
                add.armor_id = mas.armor_id;
                dataArmor.list.Add(add);
            }
        }
        dataSkill.SetSaveFilename(Defines.FILENAME_DATASKILL);
        if (dataSkill.LoadMulti() == false)
        {
            dataSkill.list.Add(new DataSkillParam(1, 1));
        }
        dataPotion.SetSaveFilename(Defines.FILENAME_DATAPOTION);
        if (dataPotion.LoadMulti() == false)
        {
            DataPotionParam add = new DataPotionParam();
            add.potion_id = 1;
            add.num       = 9;
            add.is_use    = true;
            dataPotion.list.Add(add);
        }

        dataTreasure.SetSaveFilename(Defines.FILENAME_DATATREASURE);
        if (dataTreasure.LoadMulti() == false)
        {
            /*
             * int add_serial = dataTreasure.Add(1001);
             * DataTreasureParam add_treasure = dataTreasure.list.Find(p => p.serial == add_serial);
             * add_treasure.equip = 1;
             */
        }
        dataTreasureAlbum.SetSaveFilename(Defines.FILENAME_DATATREASUREALBUM);
        if (dataTreasureAlbum.LoadMulti() == false)
        {
            /*
             * dataTreasureAlbum.Add(1002);
             * dataTreasureAlbum.Add(1003);
             * dataTreasureAlbum.Add(1006);
             * dataTreasureAlbum.Add(1010);
             * dataTreasureAlbum.Add(1026);
             */
        }

        /*
         * dataScroll.SetSaveFilename(Defines.FILENAME_DATASCROLL);
         * if( dataScroll.LoadMulti()== false)
         * {
         *      dataScroll.list.Add(new DataScrollParam(1, 120));
         *      dataScroll.list.Add(new DataScrollParam(2, 120));
         *      dataScroll.list.Add(new DataScrollParam(3, 120));
         *      dataScroll.list.Add(new DataScrollParam(4, 120));
         *      dataScroll.list.Add(new DataScrollParam(5, 120));
         * }
         */
        dataUnit.SetSaveFilename(Defines.FILENAME_DATAUNIT);
        if (dataUnit.LoadMulti() == false)
        {
        }
        dataItem.SetSaveFilename(Defines.FILENAME_DATAITEM);
        if (dataItem.LoadMulti() == false)
        {
            for (int i = 0; i < 5; i++)
            {
                dataItem.Add(Defines.ITEM_ID_SCROLL_BLUE + i, 0);
            }
        }
        dataGetItem.SetSaveFilename(Defines.FILENAME_DATAITEM_GET);
        if (dataGetItem.LoadMulti() == false)
        {
        }
        dataStage.SetSaveFilename(Defines.FILENAME_DATASTAGE);
        if (dataStage.LoadMulti() == false)
        {
            DataStageParam data = new DataStageParam();
            data.stage_id = 1;
            data.status   = 1;
            dataStage.list.Add(data);
        }
        dataFloor.SetSaveFilename(Defines.FILENAME_DATAFLOOR);
        if (dataFloor.LoadMulti() == false)
        {
            DataFloorParam data = new DataFloorParam();
            data.floor_id = 1;
            data.status   = 1;
            dataFloor.list.Add(data);
        }


        if (m_txtKey != null)
        {
            user_data.AddListenerInt(Defines.KeyKey, (iValue) =>
            {
                m_txtKey.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyGoldKey, (iValue) =>
            {
                m_txtGoldKey.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyCoin, (iValue) =>
            {
                m_txtCoin.text = iValue.ToString();
            });
            user_data.AddListenerInt(Defines.KeyGem, (iValue) =>
            {
                m_txtGem.text = iValue.ToString();
            });

#if UNITY_EDITOR
            /*
             * AddGem(debug_gem);
             * AddCoin(debug_coin);
             * AddKey(debug_key);
             * AddGoldKey(debug_gold_key);
             */
#endif
            //m_txtKey.text = user_data.ReadInt(Defines.KeyKey).ToString(); ;
            //m_txtGoldKey.text = user_data.Read(Defines.KeyGoldKey);
            //m_txtCoin.text = user_data.Read(Defines.KeyCoin);
            //m_txtGem.text = user_data.Read(Defines.KeyGem);
        }



        Initialized = true;
        Debug.Log("init_network end");
        yield return(null);
    }