コード例 #1
0
ファイル: PlayerController.cs プロジェクト: hassiumsoft/SKit
        public int Call_GetPlayerRes(ResRequest request)
        {
            var         player   = CurrentSession.GetBind <Player>();
            ResResponse response = new ResResponse();

            response.success   = true;
            response.pid       = player.Id;
            response.level     = player.Level;
            response.nickyName = player.NickName;
            response.icon      = player.Icon;
            response.exp       = player.Exp;
            response.renameCnt = player.RenameNumb;
            response.vip       = player.VIP;

            //检查每日刷新
            if (player.LastDayRefreshTime.Date != DateTime.Today)
            {
                //需要刷新
                OnPlayerEverydayRefresh(player);

                player.LastDayRefreshTime = DateTime.Today;
                _db.SaveChanges();
            }

            response.resInfos = new List <ResInfo>();
            for (int ct = 1; ct <= CurrencyType.MAX_TYPE; ct++)
            {
                response.resInfos.Add(new ResInfo()
                {
                    type  = ct,
                    count = player.Wallet.GetCurrency(ct)
                });
            }

            //一些配置表的内容
            response.nextExp       = _dlevels[player.Level].exp;
            response.resistMaxWave = 1;
            response.preExp        = player.Level == 1 ? 0:  _dlevels[player.Level - 1].exp;
            CurrentSession.SendAsync(response);
            return(0);
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                dataGridView1.DataSource = null;//clear datagridview1

                label1.Text = "";

                if (_fileName != "" || _timeStamp != "")
                {
                    _fileName  = "";
                    _timeStamp = "";
                }

                string text = DateTime.Now.ToString();

                _timeStamp = text.Replace("/", "_").Replace(":", "_");
                _fileName  = "ReservationsDetailsOn_";

                ResRequest oRequest  = new ResRequest();
                ResResult  oResponse = new ResResult();

                // Build the request to get some reservations
                // All of the filters will be applied together
                {
                    var withBlock = oRequest;
                    withBlock.ResIdFrom         = 0;
                    withBlock.ResIdTo           = 10000;
                    withBlock.ListOfPropertyIds = new int[] { 1, 2, 3, 4 };


                    // Specify some optional data to be populated
                    withBlock.ResOptionalFieldList = new OptionalFieldsRes();
                    {
                        var withBlock1 = withBlock.ResOptionalFieldList;
                        withBlock1.Company        = true;
                        withBlock1.AccountBalance = true;
                    }
                }

                // Get the data from the server
                oResponse = _PublicServiceClient.GetListOfReservations(_Token, oRequest);

                dataGridView1.DataSource = oResponse.ListOfRes;
                var FetchedData = oResponse.ListOfRes;

                if (oResponse != null && oResponse.ListOfRes != null)
                {
                    if (FetchedData.Count() == 0)
                    {
                        label1.Text = "Get Data Success: No reservations found!";
                    }
                    else
                    {
                        label1.Text = "Get Data Success:" + FetchedData.Count() + " reservations found!";
                    }
                }
                else
                {
                    label1.Text = " No Reservations found.";
                }
            }
            catch (Exception ex)
            {
                label1.Text = "Error: " + ex.Message;
            }
        }
コード例 #3
0
ファイル: ResourceManager.cs プロジェクト: EricPL/TourRun_2D
    private void _LoadAssetAsync(string _prefabName, Type _type, ILoadListening _callBack, bool _isKeepInMemory)
    {
        if(string.IsNullOrEmpty(_prefabName))
        {
            if(null!=_callBack)
                _callBack.Failure();

            return ;
        }

        if (mAssetPackDic.ContainsKey(_prefabName))
        {
            if(mAssetPackDic[_prefabName].asset==null)
            {
                if(_callBack!=null)
                    _callBack.Failure();

            }
            else
            {
                _callBack.Succeed(mAssetPackDic[_prefabName].asset);
            }

            return;
        }

        for (int i = 0; i < mLoadListIns.Count; ++i)
        {
            ResRequest request=mLoadListIns[i];

            if(request.assetName.Equals(_prefabName))
            {
                request.AddListening(_callBack);
                return ;
            }
        }

        foreach (ResRequest request in mWaitForLoadings) {
            if(request.assetName.Equals(_prefabName))
            {
                request.AddListening(_callBack);
                return;
            }
        }

        ResRequest loadRequest= new ResRequest(_prefabName,_isKeepInMemory,_type);
        loadRequest.listenings.Add(_callBack);
        mWaitForLoadings.Enqueue(loadRequest);
    }
コード例 #4
0
ファイル: ResourceManager.cs プロジェクト: EricPL/TourRun_2D
 void LoadFinish(ResRequest request)
 {
     if(request!=null)
     {
         for (int i = 0; i < request.listenings.Count; ++i)
         {
             ILoadListening listen=request.listenings[i];
             if(listen!=null)
             {
                 if(request.request!=null && request.request.asset!=null)
                 {
                     listen.Succeed(request.request.asset);
                 }
                 else
                 {
                     listen.Failure();
                 }
             }
         }
     }
 }