bool TryHireWorker(GameEntity product, WorkerRole role) { // can manage var maintenanceCost = 1.3f; var index = product.team.Teams.FindIndex(t => { var cost = Teams.GetDirectManagementCostOfTeam(t, product, gameContext).Sum(); if (cost == 0 && t.Managers.Count == 0) { return(true); } return(cost > maintenanceCost); }); // cannot manage if (index == -1) { Teams.AddTeam(product, gameContext, TeamType.CrossfunctionalTeam, 0); // TODO need to hire leader here, but it's Ok still index = product.team.Teams.Count - 1; } return(HireWorker(product, role, index)); }
private void CreateTeamButton_Click(object sender, EventArgs e) { Teams.AddTeam(NameBox.Text, SelectedPeople, out string errorMessage); if (!string.IsNullOrEmpty(errorMessage)) { MessageBox.Show(errorMessage); } this.Close(); }
public override void Execute() { Teams.AddTeam(Flagship, Q, TeamType.CrossfunctionalTeam, 0); var newTeamID = Flagship.team.Teams.Count - 1; //UpdateData(C.MENU_SELECTED_TEAM, newTeamID); ScreenUtils.SetSelectedTeam(Q, newTeamID); OpenUrl("/TeamCreationScreen"); }
public override void Execute() { if (Teams.IsCanAddMoreTeams(Flagship, Q)) { Teams.AddTeam(Flagship, Q, TeamType, 0); var newTeamID = Flagship.team.Teams.Count - 1; //UpdateData(C.MENU_SELECTED_TEAM, newTeamID); ScreenUtils.SetSelectedTeam(Q, newTeamID); OpenUrl("/TeamCreationScreen"); CloseModal(); } else { //Navigate(ScreenMode.GroupScreen); //NotificationUtils.AddSimplePopup(Q, Visuals.Negative("You've reached max limit of teams"), $"Change your {Visuals.Positive("corporate culture".ToUpper())} to add more teams"); NotificationUtils.AddSimplePopup(Q, Visuals.Negative("Not enough manager points"), $"Try this later or change your {Visuals.Positive("corporate culture".ToUpper())} to add more teams"); CloseModal(); } }