Exemplo n.º 1
0
        private static void PromoteSoftware(SoftwareWorkItem item)
        {
            AutoDevWorkItem autoDev = GetAutoDevWorkItem(item);

            AutoDevWorkItem.AutoDevItem autoDevItem = null;
            if (autoDev != null)
            {
                autoDevItem = autoDev.Items.FirstOrDefault(adi => adi.Alpha == item);
            }

            if (autoDev == null || autoDevItem == null)
            {
                Console.LogError("Could not find auto dev task for current work item");
                return;
            }

            if (item is SoftwareAlpha)
            {
                SoftwareAlpha alpha = item as SoftwareAlpha;
                if (alpha.InBeta)
                {
                    autoDevItem.AlreadyDev = autoDevItem.MonthsToSpend;
                }

                if (!alpha.InDelay)
                {
                    item.PromoteAction();
                    Console.Log("Manually moving out of alpha");
                    //if (!alpha.InDelay)
                    {
                        Console.Log("PrintingCopies target = " + autoDev.PrintingCopies);
                        if (autoDev.PrintingCopies > 0U && !autoDevItem.hasPrinted)
                        {
                            uint num = autoDev.PrintingCopies;
                            if (autoDev.PrintingCopyRel)
                            {
                                num = (uint)(item.Followers *
                                             (autoDev.PrintingCopies / 100.0));
                            }
                            Console.Log("PrintingCopies num = " + num);
                            autoDevItem.hasPrinted = true;
                            PrintJob printJob = new PrintJob(alpha.ForceID(), 1f)
                            {
                                Limit = num
                            };
                            GameSettings.Instance.PrintOrders[printJob.ID] = printJob;
                            HUD.Instance.distributionWindow.RefreshOrders();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void HandleMarketing(SoftwareWorkItem item)
        {
            AutoDevWorkItem autoDev = GetAutoDevWorkItem(item);

            AutoDevWorkItem.AutoDevItem autoDevItem = null;
            if (autoDev != null)
            {
                autoDevItem = autoDev.Items.FirstOrDefault(adi => adi.Alpha == item);
            }

            if (autoDev == null || autoDevItem == null)
            {
                Console.LogError("Could not find auto dev task for current work item");
                return;
            }

            bool doneSomething = false;

            /// Do press release
            if (!autoDevItem.InHouse && (!autoDevItem.PressRelease && autoDev.MarketingTeams.Count > 0))
            {
                MarketingWindow marketingWindow = HUD.Instance.marketingWindow;
                float           cost            = marketingWindow.PressOptionCost.Sum();
                float           potential       =
                    marketingWindow.PressOptionEffect.Sum();
                autoDevItem.PressRelease = true;
                MarketingPlan marketingPlan = new MarketingPlan(autoDevItem.Alpha,
                                                                MarketingPlan.TaskType.PressRelease, cost,
                                                                potential,
                                                                !(autoDevItem.Alpha.guiItem ==
                                                                  null)
                                                                    ? autoDevItem.Alpha.guiItem.transform
                                                                .GetSiblingIndex() + 1
                                                                    : -1);
                marketingPlan.AutoDev = true;
                marketingPlan.Hidden  = false;
                autoDev.AssignTeams(marketingPlan, autoDev.MarketingTeams);
                GameSettings.Instance.MyCompany.WorkItems.Add(marketingPlan);

                doneSomething = true;
            }

            /// Do Press builds
            if (!autoDevItem.InHouse && autoDev.MarketingTeams.Count > 0)
            {
                SoftwareAlpha alpha = item as SoftwareAlpha;
                GameSettings.Instance.PressBuildQueue.Add(autoDevItem.Alpha);
                HUD.Instance.AddPopupMessage("PressBuildConfirmation".LocColor((object)item), "Info",
                                             PopupManager.PopUpAction.None, 0U, PopupManager.NotificationSound.Neutral,
                                             0.0f, PopupManager.PopupIDs.None, 6);
                autoDevItem.PressBuild = true;

                doneSomething = true;
            }

            if (!doneSomething)
            {
                HUD.Instance.AddPopupMessage("Can't market product at this time.", "Exclamation",
                                             PopupManager.PopUpAction.None, 0, PopupManager.NotificationSound.Warning,
                                             0f);
            }
        }