Beispiel #1
0
        public void DSShipSinked(int dsID, string failReason)
        {
            DSInfo dsinfo = this.DSStorage.DSMap.TryGetValue(dsID);

            if (dsinfo != null)
            {
                DSShip dsship = dsinfo.GetDSShip();
                if (dsship != null)
                {
                    DSLog.AddLog(dsinfo.DSID, dsinfo.GetDSShip().DSWaitingQueue.QuestID, dsinfo.GetDSShip().PartyID, -1, "DSShipSinked", failReason);
                    foreach (KeyValuePair <long, DSPlayer> keyValuePair in dsship.Players)
                    {
                        this.DSPlayerDict.Remove(keyValuePair.Key);
                        keyValuePair.Value.SendMessage <DSPlayerStatusMessage>(new DSPlayerStatusMessage("", DSPlayerStatus.Unregistered, failReason, keyValuePair.Value.IsGiantRaid));
                    }
                    if (failReason != null)
                    {
                        Log <DSWaitingSystem> .Logger.ErrorFormat("DS Ship Sinked!!! : {0}", failReason);
                    }
                    dsship.DSWaitingQueue.SinkShip(dsship);
                    if (ServiceCore.FeatureMatrix.IsEnable("DSDynamicLoad"))
                    {
                        return;
                    }
                    this.ProcessAll();
                }
            }
        }
Beispiel #2
0
        public void DSShipLaunched(int dsID, long partyID)
        {
            DSInfo dsinfo = this.DSStorage.DSMap.TryGetValue(dsID);

            DSLog.AddLog(dsinfo.DSID, dsinfo.GetDSShip().DSWaitingQueue.QuestID, partyID, -1, "DSShipLaunched", "");
            dsinfo.GetDSShip().Launched(partyID);
        }
Beispiel #3
0
        public void Unregister(long cid, bool byUser)
        {
            DSPlayer dsplayer = this.DSPlayerDict.TryGetValue(cid);

            if (dsplayer != null)
            {
                if (byUser && !dsplayer.IsGiantRaid)
                {
                    if (dsplayer.Ship != null && dsplayer.Ship.ShipState >= DSShipState.Launching)
                    {
                        Log <DSWaitingSystem> .Logger.WarnFormat("Cannot unregister user after launching: - {0}", cid);

                        return;
                    }
                    if (dsplayer.FrontendConn != null)
                    {
                        CancelStartGame op = new CancelStartGame();
                        dsplayer.FrontendConn.RequestOperation(op);
                    }
                }
                DSLog.AddLog(-1, dsplayer.DSWaitingQueue.QuestID, -1L, -1, "Unregister", cid.ToString());
                dsplayer.DSWaitingQueue.UnregisterPlayer(dsplayer);
                this.DSPlayerDict.Remove(cid);
            }
        }
Beispiel #4
0
        public RegisterDSPartyResult Register(string quest, List <DSPlayerInfo> partyInfo, long microPlayID, long partyID, bool isGiantRaid, bool isAdultMode)
        {
            DSLog.AddLog(-1, quest, -1L, -1, "Register", partyInfo.Count.ToString());
            string         key            = isGiantRaid ? quest : (this.DSStorage.CheckIsolateNormalQuest(quest) ? "isolate" : "normal");
            DSWaitingQueue dswaitingQueue = this.QueueDict.TryGetValue(key);

            if (dswaitingQueue == null)
            {
                Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail NoSuchQuest] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3}", new object[]
                {
                    quest,
                    microPlayID,
                    partyID,
                    partyInfo.Count
                });

                return(RegisterDSPartyResult.NoSuchQuest);
            }
            foreach (DSPlayerInfo dsplayerInfo in partyInfo)
            {
                if (this.DSPlayerDict.ContainsKey(dsplayerInfo.CID))
                {
                    Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail AlreadyInQueue] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3} cid:{4}", new object[]
                    {
                        quest,
                        microPlayID,
                        partyID,
                        partyInfo.Count,
                        dsplayerInfo.CID
                    });

                    return(RegisterDSPartyResult.AlreadyInQueue);
                }
            }
            DSWaitingParty dswaitingParty = new DSWaitingParty(dswaitingQueue, partyInfo, quest, microPlayID, partyID, isGiantRaid, isAdultMode);

            foreach (DSPlayer dsplayer in dswaitingParty.Members.Values)
            {
                this.DSPlayerDict.Add(dsplayer.CID, dsplayer);
            }
            if (!dswaitingQueue.RegisterParty(dswaitingParty))
            {
                foreach (DSPlayer dsplayer2 in dswaitingParty.Members.Values)
                {
                    this.DSPlayerDict.Remove(dsplayer2.CID);
                    Log <DSWaitingSystem> .Logger.InfoFormat("[RegisterFail CannotJoinQuest] quest:{0} microPlayID:{1} partyID:{2} partyCount:{3} cid:{4}", new object[]
                    {
                        quest,
                        microPlayID,
                        partyID,
                        partyInfo.Count,
                        dsplayer2.CID
                    });
                }
                dswaitingParty.Clear();
                return(RegisterDSPartyResult.CannotJoinQuest);
            }
            return(RegisterDSPartyResult.Success);
        }
Beispiel #5
0
        public void DSShipUpdated(int dsID, DSGameState state)
        {
            DSInfo dsinfo = this.DSStorage.DSMap.TryGetValue(dsID);

            if (dsinfo != null && dsinfo.GetDSShip() != null)
            {
                if (state == DSGameState.GameStarted)
                {
                    dsinfo.GetDSShip().StartTime = new DateTime?(DateTime.Now);
                }
                DSLog.AddLog(dsinfo.DSID, dsinfo.GetDSShip().DSWaitingQueue.QuestID, dsinfo.GetDSShip().PartyID, -1, "DSShipUpdated", state.ToString());
                dsinfo.GetDSShip().GameState = state;
            }
        }
Beispiel #6
0
        public List <vw_CaseDefectsData> GetDefendantsByCaseID(int CaseID, int SessionID)
        {
            var defendants = (from _case in DataContext.Cases_Cases
                              join _session in DataContext.Cases_CaseSessions on _case.ID equals _session.CaseID
                              join _defendant in DataContext.Cases_CaseDefendants on _case.ID equals _defendant.CaseID
                              join _defendantCaseLog in DataContext.Cases_DefendatnsCaseLog on _defendant.ID equals _defendantCaseLog.DefendantID
                              join _personDefendant in DataContext.Configurations_Persons on _defendant.PersonID equals _personDefendant.ID
                              join Look in DataContext.Configurations_Lookups on _personDefendant.NationalityID equals Look.ID
                              join _defendantsSessionLog in DataContext.Cases_DefendatnsSessionsLog on _defendant.ID equals _defendantsSessionLog.DefendantID into DSLog
                              from _dslog in DSLog.DefaultIfEmpty()
                              join _PresenceStatus in DataContext.Configurations_Lookups on _dslog.PresenceStatusID equals _PresenceStatus.ID into PStatus
                              from _ps in PStatus.DefaultIfEmpty()
                              join _PoliceStationStatus in DataContext.Configurations_Lookups on _defendantCaseLog.PoliceStationStatusID equals _PoliceStationStatus.ID

                              where _case.ID == CaseID && _case.IsDeleted != true && _session.ID == SessionID && !_defendantCaseLog.ToDate.HasValue
                              select new vw_CaseDefectsData
            {
                ID = (int)_defendant.ID,
                PersonID = _defendant.PersonID,
                Name = _personDefendant.FullName,
                NationalID = _personDefendant.NationalID,
                DefectType = PartyTypes.Defendant,
                IsCivilRightProsecutor = _defendant.IsCivilRightProsecutor,
                Presence = _dslog == null ? 0 : (PresenceStatus)_dslog.PresenceStatusID,
                Status = _defendantCaseLog.PoliceStationStatusID,
                JobName = _personDefendant.JobTitle,
                NationalityType = _personDefendant.NationalityID,
                PassportNumber = _personDefendant.PassportNumber,
                Birthdate = _personDefendant.Birthdate,
                Order = _defendant.Order,
                Nationality = Look.Name,
                Address = _personDefendant.Address,
                // Age = DateTime.Now.Year - (DateTime)_personDefendant.Year
            }).Distinct().ToList();

            return(defendants);
        }
        public void Process()
        {
            List <DSEntityMakerQueue> dSEntityMakerQueues = new List <DSEntityMakerQueue>();
            Dictionary <int, int>     nums = new Dictionary <int, int>();

            foreach (DSEntityMakerQueue dSEntityMakerList in this.DSEntityMakerList)
            {
                int                  serviceID     = 0;
                int                  num           = -1;
                DSType               dSType        = dSEntityMakerList.DSType;
                DSServiceInfo        dSServiceInfo = null;
                bool                 flag          = false;
                List <DSServiceInfo> list          = (
                    from x in this.DSServiceInfoDic.Values
                    where x.HasEntity(dSType)
                    select x).ToList <DSServiceInfo>();
                List <DSServiceInfo> dSServiceInfos = (
                    from x in this.DSServiceInfoDic.Values
                    where x.CheckResource(dSType)
                    select x).ToList <DSServiceInfo>();
                List <DSServiceInfo> list1 = (
                    from x in this.DSServiceInfoDic.Values
                    where x.HasUnuseEntity(dSType)
                    select x).ToList <DSServiceInfo>();
                if ((
                        from x in this.DSServiceInfoDic
                        where x.Value.useFlag
                        select x).Count <KeyValuePair <int, DSServiceInfo> >() == this.DSServiceInfoDic.Count)
                {
                    foreach (KeyValuePair <int, DSServiceInfo> dSServiceInfoDic in this.DSServiceInfoDic)
                    {
                        dSServiceInfoDic.Value.useFlag = false;
                    }
                }
                if (list.Count > 0)
                {
                    dSServiceInfo = (
                        from x in list
                        orderby x.Resource descending
                        select x).First <DSServiceInfo>();
                    serviceID = dSServiceInfo.ServiceID;
                    Log <DSEntityMakerSystem> .Logger.InfoFormat("Find DS Entity!! ServiceID : [{0}]", serviceID);

                    num = dSServiceInfo.UseEntityAndGetDSID(dSType);
                }
                else if (dSServiceInfos.Count <= 0)
                {
                    if (list1.Count <= 0)
                    {
                        continue;
                    }
                    dSServiceInfo = (
                        from x in list1
                        orderby x.Resource descending
                        select x).First <DSServiceInfo>();
                    List <int> .Enumerator enumerator = dSServiceInfo.GetDestroyCadidateEntity(dSType).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            int current = enumerator.Current;
                            nums.Add(current, dSServiceInfo.ServiceID);
                            Log <DSEntityMakerSystem> .Logger.InfoFormat("Delete Entity ServiceID : [{0}] EntityID : [{1}]", serviceID, current);
                        }
                        continue;
                    }
                    finally
                    {
                        ((IDisposable)enumerator).Dispose();
                    }
                }
                else
                {
                    dSServiceInfo = ((
                                         from x in dSServiceInfos
                                         where !x.useFlag
                                         select x).Count <DSServiceInfo>() <= 0 ? (
                                         from x in dSServiceInfos
                                         orderby x.Resource descending
                                         select x).First <DSServiceInfo>() : (
                                         from x in dSServiceInfos
                                         where !x.useFlag
                                         orderby x.Resource descending
                                         select x).First <DSServiceInfo>());
                    serviceID = dSServiceInfo.ServiceID;
                    Log <DSEntityMakerSystem> .Logger.InfoFormat("Find DS Service!! ServiceID : [{0}]", serviceID);

                    num  = dSServiceInfo.UseResourceAndGetDSID(dSType);
                    flag = true;
                }
                this.Parent.DSWaitingSystem.DSStorage.DSMap.Add(num, new DSInfo(num, serviceID, dSType));
                dSEntityMakerQueues.Add(dSEntityMakerList);
                if (flag)
                {
                    MakeDSEntity makeDSEntity = new MakeDSEntity(num);
                    makeDSEntity.OnComplete += new Action <Operation>((Operation _) =>
                    {
                        if (dSEntityMakerList.DSType != DSType.Pvp)
                        {
                            this.Parent.DSWaitingSystem.ProcessAll();
                            return;
                        }
                        UpdatePvpDSInfo updatePvpDSInfo = new UpdatePvpDSInfo(num, new DSInfo(num, serviceID, dSType));
                        this.Parent.RequestOperation(dSEntityMakerList.PVPServiceID, updatePvpDSInfo);
                        this.DSServiceInfoDic[serviceID].EntityInfoDic[num].TargetPvpServiceID = dSEntityMakerList.PVPServiceID;
                    });
                    this.Parent.RequestOperation(serviceID, makeDSEntity);
                }
                else if (dSEntityMakerList.DSType != DSType.Pvp)
                {
                    this.Parent.DSWaitingSystem.ProcessAll();
                }
                else
                {
                    UpdatePvpDSInfo updatePvpDSInfo1 = new UpdatePvpDSInfo(num, new DSInfo(num, serviceID, dSType));
                    this.Parent.RequestOperation(dSEntityMakerList.PVPServiceID, updatePvpDSInfo1);
                    this.DSServiceInfoDic[serviceID].EntityInfoDic[num].TargetPvpServiceID = dSEntityMakerList.PVPServiceID;
                }
            }
            foreach (KeyValuePair <int, int> keyValuePair in nums)
            {
                DSLog.AddLog(keyValuePair.Key, "", (long)-1, -1, "RemoveDSEntity", "");
                RemoveDSEntity removeDSEntity = new RemoveDSEntity(keyValuePair.Key);
                this.Parent.RequestOperation(keyValuePair.Value, removeDSEntity);
            }
            foreach (DSEntityMakerQueue dSEntityMakerQueue in dSEntityMakerQueues)
            {
                this.DSEntityMakerList.Remove(dSEntityMakerQueue);
            }
        }
 private void Start()
 {
     DSLog.I("Hello,UnitySir");
     DSLog.E("Hello,UnitySir");
 }