示例#1
0
        public Api_Result <Mem_deck> Start(int deck_rid, int mission_id, int tankerNum)
        {
            Api_Result <Mem_deck> api_Result = new Api_Result <Mem_deck>();
            Mst_mission2          value      = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, out value))
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
            }
            else
            {
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck[deck_rid].Area_id);
                value = ((mission_id != -1) ? supportResistedData[1] : supportResistedData[0]);
            }
            Mem_deck value2 = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, out value2))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mission_id > 0 && !Comm_UserDatas.Instance.User_missioncomp.ContainsKey(mission_id))
            {
                Mem_missioncomp mem_missioncomp = new Mem_missioncomp(mission_id, value.Maparea_id, MissionClearKinds.NOTCLEAR);
                mem_missioncomp.Insert();
            }
            if (!value2.MissionStart(value))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (tankerNum > 0)
            {
                IEnumerable <Mem_tanker> enumerable = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker).Take(tankerNum);
                List <Mem_tanker>        list       = new List <Mem_tanker>();
                foreach (Mem_tanker item in enumerable)
                {
                    if (!item.MissionStart(value.Maparea_id, deck_rid))
                    {
                        list.ForEach(delegate(Mem_tanker x)
                        {
                            x.MissionTerm();
                        });
                        api_Result.state = Api_Result_State.Parameter_Error;
                        return(api_Result);
                    }
                    list.Add(item);
                }
            }
            api_Result.data = value2;
            QuestMission questMission = new QuestMission(value.Id, value2, MissionResultKinds.FAILE);

            questMission.ExecuteCheck();
            return(api_Result);
        }
示例#2
0
        public static void MissionOpenToArea(int areaId)
        {
            IEnumerable <Mst_mission2> enumerable = from x in Mst_DataManager.Instance.Mst_mission.Values
                                                    where x.Maparea_id == areaId
                                                    select x;

            foreach (Mst_mission2 item in enumerable)
            {
                Mem_missioncomp mem_missioncomp = new Mem_missioncomp(item.Id, areaId, MissionClearKinds.CLEARED);
                if (!Comm_UserDatas.Instance.User_missioncomp.ContainsKey(item.Id))
                {
                    mem_missioncomp.Insert();
                }
                else
                {
                    mem_missioncomp.Update();
                }
            }
        }
示例#3
0
        public static void MissionOpenToMissionId(int missionId)
        {
            Mst_mission2           master          = Mst_DataManager.Instance.Mst_mission[missionId];
            Mem_missioncomp        mem_missioncomp = new Mem_missioncomp(master.Id, master.Maparea_id, MissionClearKinds.CLEARED);
            List <User_MissionFmt> activeMission   = mem_missioncomp.GetActiveMission();

            if (activeMission.Any((User_MissionFmt x) => x.MissionId == master.Id))
            {
                Mem_missioncomp value = null;
                if (Comm_UserDatas.Instance.User_missioncomp.TryGetValue(missionId, out value))
                {
                    mem_missioncomp.Update();
                }
                else
                {
                    mem_missioncomp.Insert();
                }
                mem_missioncomp.GetActiveMission();
            }
        }
示例#4
0
        public static void MissionOpenToArea(int areaId)
        {
            IEnumerable <Mst_mission2> enumerable = Enumerable.Where <Mst_mission2>(Mst_DataManager.Instance.Mst_mission.get_Values(), (Mst_mission2 x) => x.Maparea_id == areaId);

            using (IEnumerator <Mst_mission2> enumerator = enumerable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mst_mission2    current         = enumerator.get_Current();
                    Mem_missioncomp mem_missioncomp = new Mem_missioncomp(current.Id, areaId, MissionClearKinds.CLEARED);
                    if (!Comm_UserDatas.Instance.User_missioncomp.ContainsKey(current.Id))
                    {
                        mem_missioncomp.Insert();
                    }
                    else
                    {
                        mem_missioncomp.Update();
                    }
                }
            }
        }
示例#5
0
        public static void MissionOpenToMissionId(int missionId)
        {
            Mst_mission2           master          = Mst_DataManager.Instance.Mst_mission.get_Item(missionId);
            Mem_missioncomp        mem_missioncomp = new Mem_missioncomp(master.Id, master.Maparea_id, MissionClearKinds.CLEARED);
            List <User_MissionFmt> activeMission   = mem_missioncomp.GetActiveMission();

            if (!Enumerable.Any <User_MissionFmt>(activeMission, (User_MissionFmt x) => x.MissionId == master.Id))
            {
                return;
            }
            Mem_missioncomp mem_missioncomp2 = null;

            if (Comm_UserDatas.Instance.User_missioncomp.TryGetValue(missionId, ref mem_missioncomp2))
            {
                mem_missioncomp.Update();
            }
            else
            {
                mem_missioncomp.Insert();
            }
            mem_missioncomp.GetActiveMission();
        }
        public Api_Result <Mem_deck> Start(int deck_rid, int mission_id, int tankerNum)
        {
            Api_Result <Mem_deck> api_Result  = new Api_Result <Mem_deck>();
            Mst_mission2          mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, ref mst_mission))
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
            }
            else
            {
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck.get_Item(deck_rid).Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData.get_Item(1) : supportResistedData.get_Item(0));
            }
            Mem_deck mem_deck = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, ref mem_deck))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mission_id > 0 && !Comm_UserDatas.Instance.User_missioncomp.ContainsKey(mission_id))
            {
                Mem_missioncomp mem_missioncomp = new Mem_missioncomp(mission_id, mst_mission.Maparea_id, MissionClearKinds.NOTCLEAR);
                mem_missioncomp.Insert();
            }
            if (!mem_deck.MissionStart(mst_mission))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (tankerNum > 0)
            {
                IEnumerable <Mem_tanker> enumerable = Enumerable.Take <Mem_tanker>(Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker), tankerNum);
                List <Mem_tanker>        list       = new List <Mem_tanker>();
                using (IEnumerator <Mem_tanker> enumerator = enumerable.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Mem_tanker current = enumerator.get_Current();
                        if (!current.MissionStart(mst_mission.Maparea_id, deck_rid))
                        {
                            list.ForEach(delegate(Mem_tanker x)
                            {
                                x.MissionTerm();
                            });
                            api_Result.state = Api_Result_State.Parameter_Error;
                            return(api_Result);
                        }
                        list.Add(current);
                    }
                }
            }
            api_Result.data = mem_deck;
            QuestMission questMission = new QuestMission(mst_mission.Id, mem_deck, MissionResultKinds.FAILE);

            questMission.ExecuteCheck();
            return(api_Result);
        }