Ejemplo n.º 1
0
        public static void SendStrategicPartnershipRequest(GameEntity requester, GameEntity acceptor, GameContext gameContext, bool notifyPlayer)
        {
            // don't render buttons
            if (!IsCanBePartnersTheoretically(requester, acceptor) || IsHaveStrategicPartnershipAlready(requester, acceptor))
            {
                return;
            }

            if (IsHasTooManyPartnerships(requester) && notifyPlayer)
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageTooManyPartners(requester.company.Id));
                return;
            }

            if (IsHasTooManyPartnerships(acceptor) && notifyPlayer)
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageTooManyPartners(acceptor.company.Id));
                return;
            }



            bool wantsToAccept = GetPartnershipOpinionAboutUs(requester, acceptor, gameContext) > 0;

            if (wantsToAccept)
            {
                AcceptStrategicPartnership(requester, acceptor);
            }

            if (notifyPlayer)
            {
                NotifyAboutPartnershipResponse(requester, acceptor, wantsToAccept, gameContext);
            }
        }
        public static void NotifyAboutInterest(GameContext gameContext, int companyId, int buyerInvestorId)
        {
            var company = Get(gameContext, companyId);

            if (IsInPlayerSphereOfInterest(company, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageInterestToCompany(companyId, buyerInvestorId));
            }
        }
Ejemplo n.º 3
0
        public static void NotifyAboutAcquisition(GameContext gameContext, GameEntity buyer, GameEntity target, long bid)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(target.company.Id, buyer.shareholder.Id, bid));

            if (IsInPlayerSphereOfInterest(target, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(target.company.Id, buyer.shareholder.Id, bid));
            }


            Debug.LogFormat("ACQUISITION: {0} bought {1} for {2}!",
                            GetInvestorName(buyer),
                            target.company.Name,
                            Format.Money(bid));
        }
Ejemplo n.º 4
0
        public static void NotifyAboutCorporateAcquisition(GameContext gameContext, GameEntity corporation, int targetCompanyId)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(targetCompanyId, corporation.shareholder.Id, 0));

            var company = Get(gameContext, targetCompanyId);

            if (IsInPlayerSphereOfInterest(company, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(targetCompanyId, corporation.shareholder.Id, 0));
            }


            Debug.LogFormat("CORPORATE ACQUISITION: {0} integrated {1}!",
                            GetInvestorName(corporation),
                            company.company.Name);
        }
        public static void NotifyAboutAcquisition(GameContext gameContext, int buyerShareholderId, int targetCompanyId, long bid)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(targetCompanyId, buyerShareholderId, bid));

            var company = Get(gameContext, targetCompanyId);

            if (IsInPlayerSphereOfInterest(company, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(targetCompanyId, buyerShareholderId, bid));
            }


            Debug.LogFormat("ACQUISITION: {0} bought {1} for {2}!",
                            GetInvestorName(gameContext, buyerShareholderId),
                            Get(gameContext, targetCompanyId).company.Name,
                            Format.Money(bid));
        }
Ejemplo n.º 6
0
        public static void TweakCorporatePolicy(GameContext gameContext, GameEntity company, CorporatePolicy policy, int value)
        {
            if (Cooldowns.HasCorporateCultureUpgradeCooldown(gameContext, company))
            {
                return;
            }

            Cooldowns.AddCorporateCultureUpgradeCooldown(gameContext, company, Balance.CORPORATE_CULTURE_CHANGES_DURATION);
            var culture = GetOwnCorporateCulture(company);

            var prevValue = culture[policy];

            culture[policy] = Mathf.Clamp(value, Balance.CORPORATE_CULTURE_LEVEL_MIN, Balance.CORPORATE_CULTURE_LEVEL_MAX);

            if (value != prevValue)
            {
                // culture changed
                NotificationUtils.AddPopup(gameContext, new PopupMessageCultureChange(company.company.Id));
            }

            company.ReplaceCorporateCulture(culture);
        }
Ejemplo n.º 7
0
 public static void NotifyAboutPartnershipResponse(GameEntity requester, GameEntity acceptor, bool willAccept, GameContext gameContext)
 {
     NotificationUtils.AddPopup(gameContext, new PopupMessageStrategicPartnership(requester.company.Id, acceptor.company.Id, willAccept));
 }