private async UniTaskVoid Initialize() { Controller.I.AddRpcContainer(this); // Controller.I.OnAppPause += DestroyLobby; await UniTask.DelayFrame(1); var containerRoot = new GameObject("Lobby").transform; new LobbyReferences(); LobbyReferences.I.Canvas = (await Addressables.InstantiateAsync("canvas", containerRoot)) .GetComponent <Transform>(); await FriendsView.Create(); SoundButton.Create(); await PersonalActiveUserView.Create(); await RoomRequester.Create(); await Shop.Create(LobbyReferences.I.Canvas, ItemType.Cardback); await Shop.Create(LobbyReferences.I.Canvas, ItemType.Background); #if HMS IapShop.Create(); #endif Background.I.SetForLobby(); }
public ActionResult Index(string searchText) { int count = GetCount(); List <Friend> friends = _friendRepository.FindFriends(searchText, Owner.Id); IDictionary <string, string> breadCrumbs = GetBreadCrumbs(); FriendsView friendsView = ModelFactory <FriendsView>(new { FriendsCount = count, Friends = friends, Query = searchText }); return(View(friendsView, breadCrumbs)); }
public ActionResult Index() { int count = GetCount(); IDictionary <string, string> crumbs = GetBreadCrumbs(); crumbs.Add("find", UrlService.UserUrl("friends")); FriendsView friendsView = ModelFactory <FriendsView>(new { FriendsCount = count, Friends = new List <Friend>() }); return(View(friendsView, crumbs)); }
public ref FriendsView GetFriendsView(User user, FriendsView.Mode mode, LocalData localData) { if (friendsView != null) { friendsView.Update(user, mode, localData); return(ref friendsView); } else { friendsView = new FriendsView(user, mode, localData); return(ref friendsView); } }
public async Task <IActionResult> Put([FromBody] ShortFriend shortFriend) { Friends friend = _friendService.FindByAssociation(shortFriend); if (friend == null) { return(NotFound()); } try { FriendsView friendsView = await _friendService.Update(friend); return(Ok(friendsView)); } catch (Exception e) { ModelState.AddModelError("error", e.Message); return(new BadRequestObjectResult(ModelState)); } }
// GET: UserDetails public ActionResult Index(string msg) { string myId = User.Identity.GetUserId(); List <FriendsView> model = new List <FriendsView>(); foreach (var user in db.UserDetails.ToList()) { FriendsView friend = new FriendsView(); friend.friend = user; if (db.Friends.Any(x => x.User1Id == user.Id && x.User2Id == myId) || db.Friends.Any(x => x.User1Id == myId && x.User2Id == user.Id)) { friend.friends = true; } model.Add(friend); } if (!String.IsNullOrEmpty(msg)) { TempData["msg"] = "<script>alert('" + msg + "');</script>"; } return(View(model.Where(x => x.friend.OwnerID != myId))); }
public void ShowAllFriends() { Friends.Clear(); Friends = JsonConvert.DeserializeObject <List <FriendsViewModel> >( RequestController.HttpGet(MainForm.ServerUrl + "/api/Friendship/GetFriends", MainForm.Token).Result); _panel.Controls.Clear(); foreach (var ul in Friends) { FriendsView friend = new FriendsView() { UserId = ul.UserId, Email = ul.Email, FirstName = ul.FirstName, SecondName = ul.SecondName, LastName = ul.LastName, DateOfBirthd = ul.DateOfBirth.Date, Photo = byteArrayToImage(ul.Photo), CanSeeTree = ul.CanSeeTree }; _panel.Controls.Add(friend); } }
public static async UniTask Create() { I = (await Addressables.InstantiateAsync("friendsView", LobbyReferences.I.Canvas)) .GetComponent <FriendsView>(); }
public ActionResult UserFriends(string userId) { var model = new FriendsView(ApplicationDbContext.Create().Friends.Where(f => f.User1.Id == userId && (f.Status == FriendStatus.Friends) && (f.User1 != f.User2)).Include(f => f.User2).ToList()); return(View(model)); }
/// <summary> /// Read all about this, but this is a nice way if there were multiple /// fragments on the screen for us to decide what and where to show stuff /// See: http://enginecore.blogspot.ro/2013/06/more-dynamic-android-fragments-with.html /// </summary> /// <param name="request"></param> /// <returns></returns> public bool Show(MvxViewModelRequest request) { try { MvxFragment frag = null; var title = string.Empty; var section = this.ViewModel.GetSectionForViewModelType(request.ViewModelType); switch (section) { case HomeViewModel.Section.Browse: { if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as BrowseView != null) { return(true); } frag = new BrowseView(); title = "Browse"; } break; case HomeViewModel.Section.Friends: { if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as FriendsView != null) { return(true); } frag = new FriendsView(); title = "Friends"; } break; case HomeViewModel.Section.Profile: { if (this.SupportFragmentManager.FindFragmentById(Resource.Id.content_frame) as ProfileView != null) { return(true); } frag = new ProfileView(); title = "Profile"; } break; } var loaderService = Mvx.Resolve <IMvxViewModelLoader>(); var viewModel = loaderService.LoadViewModel(request, null /* saved state */); frag.ViewModel = viewModel; // TODO - replace this with extension method when available //Normally we would do this, but we already have it this.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit(); this._drawerList.SetItemChecked(this.ViewModel.MenuItems.FindIndex(m => m.Id == (int)section), true); this.ActionBar.Title = this._title = title; this._drawer.CloseDrawer(this._drawerList); return(true); } finally { this._drawer.CloseDrawer(this._drawerList); } }