public FileStreamResult ProfilePictureForDiscussion(int course, int userProfile) { // File Stream that will ultimately contain profile picture. Stream pictureStream; // User Profile object of user we are trying to get a picture of UserProfile u = db.UserProfiles.Find(userProfile); // A role for both our current user and // the one we're trying to see AbstractRole ourRole = currentCourses.Where(c => c.AbstractCourseID == course).Select(c => c.AbstractRole).FirstOrDefault(); AbstractRole theirRole = db.CourseUsers.Where(c => (c.AbstractCourseID == course) && (c.UserProfileID == userProfile)).Select(c => c.AbstractRole).FirstOrDefault(); // Show picture if user is requesting their own profile picture or they have the right to view the profile picture if (userProfile == CurrentUser.ID || // Current user's CourseRole ourRole != null && // Target user's CourseRole theirRole != null && // If current user is not anonymous or other user is instructor/TA, show picture (!(ourRole.Anonymized) || theirRole.CanGrade) ) { pictureStream = FileSystem.GetProfilePictureOrDefault(u); } else { // Default to blue OSBLE guy picture. pictureStream = FileSystem.GetDefaultProfilePicture(); } return(new FileStreamResult(pictureStream, "image/jpeg")); }
void DoNightEvent(object sender, MessageReceivedEventArgs e) { AbstractRole role = networkManager.getMyRole(); role.InitNightEvent(); StartCoroutine(networkManager.waitInSecondsToEndTurn(10)); /* * Here should be code to return the updated playfield including all cards */ }
public string DisplayName(AbstractRole viewerRole) { if (viewerRole.Anonymized) // observer { // will want to change this.ID to this.ID % with # teams Mabye return("Team " + this.ID); } else { return(this.Name); } }
public void SetRole(string roleName) { AbstractRoleCreator role; switch (roleName) { case "ROBBER": role = new RobberCreator(); break; case "SEER": role = new SeerCreator(); break; case "TROUBLE": role = new TroubleCreator(); break; case "WEREWOLF": role = new WerewolfCreator(); break; case "DRUNK": role = new DrunkCreator(); break; case "INSOMNIAC": role = new InsomniacCreator(); break; default: role = new OtherRoleCreator(); break; } myRole = role.CreateRole(); }
/// <summary> /// Converts the list of team members into a string for display purposes. /// Will contain the name(s) of each individual on the team. /// </summary> /// <param name="seperator"></param> /// <returns></returns> public string TeamMemberString(AbstractRole viewerRole, string separator = "; ") { string[] names = (from member in this.TeamMembers select member.CourseUser.DisplayName(viewerRole)).ToArray <string>(); return(string.Join(separator, names)); }