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(); } } } } }
/// <summary> /// Auto promotes the on going contracts /// </summary> /// <param name="workItems"></param> private void AutoPromote(IEnumerable <WorkItem> workItems) { try { var designDocuments = workItems.OfType <DesignDocument>() .Where(designDocument => designDocument.Iteration >= 1 && !designDocument.Done && designDocument.contract != null).ToList(); foreach (var designDocument in designDocuments) { designDocument.PromoteAction(); } } catch (Exception e) { Console.LogError($"Error while running AutoPromote Exception: {e}"); disabled = true; } }
/// <summary> /// It handles the beta and developing cycle of the contract /// </summary> /// <param name="workItems"></param> private void AutoBeta(IEnumerable <WorkItem> workItems) { try { var alphaPhase = workItems.OfType <SoftwareAlpha>().Where(alpha => alpha.contract != null).ToList(); foreach (var alpha in alphaPhase) { if (alpha.InBeta) { //If it is Art related contract there is no bugs if (alpha.Bugs < 0.1f) { alpha.PromoteAction(); } else { if (alpha.FixedBugs >= Math.Min(5, alpha.Bugs / 2f)) { alpha.PromoteAction(); } } } else { if (alpha.GetProgress() >= Math.Min(100f, alpha.contract.MinProg * 1.2f)) { alpha.PromoteAction(); } } } } catch (Exception e) { Console.LogError($"Error while running AutoBeta Exception: {e}"); disabled = true; } }
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); } }