public static InvestmentFormViewModel MapToInvestmentFormViewModel(this Investments model) { return(new InvestmentFormViewModel() { Id = model.Id, DFIndicatorId = model.DFIndicatorId, DFSourceId = model.DFSourceId, DFYearId = model.DFYearId, DFUnitId = model.DFUnitId, DFQuarterId = model.DFQuarterId, IsDeleted = model.isDeleted, Agriculture = model.Agriculture, AccommodationAndFoodServiceActivities = model.AccommodationAndFoodServiceActivities, Construction = model.Construction, Education = model.Education, Electricity = model.Electricity, FinancialIntermediaryInsuranceAndSocialSecurity = model.FinancialIntermediaryInsuranceAndSocialSecurity, Health = model.Health, InformationAndCommunication = model.InformationAndCommunication, NaturalGas = model.NaturalGas, OtherExtractions = model.OtherExtractions, OtherManufacturing = model.OtherManufacturing, OtherSrvices = model.OtherSrvices, Petroleum = model.Petroleum, PetroleumRefining = model.PetroleumRefining, RealEstateActivities = model.RealEstateActivities, StorageAndTransportation = model.StorageAndTransportation, SuezCanal = model.SuezCanal, TotalInvestments = model.TotalInvestments, WaterAndSewerage = model.WaterAndSewerage, WholesaleAndRetailTrade = model.WholesaleAndRetailTrade, Investmentid = model.Id }); }
public override void Execute() { var proposalScreen = FindObjectOfType <InestmentProposalScreen>(); if (proposalScreen.urgency < 2) { SoundManager.PlayFastCashSound(); } else { SoundManager.PlayFastCashSound(); SoundManager.Play(Sound.FillPaper); } // sets urgency proposalScreen.UpdateStartDates(); Companies.AcceptAllInvestmentProposals(MyCompany, Q); MyCompany.RemoveAcceptsInvestments(); // set goal Investments.AddCompanyGoal(MyCompany, Q, proposalScreen.Goal); proposalScreen.ResetOffer(); }
public void CompleteGoal() { bool willComplete = Investments.CompleteGoal(MyCompany, Q, InvestmentGoal); if (InvestmentGoal.InvestorGoalType == InvestorGoalType.BuyBack) { if (willComplete) { CloseModal("Missions"); NotificationUtils.AddSimplePopup(Q, Visuals.Positive("CONGRATULATIONS! YOU WON!"), Visuals.Positive("Hope you've enjoyed the game:)".ToUpper())); // SPECIAL SOUND AT THE GAME END? SoundManager.Play(Sound.GoalCompleted); } } else { if (willComplete) { //SoundManager.Play(Sound.Action); SoundManager.Play(Sound.GoalCompleted); FindObjectOfType <MissionRelay>().ShowActiveMissions(); } } FindObjectOfType <GoalsListView>().ViewRender(); Refresh(); }
private GameEntity[] GetInvestments() { if (SelectedHuman.hasShareholder) return Investments.GetInvestmentsOf(Q, SelectedHuman.shareholder.Id); return new GameEntity[0]; }
public void PopulateInvestments() { Investments.Clear(); var inv = investRepo.GetInvestmentsForId(CurrentUser.Id).ToList(); inv.ForEach(x => Investments.Add(new InvestmentViewModel(x))); }
void CompleteGoals(GameEntity product) { var time = DateTime.Now; Investments.CompleteGoals(product, gameContext); Measure("Complete goals ", product, time); }
//set all the variables required for a new game public Game() { //language = 0; rnd = new System.Random(); events = new List <GameEvent>(); regions = new List <MapRegion>(); actions = new List <RegionAction>(); quests = new List <Quest>(); monthlyReport = new ProgressReport(); yearlyReport = new ProgressReport(); oldMonthlyReport = new ProgressReport(); oldYearlyReport = new ProgressReport(); economyAdvisor = new EconomyAdvisor(); pollutionAdvisor = new PollutionAdvisor(); happinessAnalyst = new HappinessAnalyst(); investments = new Investments(); cards = new List <Card>(); inventory = new Inventory(); timeline = new Timeline(); //not used tutorial = new Tutorial(); completedEventsCount = 0; abandonedEventsCount = 0; completedActionsCount = 0; completedQuestsCount = 0; receivedCardsCount = 0; gameStatistics = new GameStatistics(10000, 17000000, new Energy()); currentYear = 1; currentMonth = 1; totalTimePlayed = 0; }
void DecreaseCompanyPrice(GameEntity offer, int targetId, int shareholderId) { var o = offer.acquisitionOffer; var cost = Economy.GetCompanyCost(gameContext, targetId); var Kmin = Companies.GetRandomAcquisitionPriceModifier(targetId, shareholderId); var Kbuyer = o.BuyerOffer.Price * 1f / cost; var Kseller = 2 * Kmin - Kbuyer; var KsellerRandomised = Kseller * Random.Range(0.85f, 1.15f); var newPrice = Mathf.Max(KsellerRandomised, Kmin, Kbuyer) * cost; var sellerConditions = new AcquisitionConditions { Price = (long)newPrice, ByCash = (long)newPrice, ByShares = 0, KeepLeaderAsCEO = o.SellerOffer.KeepLeaderAsCEO }; offer.ReplaceAcquisitionOffer(targetId, shareholderId, AcquisitionTurn.Buyer, o.BuyerOffer, sellerConditions); var investor = Investments.GetInvestorById(gameContext, shareholderId); if (investor.isControlledByPlayer) { NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfferResponse(targetId, shareholderId)); } }
void SpawnInvestors(int amountOfInvestors, int investmentMin, int investmentMax) { for (var i = 0; i < amountOfInvestors; i++) { Investments.GenerateAngel(Q); } }
public static int Perform(Sim sim) { using (ManagerMoney.SetAccountingKey setKey = new ManagerMoney.SetAccountingKey(sim.Household, "Investments")) { return(Investments.Collect(sim)); } }
AcquisitionConditions GetNewCounterOffer(GameEntity offer, int targetId, int shareholderId, long maxOfferedPrice) { var cost = Economy.GetCompanyCost(gameContext, targetId); var modifier = Companies.GetRandomAcquisitionPriceModifier(targetId, shareholderId); var maxPrice = (long)(cost * modifier); // the max amount, that we want to pay theoretically var newPrice = (long)(maxOfferedPrice * Random.Range(1.05f, 5f)); if (newPrice > maxPrice) { newPrice = maxPrice; } var investor = Investments.GetInvestorById(gameContext, shareholderId); var balance = investor.companyResource.Resources.money; if (newPrice > balance) { newPrice = balance; } return(new AcquisitionConditions { ByCash = newPrice, Price = newPrice, ByShares = offer.acquisitionOffer.BuyerOffer.ByShares, KeepLeaderAsCEO = offer.acquisitionOffer.BuyerOffer.KeepLeaderAsCEO, }); }
void SendNewSellerOffer(GameEntity offer, GameEntity target, int shareholderId) { var o = offer.acquisitionOffer; var newPrice = GetNewPrice(target, shareholderId, o.BuyerOffer); var sellerConditions = new AcquisitionConditions { Price = newPrice, ByCash = newPrice, ByShares = 0, KeepLeaderAsCEO = o.SellerOffer.KeepLeaderAsCEO }; offer.acquisitionOffer.Turn = AcquisitionTurn.Buyer; offer.acquisitionOffer.SellerOffer = sellerConditions; //offer.ReplaceAcquisitionOffer(target.company.Id, shareholderId, AcquisitionTurn.Buyer, o.BuyerOffer, sellerConditions); var investor = Investments.GetInvestor(gameContext, shareholderId); if (investor.isControlledByPlayer) { NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfferResponse(target.company.Id, shareholderId)); } }
public void Setup() { _stocks = new List <Stock> { new Stock { Id = "1", Name = "AAPL", NameReadable = "Apple", CostBasis = 0.25m, Price = 4.00m, Shares = 10, AcquiredDate = new DateTime(2001, 10, 16), }, new Stock { Id = "2", Name = "Google", NameReadable = "GOOGL", CostBasis = 849.08m, Price = 2225.29m, Shares = 6, AcquiredDate = new DateTime(2001, 10, 16), }, new Stock { Id = "1", Name = "AAPL", NameReadable = "Apple", CostBasis = 0.25m, Price = 4.00m, Shares = 10, AcquiredDate = new DateTime(2001, 10, 16), } }; _investmentController = new Investments(true, _stocks); }
public Payment Pay(DateTime payDate, double paymentAmount) { var payment = Loan.Pay(payDate, paymentAmount); Investments.ForEach(e => e.Pay(payment, Loan.StartAmount)); return(payment); }
public InvestmentDTO SaveInvestment([FromBody] InvestmentDTO inv) { Investments investment; if (inv.Id != 0) { investment = context.Investments.FirstOrDefault(c => c.Id == inv.Id); } else { investment = new Investments(); context.Investments.Add(investment); } if (investment == null) { return(null); } investment.Name = inv.Name; investment.NameUa = inv.NameUa; investment.Description = inv.Description; investment.DescriptionUa = inv.DescriptionUa; investment.Done = inv.Done; investment.Logo = inv.Logo; investment.Link = inv.Link; context.SaveChanges(); inv.Id = investment.Id; return(inv); }
public override void ViewRender() { base.ViewRender(); var goals = Investments.GetNewGoals(MyCompany, Q); SetItems(goals); }
public override string GetBenefits() { if (Goal == null) { return(""); } return(Investments.GetFormattedRequirements(Goal, MyCompany, Q)); }
bool InvestorIsNotRelatedToPlayer(InvestmentProposal proposal) { var investor = Investments.GetInvestorById(gameContext, proposal.ShareholderId); var isRelatedToPlayer = investor.hasCompany && Companies.IsRelatedToPlayer(gameContext, investor); return(!isRelatedToPlayer); }
public void InitializeTest() { investments = new Investments(); coin = new Coin(1, 1.2, new DateTime(2018, 2, 21)); gold = new Gold(200, 300, new DateTime(2018, 2, 21)); antique = new Antique(100, 300, new DateTime(2018, 2, 21)); }
private GameEntity[] GetInvestments() { if (SelectedHuman.hasShareholder) { return(Investments.GetInvestmentsOf(Q, SelectedHuman.shareholder.Id)); } return(new GameEntity[0]); }
public void SetEntity(GameEntity offer) { var investorId = offer.acquisitionOffer.BuyerId; var buyerCompanyId = Investments.GetCompanyByInvestorId(Q, investorId).company.Id; GetComponent <LinkToProjectView>().CompanyId = buyerCompanyId; Offer.text = Format.Money(offer.acquisitionOffer.BuyerOffer.Price); CompanyName.text = Companies.Get(Q, buyerCompanyId).company.Name; }
public void PickGoal() { Investments.AddCompanyGoal(MyCompany, Q, InvestmentGoal); SoundManager.Play(Sound.GoalPicked); FindObjectOfType <PickGoalsListView>().ViewRender(); FindObjectOfType <MissionRelay>().RenderButtons(true); Refresh(); }
public override void ViewRender() { base.ViewRender(); RenderCompanyType(); RenderCompanyEconomy(); CompanyGoal.text = Investments.GetFormattedInvestorGoal(SelectedCompany.companyGoal.InvestorGoal); }
void Render() { var investor = Companies.GetInvestorById(Q, shareholderId); var percentage = Companies.GetShareSize(Q, SelectedCompany.company.Id, shareholderId); Name.text = $"{investor.shareholder.Name}"; Share.text = percentage + "%"; Status.text = Investments.GetFormattedInvestorType(investor.shareholder.InvestorType); }
void Render() { RenderValuation(); RenderOffer(); RenderProposalStatus(); SetButtons(); InvestorName.text = $"Proposal from {SelectedInvestor.shareholder.Name}, {Investments.GetFormattedInvestorType(SelectedInvestor.shareholder.InvestorType)}"; }
private GameEntity[] GetInvestments() { var human = SelectedHuman; if (human.hasShareholder) { return(Investments.GetOwnings(human, Q)); } return(new GameEntity[0]); }
public override void ViewRender() { base.ViewRender(); Draw(PickButton, true); Draw(Requirements, true); Title.text = InvestmentGoal.GetFormattedName(); Requirements.text = Investments.GetFormattedRequirements(InvestmentGoal, MyCompany, Q); Number.text = $"#{index + 1}"; }
void WorkOnGoal(GameEntity product, InvestmentGoal goal) { var actions = Investments.GetProductActions(product, goal); foreach (var action in actions) { ManageProduct(action, product); } //Investments.CompleteGoal(product, gameContext, goal); }
public InvestmentDTO(Investments investment) { Id = investment.Id; Name = investment.Name; NameUa = investment.NameUa; Description = investment.Description; DescriptionUa = investment.DescriptionUa; Done = investment.Done; Logo = investment.Logo; Link = investment.Link; }
public static List <ArrayList> GetOwnersEquityData() { CalculateFinalCapital(); //if +ve add to investents else add to drawings foreach (Account a in Capital.Accounts) { if (a.Sum > 0) { Investments.Add(a); } else { Drawings.Add(a); } } //List to fill Owners Equity Data Grid List <ArrayList> OEEntries = new List <ArrayList>(); ArrayList EntryArray = new ArrayList(); EntryArray.Add("Investments"); EntryArray.Add(null); OEEntries.Add(EntryArray); foreach (Account account in Investments) { OEEntries.Add(account.ToArray()); } EntryArray = new ArrayList(); EntryArray.Add("Income"); EntryArray.Add(IncomeStatement.Income); OEEntries.Add(EntryArray); EntryArray = new ArrayList(); EntryArray.Add("Drawings"); EntryArray.Add(null); OEEntries.Add(EntryArray); foreach (Account account in Drawings) { OEEntries.Add(account.ToArray(2)); } EntryArray = new ArrayList(); EntryArray.Add("Final Capital"); EntryArray.Add(FinalCapital); OEEntries.Add(EntryArray); return(OEEntries); }