Пример #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            int iCurrentFloor = DataManager.Instance.floor_current;

            current_floor.Value = iCurrentFloor;

            MasterDungeonParam master_dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == dungeon_id.Value);

            if (master_dungeon.floor_max < iCurrentFloor)
            {
                iCurrentFloor       = 1;
                current_floor.Value = iCurrentFloor;
            }

            if (iCurrentFloor < 1)
            {
                iCurrentFloor = 1;
            }
            bool bUpdate = DataManager.Instance.UpdateFloor(iCurrentFloor, false);

            best_floor.Value = DataManager.Instance.floor_best;

            if (bUpdate)
            {
                DataManager.Instance.user_data.Save();
            }
            gameMain.ClearDropObjects();

            // 敵キャラとかの作成
            create_enemies(current_floor.Value, dungeon_id.Value);
        }
Пример #2
0
        public override void OnEnter()
        {
            base.OnEnter();
            campMain.m_goCampCheck.SetActive(true);

            MasterDungeonParam master_dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == dungeon_id.Value);

            campMain.m_txtCheckTitle.text  = master_dungeon.dungeon_label;
            campMain.m_txtCheckDetail.text = master_dungeon.outline;

            MasterItemParam prize_item_1 = DataManager.Instance.masterItem.list.Find(p => p.item_id == master_dungeon.prize_id_1);
            MasterItemParam prize_item_2 = DataManager.Instance.masterItem.list.Find(p => p.item_id == master_dungeon.prize_id_2);

            campMain.prize_1.Initialize(prize_item_1);
            campMain.prize_2.Initialize(prize_item_2);

            if (prize_item_1 == null)
            {
                campMain.m_goPrizeRoot.SetActive(false);
            }
            else
            {
                campMain.m_goPrizeRoot.SetActive(true);
            }

            campMain.m_btnYes.onClick.AddListener(OnYes);
            campMain.m_btnNo.onClick.AddListener(OnNo);
        }
Пример #3
0
    public int GetDropItemId()
    {
        int iRet = 0;

        int[] drop_prob_arr = new int[7]
        {
            drop_prob,                          // セットされたアイテム
            1000,                               // ドロップCoin
            20,                                 // ドロップGem
            10,                                 // ドロップGemの秘伝書
            drop_prob,                          // dtop_item_id_2
            drop_prob,                          // dtop_item_id_3
            15,                                 // なんかメダルが設定されてたら
        };

        int [] drop_item_id_arr = new int[7]
        {
            drop_item_id,
            1,
            2,
            3,
            drop_item_id_2,
            drop_item_id_3,
            1,                          // 差し替え必須
        };

        // Gemの秘伝書が3つ以上ある場合はそれ以上ドロップさせない
        DataItemParam gem_book_check = DataManager.Instance.dataItem.list.Find(p => p.item_id == Defines.ITEM_ID_GEM_BOOK && Defines.GEM_BOOK_DROP_LIMIT < p.num);

        if (gem_book_check != null)
        {
            drop_prob_arr[3] = 0;
        }

        MasterDungeonParam dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == Defines.CurrentDungeonID);

        //Debug.Log(dungeon.dungeon_label);
        if (dungeon.item_id_medal != 0)
        {
            drop_item_id_arr[6] = dungeon.item_id_medal;
        }


        int iResultIndex = UtilRand.GetIndex(drop_prob_arr);

        iRet = drop_item_id_arr[iResultIndex];

        /*
         * if(iResultIndex== 0 )
         * {
         *      iRet = drop_item_id;
         * }
         * else
         * {
         *      iRet = iResultIndex;
         * }
         */
        return(iRet);
    }
Пример #4
0
        public override void OnEnter()
        {
            base.OnEnter();
            int iNextFloor = current_floor.Value + 1;

            MasterDungeonParam master_dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == dungeon_id.Value);


            if (master_dungeon.floor_max < iNextFloor)
            {
                /*
                 * if (1001 <= DataManager.Instance.floor_best)
                 * {
                 *      SceneManager.LoadScene("ending");
                 *
                 * }
                 */
                DataManager.Instance.user_data.WriteInt(Defines.KEY_CHARA_FLOOR_CURRENT, iNextFloor);
                DataManager.Instance.user_data.Save();
                Fsm.Event("ending");
            }
            else
            {
                bool bIsBestFloor = DataManager.Instance.floor_best < iNextFloor;

                bool bUpdate = DataManager.Instance.UpdateFloor(iNextFloor, false);

                current_floor.Value = iNextFloor;
                if (bUpdate)
                {
                    best_floor.Value = iNextFloor;
                }

                if (bIsBestFloor)
                {
                    int iAddGem = 10;
                    DataManager.Instance.user_data.AddInt(Defines.KeyGem, iAddGem);
                    GameMain.Instance.BattleLog(string.Format("<color=#0FF>フロア更新ボーナス</color>:Gem<color=#F00>{0}</color>個獲得", iAddGem));
                }
                DataManager.Instance.SaveAll();

                int iRet = DataManager.Instance.user_data.ReadInt(Defines.KEY_STOP_100);
                //Debug.Log(iRet);

                if (bIsBestFloor && iNextFloor == review_floor.Value)
                {
                    Fsm.Event("review");
                }
                else if (0 < iRet && (iNextFloor - 1) % 100 == 0)
                {
                    Fsm.Event("stop");
                }
                else
                {
                    Finish();
                }
            }
        }
Пример #5
0
    public void Initialize(MasterDungeonParam _master)
    {
        //Debug.Log(_master.dungeon_label);
        m_strDungeonId    = _master.dungeon_id;
        m_txtName.text    = _master.dungeon_label;
        m_txtOutline.text = _master.outline;

        int iBest = DataManager.Instance.GetBestFloor(_master.dungeon_id);

        m_txtFloor.text = string.Format("{0}/{1}", iBest, _master.floor_max);

        btn.onClick.AddListener(() =>
        {
            OnEvent.Invoke(m_strDungeonId);
        });
    }
Пример #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            int use_skin_id = DataManager.Instance.user_data.ReadInt(Defines.KEY_USE_SKIN_ID);

            if (skin_id.Value != use_skin_id)
            {
                skin_id.Value = use_skin_id;
                MasterSkinParam master_skin = DataManager.Instance.masterSkin.list.Find(p => p.skin_id == use_skin_id);
                GameMain.Instance.ChangeCharaTexture(master_skin);
            }



            if (DataManager.Instance.user_data.HasKey(Defines.KEY_DUNGEON_ID))
            {
                dungeon_id.Value = DataManager.Instance.user_data.Read(Defines.KEY_DUNGEON_ID);
            }
            else
            {
                dungeon_id.Value = "normal";
            }


            MasterDungeonParam master_dungeon = DataManager.Instance.masterDungeon.list.Find(p => p.dungeon_id == dungeon_id.Value);

            //Debug.Log(Defines.CurrentDungeonID);
            //Debug.Log(master_dungeon.item_id_medal);
            gameMain.btn_medal.gameObject.SetActive(0 < master_dungeon.item_id_medal);
            gameMain.btn_medal.SetMedalId(master_dungeon.item_id_medal);

            if (dungeon_id.Value != Defines.CurrentDungeonID)
            {
                Defines.CurrentDungeonID = dungeon_id.Value;

                //Debug.Log(dungeon_id.Value);
                // 背景切り替え
                gameMain.SetBackground(master_dungeon);
            }
            gameMain.FadeIn();

            Finish();
        }
Пример #7
0
 public void SetBackground(MasterDungeonParam _dungeon)
 {
     Debug.Log(_dungeon.background);
     Debug.Log(SpriteManager.Instance.Get(_dungeon.background));
     m_sprBackGround.sprite = SpriteManager.Instance.Get(_dungeon.background);
 }
Пример #8
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();
    }