Beispiel #1
0
 public MissionModel(User_MissionFmt fmt, DeckModel deck)
 {
     _id    = fmt.MissionId;
     _state = fmt.State;
     _mst   = Mst_DataManager.Instance.Mst_mission[_id];
     _deck  = deck;
 }
 public MissionModel(User_MissionFmt fmt, DeckModel deck)
 {
     this._id    = fmt.MissionId;
     this._state = fmt.State;
     this._mst   = Mst_DataManager.Instance.Mst_mission.get_Item(this._id);
     this._deck  = deck;
 }
Beispiel #3
0
        private void _UpdateMission()
        {
            _mission_dic = new Dictionary <int, List <MissionModel> >();
            Api_Result <List <User_MissionFmt> > api_Result = new Api_get_Member().Mission();

            if (api_Result.state != 0)
            {
                return;
            }
            DeckModel[] decksFromArea = base.UserInfo.GetDecksFromArea(_area_id);
            Dictionary <int, DeckModel> dictionary = new Dictionary <int, DeckModel>();

            foreach (DeckModel deckModel in decksFromArea)
            {
                if (deckModel.MissionState != 0)
                {
                    dictionary.Add(deckModel.MissionId, deckModel);
                }
            }
            for (int j = 0; j < api_Result.data.Count; j++)
            {
                User_MissionFmt user_MissionFmt = api_Result.data[j];
                MissionModel    missionModel    = (!dictionary.ContainsKey(user_MissionFmt.MissionId)) ? new MissionModel(user_MissionFmt) : new MissionModel(user_MissionFmt, dictionary[user_MissionFmt.MissionId]);
                if (!_mission_dic.ContainsKey(missionModel.AreaId))
                {
                    _mission_dic[missionModel.AreaId] = new List <MissionModel>();
                }
                _mission_dic[missionModel.AreaId].Add(missionModel);
            }
        }
Beispiel #4
0
        private List <User_MissionFmt> newUserActiveMission(Dictionary <int, Mst_mission2> mst_mission)
        {
            List <User_MissionFmt> list = new List <User_MissionFmt>();

            foreach (Mst_mission2 value in mst_mission.Values)
            {
                if (Mst_DataManager.Instance.Mst_maparea.ContainsKey(value.Maparea_id) && Mst_DataManager.Instance.Mst_maparea[value.Maparea_id].Evt_flag == 0 && string.IsNullOrEmpty(value.Required_ids))
                {
                    User_MissionFmt user_MissionFmt = new User_MissionFmt();
                    user_MissionFmt.MissionId = value.Id;
                    user_MissionFmt.State     = MissionClearKinds.NEW;
                    list.Add(user_MissionFmt);
                }
            }
            return((from x in list
                    orderby x.MissionId
                    select x).ToList());
        }
Beispiel #5
0
        public HashSet <int> GetMissionAreaId()
        {
            HashSet <int> hashSet = new HashSet <int>();
            Api_Result <List <User_MissionFmt> > api_Result = new Api_get_Member().Mission();

            if (api_Result.state != 0)
            {
                return(hashSet);
            }
            Dictionary <int, Mst_mission2> mst_mission = Mst_DataManager.Instance.Mst_mission;

            for (int i = 0; i < api_Result.data.Count; i++)
            {
                User_MissionFmt user_MissionFmt = api_Result.data[i];
                if (mst_mission.TryGetValue(user_MissionFmt.MissionId, out Mst_mission2 value) && !hashSet.Contains(value.Maparea_id))
                {
                    hashSet.Add(value.Maparea_id);
                }
            }
            return(hashSet);
        }
        private void _UpdateMission()
        {
            this._mission_dic = new Dictionary <int, List <MissionModel> >();
            Api_Result <List <User_MissionFmt> > api_Result = new Api_get_Member().Mission();

            if (api_Result.state != Api_Result_State.Success)
            {
                return;
            }
            DeckModel[] decksFromArea = base.UserInfo.GetDecksFromArea(this._area_id);
            Dictionary <int, DeckModel> dictionary = new Dictionary <int, DeckModel>();

            for (int i = 0; i < decksFromArea.Length; i++)
            {
                DeckModel deckModel = decksFromArea[i];
                if (deckModel.MissionState != MissionStates.NONE)
                {
                    dictionary.Add(deckModel.MissionId, deckModel);
                }
            }
            for (int j = 0; j < api_Result.data.get_Count(); j++)
            {
                User_MissionFmt user_MissionFmt = api_Result.data.get_Item(j);
                MissionModel    missionModel;
                if (dictionary.ContainsKey(user_MissionFmt.MissionId))
                {
                    missionModel = new MissionModel(user_MissionFmt, dictionary.get_Item(user_MissionFmt.MissionId));
                }
                else
                {
                    missionModel = new MissionModel(user_MissionFmt);
                }
                if (!this._mission_dic.ContainsKey(missionModel.AreaId))
                {
                    this._mission_dic.set_Item(missionModel.AreaId, new List <MissionModel>());
                }
                this._mission_dic.get_Item(missionModel.AreaId).Add(missionModel);
            }
        }
        public HashSet <int> GetMissionAreaId()
        {
            HashSet <int> hashSet = new HashSet <int>();
            Api_Result <List <User_MissionFmt> > api_Result = new Api_get_Member().Mission();

            if (api_Result.state != Api_Result_State.Success)
            {
                return(hashSet);
            }
            Dictionary <int, Mst_mission2> mst_mission = Mst_DataManager.Instance.Mst_mission;

            for (int i = 0; i < api_Result.data.get_Count(); i++)
            {
                User_MissionFmt user_MissionFmt = api_Result.data.get_Item(i);
                Mst_mission2    mst_mission2;
                if (mst_mission.TryGetValue(user_MissionFmt.MissionId, ref mst_mission2) && !hashSet.Contains(mst_mission2.Maparea_id))
                {
                    hashSet.Add(mst_mission2.Maparea_id);
                }
            }
            return(hashSet);
        }
Beispiel #8
0
        public List <User_MissionFmt> GetActiveMission()
        {
            Dictionary <int, Mst_mission2> mst_mission = Mst_DataManager.Instance.Mst_mission;

            if (Comm_UserDatas.Instance.User_missioncomp.Count == 0)
            {
                return(newUserActiveMission(mst_mission));
            }
            var source = from element in Comm_UserDatas.Instance.User_missioncomp.Values
                         select new
            {
                id    = element.Rid,
                state = element.State
            };
            List <User_MissionFmt> list = new List <User_MissionFmt>();

            using (Dictionary <int, Mst_mission2> .ValueCollection.Enumerator enumerator = mst_mission.Values.GetEnumerator())
            {
                Mst_mission2 mst_item;
                while (enumerator.MoveNext())
                {
                    mst_item = enumerator.Current;
                    if (Mst_DataManager.Instance.Mst_maparea.ContainsKey(mst_item.Maparea_id) && Mst_DataManager.Instance.Mst_maparea[mst_item.Maparea_id].Evt_flag == 0)
                    {
                        var anon = source.FirstOrDefault(x => x.id == mst_item.Id);
                        if (anon != null)
                        {
                            User_MissionFmt user_MissionFmt = new User_MissionFmt();
                            user_MissionFmt.MissionId = mst_item.Id;
                            user_MissionFmt.State     = anon.state;
                            list.Add(user_MissionFmt);
                        }
                        else if (string.IsNullOrEmpty(mst_item.Required_ids))
                        {
                            User_MissionFmt user_MissionFmt2 = new User_MissionFmt();
                            user_MissionFmt2.MissionId = mst_item.Id;
                            user_MissionFmt2.State     = MissionClearKinds.NEW;
                            list.Add(user_MissionFmt2);
                        }
                        else
                        {
                            string[] array  = mst_item.Required_ids.Split(',');
                            bool     flag   = true;
                            string[] array2 = array;
                            foreach (string s in array2)
                            {
                                int id    = int.Parse(s);
                                var anon2 = source.FirstOrDefault(y => y.id == id);
                                if (anon2 == null)
                                {
                                    flag = false;
                                    break;
                                }
                                MissionClearKinds state = anon2.state;
                                if (state != MissionClearKinds.CLEARED)
                                {
                                    flag = false;
                                    break;
                                }
                            }
                            if (flag)
                            {
                                User_MissionFmt user_MissionFmt3 = new User_MissionFmt();
                                user_MissionFmt3.MissionId = mst_item.Id;
                                user_MissionFmt3.State     = MissionClearKinds.NEW;
                                list.Add(user_MissionFmt3);
                            }
                        }
                    }
                }
            }
            return((from x in list
                    orderby x.MissionId
                    select x).ToList());
        }