コード例 #1
0
ファイル: Dungeon.cs プロジェクト: tapenjoyGame/cry
    public bool GetClearRewardAvailable(int idx)
    {
        int total_clear = MapClearDataManager.Instance.GetTotalClearRate(m_SelectedMapInfo.IDN, CurrentDifficulty);
        MapClearRewardInfo map_clear_reward_info = MapClearRewardInfoManager.Instance.GetInfoByIdn(m_SelectedMapInfo.IDN);
        pd_MapClearReward  rewarded_info         = MapClearRewardManager.Instance.GetRewardedData(m_SelectedMapInfo.IDN, CurrentDifficulty);

        return((rewarded_info == null || rewarded_info.GetAt(idx) == false) && map_clear_reward_info.CheckCondition(idx, total_clear, CurrentDifficulty));
    }
コード例 #2
0
ファイル: Dungeon.cs プロジェクト: tapenjoyGame/cry
    void Init()
    {
        MapInfo map_info = MapInfo;
        List <MapStageDifficulty> stages = map_info.Stages.Select(e => e.Difficulty[(int)CurrentDifficulty]).ToList();

        pd_MapClearData last_stage_info = null;

        if (map_info != m_SelectStageInfo.MapInfo)
        {
            last_stage_info = MapClearDataManager.Instance.GetLastStage(map_info.IDN, CurrentDifficulty);
        }

        bool is_set_character_position = false;

        for (int i = 0; i < stages.Count; ++i)
        {
            MapStageDifficulty stage_info = stages[i];
            DungeonSpot        stage;
            if (m_Spots.Count < i + 1)
            {
                GameObject dungeon = NGUITools.AddChild(DungeonLocation, DungeonSpotPrefab);
                stage = dungeon.GetComponent <DungeonSpot>();
                m_Spots.Add(stage);
            }
            else
            {
                stage = m_Spots[i];
            }

            stage.transform.localPosition = stage_info.MapPos;
            stage.gameObject.name         = stage_info.ID;

            pd_MapClearData clear_data = MapClearDataManager.Instance.GetData(stage_info);
            short           clear_rate = clear_data == null ? (short)0 : clear_data.clear_rate;
            stage.Init(stage_info, clear_rate);

            if (last_stage_info != null && stage_info.StageIndex == last_stage_info.stage_index || stage_info == m_SelectStageInfo || is_set_character_position == false && clear_rate == 0)
            {
                SetCharacterPosition(stage.transform.position);
                is_set_character_position = true;
            }

            stage.OnClickStage = OnClickStage;
        }
        while (m_Spots.Count > stages.Count)
        {
            DungeonSpot spot = m_Spots[m_Spots.Count - 1];
            m_Spots.Remove(spot);
            spot.gameObject.SetActive(false);
            Destroy(spot);
        }
        m_LabelTitle.text = map_info.GetShowName(CurrentDifficulty);
        if (CurrentDifficulty == pe_Difficulty.Hard)
        {
            GameMain.Instance.m_BG.material.SetColor("_GrayColor", GameMain.colorHard);
        }
        else
        {
            GameMain.Instance.m_BG.material.SetColor("_GrayColor", GameMain.colorZero);
        }

        //clear reward
        MapClearRewardInfo reward_info = MapClearRewardInfoManager.Instance.GetInfoByIdn(map_info.IDN);

        if (reward_info.conditions(CurrentDifficulty).Count > 0)
        {
            m_ClearReward.SetActive(true);
            int total_clear = MapClearDataManager.Instance.GetTotalClearRate(map_info.IDN, CurrentDifficulty);
            m_RewardProgress.value = (float)total_clear / reward_info.Total;
            m_LabelClearTotal.text = total_clear.ToString();

            pd_MapClearReward rewarded_info = MapClearRewardManager.Instance.GetRewardedData(m_SelectedMapInfo.IDN, CurrentDifficulty);

            for (int i = 0; i < reward_info.conditions(CurrentDifficulty).Count; ++i)
            {
                m_LabelCondition[i].text = reward_info.conditions(CurrentDifficulty)[i].condition.ToString();

                if (rewarded_info == null || rewarded_info.GetAt(i) == false)
                {
                    m_Boxes[i].GetComponentInChildren <UIToggleSprite>().SetSpriteActive(false);
                    m_Boxes[i].GetComponent <BoxCollider2D>().enabled = true;
                    m_BoxEffects[i].SetActive(GetClearRewardAvailable(i));
                }
                else
                {                //rewarded
                    m_Boxes[i].GetComponentInChildren <UIToggleSprite>().SetSpriteActive(true);
                    m_Boxes[i].GetComponent <BoxCollider2D>().enabled = false;
                    m_BoxEffects[i].SetActive(false);
                }
            }
        }
        else
        {
            m_ClearReward.SetActive(false);
        }


        m_Left.gameObject.SetActive(MapInfo.IDN > 1);
        m_Right.gameObject.SetActive(MapInfoManager.Instance.ContainsIdn(MapInfo.IDN + 1) && MapInfo.IDN + 1 <= GameConfig.Get <int>("contents_open_main_map"));

        m_HardModeLock.SetActive(MapInfo.IDN == 1 && MapInfo.CheckCondition(pe_Difficulty.Hard) != null);
    }