public bool PridejClenaCommand(string arg = "") { CrewMember newMember = new CrewMember(); Console.Write("Zadejte Jméno: "); newMember.Name = Console.ReadLine(); Console.Write("Zadejte Příjmení: "); newMember.Surname = Console.ReadLine(); Console.Write("Zadejte Barvu Týmu: "); newMember.Team = Console.ReadLine(); List <CrewMember> expected = Repository.ExpectedCrewMembers; List <CrewMember> matching = expected.Where(e => e.Name == newMember.Name && e.Surname == newMember.Surname && e.Team == newMember.Team).ToList(); if (matching.Count() == 0) { Console.WriteLine("Tato osoba se na lodi nenachází! (Zkontrolujte Jméno, Příjmení a Tým"); return(false); } List <CrewMember> members = Repository.CrewMembers; members.Add(newMember); Repository.CrewMembers = members; Console.WriteLine("Člen úspěšně přidán"); return(true); }
public List <CrewMember> GetCrewMembersForCrewId(UInt32 crewId) { List <CrewMember> crewMembers = new List <CrewMember>(); OpenConnection(); string query = "SELECT cm.char_id, cm.is_captain, cm.is_first_mate, c.handle, c.is_online FROM crew_members cm LEFT JOIN characters c ON cm.char_id=c.charId WHERE cm.crew_id = '" + crewId + "' "; queryExecuter = conn.CreateCommand(); queryExecuter.CommandText = query; dr = queryExecuter.ExecuteReader(); while (dr.Read()) { UInt32 charId = (UInt32)dr.GetInt32(0); bool isCaptain = dr.GetBoolean(1); bool isFirstMate = dr.GetBoolean(2); string handle = dr.GetString(3); ushort isOnline = (ushort)dr.GetInt16(4); CrewMember member = new CrewMember(); member.charId = charId; member.handle = handle; member.isCaptain = isCaptain; member.isFirstMate = isFirstMate; member.isOnline = isOnline; crewMembers.Add(member); } CloseConnection(); return(crewMembers); }
public MoveCommand(CrewMember commandOwner, Room destination) { this.Destination = destination; this.commandOwner = commandOwner; this.Name = "Move"; this.StatusText = "Moving"; }
private void RePrioritize(List <CrewMember> priorities, MovementTile tile) { for (int i = 0; i < priorities.Count; i++) { if (!priorities [i]) { priorities.RemoveAt(i); i--; } } for (int i = priorities.Count - 1; i > 0; i--) { for (int j = i; j > 0; j--) { if (CompareCrewMember(priorities [j - 1], priorities [j], tile) > 0) { CrewMember c = priorities [j - 1]; priorities [j - 1] = priorities [j]; priorities [j] = c; } else { break; } } } }
public FixElectricCommand(CrewMember crewMember, Room destination) { this.crewMember = crewMember; Destination = destination; Name = "Fix Electronics"; StatusText = "Working..."; }
public async Task <IActionResult> RegisterAdmin(RegisterViewModel avm, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var user = new CrewMember { UserName = avm.Email, Email = avm.Email, Rank = avm.Rank, Department = avm.Department }; var result = await _userManager.CreateAsync(user, avm.Password); if (result.Succeeded) { List <Claim> memberClaims = new List <Claim>(); Claim admin = new Claim(ClaimTypes.Role, "Admin", ClaimValueTypes.String); memberClaims.Add(admin); var addClaims = await _userManager.AddClaimsAsync(user, memberClaims); if (addClaims.Succeeded) { await _signInManager.SignInAsync(user, isPersistent : false); return(RedirectToAction("Index", "Home")); } } } return(View()); }
private static string GetCrewJob(CrewMember crewMember) { var jobBuilder = new StringBuilder("Crew: "); if (!string.IsNullOrWhiteSpace(crewMember.CreditSubtype) && crewMember.CreditSubtype != "Custom") { jobBuilder.Append(crewMember.CreditSubtype.Trim()); } else { jobBuilder.Append(crewMember.CreditType?.Trim()); } if (!string.IsNullOrWhiteSpace(crewMember.CustomRole)) { jobBuilder.Append(" / "); jobBuilder.Append(crewMember.CustomRole.Trim()); } if (!string.IsNullOrWhiteSpace(crewMember.CreditedAs)) { jobBuilder.Append(" (as "); jobBuilder.Append(crewMember.CreditedAs.Trim()); jobBuilder.Append(")"); } return(jobBuilder.ToString()); }
public async Task <IActionResult> ExternalLoginConfirmation(ExternalLoginModel elm) { if (ModelState.IsValid) { var info = await _signInManager.GetExternalLoginInfoAsync(); if (info == null) { return(RedirectToAction(nameof(Login))); } var user = new CrewMember { UserName = elm.Email, Email = elm.Email }; var result = await _userManager.CreateAsync(user); if (result.Succeeded) { result = await _userManager.AddLoginAsync(user, info); if (result.Succeeded) { await _signInManager.SignInAsync(user, isPersistent : false); return(RedirectToAction("Index", "Home")); } } } return(View(nameof(ExternalLogin), elm)); }
public void Unassign(CrewMember crew) { crew.shipPos.isManned = false; crew.shipPos = null; crewMembers.Remove(crew); crew.ship = null; }
public bool Assign(CrewMember crew, ShipPosition shipPos, bool asNewMemeber = false) { if (!shipPos.isManned) { if (crew.shipPos) { crew.shipPos.isManned = false; } crew.shipPos = shipPos; crew.role = shipPos.getRole(); shipPos.isManned = true; if (asNewMemeber) { crewMembers.Add(crew); crew.ship = this; } crew.BeginPath(AStar.FindPath(crew.current, shipPos.tile, true)); return(true); } return(false); }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } }
public ViewModelUpdateCrewMember() { if (Client.State == CommunicationState.Closed) { Client.Open(); } crewMember = new CrewMember(); AddSkillCommand = new RelayCommand(AddSkillCommand_Execute, AddSkillCommand_CanExecute); RemoveSkillCommand = new RelayCommand(RemoveSkillCommand_Execute, RemoveSkillCommand_CanExecute); AddAllSkillsCommand = new RelayCommand(AddAllSkillsCommand_Execute, AddAllSkillsCommand_CanExecute); RemoveAllSkillsCommand = new RelayCommand(RemoveAllSkillsCommand_Execute, RemoveAllSkillsCommand_CanExecute); UpdateEntityCommand = new RelayCommand(UpdateEntityCommand_Execute); Crews = new ObservableCollection <Crew>(Client.GetEntityByType(EntityType.Crew).Cast <Crew>()); CrewMembers = new ObservableCollection <CrewMember>(Client.GetEntityByType(EntityType.CrewMember).Cast <CrewMember>()); UserTypes = new ObservableCollection <UserType> { UserType.Manager, UserType.Worker }; AllSkills = new ObservableCollection <Skills> { Skills.OperateInSubstation, Skills.OperateOutOfSubstation, Skills.PerformPlannedWork, Skills.PerformSwitching, Skills.PerformUnplannedWork }; MemeberSkills = new ObservableCollection <Skills>(); SelectedAllSkills = new ObservableCollection <Skills>(); SelectedMemberSkills = new ObservableCollection <Skills>(); }
public static void Feed(ApplicationDbContext dbContext) { var owner1 = new CrewMember { Name = "Dom", Email = "*****@*****.**", }; dbContext.Owners.Add(owner1); var boat1 = new Boat { Name = "DW 12345", BuildNumber = 3, LoA = 3.3F, B = 2.2F, CrewMembers = new List <CrewMember> { owner1 }, }; dbContext.Boats.Add(boat1); dbContext.SaveChanges(); }
/// <summary> /// Set-up the pop-up for displaying the given CrewMember /// </summary> public void SetUpDisplay(CrewMember crewMember, string source) { //do not display if the season has finished if (!GameManagement.SeasonOngoing) { return; } //Change the opinion icon dictionary from the available array if not already done if (_opinionIconDict == null) { _opinionIconDict = _opinionIcons.ToDictionary(o => o.name.Replace("Icon_Box_", string.Empty), o => o); } _currentMember = crewMember; //ensure that the crew member is visible on the crew container at the bottom UIManagement.TeamSelection.EnsureVisible(_currentMember); //make pop-up visible and firing warning not visible gameObject.Active(true); _fireWarningPopUp.Active(false); //disable opinion images on CrewMember UI objects ResetOpinionIcons(); TrackerEventSender.SendEvent(new TraceEvent("CrewMemberPopUpOpened", TrackerAsset.Verb.Accessed, new Dictionary <TrackerContextKey, object> { { TrackerContextKey.CrewMemberName, crewMember.Name }, { TrackerContextKey.CurrentTalkTime, GameManagement.ActionAllowance }, { TrackerContextKey.CurrentSession, GameManagement.CurrentSessionString }, { TrackerContextKey.CrewMemberPosition, crewMember.BoatPosition() }, { TrackerContextKey.SizeOfTeam, GameManagement.CrewCount }, { TrackerContextKey.TriggerUI, source }, { TrackerContextKey.CrewMemberSessionsInTeam, crewMember.SessionsIncluded() } }, AccessibleTracker.Accessible.Screen)); SUGARManager.GameData.Send("View Crew Member Screen", crewMember.Name); Display(); //set the order of the pop-ups and pop-up blockers and set-up the click event for the blocker transform.EnableSmallBlocker(() => CloseCrewMemberPopUp(TrackerTriggerSource.PopUpBlocker.ToString())); }
/// <summary> /// Bring in elements that need to be known to this object, set properties related to this object and set the UI accordingly /// </summary> public void SetUp(bool usable, CrewMember crewMember, int mood, TrackerTriggerSource source = TrackerTriggerSource.TeamManagementScreen) { CrewMember = crewMember; Current = crewMember.Current(); Usable = usable; _source = source; _borderImage = GetComponent <Image>(); _backImage = transform.FindImage("AvatarIcon"); _button = GetComponent <Button>(); _avatarDisplay = GetComponentInChildren <AvatarDisplay>(); _positionImage = transform.FindImage("Position"); _positionButton = transform.FindButton("Position"); _nameText = transform.FindText("Name"); _sortImage = transform.FindImage("Sort"); _sortText = transform.FindText("Sort/Sort Text"); _aspectFitter = GetComponent <AspectRatioFitter>(); _defaultParent = transform.parent; _nameText.text = CrewMember.FirstInitialLastName(); _backImage.color = Usable ? new Color(0, 1, 1) : Current ? new Color(0, 0.5f, 0.5f) : Color.white; _borderImage.color = ShowEmotion ? AvatarDisplay.MoodColor(mood) : Current ? Color.grey : Color.black; UpdateAvatar(mood); _button.enabled = Current && GameManagement.SeasonOngoing; _positionButton.enabled = GameManagement.SeasonOngoing; _aspectFitter.aspectMode = Usable ? AspectRatioFitter.AspectMode.FitInParent : AspectRatioFitter.AspectMode.WidthControlsHeight; }
public void ConnectedCrewName() { if (ds.Storage.GetValue("$connections_number").AsNumber > 0) { if (Globals.GameVars.Network.GetCrewMemberNetwork(Globals.GameVars.Jason).Contains(city)) { ds.Storage.SetValue("$jason_connected", true); ds.Storage.SetValue("$crew_name_1", "me"); ds.Storage.SetValue("$crew_name_2", "I"); ds.Storage.SetValue("$crew_name_3", "You"); ds.Storage.SetValue("$crew_description", Globals.GameVars.Jason.backgroundInfo); ds.Storage.SetValue("$crew_home", Globals.GameVars.GetSettlementFromID(Globals.GameVars.Jason.originCity).name); } else { IEnumerable <CrewMember> connected = Globals.GameVars.Network.CrewMembersWithNetwork(city); CrewMember crew = connected.RandomElement(); ds.Storage.SetValue("$crew_name_1", crew.name); ds.Storage.SetValue("$crew_name_2", crew.name); ds.Storage.SetValue("$crew_name_3", crew.name); ds.Storage.SetValue("$crew_description", crew.backgroundInfo); ds.Storage.SetValue("$crew_home", Globals.GameVars.GetSettlementFromID(crew.originCity).name); } } else { ds.Storage.SetValue("$jason_connected", false); ds.Storage.SetValue("$crew_name_1", "ERROR"); ds.Storage.SetValue("$crew_name_2", "ERROR"); ds.Storage.SetValue("$crew_name_3", "ERROR"); ds.Storage.SetValue("$crew_description", "ERROR"); ds.Storage.SetValue("$crew_home", "ERROR"); } }
public async Task <IActionResult> PutCrewMember(Guid id, CrewMember crewMember) { if (id != crewMember.Id) { return(BadRequest()); } _context.Entry(crewMember).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CrewMemberExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(string id, [Bind("Rank,Department,Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount")] CrewMember crewMember) { if (id != crewMember.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(crewMember); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CrewMemberExists(crewMember.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(crewMember)); }
public ExtinguishFireCommand(CrewMember crewMember, Room destination) { this.crewMember = crewMember; Destination = destination; Name = "Extinguish Fire"; StatusText = "Working..."; }
//This method is run first in the Procedural Engine initial setup public CrewMember ChooseCulprit() { // For the vertical slice of our game there can only be two possible Culprits (First Mate or Pilot). So we limit the choices to those // two here in this function. The values passed in here is the ID value that corresponds to each crew member in the JSON File crew.json // For culprit, the ID's are 3 and 5 JsonData culpritData = JsonMapper.ToObject(crewFinal.text); //int randomID = Random.Range (0, 6); int randomID = ChooseID(3, 5); CrewMember void_Culprit = new CrewMember(); // Assign the randomID to _culpritID to ensure that we have an ID to check against void_Culprit.ID = randomID; // Assign the Title property of void_Culprit by drilling into the JsonData Object and extracting the "Title" entry for our random crew member void_Culprit.Title = culpritData["Crew"][randomID]["Title"].ToString(); // This is the Culprit so we set it's bool of isCulprit to true void_Culprit.IsCulprit = true; // Clear the JsonData object culpritData.Clear(); // Remove the culprit from the _crewMembers List _crewMembers.Remove(void_Culprit.Title); // Return the CrewMember object that holds the culprit's data return(void_Culprit); }
public void ChooseVictim(Text textboxToPopulate) { JsonData data = JsonMapper.ToObject(JSONAsset.text); // Pick random number to see what id we will be using to grab that crews information from the JSON file int randomID = Random.Range(1, 7); // Pick a new random number until we get one that has not already been used to pick a new member. while (_idAlreadyChosen.Contains(randomID)) { randomID = Random.Range(1, 7); } // Add the randomID chosen to the _idAlreadyChosen List so that we can keep track of Crew Members we have already utilized _idAlreadyChosen.Add(randomID); CrewMember currentCrew = new CrewMember(); currentCrew.id = System.Int32.Parse(data ["crew"] [randomID - 1] ["id"].ToString()); currentCrew.title = data ["crew"] [randomID - 1] ["title"].ToString(); currentCrew.name = data ["crew"] [randomID - 1] ["name"].ToString(); currentCrew.description = data ["crew"] [randomID - 1] ["description"].ToString(); textboxToPopulate.text = "ID: " + currentCrew.id + "\n" + "Title: " + currentCrew.title + "\n" + "Name: " + currentCrew.name + "\n" + "Description: " + currentCrew.description; }
public FixHullBreachCommand(CrewMember crewMember, Room destination) { this.crewMember = crewMember; Destination = destination; Name = "Repair Hullbreach"; StatusText = "Working..."; }
// HELPER FUNCTIONS THAT MAY BE USEFUL FOR ALL SUBCLASSES protected static CrewMember RemoveRandomCrewMember(Ship ship) { //Find a random crewmember to kill if they can be killed CrewMember killedMate = new CrewMember(-1); List <int> listOfPossibleCrewToKill = new List <int>(); //generate a list of possible crew that can be killed for (int i = 0; i < ship.crewRoster.Count; i++) { if (ship.crewRoster[i].isKillable) { listOfPossibleCrewToKill.Add(i); } } //if we don't find any available crewmembers to kill, return an empty crewman as a flag that none exist to be killed if (listOfPossibleCrewToKill.Count != 0) { int randomMemberToKill = listOfPossibleCrewToKill[Random.Range(0, listOfPossibleCrewToKill.Count - 1)]; //Store the crewman in a temp variable killedMate = ship.crewRoster[randomMemberToKill]; //Remove the crewmember ship.crewRoster.Remove(killedMate); //return the removed crewmember return(killedMate); } //If there are no available members then just return a null flagged member initialize in the beggining of this function return(killedMate); }
//-Implementation private void Awake() { XUtils.check(ProgressIndicator); XUtils.check(WorkersAssignemntControl); WorkersAssignemntControl.onPressedAssignWorker += () => { CrewMember theCrewMemberToAssign = XUtils.verify(_carCity).getFirstFreeCrewMember(); if (null == theCrewMemberToAssign) { return; } collectConstructionSiteWorkers(ref __arrayRegister); if (__arrayRegister.getSize() >= _constructionSite.getMaxWorkersPossibleToAssign()) { return; } theCrewMemberToAssign.setConstruction(_constructionSite); }; WorkersAssignemntControl.onPressedWithdrawWorker += () => { collectConstructionSiteWorkers(ref __arrayRegister); if (0 == __arrayRegister.getSize()) { return; } __arrayRegister[0].setConstruction(null); }; }
public async Task <ActionResult <CrewMember> > PostCrewMember([FromBody] CrewMember crewMember) { _context.CrewMembers.Add(crewMember); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCrewMember", new { id = crewMember.Id }, crewMember)); }
/// <summary> /// Check if the drag stopped over a Position UI element. /// </summary> private void CheckPlacement() { foreach (var result in _raycastResults) { var positionUI = result.gameObject.GetComponent <PositionUI>(); if (positionUI != null) { var position = positionUI.Position; var crewMember = positionUI.CrewMemberUI; TrackerEventSender.SendEvent(new TraceEvent("CrewMemberPositioned", TrackerAsset.Verb.Interacted, new Dictionary <TrackerContextKey, object> { { TrackerContextKey.CrewMemberName, CrewMember.Name }, { TrackerContextKey.PositionName, position }, { TrackerContextKey.PreviousCrewMemberInPosition, crewMember != null ? crewMember.CrewMember.Name : "Null" }, { TrackerContextKey.PreviousCrewMemberPosition, _currentPlacement != null ? _currentPlacement.Position : Position.Null } }, GameObjectTracker.TrackedGameObject.Npc)); SUGARManager.GameData.Send("Place Crew Member", CrewMember.Name); SUGARManager.GameData.Send("Fill Position", position.ToString()); Place(positionUI); //reset the position and meeting UIs UIManagement.PositionDisplay.Display(); UIManagement.MemberMeeting.Display(); return; } } //remove this CrewMember from their position if they were in one CrewMember.Assign(Position.Null); OnReset(); //reset the position and meeting UIs UIManagement.PositionDisplay.Display(); UIManagement.MemberMeeting.Display(); }
public void UpdateEmployeeCrews(int id, List <int> crewIds) { var idsToRemove = new List <int>(); var employee = db.Employees.FirstOrDefault(p => p.Id == id); if (employee == null) { return; } foreach (var crewmember in employee.CrewMembers) { idsToRemove.Add(crewmember.Id); } foreach (var idToRemove in idsToRemove) { var crewmember = db.CrewMembers.First(i => i.Id == idToRemove); db.CrewMembers.Remove(crewmember); db.SaveChanges(); } foreach (var crewId in crewIds) { var crewMember = new CrewMember(); crewMember.EmployeeId = id; crewMember.CrewId = crewId; employee.CrewMembers.Add(crewMember); } db.SaveChanges(); }
public void AssignTo(ShipPosition pos) { if (!selected || !selected.isPlayerCrew || selected.currentAction == CrewMember.Action.ATTACKING || !zoneEvent.canChangeCrewPositions) { return; } //TODO: clean this shit up if (pos.isManned) { CrewMember memToSwap = null; for (int i = 0; i < ship.crewMembers.Count; i++) { if (ship.crewMembers[i].shipPos == pos) { memToSwap = ship.crewMembers[i]; break; } } ship.Unassign(memToSwap); ShipPosition temp = selected.shipPos; ship.Assign(selected, pos); ship.Assign(memToSwap, temp, true); } else { ship.Assign(selected, pos); } selected = null; DisplayStats(); }
public void HireCrewMember(PlayerShip player, SpaceStation fromStation, CrewMember crewMember) { Debug.Assert(fromStation.AvailableCrew.Contains(crewMember), "can't buy crew who aren't available to buy"); var ship = player.Ship; Debug.Assert(ship != null, "can't buy stuff without a ship"); //check ship has space var passengerCount = ship.GetPassengers().Count(); if (passengerCount == ship.CurrentStats.PassengerCapacity) { throw new InvalidOperationException("no room for more passengers"); } //check player has enough money var price = GetHirePrice(crewMember); if (player.Money < price) { throw new InvalidOperationException("player can't afford price of " +price); } player.AddMoney(-price); crewMember.Assign(ship, CrewAssignment.Passenger); fromStation.AvailableCrew.Remove(crewMember); }
public CrewMember ChooseVictim() { // For the vertical slice of our game there can only be two possible Victims (Engineer and Cook). So we limit the choices to those // two here in this function. The values passed in here is the ID value that corresponds to each crew member in the JSON File crew.json // The ID's are 1 and 2 JsonData victimData = JsonMapper.ToObject(crewFinal.text); // int randomID = Random.Range (0, 6); int randomID = ChooseID(1, 2); // We would need to include a check here if we were to open the game up to randomly choose a victim from the // entire crew list. The check would ensure that the same ID as _culpritID is not assigned CrewMember void_Victim = new CrewMember(); void_Victim.Title = victimData["Crew"][randomID]["Title"].ToString(); // Assign the chosen Victim's Title to _victimTitle. This will be used to find the appropriate Location in the json file. //void_Victim.title = _victimTitle; // Clear the JsonData Object victimData.Clear(); // Remove the Victim from the _crewMembers List _crewMembers.Remove(void_Victim.Title); // Return the CrewMember object that holds the victim's data return(void_Victim); }
protected new void Start() { base.Start(); int otherPeople = Random.Range(minNumOfPeople, maxNumOfPeople + 1); for (int i = 0; i < otherPeople; i++) { ShipPosition sp = otherShip.GetVacantPositionByPriority(); CrewMember c = CreateCrewMember(sp.tile); c.ship = otherShip; otherShip.Assign(c, sp, true); } int food = Random.Range(foodMin, foodMax + 1); int wood = Random.Range(woodMin, woodMax + 1); int gold = Random.Range(goldMin, goldMax + 1); otherShip.AddInventory(food, wood, gold); if (PlayerHasRangeAdvantage()) { message.text += "The ship has not yet seen us.\nWhat do we wish to do?"; shipSeesFirstOptions.SetActive(false); playerSeesFirstOptions.SetActive(true); } else { ShipDecision decision = GenerateShipDecision(false); switch (decision) { case ShipDecision.FLEE: otherParleyOptions.SetActive(false); message.text += "The ship is attempting to flee us.\nWe are "; if (!PlayerHasFasterShip()) { engageOptions.SetActive(false); message.text += "not "; } message.text += "faster than them."; break; case ShipDecision.PARLEY: message.text += "The ship wishes to parley with us."; break; case ShipDecision.ENGAGE: message.text += "The ship is engaging us."; continueMessageButton.SetActive(true); shipSeesFirstOptions.SetActive(false); break; } } battleManager.Init(playerShip.GetBoardingTile(), otherShip.GetBoardingTile()); }
public void FireCrewMember(PlayerShip player, SpaceStation atStation, CrewMember crewMember) { var ship = player.Ship; Debug.Assert(ship != null, "can't sell stuff without a ship"); Debug.Assert(crewMember == ship.GetCaptain() || ship.GetPassengers().Contains(crewMember), "can't fire someone who doesn't work for you"); atStation.AvailableCrew.Add(crewMember); crewMember.Unassign(); }
public CrewMember NewCharacter(CrewMember source) { var result = Instantiate(source); result.name = source.name; //get rid of (Clone) characters.Add(result); return result; }
public CharacterInfo(CrewMember fromCharacter, int transientId) { this.transientId = transientId; Name = fromCharacter.name; var portrait = fromCharacter.Portrait; if (portrait) { PortraitIndex = SpaceTraderConfig.CrewConfiguration.Portraits.IndexOf(portrait); } }
public void Awake() { cm = this; Engineer = new CrewMember(); Engineer.initialize("Toby", CrewMember.CrewRole.Engineer, CrewMember.BackgroundInfo.Duster); Pilot = new CrewMember(); Pilot.initialize("Jim", CrewMember.CrewRole.Pilot, CrewMember.BackgroundInfo.Gun); Gunner = new CrewMember(); Gunner.initialize("Tim", CrewMember.CrewRole.Gunner, CrewMember.BackgroundInfo.Traderunner); Scientist = new CrewMember(); Scientist.initialize("Larry", CrewMember.CrewRole.Scientist, CrewMember.BackgroundInfo.Duster); }
public void Show() { isOpen = true; infoPanel.ip.Hide(); PowerManagementPanel.pmp.Hide(); foreach (HPSelectButton hpb in HPbuttonGenerator.btg.HPbuttons) { hpb.Hide(); } Crew = CrewManager.cm.Captain; updateReadouts(); control.Opacity = 1; tween1.Play(); }
private void CrewField(CrewMember crewMember, CrewAssignment assignment) { var selected = EditorGUILayout.ObjectField(crewMember, typeof(CrewMember), true) as CrewMember; if (crewMember != selected) { if (crewMember) { crewMember.Unassign(); } if (selected) { selected.Assign(target as Ship, assignment); } } }
public void addCrew(CrewMember cm) { switch (cm.role) { case CrewMember.CrewRole.Captain: Captain = cm; break; case CrewMember.CrewRole.Engineer: Engineer = cm; break; case CrewMember.CrewRole.Pilot: Pilot = cm; break; case CrewMember.CrewRole.Gunner: Gunner = cm; break; case CrewMember.CrewRole.Scientist: Scientist = cm; break; } }
/** * @param UnwantedCrewMember * @return */ public void RemoveCrewMember(CrewMember UnwantedCrewMember) { // TODO implement here return null; }
public CrewMemberScreen(ScreenComponent manager, CrewMember member) : base(manager) { VerticalAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; SpriteFont boldFont = manager.Content.Load<SpriteFont>("BoldFont"); Padding = new Border(0, 0, 0, 0); SetDefaultBackground(); //The Panel Texture2D panelBackground = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/panel.png", manager.GraphicsDevice); Panel panel = new Panel(manager) { MaxWidth = 750, Background = NineTileBrush.FromSingleTexture(panelBackground, 30, 30), Padding = new Border(15, 15, 15, 15), }; Controls.Add(panel); //The Vertical Stack - Split the Panel in half Vertical StackPanel verticalStack = new StackPanel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, }; // panel.Controls.Add(verticalStack); //The Main Stack - Split the Panel in half Horizontal StackPanel horizontalStack = new StackPanel(manager) { HorizontalAlignment = HorizontalAlignment.Center, Orientation = Orientation.Horizontal }; panel.Controls.Add(horizontalStack); //The Profile Image Image profileImage = new Image(manager) { Height = 200, Width = 200, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Padding = new Border(0, 0, 10, 0) }; if (member.PictureFilename == null) profileImage.Texture = manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/Crew/base.png", manager.GraphicsDevice); else profileImage.Texture = manager.Content.LoadTexture2DFromFile(member.PictureFilename, manager.GraphicsDevice); horizontalStack.Controls.Add(profileImage); //The Text Stack StackPanel textStack = new StackPanel(manager); textStack.VerticalAlignment = VerticalAlignment.Stretch; textStack.HorizontalAlignment = HorizontalAlignment.Left; textStack.Width = 430; horizontalStack.Controls.Add(textStack); //The Username Label username = new Label(manager) { Text = member.Username, Font = manager.Content.Load<SpriteFont>("HeadlineFont"), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; textStack.Controls.Add(username); //The Alias Label alias = new Label(manager) { Text = member.Alias, HorizontalAlignment = HorizontalAlignment.Left }; textStack.Controls.Add(alias); //Achievements string achievementString = ""; foreach (CrewMember.Achievements achievement in member.AchievementList) { achievementString += " " + achievement.ToString(); if (member.AchievementList.IndexOf(achievement) != member.AchievementList.Count - 1) achievementString += ", "; } StackPanel achievementStack = new StackPanel(manager); achievementStack.VerticalAlignment = VerticalAlignment.Top; achievementStack.HorizontalAlignment = HorizontalAlignment.Left; achievementStack.Orientation = Orientation.Horizontal; textStack.Controls.Add(achievementStack); Label achievementsTitle = new Label(manager) { Text = Languages.OctoClient.Achievements + ": ", Font = boldFont, HorizontalAlignment = HorizontalAlignment.Left }; Label achievements = new Label(manager) { Text = achievementString, HorizontalAlignment = HorizontalAlignment.Left }; achievementStack.Controls.Add(achievementsTitle); achievementStack.Controls.Add(achievements); Panel DescriptionPanel = new Panel(manager) { VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, }; textStack.Controls.Add(DescriptionPanel); Label Description = new Label(manager) { Text = member.Description, WordWrap = true, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Left, HorizontalTextAlignment = HorizontalAlignment.Left, VerticalTextAlignment = VerticalAlignment.Top, }; Description.InvalidateDimensions(); DescriptionPanel.Controls.Add(Description); panel.Width = 700; }
private void removeCrew(CrewMember targetCrew) { if (targetCrew.part.protoModuleCrew.Count > 0) { targetCrew.part.RemoveCrewmember(targetCrew.part.protoModuleCrew[targetCrew.index]); //targetCrew.part.protoModuleCrew[targetCrew.index].rosterStatus = ProtoCrewMember.RosterStatus.AVAILABLE; //targetCrew.part.protoModuleCrew[targetCrew.index].seat.DespawnCrew(); } /*member.seat.DespawnCrew(); p.RemoveCrewmember(member);*/ }
void CreateCrew() { for (int i = 0; i < crew; i++) { //Debug.Log(i); int numbera = 0; int agea = 99; string gendera = "female"; string firstNamea = "Jane"; string lastNamea = "Doe"; string ranka = "Captain"; string possessivea = "her"; string pronouna = "she"; string diroa = "her"; numbera = i; //age agea = Random.Range(22, 51);// change for rank appropriateness //Pick Gender int g = Random.Range (1,3); if(g == 1){ gendera = "female"; possessivea = "her"; pronouna = "she"; diroa = "her"; } if (g == 2){ gendera = "male"; possessivea = "his"; pronouna = "he"; diroa = "him"; } //Pick name if (gendera == "female"){ firstNamea = LadyNames[Random.Range(0, LadyNames.Length)]; } if (gendera == "male"){ firstNamea = DudeNames[Random.Range(0, DudeNames.Length)]; } lastNamea = LastNames[Random.Range(0, LastNames.Length)]; //Pick rank if(i==0)//captain {agea = Random.Range(35, 50); ranka = "Captain";} if(i==1)//Commander {ranka = "Commander";} if(i>1 && i<=4) {ranka = "Lieutenant Commander";} if(i>4 && i<=20) {ranka = "Lieutenant";} if(i>20 && i<=35) {ranka = "Sub-Lieutenant";} if(i>35) {ranka = "Ensign";} //Class Crewmember CrewMember thing = new CrewMember(); thing.age = agea; thing.rank = ranka; thing.firstName = firstNamea; thing.lastName = lastNamea; thing.number = numbera; thing.diro = diroa; thing.gender = gendera; thing.pronoun = pronouna; thing.possessive = possessivea; //Debug.Log("thing = "+thing.age); crewmembers.Add(thing); //Debug.Log (thing.firstName +" "+thing.possessive); } }
public void setCrewMember(CrewMember cm) { Crew = cm; updateReadouts(); }
public int GetHirePrice(CrewMember crewMember) { return baseHirePrice * crewMember.Level; }
public void changeCrew(CrewMember crew, SpecialCrewMember member) { switch (crew) { case CrewMember.EXECUTIVE: executiveOfficer = (ExecutiveOfficer)member; executiveOfficer.isNull = false; executiveOfficer.active = true; executiveOfficer.addBonus(); break; case CrewMember.COMMS: commOfficer.removeBonus(); commOfficer.active = false; commOfficer = transform.GetComponent<NULL_Comm>(); commOfficer = (CommOfficer)member; commOfficer.isNull = false; commOfficer.active = true; commOfficer.addBonus(); break; case CrewMember.ENGINEER: engineerOfficer = (EngineerOfficer)member; engineerOfficer.isNull = false; engineerOfficer.active = true; engineerOfficer.addBonus(); break; case CrewMember.GUNNERY: gunneryOfficer = (GunneryOfficer)member; gunneryOfficer.isNull = false; gunneryOfficer.active = true; gunneryOfficer.addBonus(); break; case CrewMember.MARINE: marineOfficer = (MarineOfficer)member; marineOfficer.isNull = false; marineOfficer.active = true; marineOfficer.addBonus(); break; case CrewMember.NAVIGATION: navigationOfficer = (NavigationOfficer)member; navigationOfficer.isNull = false; navigationOfficer.active = true; navigationOfficer.addBonus(); break; case CrewMember.MEDICAL: medicalOfficer = (MedicalOfficer)member; medicalOfficer.isNull = false; medicalOfficer.active = true; medicalOfficer.addBonus(); break; case CrewMember.GEN1: genericCrew1 = (SpecialCrewMember)member; genericCrew1.isNull = false; genericCrew1.active = true; genericCrew1.addBonus(); break; case CrewMember.GEN2: genericCrew2 = (SpecialCrewMember)member; genericCrew2.isNull = false; genericCrew2.active = true; genericCrew2.addBonus(); break; case CrewMember.GEN3: genericCrew3 = (SpecialCrewMember)member; genericCrew3.isNull = false; genericCrew3.active = true; genericCrew3.addBonus(); break; } }
/** * @param NewCrewMember * @return */ public void AddCrewMember(CrewMember NewCrewMember) { // TODO implement here return null; }
public void DestroyCharacter(CrewMember character) { Debug.Assert(characters.Contains(character), "character should be registered in global characters list"); characters.Remove(character); }
private void addCrew(Part part, CrewMember crew) //from kerbal crew manifest by vXSovereignXv { ProtoCrewMember kerbal = new ProtoCrewMember(); kerbal.name = crew.Name; kerbal.isBadass = crew.isBadass; kerbal.stupidity = crew.Stupidity; kerbal.courage = crew.Courage; kerbal.rosterStatus = ProtoCrewMember.RosterStatus.ASSIGNED; //kerbal.seat = null; //kerbal.seatIdx = -1; part.AddCrewmember(kerbal); if (kerbal.seat != null) kerbal.seat.SpawnCrew(); }