private void processSquareMsg(SocketMsg <SquareUser> msg) { switch (msg.data.type) { case SocketEventType.SquareFriends: SquareUser squareUser = msg.data.data as SquareUser; friendHandler.OnReceive(ReqEventType.squarefriend, squareUser); break; case SocketEventType.ApplyList: SquareUser applyUser = msg.data.data as SquareUser; friendHandler.OnReceive(ReqEventType.applyfriend, applyUser); break; case SocketEventType.FriendList: SquareUser friendUser = msg.data.data as SquareUser; friendHandler.OnReceive(ReqEventType.listfriend, friendUser); break; case SocketEventType.NextGround: break; default: break; } }
public async Task <IActionResult> Edit(int id, [Bind("Id,GameId,xScore,yScore")] SquareUser SquareUser) { if (id != SquareUser.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(SquareUser); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SquareUserExists(SquareUser.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(SquareUser)); }
public async Task <IActionResult> Create([Bind("Id,UserName,UserPassword")] SquareUser SquareUser) { if (ModelState.IsValid) { _context.Add(SquareUser); await _context.SaveChangesAsync(); return(Redirect("/Home/Index")); } return(View(SquareUser)); }
protected internal override void Execute(int eventCode, object message) { switch (eventCode) { case UIEvent.SQUARE_LIST_PANEL_ACTIVE: setPanelActive((bool)message); if ((bool)message == false) { for (int i = 0; i < list_InformationBox.Count; i++) { RePreObj(list_InformationBox[i]); } list_InformationBox.Clear(); pageNum = 0; } break; case UIEvent.SQUARE_LIST_PANEL_VIEW: if (message == null) { return; } squareuser = message as SquareUser; //在此防止重复生成 if (pageNum >= squareuser.pageNum) { return; } pageNum = squareuser.pageNum; squareData = squareuser.list; UpdateSquareList(); break; case UIEvent.SEARCH_PANEL_VIEW: if (message == null) { list_InformationBox.Clear(); break; } UserInfos t1 = message as UserInfos; SearchSquareUser(t1); break; default: break; } }
/// <summary> /// 搜索 /// </summary> /// <param name="value"></param> private void searchfriendRespon(object value) { SquareUser square = value as SquareUser; //todo if (square.list == null) { Dispatch(AreaCode.UI, UIEvent.SEARCH_PANEL_VIEW, null); return; } else if (square.list.Count == 1) { Dispatch(AreaCode.UI, UIEvent.SEARCH_PANEL_VIEW, square.list[0]); } else { Dispatch(AreaCode.UI, UIEvent.SQUARE_LIST_PANEL_VIEW, square); } }
public IActionResult Login(string username, string password) { IQueryable <SquareUser> userQuery = from u in _context.SquareUser where u.UserName.ToUpper() == username.ToUpper() && u.UserPassword == password select u; try { SquareUser user = userQuery.SingleOrDefault(); if (user == null) { return(RedirectToAction(nameof(Index))); } TempData["username"] = user.UserName; return(Redirect("/SquareGame/Index")); } catch (Exception) { return(RedirectToAction(nameof(Index))); } }
public override bool OnReceive(int subCode, object value) { switch (subCode) { case ReqEventType.addfriend: //diFriendData = value as Dictionary<string, UserInfo>; addfriendRespon(); break; case ReqEventType.listfriend: _friendData = value as SquareUser; listfriendRespon(); break; case ReqEventType.searchfriend: searchfriendRespon(value); break; case ReqEventType.applyfriend: _applyData = value as SquareUser; applyListRespon(); break; case ReqEventType.squarefriend: _squareData = value as SquareUser; dicSquareFriendRespon(); break; case ReqEventType.applytofriend: isAgreedResonse(value.ToString()); break; default: break; } return(false); }