private void Update()
        {
            PopupQueue.TryShowNextPopup();
            if (numEnabledCheatMods() > 0 && Bridge.IsSimulating() && !BridgeCheat.m_Cheated)
            {
                GameStateSim.m_BudgetUsed = Mathf.RoundToInt(Budget.CalculateBridgeCost());
                BridgeCheat.m_Cheated     = BridgeCheat.CheckForCheating((float)GameStateSim.m_BudgetUsed);
            }
            if (!flag && globalToggleHotkey.Value.IsDown())
            {
                flag = true;
                if (this.isEnabled)
                {
                    this.isEnabled = modEnabled.Value = false;
                    this.disableMod();
                }
                else
                {
                    this.isEnabled = modEnabled.Value = true;
                    this.enableMod();
                }
                if (modsToggledSummary.Length > 0)
                {
                    PopUpWarning.Display(modsToggledSummary);
                }
                //Logger.LogMessage(modsToggledSummary);
            }
            else if (flag & globalToggleHotkey.Value.IsUp())
            {
                flag = false;
            }

            if (autoDraw == null)
            {
                var autoDraw = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/GridStress/ButtonsHorizontalLayout/ButtonContainer_AutoDraw");
                if (autoDraw == null)
                {
                    return;
                }
                autoDraw.SetActive(true);
                sandbox          = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox");
                sandboxSettings  = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_SandboxSettings");
                sandboxCreate    = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Create");
                sandboxVehicles  = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Vehicles");
                sandboxWorkshop  = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Workshop");
                sandboxResources = GameObject.Find("GameUI/Panel_TopBar/HorizontalLayout/CenterInfo/Sandbox/ButtonsHorizontalLayout/Button_Resources");
            }

            sandboxCreate.SetActive(GameStateManager.GetState() == GameState.SANDBOX);
            sandboxVehicles.SetActive(GameStateManager.GetState() == GameState.SANDBOX);
            sandboxWorkshop.SetActive(GameStateManager.GetState() == GameState.SANDBOX);
            sandboxSettings.SetActive(true);
            sandboxResources.SetActive(true);
            sandbox.SetActive((sandboxEverywhere.Value && PolyTechMain.modEnabled.Value) || GameStateManager.GetState() == GameState.SANDBOX);
        }
 public static bool PopupWarningPatch(
     string message,
     PopUpWarningCategory category
     )
 {
     if (PopupQueue.PopupIsActive())
     {
         ptfInstance.ptfLogger.LogInfo("popup is already active, queueing!");
         PopupWarningQueueItem QueueItem = new PopupWarningQueueItem(
             message,
             category
             );
         PopupQueue.queue.Enqueue(QueueItem);
         return(false);
     }
     return(true);
 }
 public static bool PopupMessageInputFieldPatch(
     string title,
     string defaultText,
     Panel_PopUpInputField.OnOkDelegate okDelegate
     )
 {
     if (PopupQueue.PopupIsActive())
     {
         ptfInstance.ptfLogger.LogInfo("popup is already active, queueing!");
         PopupInputFieldQueueItem QueueItem = new PopupInputFieldQueueItem(
             title,
             defaultText,
             okDelegate
             );
         PopupQueue.queue.Enqueue(QueueItem);
         return(false);
     }
     return(true);
 }
 public static bool PopupMessagePatch(
     string message,
     Panel_PopUpMessage.OnChoiceDelegate okDelegate,
     Panel_PopUpMessage.OnChoiceDelegate cancelDelegate,
     PopUpWarningCategory warningCategory
     )
 {
     if (PopupQueue.PopupIsActive())
     {
         ptfInstance.ptfLogger.LogInfo("popup is already active, queueing!");
         PopupMessageQueueItem QueueItem = new PopupMessageQueueItem(
             message,
             okDelegate,
             cancelDelegate,
             warningCategory
             );
         PopupQueue.queue.Enqueue(QueueItem);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 5
0
    // Use this for initialization
    private IEnumerator Start()
    {
        PurchaseOffer.Setup(
            GlobalConfig.Offers.startIndex,
            GlobalConfig.Shop.offers.Count,
            GlobalConfig.Offers.firstDelay,
            GlobalConfig.Offers.offerDuration,
            GlobalConfig.Offers.coolTime,
            GlobalConfig.Offers.minResource,
            GlobalConfig.Offers.resourceTime,
            GlobalConfig.Offers.lastPurchaseTime);

#if UNITY_EDITOR
        PurchaseOffer.Setup(1, GlobalConfig.Shop.offers.Count, 10, 15, 10, 99999999, 5, 60);
#endif

        pack = Game.GetOfferPackage();
        if (pack != null)
        {
            PopupQueue.Add(0.5f, () => Game.Instance.OpenPopup <Popup_Offer>().Setup(pack));
        }

        button.onClick.AddListener(() => Game.Instance.OpenPopup <Popup_Offer>().Setup(pack));

        var wait = new WaitForSeconds(1);
        while (true)
        {
            pack = Game.GetOfferPackage();
            if (pack != null)
            {
                discountLabel.SetFormatedText(pack.discount);
                timeLabel.SetText(Utilities.TimeToString(PurchaseOffer.RemainedTime, 0));
            }
            presenter.SetActive(pack != null && pack.discount > 0);

            yield return(wait);
        }
    }
 public static bool PopupTwoChoicesPatch(
     string message,
     string choiceA,
     string choiceB,
     Panel_PopUpTwoChoices.OnChoiceDelegate callbackA,
     Panel_PopUpTwoChoices.OnChoiceDelegate callbackB,
     PopUpWarningCategory warningCategory
     )
 {
     if (PopupQueue.PopupIsActive())
     {
         ptfInstance.ptfLogger.LogInfo("popup is already active, queueing!");
         PopupTwoChoicesQueueItem QueueItem = new PopupTwoChoicesQueueItem(
             message,
             choiceA,
             choiceB,
             callbackA,
             callbackB
             );
         PopupQueue.queue.Enqueue(QueueItem);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Start queuing up popup windows
 /// </summary>
 public void StartPopupQueue()
 {
     _popupQueue = new PopupQueue(o => !ShouldMessageBoxPopup);
     _popupQueue.NewPopupDequeued += UpdatePopupViewModel;
 }