Beispiel #1
0
        public async Task <IActionResult> PutLandlord(int id, LandlordDto landlord)
        {
            if (id != landlord.Id)
            {
                return(BadRequest());
            }
            var mapUpdate = _mapper.Map <LandlordDto, Landlord>(landlord);

            _lettingRepository.UpdateEntity(mapUpdate);
            var result = false;

            try
            {
                result = await _lettingRepository.SaveAllAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (result)
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <LandlordDto> AddLandlord(LandlordDto landlord)
        {
            var result = await _client.PostAsJsonAsync("/api/Landlords/AddLandlord", landlord);

            var Resultlandlord = await result.Content.ReadFromJsonAsync <LandlordDto>();

            return(Resultlandlord);
        }
Beispiel #3
0
        public async Task <ActionResult <Landlord> > PostLandlord(LandlordDto landlord)
        {
            var mapInsert = _mapper.Map <LandlordDto, Landlord>(landlord);

            _lettingRepository.AddEntity(mapInsert);
            await _lettingRepository.SaveAllAsync();

            return(CreatedAtAction("GetLandlord", new { id = mapInsert.Id }, mapInsert));
        }
 private void CreatTableCards(LandlordDto dto)
 {
     if (dto.landLordId == Models.gameModel.MatchRoomDto.rightPlayerId)//是自己
     {
         var cardPrefab = Resources.Load(GlobalData.OtherCardPath);
         for (int i = 0; i < dto.tableCardsList.Count; i++)
         {
             CreatCard(myCardsList.Count, cardPrefab);
         }
     }
 }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var Id             = id ?? default;
            var LandlordResult = await _repo.GetLandlordById(Id);

            Landlord = _mapper.Map <Landlord, LandlordDto>(LandlordResult);

            if (Landlord == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #6
0
    /// <summary>
    /// 抢地主响应
    /// </summary>
    /// <param name="dto"></param>
    private void QiangLandlordBro(LandlordDto dto)
    {
        //给设置身份
        Dispatch(AreaCode.UI, UIEvent.PLAYER_CHANGE_IDENTITY, dto.landLordId);
        //所有人显示显示底牌
        Dispatch(AreaCode.UI, UIEvent.SET_TABLE_CARDS, dto.tableCardsList);
        //给地主添加底牌
        Dispatch(AreaCode.CHARACTER, CharactorEvent.SET_LANDLORD_TABLECARDS, dto);
        //播放抢地主的声音
        //Dispatch(AreaCode.AUDIO,AudioEvent.EFFECTAUDIO,);
        //显示抢地主操作结果。就像如果xx不抢,服务器会广播xx不抢,自己要把不抢的结果txt显示出来,其他玩家也要显示谁不抢的txt
        Dispatch(AreaCode.UI, UIEvent.QIANG_LANDLORD_OPERATE, dto.landLordId);

        //播放抢地主音效
        audioMsg.Set("Sound/Fight/", "Order");
        Dispatch(AreaCode.AUDIO, AudioEvent.EFFECTAUDIO, audioMsg);
    }
Beispiel #7
0
    //private void CreatTableCards(LandlordDto dto)
    //{
    //    if (dto.landLordId == Models.gameModel.UserDto.id)//是自己
    //    {
    //        var cardPrefab = Resources.Load(GlobalData.MyCardPath);
    //        for (int i = 0; i < dto.tableCardsList.Count; i++)
    //        {
    //            CreatCard(dto.tableCardsList[i], myCardsList.Count, cardPrefab);
    //        }
    //        //排序
    //        myCard.SortEx();
    //        for (int i = 0; i < myCardsList.Count; i++)
    //        {
    //            myCardsList[i].Init(myCard[i], i, true, dto.tableCardsList.Contains(myCard[i]));
    //        }
    //    }

    //}
    private IEnumerator CreatTableCards(LandlordDto dto)
    {
        if (dto.landLordId == Models.gameModel.UserDto.id)//是自己
        {
            myCard.AddRange(dto.tableCardsList);
            //排序
            myCard.SortEx();
            for (int i = 0; i < myCardsList.Count; i++)
            {
                myCardsList[i].IsSelect = false;
                myCardsList[i].Init(myCard[i], i, true, dto.tableCardsList.Contains(myCard[i]));
            }
            yield return(new WaitForSeconds(0.2f));

            //给地主的牌选中
            foreach (var card in myCardsList)
            {
                if (card.isTableCard)
                {
                    card.IsSelect = true;
                }
            }
        }
    }
 public async Task SaveLandlord(LandlordDto landlord)
 {
     await _client.PutAsJsonAsync($"/api/Landlords/UpdateLandlord/{landlord.Id}", landlord);
 }