Exemplo n.º 1
0
        public static void UpdateUserBpBase(ref UserManager instance, ref UserAll userAll)
        {
            List <UserBpBase> userBpBases = new List <UserBpBase>();

            foreach (var bp in instance.userRecentBattleScore)
            {
                UserBpBase userBpBase = new UserBpBase()
                {
                    musicId        = bp.musicId,
                    difficultId    = NetPacketUtil.toServerFumenDifficulty(bp.difficultId),
                    romVersionCode = bp.romVersionCode,
                    score          = bp.score
                };
                userBpBases.Add(userBpBase);
            }
            userAll.userBpBaseList = userBpBases.ToArray();
        }
Exemplo n.º 2
0
 public static void UpdateSessionlogList(ref UserManager instance, ref UserAll userAll, ref bool isLogout)
 {
     if (isLogout)
     {
         DateTime       now            = DateTime.Now;
         UserSessionLog userSessionLog = new UserSessionLog();
         userSessionLog.sortNumber   = NetPacketUtil.toSortNumber(instance.userLocal.loginDateTime);
         userSessionLog.placeId      = Auth.LocationId;
         userSessionLog.playDate     = NetPacketUtil.toLogDateString(now);
         userSessionLog.userPlayDate = NetPacketUtil.toString(now);
         userSessionLog.isPaid       = instance.userLocal.isPaid;
         userAll.userSessionlogList  = new UserSessionLog[1] {
             userSessionLog
         };
     }
     else
     {
         userAll.userSessionlogList = new UserSessionLog[0];
     }
 }
Exemplo n.º 3
0
        public static void Save()
        {
            GetUserCardResponse userCardResponse = FileSystem.Configuration.LoadJson <GetUserCardResponse>(_filename);

            foreach (var card in _cards)
            {
                if (card.created == "0000-00-00 00:00:00.0")
                {
                    card.created = NetPacketUtil.toString(NetPacketUtil.LocalNow);
                }
                if (card.kaikaDate == "0000-00-00 00:00:00.0" && card.printCount > 0)
                {
                    card.kaikaDate = NetPacketUtil.toString(NetPacketUtil.LocalNow);
                }
                if (card.choKaikaDate == "0000-00-00 00:00:00.0" && card.printCount > 2 && card.level == card.maxLevel)
                {
                    card.choKaikaDate = NetPacketUtil.toString(NetPacketUtil.LocalNow);
                }
            }

            userCardResponse.userCardList = _cards.ToArray();
            userCardResponse.length       = _cards.Count;
            FileSystem.Configuration.SaveJson(_filename, userCardResponse);
        }
Exemplo n.º 4
0
 protected Packet.State procImpl()
 {
     Packet.State state  = this.state_;
     Packet.State state2 = this.state_;
     if (state2 != Packet.State.Ready)
     {
         if (state2 != Packet.State.Process)
         {
             if (state2 == Packet.State.RetryWait)
             {
                 this.time_ += Time.deltaTime;
                 if (NetConfig.RetryWaitInSec <= this.time_)
                 {
                     this.reset();
                 }
             }
         }
         else
         {
             int state3 = this.client_.State;
             if (state3 != 4)
             {
                 if (state3 == 5)
                 {
                     this.procResult();
                 }
             }
             else
             {
                 MemoryStream response  = this.client_.getResponse();
                 byte[]       buffer    = response.GetBuffer();
                 string       response2 = (buffer == null) ? string.Empty : Encoding.UTF8.GetString(buffer, 0, (int)response.Length);
                 try
                 {
                     if (this.query_.setResponse(response2))
                     {
                         this.state_  = Packet.State.Done;
                         this.status_ = Packet.Status.OK;
                     }
                     else
                     {
                         this.state_  = Packet.State.Error;
                         this.status_ = Packet.Status.Error_DecodeResponse;
                     }
                 }
                 catch
                 {
                     this.state_  = Packet.State.Error;
                     this.status_ = Packet.Status.Error_DecodeResponse;
                 }
                 this.clear();
             }
         }
     }
     else
     {
         try
         {
             string request = this.query_.getRequest();
             if (!this.client_.request(Encoding.UTF8.GetBytes(request), NetPacketUtil.getUserAgent(this.query_), this.query_.Compress))
             {
                 this.procResult();
             }
             else
             {
                 this.state_ = Packet.State.Process;
             }
         }
         catch
         {
             this.state_  = Packet.State.Error;
             this.status_ = Packet.Status.Error_EcodeRequest;
         }
     }
     if (state != this.state_ && (this.state_ == Packet.State.Done || this.state_ == Packet.State.Error))
     {
         Singleton <OperationManager> .instance.onPacketFinish(this.status_);
     }
     return(this.state_);
 }