Пример #1
0
    public MapRewardInfo(XmlNode node, pe_Difficulty difficulty = pe_Difficulty.Normal)
    {
        string id = node.Attributes["id"].Value;

        Reward     = ItemInfoManager.Instance.GetInfoByID(id);
        Difficulty = difficulty;
        var showAttr = node.Attributes["show"];

        if (showAttr != null)
        {
            IsShow = bool.Parse(showAttr.Value);
        }
        switch (Reward.ItemType)
        {
        case eItemType.Stuff:
        case eItemType.Item:
            Percent = short.Parse(node.Attributes["percent"].Value);
            break;

        default:
            Value = int.Parse(node.Attributes["value"].Value);
            break;
        }
        if (Reward == null)
        {
            throw new System.Exception(string.Format("not exist item id in MapRewardInfo : {0}", id));
        }
    }
Пример #2
0
    void OnClickItemLocation(MoveMenuInfo info)
    {
        switch (info.menu)
        {
        case GameMenu.Dungeon:
            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), info.menu_parm_2);
            if (MapClearDataManager.Instance.AvailableMap(info.menu_parm_1, difficulty) == false)
            {
                Tooltip.Instance.ShowMessageKey("NotAvailbleStage");
                return;
            }
            Network.TargetItemInfo = m_Info;
            GameMain.Instance.StackPopup();

            MenuParams parm = new MenuParams();
            parm.AddParam("menu_parm_1", info.menu_parm_1);
            parm.AddParam("menu_parm_2", info.menu_parm_2);
            GameMain.Instance.ChangeMenu(info.menu, parm);
            break;

        case GameMenu.Store:
            GameMain.Instance.StackPopup();
            GameMain.MoveStore(info.menu_parm_1);
            break;

        default:
            GameMain.Instance.StackPopup();
            GameMain.Instance.ChangeMenu(info.menu);
            break;
        }
    }
Пример #3
0
    override public void Load(XmlNode node)
    {
        base.Load(node);
        MapInfo map_info = MapInfoManager.Instance.GetInfoByIdn(IDN);

        Total = map_info.Stages.Count * 3;

        _conditions = new List <RewardCondition>();
        _loot_infos = new List <RewardLootInfo>();
        foreach (XmlNode difficultyNode in node.ChildNodes)
        {
            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), difficultyNode.Attributes["type"].Value);
            foreach (XmlNode child in difficultyNode.SelectNodes("Condition"))
            {
                _conditions.Add(new RewardCondition(child, difficulty));
            }

            _loot_infos.Add(new RewardLootInfo((XmlNode)difficultyNode.SelectSingleNode("Loot"), difficulty));

            if (conditions(difficulty).Count < 3)
            {
                throw new System.Exception("MapClearRewardInfo is not valid.");
            }
        }
    }
Пример #4
0
    public MapCondition CheckCondition()
    {
        switch (type)
        {
        case eMapCondition.MapClear:
        {
            MapInfo      map_info   = MapInfoManager.Instance.GetInfoByID(value);
            MapStageInfo stage_info = map_info.Stages.Last();

            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), value2);

            var clear_data = MapClearDataManager.Instance.GetData(stage_info, difficulty);
            if (clear_data == null || clear_data.clear_rate == 0)
            {
                return(this);
            }
        }
        break;

        case eMapCondition.MapStageClear:
        {
            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), value2);

            MapStageDifficulty stage_info = MapInfoManager.Instance.GetStageInfoByID(value, difficulty);


            var clear_data = MapClearDataManager.Instance.GetData(stage_info);
            if (clear_data == null || clear_data.clear_rate == 0)
            {
                return(this);
            }
        }
        break;

        case eMapCondition.Weekly:
            DayOfWeek cur_dow = Network.Instance.ServerTime.DayOfWeek;
            DayOfWeek set_dow = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), value);
            if (cur_dow != set_dow)
            {
                return(this);
            }

            break;

        case eMapCondition.Period:
            DateTime begin_time = DateTime.Parse(value);
            DateTime end_time   = DateTime.Parse(value2);
            if (begin_time > Network.Instance.ServerTime || end_time < Network.Instance.ServerTime)
            {
                return(this);
            }
            break;

        case eMapCondition.Block:
            return(this);
        }
        return(null);
    }
Пример #5
0
    public void OnDifficultChanged(GameObject obj)
    {
        UIToggle toggle = obj.GetComponentInChildren <UIToggle>();

        //Debug.LogFormat("OnDifficultChanged({0}:{1})", obj.name, toggle.value);
        if (toggle.value == true)
        {
            switch (obj.name)
            {
            case "NormalMap":
            {
                if (CurrentDifficulty == pe_Difficulty.Normal)
                {
                    return;
                }
                CurrentDifficulty        = pe_Difficulty.Normal;
                m_DifficultyToggle.value = false;
            }
            break;

            case "HardMap":
            {
                if (CurrentDifficulty == pe_Difficulty.Hard)
                {
                    return;
                }

                if (MapInfo.IDN == 1)
                {
                    var condition = MapInfo.CheckCondition(pe_Difficulty.Hard);
                    if (condition != null)
                    {
                        Tooltip.Instance.ShowMessage(condition.Condition);
                        m_ToggleDifficultyNormal.value = true;
                        return;
                    }
                }

                CurrentDifficulty        = pe_Difficulty.Hard;
                m_DifficultyToggle.value = true;
            }
            break;
            }
            var last_main_stage = MapClearDataManager.Instance.GetLastMainStage(CurrentDifficulty);
            if (last_main_stage == null)
            {
                m_SelectedMapInfo = MapInfoManager.Instance.Values.First();
                m_SelectStageInfo = m_SelectedMapInfo.Stages[0].Difficulty[(int)CurrentDifficulty];
            }
            else
            {
                m_SelectedMapInfo = MapInfoManager.Instance.GetInfoByIdn(last_main_stage.map_idn);
                m_SelectStageInfo = m_SelectedMapInfo.Stages[last_main_stage.stage_index].Difficulty[(int)CurrentDifficulty];
            }
            GameMain.Instance.ChangeMenu(GameMenu.Dungeon, null);
        }
    }
Пример #6
0
    public MapCondition CheckCondition(pe_Difficulty difficulty = pe_Difficulty.Normal)
    {
        if (Conditions[(int)difficulty] == null)
        {
            return(null);
        }

        return(Conditions[(int)difficulty].CheckCondition());
    }
Пример #7
0
    public pd_MapClearData GetLastStage(int map_idn, pe_Difficulty difficulty)
    {
        var datas = Data.Where(c => c.map_idn == map_idn && c.difficulty == difficulty).ToList();

        if (datas.Count() == 0)
        {
            return(null);
        }
        return(datas.OrderByDescending(c => c.updated_at).First());
    }
Пример #8
0
    public MapStageDifficulty GetStageInfoByID(string id, pe_Difficulty difficulty)
    {
        MapStageInfo stage_info;

        if (m_Stages.TryGetValue(id, out stage_info) == false)
        {
            throw new System.Exception(string.Format("Not exists stage : {0}", id));
        }
        return(stage_info.Difficulty[(int)difficulty]);
    }
Пример #9
0
    private pd_MapClearData CreateMapClearData(int map_idn, short stage_index, pe_Difficulty difficulty)
    {
        pd_MapClearData clearData = new pd_MapClearData();

        clearData.map_idn     = map_idn;
        clearData.stage_index = stage_index;
        clearData.difficulty  = difficulty;
        Data.Add(clearData);
        return(clearData);
    }
Пример #10
0
 public RewardCondition(XmlNode node, pe_Difficulty difficulty)
 {
     this.difficulty = difficulty;
     condition       = short.Parse(node.Attributes["clear_rate"].Value);
     rewards         = new List <RewardBase>();
     foreach (XmlNode child in node.ChildNodes)
     {
         rewards.Add(new RewardBase(child));
     }
 }
Пример #11
0
 public RewardLootInfo(XmlNode node, pe_Difficulty difficulty)
 {
     this.difficulty = difficulty;
     loot_count_min  = int.Parse(node.Attributes["loot_count_min"].Value);
     loot_count_max  = int.Parse(node.Attributes["loot_count_max"].Value);
     groups          = new List <RewardLootGroup>();
     foreach (XmlNode child in node.ChildNodes)
     {
         groups.Add(new RewardLootGroup(child));
     }
 }
Пример #12
0
    public string GetShowName(pe_Difficulty difficulty)
    {
        switch (MapType)
        {
        case "main":
            return(Localization.Format("DungeonName", IDN, Name, Localization.Get("MapDifficulty_" + difficulty)));

        default:
            return(Name);
        }
    }
Пример #13
0
    public pd_MapClearData GetLastMainStage(pe_Difficulty difficulty)
    {
        int open_idn = GameConfig.Get <int>("contents_open_main_map");
        var datas    = Data.Where(c => c.map_idn <= open_idn && c.difficulty == difficulty).ToList();

        if (datas.Count() == 0)
        {
            return(null);
        }
        return(datas.OrderByDescending(c => c.updated_at).First());
    }
Пример #14
0
    ////////////////////////////////////////////////////////////////
    override public bool Init(MenuParams parms)
    {
        string menu_parm_1 = parms.GetObject <string>("menu_parm_1");
        string menu_parm_2 = parms.GetObject <string>("menu_parm_2");

        if (string.IsNullOrEmpty(menu_parm_2) == false && string.IsNullOrEmpty(menu_parm_1) == false)
        {
            CurrentDifficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), menu_parm_2);

            m_SelectedMapInfo = MapInfoManager.Instance.GetInfoByID(menu_parm_1);
            m_SelectStageInfo = m_SelectedMapInfo.Stages[0].Difficulty[(int)CurrentDifficulty];
        }

        if (Network.LastOpenContentsStageInfo != null)
        {
            Tooltip.Instance.CheckOpenContentsMapStageClear(Network.LastOpenContentsStageInfo);
            Network.LastOpenContentsStageInfo = null;
        }

        if (Network.NewStageInfo != null)
        {
            m_SelectStageInfo = Network.NewStageInfo;
            m_SelectedMapInfo = m_SelectStageInfo.MapInfo;

            Network.NewStageInfo = null;
            CurrentDifficulty    = m_SelectStageInfo.Difficulty;
        }
        else if (m_SelectStageInfo == null)
        {
            var last_main_stage = MapClearDataManager.Instance.GetLastMainStage();
            if (last_main_stage == null)
            {
                CurrentDifficulty = pe_Difficulty.Normal;
                m_SelectedMapInfo = MapInfoManager.Instance.Values.First();
                m_SelectStageInfo = m_SelectedMapInfo.Stages[0].Difficulty[(int)pe_Difficulty.Normal];
            }
            else
            {
                m_SelectedMapInfo = MapInfoManager.Instance.GetInfoByIdn(last_main_stage.map_idn);
                m_SelectStageInfo = m_SelectedMapInfo.Stages[last_main_stage.stage_index].Difficulty[(int)last_main_stage.difficulty];
                CurrentDifficulty = m_SelectStageInfo.Difficulty;
            }
        }

        m_ToggleDifficultyNormal.value = CurrentDifficulty == pe_Difficulty.Normal;
        m_ToggleDifficultyHard.value   = CurrentDifficulty == pe_Difficulty.Hard;
        m_DifficultyToggle.value       = CurrentDifficulty == pe_Difficulty.Hard;
        Init();

        return(true);
    }
Пример #15
0
    void SetTry(int map_idn, short stage_index, pe_Difficulty difficulty)
    {
        pd_MapClearData clearData = GetData(map_idn, stage_index, difficulty);

        if (clearData == null)
        {
            clearData = CreateMapClearData(map_idn, stage_index, difficulty);
        }

        clearData.updated_at = Network.Instance.ServerTime;
        clearData.try_count += 1;

        Save();
    }
Пример #16
0
    public bool AvailableMap(string map_id, pe_Difficulty difficulty = pe_Difficulty.Normal)
    {
        MapInfo map_info = MapInfoManager.Instance.GetInfoByID(map_id);

        if (map_info != null)
        {
            MapCondition condition = map_info.CheckCondition(difficulty);
            if (condition == null)
            {
                return(true);
            }
        }

        return(false);
    }
Пример #17
0
    public MapCondition CheckCondition(pe_Difficulty difficulty)
    {
        var condition = MapInfo.CheckCondition(difficulty);

        if (condition != null)
        {
            return(condition);
        }

        if (Conditions == null || Conditions[(int)difficulty] == null)
        {
            return(null);
        }

        return(Conditions[(int)difficulty].CheckCondition());
    }
Пример #18
0
    public string GetShowName(pe_Difficulty difficulty)
    {
        switch (MapInfo.MapType)
        {
        case "main":
            return(Localization.Format("StageMainShowName", MapInfo.IDN, StageIndex + 1, Name, Localization.Get("MapDifficulty_" + difficulty)));

        case "event":
            return(Localization.Format("StageEventShowName", MapInfo.Name, Name));

        case "weekly":
            return(Localization.Format("StageWeeklyShowName", MapInfo.Name, Name, Localization.Get("MapDifficulty_" + difficulty)));

        default:
            return(Name);
        }
    }
Пример #19
0
    public void SetReward(string map_id, int idx, pe_Difficulty difficulty)
    {
        int map_idn = MapInfoManager.Instance.GetInfoByID(map_id).IDN;
        pd_MapClearReward rewarded_info = GetRewardedData(map_idn, difficulty);

        if (rewarded_info == null)
        {
            rewarded_info            = new pd_MapClearReward();
            rewarded_info.map_idn    = map_idn;
            rewarded_info.difficulty = difficulty;
            Data.Add(rewarded_info);
        }

        rewarded_info.SetAt(idx, true);

        Save();
    }
Пример #20
0
    public MapCondition(XmlNode node)
    {
        type = (eMapCondition)Enum.Parse(typeof(eMapCondition), node.Attributes["type"].Value);

        XmlAttribute difficultyAttr = node.Attributes["difficulty"];

        if (difficultyAttr != null)
        {
            difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), difficultyAttr.Value);
        }
        else
        {
            difficulty = pe_Difficulty.Normal;
        }

        value = node.Attributes["value"].Value;

        switch (type)
        {
        case eMapCondition.MapClear:
        case eMapCondition.MapStageClear:
        {
            XmlAttribute value2Attr = node.Attributes["value2"];
            if (value2Attr != null)
            {
                value2 = value2Attr.Value;
            }
            else
            {
                value2 = "Normal";
            }
        }
        break;

        case eMapCondition.Period:
            value2 = node.Attributes["value2"].Value;
            break;
        }
    }
Пример #21
0
    bool SetClearRate(int map_idn, short stage_index, short clear_rate, pe_Difficulty difficulty)
    {
        bool            new_clear = false;
        pd_MapClearData clearData = GetData(map_idn, stage_index, difficulty);

        if (clearData.clear_rate == 0)
        {
            new_clear = true;
        }

        clearData.clear_rate = System.Math.Max(clearData.clear_rate, clear_rate);
        clearData.updated_at = Network.Instance.ServerTime;
        if (clearData.daily_index != Network.DailyIndex)
        {
            clearData.daily_index       = Network.DailyIndex;
            clearData.daily_clear_count = 0;
        }
        clearData.daily_clear_count++;
        clearData.clear_count++;

        Save();
        return(new_clear);
    }
Пример #22
0
    public void SetConditionText()
    {
        switch (type)
        {
        case eMapCondition.MapClear:
        case eMapCondition.MapStageClear:
        {
            switch (type)
            {
            case eMapCondition.MapClear:
            {
                MapInfo       map_info        = MapInfoManager.Instance.GetInfoByID(value);
                pe_Difficulty show_difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), value2);

                Condition = Localization.Format("StageConditionMapClear", map_info.GetShowName(show_difficulty));
            }
            break;

            case eMapCondition.MapStageClear:
            {
                pe_Difficulty      show_difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), value2);
                MapStageDifficulty stage_info      = MapInfoManager.Instance.GetStageInfoByID(value, show_difficulty);

                Condition = Localization.Format("StageConditionMapStageClear", stage_info.ShowName);
            }
            break;
            }
        }
        break;

        case eMapCondition.Block:
        {
            Condition = Localization.Get(value);
        }
        break;
        }
    }
Пример #23
0
    public void CheckOpenContentsMapStageClear(MapStageDifficulty map_stage_info)
    {
        if (Tutorial.Instance.Completed == false)
        {
            return;
        }

        List <ContentsOpenInfo> opens      = new List <ContentsOpenInfo>();
        pe_Difficulty           difficulty = map_stage_info.Difficulty;

        if (map_stage_info.MapInfo.Stages[map_stage_info.MapInfo.Stages.Count - 1].Difficulty[(int)difficulty] == map_stage_info)
        {
            // map clear
            MapInfoManager.Instance.CheckOpenContents(ref opens, eMapCondition.MapClear, map_stage_info.MapInfo.ID, difficulty.ToString());
        }

        // map stage clear
        MapInfoManager.Instance.CheckOpenContents(ref opens, eMapCondition.MapStageClear, map_stage_info.ID, difficulty.ToString());

        if (opens.Count > 0)
        {
            ShowTooltip(eTooltipMode.OpenContents, opens);
        }
    }
Пример #24
0
    //---------------------------------------------------------------------------
    public void Init(MoveMenuInfo info, OnItemLocationDelegate _del)
    {
        MenuInfo                     = info;
        OnItemLocation               = _del;
        m_LabelChapter.text          = info.title;
        m_LabelName.text             = info.desc;
        m_SpritePlaceIcon.spriteName = info.icon_id;

        if (MenuInfo.menu == GameMenu.Dungeon)
        {
            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), MenuInfo.menu_parm_2);

            if (MapClearDataManager.Instance.AvailableMap(MenuInfo.menu_parm_1, difficulty) == false)
            {
                m_ButtonMove.SetState(UIButtonColor.State.Disabled, true);
                m_ButtonMove.GetComponent <BoxCollider2D>().enabled = false;
                m_LabelMove.color = Color.grey;
                return;
            }
        }
        m_ButtonMove.SetState(UIButtonColor.State.Normal, true);
        m_ButtonMove.GetComponent <BoxCollider2D>().enabled = true;
        m_LabelMove.color = Color.white;
    }
Пример #25
0
 public bool CheckCondition(int idx, int value, pe_Difficulty difficulty)
 {
     return(conditions(difficulty)[idx].condition <= value);
 }
Пример #26
0
    ////////////////////////////////////////////////////////////////

    public pd_MapClearReward GetRewardedData(int map_idn, pe_Difficulty difficulty)
    {
        return(Data.Find(e => e.map_idn == map_idn && e.difficulty == difficulty));
    }
Пример #27
0
 pd_MapClearData GetData(int map_idn, int stage_index, pe_Difficulty difficulty)
 {
     return(Data.Find(d => d.map_idn == map_idn && d.stage_index == stage_index && d.difficulty == difficulty));
 }
Пример #28
0
 public pd_MapClearData GetData(MapStageInfo stage_info, pe_Difficulty difficulty = pe_Difficulty.Normal)
 {
     return(GetData(stage_info.MapInfo.IDN, stage_info.StageIndex, difficulty));
 }
Пример #29
0
 public int GetMapDailyClearCount(int map_idn, pe_Difficulty difficulty)
 {
     return(Data.Where(c => c.map_idn == map_idn && c.difficulty == difficulty).Sum(c => c.GetDailyClearCount()));
 }
Пример #30
0
 public int GetTotalClearRate(int map_idn, pe_Difficulty difficulty)
 {
     return(Data.Where(c => c.map_idn == map_idn && c.difficulty == difficulty).Sum(e => e.clear_rate));
 }