Пример #1
0
 private void HandleGetMainDataCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams)
 {
     if (this.IsGongNengOpened(client))
     {
         DateTime           now      = TimeUtil.NowDateTime();
         CoupleWishMainData mainData = new CoupleWishMainData();
         lock (this.Mutex)
         {
             mainData.RankList      = new List <CoupleWishCoupleData>(this.ThisWeekTopNList);
             mainData.CanGetAwardId = this.CheckGiveAward(client);
             int idx;
             if (this.SyncData.ThisWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx))
             {
                 CoupleWishCoupleDataK coupleDataK = this.SyncData.ThisWeek.RankList[idx];
                 if (coupleDataK.Man.RoleId == client.ClientData.RoleID || coupleDataK.Wife.RoleId == client.ClientData.RoleID)
                 {
                     mainData.MyCoupleRank      = coupleDataK.Rank;
                     mainData.MyCoupleBeWishNum = coupleDataK.BeWishedNum;
                 }
             }
         }
         mainData.MyCoupleManSelector = Global.sendToDB <RoleData4Selector, int>(10232, client.ClientData.RoleID, client.ServerId);
         if (MarryLogic.IsMarried(client.ClientData.RoleID))
         {
             mainData.MyCoupleWifeSelector = Global.sendToDB <RoleData4Selector, int>(10232, client.ClientData.MyMarriageData.nSpouseID, client.ServerId);
         }
         if (client.ClientData.RoleSex == 1)
         {
             DataHelper2.Swap <RoleData4Selector>(ref mainData.MyCoupleManSelector, ref mainData.MyCoupleWifeSelector);
         }
         client.sendCmd <CoupleWishMainData>(nID, mainData, false);
     }
 }
Пример #2
0
        /// <summary>
        /// 玩家查看情侣祝福主界面
        /// </summary>
        /// <param name="client"></param>
        /// <param name="nID"></param>
        /// <param name="bytes"></param>
        /// <param name="cmdParams"></param>
        private void HandleGetMainDataCommand(GameClient client, int nID, byte[] bytes, string[] cmdParams)
        {
            if (!IsGongNengOpened(client))
            {
                return;
            }
            DateTime now = TimeUtil.NowDateTime();

            CoupleWishMainData mainData = new CoupleWishMainData();

            lock (Mutex)
            {
                mainData.RankList      = new List <CoupleWishCoupleData>(ThisWeekTopNList);
                mainData.CanGetAwardId = CheckGiveAward(client);

                int idx;
                if (SyncData.ThisWeek.RoleIndex.TryGetValue(client.ClientData.RoleID, out idx))
                {
                    CoupleWishCoupleDataK coupleDataK = SyncData.ThisWeek.RankList[idx];
                    if (coupleDataK.Man.RoleId == client.ClientData.RoleID || coupleDataK.Wife.RoleId == client.ClientData.RoleID)
                    {
                        mainData.MyCoupleRank      = coupleDataK.Rank;
                        mainData.MyCoupleBeWishNum = coupleDataK.BeWishedNum;
                    }
                }
            }

            mainData.MyCoupleManSelector = Global.sendToDB <RoleData4Selector,
                                                            string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", client.ClientData.RoleID), client.ServerId);
            if (MarryLogic.IsMarried(client.ClientData.RoleID))
            {
                mainData.MyCoupleWifeSelector = Global.sendToDB <RoleData4Selector,
                                                                 string>((int)TCPGameServerCmds.CMD_SPR_GETROLEUSINGGOODSDATALIST, string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID), client.ServerId);
            }

            if (client.ClientData.RoleSex == (int)ERoleSex.Girl)
            {
                DataHelper2.Swap(ref mainData.MyCoupleManSelector, ref mainData.MyCoupleWifeSelector);
            }

            client.sendCmd(nID, mainData);
        }