protected void Play(Payloader <SC_Play> payloader) { payloader.Callback( success: (data) => { }); }
private void EnterRoom(Payloader <SC_EnterRoom> payloader) { payloader.Callback( success: (data) => { }); }
public async Task <IActionResult> Create([FromBody] ManagerViewModel body) { try { var entity = await _unitOfWork.Managers.GetAsync(u => u.Id == body.Id); if (entity != null) { return(Payloader.Fail(PayloadCode.Duplication)); } var newEntity = new Manager { Id = body.Id, Password = body.Password, }; await _unitOfWork.Managers.AddAsync(newEntity); await _unitOfWork.CommitAsync(); return(Payloader.Success(_mapper.Map <ManagerViewModel>(newEntity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
protected void CompleteLoading(Payloader <SC_CompleteLoading> payloader) { payloader.Callback( success: (data) => { }); }
public async Task <IActionResult> Get() { try { var authToken = Request.Headers["Authorization"].ToString(); var tokenString = authToken.Substring(7); var tokenHandler = new JwtSecurityTokenHandler(); var token = tokenHandler.ReadToken(tokenString); var userId = ((JwtSecurityToken)token).Payload["nameid"].ToString(); var entity = await _unitOfWork.Managers.GetAsync(u => u.Id == userId); if (entity == null) { return(Payloader.Fail(PayloadCode.DbNull)); } return(Payloader.Success(_mapper.Map <ManagerViewModel>(entity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> Create([FromBody] VideoViewModel body) { try { var entity = await _unitOfWork.Videos.GetAsync(u => u.Id == body.Id); if (entity != null) { return(Payloader.Fail(PayloadCode.Duplication)); } var newEntity = new Video { Title = body.Title, Uri = body.Uri, }; await _unitOfWork.Videos.AddAsync(newEntity); await _unitOfWork.CommitAsync(); return(Payloader.Success(_mapper.Map <VideoViewModel>(newEntity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
protected void MoveCube(Payloader <SC_MoveCube> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.MoveCube(data.CubeSeq, data.PositionX, data.PositionY); }); }
private void ExitRoom(Payloader <SC_ExitRoom> payloader) { payloader.Callback( success: (data) => { Router.CloseAndOpen("LobbyView/PlayView"); }); }
protected void ShotMissile(Payloader <SC_ShotMissile> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.ShotMissile(data.CubeSeq, data.MonsterSeq); }); }
protected void DeleteCube(Payloader <SC_DeleteCube> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.DeleteCube(data.DeleteCubes); }); }
protected void CombineCube(Payloader <SC_CombineCube> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.CombineCube(data.OwnerSeq, data.TargetSeq); }); }
private void ExitMatch(Payloader <SC_ExitMatch> payloader) { payloader.Callback( success: (data) => { Router.Close("MatchView"); }); }
private void EnterMatch(Payloader <SC_EnterMatch> payloader) { payloader.Callback( success: (data) => { Router.Open("MatchView"); }); }
protected void Wave(Payloader <SC_Wave> payloader) { payloader.Callback( success: (data) => { StartCoroutine(WaveMonster(8f)); }); }
private void Login(Payloader <SC_Login> payloader) { payloader.Callback( success: (data) => { ServerInfo.isLogin = true; Router.CloseAndOpen("LobbyView/PlayView"); }); }
protected void UpdateSlot(Payloader <SC_UpdateSlot> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.UpdateSlot(data.SlotIndex, data.SlotLv); Router.Refresh(); }); }
protected void DieMonster(Payloader <SC_DieMonster> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.DieMonster(data.MonsterSeq); Router.Refresh(); }); }
protected void CreateCube(Payloader <SC_CreateCube> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.CreateCube(data.NewCube); Router.Refresh(); }); }
private void Loading(Payloader <SC_Loading> payloader) { payloader.Callback( success: (data) => { ServerInfo.GameUsers = data.Users; SceneManager.LoadScene("MultiGame", LoadSceneMode.Single); }); }
protected void EscapeMonster(Payloader <SC_EscapeMonster> payloader) { payloader.Callback( success: (data) => { GetTeam(data.Id)?.EscapeMonster(data.MonsterSeq); Router.Refresh(); CheckResult(); }); }
public async Task <IActionResult> Parsing() { try { await ParsingCubeData(); return(Payloader.Success("Parse Success")); } catch (Exception ex) { return(Payloader.Error(ex)); } }
protected virtual void Result(Payloader <SC_Result> payloader) { payloader.Callback( success: (data) => { GetTeams().ForEach(x => x.UnRegister()); ServerInfo.GameUsers = data.Users; Router.Open("ResultView"); var my = ServerInfo.MyGameUser(); LobbyServer.sInstance.UpdateMoney(my.Id, my.Money); }); }
protected override void Result(Payloader <SC_Result> payloader) { payloader.Callback( success: (data) => { GetTeams().ForEach(x => x.UnRegister()); ServerInfo.GameUsers = data.Users; ServerInfo.GameUsers.FirstOrDefault().Id = tempUserId; ServerInfo.GameUsers.FirstOrDefault().Name = tempUserName; ServerInfo.User.Id = tempUserId; ServerInfo.User.Name = tempUserName; Router.Open("ResultView"); }); }
public async Task <IActionResult> Get(string id) { try { var entity = await _unitOfWork.Managers.GetAsync(u => u.Id == id); if (entity == null) { return(Payloader.Fail(PayloadCode.DbNull)); } return(Payloader.Success(_mapper.Map <ManagerViewModel>(entity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> Get() { try { var entries = await _unitOfWork.Managers.GetManyAsync(); if (entries == null) { return(Payloader.Fail(PayloadCode.DbNull)); } return(Payloader.Success(_mapper.Map <IEnumerable <ManagerViewModel> >(entries))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> UpdateLv(string userId, int cubeId) { try { var user = await _unitOfWork.Users.GetAsync(x => x.Id == userId, isTracking : true); if (user == null) { return(Payloader.Fail(PayloadCode.DbNull)); } var lv = 0; var cube = await _unitOfWork.Cubes.GetAsync(x => x.UserId == userId && x.CubeId == cubeId); if (cube != null) { lv = cube.Lv; } var price = ServerDefine.CubeLv2Price((byte)lv); if (user.Money < price) { return(Payloader.Fail(PayloadCode.Not)); } user.Money -= price; var newCube = await _unitOfWork.Cubes.UpdateLv(userId, cubeId, 1); await _unitOfWork.CommitAsync(); return(Payloader.Success(new UpdateCubeLvBody() { Cube = _mapper.Map <CubeViewModel>(newCube), Money = user.Money, })); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> ParsingSkillData(IFormFile xml = null) { try { var datas = XmlKey.CubeData.FindAll <SkillDataXml.Data>(xml, new SkillDataXml()); await _unitOfWork.SkillDatas.DeleteManyAsync(); await _unitOfWork.SkillDatas.AddAsync(_mapper.Map <IEnumerable <SkillData> >(datas)); await _unitOfWork.CommitAsync(); return(Payloader.Success(datas.Count)); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> Get(string id) { try { var entity = await _unitOfWork.Users.GetAsync(x => x.Id == id, eagerLoad : q => q.Include(x => x.Entry), explicitLoad : q => q.Include(x => x.Cubes).ThenInclude(x => x.CubeData).Load(), isTracking : true); if (entity == null) { return(Payloader.Fail(PayloadCode.DbNull)); } return(Payloader.Success(_mapper.Map <UserViewModel>(entity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> Put(string id, [FromBody] ManagerViewModel body) { try { var entity = await _unitOfWork.Managers.GetAsync(u => u.Id == id, isTracking : true); if (entity == null) { return(Payloader.Fail(PayloadCode.DbNull)); } entity.Password = body.Password; await _unitOfWork.CommitAsync(); return(Payloader.Success(_mapper.Map <ManagerViewModel>(entity))); } catch (Exception ex) { return(Payloader.Error(ex)); } }
public async Task <IActionResult> Delete(string id) { try { var entity = await _unitOfWork.Managers.GetAsync(u => u.Id == id); if (entity == null) { return(Payloader.Fail(PayloadCode.DbNull)); } await _unitOfWork.Managers.DeleteAsync(entity); await _unitOfWork.CommitAsync(); return(Payloader.Success(id)); } catch (Exception ex) { return(Payloader.Error(ex)); } }