/// <summary>
        /// Harmony postfix to perform actions require after the level has loaded.
        /// </summary>
        public static void Postfix()
        {
            // Don't do anything if mod hasn't activated for whatever reason (mod conflict, harmony error, something else).
            if (!Loading.isModEnabled)
            {
                return;
            }

            // Report any 'soft' mod conflicts.
            if (Loading.softModConflct)
            {
                // Soft conflict detected - display warning notification for each one.
                foreach (string mod in ModUtils.conflictingModNames)
                {
                    if (mod.Equals("PTG") && ModSettings.dsaPTG == 0)
                    {
                        // Plop the Growables.
                        DontShowAgainMessageBox softConflictBox = MessageBoxBase.ShowModal <DontShowAgainMessageBox>();
                        softConflictBox.AddParas(Translations.Translate("PRR_CON_PTG0"), Translations.Translate("PRR_CON_PTG1"), Translations.Translate("PRR_CON_PTG2"));
                        softConflictBox.DSAButton.eventClicked += (component, clickEvent) => { ModSettings.dsaPTG = 1; SettingsUtils.SaveSettings(); };
                    }
                }
            }

            // Report any broken assets and remove from our prefab dictionary.
            foreach (BuildingInfo prefab in Loading.brokenPrefabs)
            {
                Logging.Error("broken prefab: ", prefab.name);
                Loading.xmlManager.prefabHash.Remove(prefab);
            }
            Loading.brokenPrefabs.Clear();

            // Init Ploppable Tool panel.
            PloppableTool.Initialize();

            // Add buttons to access building details from zoned building info panels.
            SettingsPanel.AddInfoPanelButtons();

            // Display update notification.
            try
            {
                WhatsNew.ShowWhatsNew();
            }
            catch (Exception e)
            {
                Logging.LogException(e, "exception showing WhatsNew panel");
            }

            // Set up options panel event handler.
            try
            {
                OptionsPanel.OptionsEventHook();
            }
            catch (Exception e)
            {
                Logging.LogException(e, "exception hooking options panel");
            }

            Logging.KeyMessage("loading complete");
        }
示例#2
0
        private void ShowWhatsNew()
        {
            if (!UI.Settings.ShowWhatsNew || VersionComparer.Instance.Compare(Version, UI.Settings.WhatsNewVersion) <= 0)
            {
                return;
            }

            var messages = GetWhatsNewMessages();

            if (!messages.Any())
            {
                return;
            }

            var messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();

            messageBox.CaprionText   = string.Format(Localize.Mod_WhatsNewCaption, StaticName);
            messageBox.OnButtonClick = Confirm;
            messageBox.Init(messages);

            bool Confirm()
            {
                UI.Settings.WhatsNewVersion.value = Version;
                return(true);
            }
        }
示例#3
0
        private void DeleteAllLines()
        {
            Logger.LogDebug($"{nameof(NodeMarkupTool)}.{nameof(DeleteAllLines)}");

            if (ToolMode == Mode.ConnectLine && !IsSelectPoint && MarkupManager.TryGetMarkup(SelectNodeId, out Markup markup))
            {
                if (UI.Settings.DeleteWarnings)
                {
                    var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();
                    messageBox.CaprionText    = Localize.Tool_ClearMarkingsCaption;
                    messageBox.MessageText    = string.Format(Localize.Tool_ClearMarkingsMessage, SelectNodeId);
                    messageBox.OnButton1Click = Delete;
                }
                else
                {
                    Delete();
                }

                bool Delete()
                {
                    markup.Clear();
                    Panel.UpdatePanel();
                    return(true);
                }
            }
        }
示例#4
0
        public void DeleteRule(RulePanel rulePanel)
        {
            if (!(EditObject is MarkupRegularLine regularLine))
            {
                return;
            }

            if (Settings.DeleteWarnings && Settings.DeleteWarningsType == 0)
            {
                var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();
                messageBox.CaprionText    = NodeMarkup.Localize.LineEditor_DeleteRuleCaption;
                messageBox.MessageText    = $"{NodeMarkup.Localize.LineEditor_DeleteRuleMessage}\n{MessageBoxBase.CantUndone}";
                messageBox.OnButton1Click = Delete;
            }
            else
            {
                Delete();
            }

            bool Delete()
            {
                regularLine.RemoveRule(rulePanel.Rule as MarkupLineRawRule <RegularLineStyle>);
                RemoveRulePanel(rulePanel);
                Refresh();
                DeleteAddButton();
                AddAddButton();
                return(true);
            }
        }
示例#5
0
        /// <summary>
        /// Called by the game when level loading is complete.
        /// </summary>
        /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            // Check to see that Harmony 2 was properly loaded.
            if (!Patcher.Patched)
            {
                // Harmony 2 wasn't loaded.
                Logging.Error("Harmony patches not applied; aborting");

                // Display warning message.
                ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("ZAM_ERR_HAR"), Translations.Translate("ZAM_ERR_FAT"), Translations.Translate("ERR_HAR1"));

                // List of dot points.
                harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3"));

                // Closing para.
                harmonyBox.AddParas(Translations.Translate("MES_PAGE"));

                // Don't do anything further.
                return;
            }
        }
示例#6
0
        public void Cancel()
        {
            if (HasChanges)
            {
                var messageBox = MessageBoxBase.ShowModal <ThreeButtonMessageBox>();
                messageBox.CaprionText    = NodeMarkup.Localize.TemplateEditor_SaveChanges;
                messageBox.MessageText    = SaveChangesMessage;
                messageBox.Button1Text    = MessageBoxBase.Yes;
                messageBox.Button2Text    = MessageBoxBase.No;
                messageBox.Button3Text    = MessageBoxBase.Cancel;
                messageBox.OnButton1Click = OnSave;
                messageBox.OnButton2Click = OnNotSave;
            }
            else
            {
                OnNotSave();
            }

            bool OnSave()
            {
                SaveChanges();
                return(true);
            }

            bool OnNotSave()
            {
                NotSaveChanges();
                return(true);
            }
        }
示例#7
0
        private static void AddDump(UIHelper group, string buttonText, string caption, Dump dump)
        {
            AddButton(group, buttonText, Click, 600);

            void Click()
            {
                var result = dump(out string path);

                if (result)
                {
                    var messageBox = MessageBoxBase.ShowModal <TwoButtonMessageBox>();
                    messageBox.CaprionText    = caption;
                    messageBox.MessageText    = Localize.Settings_DumpMessageSuccess;
                    messageBox.Button1Text    = Localize.Settings_CopyPathToClipboard;
                    messageBox.Button2Text    = NodeMarkupMessageBox.Ok;
                    messageBox.OnButton1Click = CopyToClipboard;
                    messageBox.SetButtonsRatio(2, 1);

                    bool CopyToClipboard()
                    {
                        Clipboard.text = path;
                        return(false);
                    }
                }
                else
                {
                    var messageBox = MessageBoxBase.ShowModal <OkMessageBox>();
                    messageBox.CaprionText = caption;
                    messageBox.MessageText = Localize.Settings_DumpMessageFailed;
                }
            }
        }
示例#8
0
        public static void ShowWhatsNew()
        {
            var fromVersion = new Version(Settings.WhatsNewVersion);

            if (!Settings.ShowWhatsNew || Version <= fromVersion)
            {
                return;
            }

            var messages = GetWhatsNewMessages(fromVersion);

            if (!messages.Any())
            {
                return;
            }

            if (!IsBeta)
            {
                var messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();
                messageBox.CaptionText   = string.Format(Localize.Mod_WhatsNewCaption, ShortName);
                messageBox.OnButtonClick = Confirm;
                messageBox.OkText        = NodeMarkupMessageBox.Ok;
                messageBox.Init(messages, GetVersionString);
            }
            else
            {
                var messageBox = MessageBoxBase.ShowModal <BetaWhatsNewMessageBox>();
                messageBox.CaptionText      = string.Format(Localize.Mod_WhatsNewCaption, ShortName);
                messageBox.OnButtonClick    = Confirm;
                messageBox.OnGetStableClick = GetStable;
                messageBox.OkText           = NodeMarkupMessageBox.Ok;
                messageBox.GetStableText    = Localize.Mod_BetaWarningGetStable;
                messageBox.Init(messages, string.Format(Localize.Mod_BetaWarningMessage, ShortName), GetVersionString);
            }
示例#9
0
        private void ShowWhatsNew()
        {
            var whatNewVersion = new Version(UI.Settings.WhatsNewVersion);

            if (!UI.Settings.ShowWhatsNew || Version <= whatNewVersion)
            {
                return;
            }

            var messages = GetWhatsNewMessages(whatNewVersion);

            if (!messages.Any())
            {
                return;
            }

            var messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();

            messageBox.CaprionText   = string.Format(Localize.Mod_WhatsNewCaption, StaticName);
            messageBox.OnButtonClick = Confirm;
            messageBox.Init(messages);

            bool Confirm()
            {
                UI.Settings.WhatsNewVersion.value = Version.ToString();
                return(true);
            }
        }
示例#10
0
        private void ShowBetaWarning()
        {
            if (!IsBeta)
            {
                UI.Settings.BetaWarning.value = true;
            }
            else if (UI.Settings.BetaWarning.value)
            {
                var messageBox = MessageBoxBase.ShowModal <TwoButtonMessageBox>();
                messageBox.CaprionText    = Localize.Mod_BetaWarningCaption;
                messageBox.MessageText    = string.Format(Localize.Mod_BetaWarningMessage, StaticName);
                messageBox.Button1Text    = Localize.Mod_BetaWarningAgree;
                messageBox.Button2Text    = Localize.Mod_BetaWarningGetStable;
                messageBox.OnButton1Click = AgreeClick;
                messageBox.OnButton2Click = GetStable;

                bool AgreeClick()
                {
                    UI.Settings.BetaWarning.value = false;
                    return(true);
                }

                bool GetStable()
                {
                    Utilities.OpenUrl(StableURL);
                    return(true);
                }
            }
        }
示例#11
0
 private void ShowLoadError()
 {
     if (MarkupManager.HasLoadErrors)
     {
         var messageBox = MessageBoxBase.ShowModal <ErrorLoadedMessageBox>();
         messageBox.MessageText = MarkupManager.LoadErrors > 0 ? string.Format(Localize.Mod_LoadFailed, MarkupManager.LoadErrors) : Localize.Mod_LoadFailedAll;
     }
 }
        private void listening_thread()
        {
            while (true)
            {
                Byte[] arr_data = new Byte[BUFSIZ];
                Dictionary <String, String> dict;
                try
                {
                    server_socket.Receive(arr_data);
                }
                catch (SocketException)
                {
                    MessageBoxBase.Show("服务器掉线了!");
                    Application.Exit();
                }
                try
                {
                    dict = DataEncoding.get_dictionary(arr_data);
                }
                catch (DataEncodingException e)
                {
                    MessageBoxBase.Show(e.Message);
                    Application.Exit();
                    break;
                }
                switch (dict["identifier"])
                {
                default:
                    throw new DataEncodingException("Invalid identifier.");

                case "lobby_ready":
                    check_ready_request(dict);
                    break;

                case "lobby_chessmove":
                    check_chessmove_request(dict);
                    break;

                case "lobby_gamestart":
                    check_gamestart_request(dict);
                    break;

                case "lobby_draw":
                    check_draw_request(dict);
                    break;

                case "lobby_gameend":
                    check_gameend_request(dict);
                    break;

                case "lobby_exit":
                    MessageBoxBase.Show("你的对手已经退出了房间. 即将关闭房间.",
                                        "对手退出房间");
                    this.Close();
                    break;
                }
            }
        }
示例#13
0
 /// <summary>
 /// Checks to see if an exception has occured and, and if so displays it (if we aren't already).
 /// </summary>
 internal static void CheckException()
 {
     // Display exception message if an exception occured and we're not already displaying one.
     if (wasException && !displayingException)
     {
         // Set displaying flag and show message.
         displayingException = true;
         MessageBoxBase.ShowModal <ExceptionMessageBox>();
     }
 }
示例#14
0
        /// <summary>
        /// Called by the game when level loading is complete.
        /// </summary>
        /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            // Check to see that Harmony 2 was properly loaded.
            if (!harmonyLoaded)
            {
                // Harmony 2 wasn't loaded; display warning notification and exit.
                ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("ABLC_ERR_HAR"), Translations.Translate("ABLC_ERR_FAT"), Translations.Translate("ERR_HAR1"));

                // List of dot points.
                harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3"));

                // Closing para.
                harmonyBox.AddParas(Translations.Translate("MES_PAGE"));

                // Exit.
                return;
            }

            // Check to see if a conflicting mod has been detected.
            if (conflictingMod)
            {
                // Mod conflict detected - display warning notification and exit.
                ListMessageBox modConflictBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                modConflictBox.AddParas(Translations.Translate("ERR_CON0"), Translations.Translate("ABLC_ERR_FAT"), Translations.Translate("ABLC_ERR_CON0"), Translations.Translate("ERR_CON1"));

                // Add conflicting mod name(s).
                modConflictBox.AddList(ModUtils.conflictingModNames.ToArray());

                // Closing para.
                modConflictBox.AddParas(Translations.Translate("ABLC_ERR_CON1"));

                // Exit.
                return;
            }

            // Load mod if it's enabled.
            if (isModEnabled)
            {
                // Check for Ploppable RICO Revisited.
                ModUtils.RICOReflection();

                // Hook info panel events.
                DistrictPanelManager.Hook();
                BuildingPanelManager.Hook();

                // Add building info panel button.
                BuildingPanelManager.AddInfoPanelButton();
            }
        }
示例#15
0
 private void ShowLoadError()
 {
     if (MarkupManager.LoadErrors != 0)
     {
         var messageBox = MessageBoxBase.ShowModal <TwoButtonMessageBox>();
         messageBox.CaprionText    = StaticName;
         messageBox.MessageText    = string.Format(Localize.Mod_LoadFailed, MarkupManager.LoadErrors);
         messageBox.Button1Text    = Localize.MessageBox_OK;
         messageBox.Button2Text    = Localize.Mod_Support;
         messageBox.OnButton2Click = OpenTroubleshooting;
     }
 }
        private void check_draw_request(Dictionary <String, String> dict)
        {
            String message = dict["message"];

            switch (message)
            {
            // TODO
            case "draw":
                MessageBoxBase.Show("对方提和, 请问您是否接受?");
                break;
            }
        }
        private void button_draw_Click(object sender, EventArgs e)
        {
            MessageBoxBase.Show("敬请期待求和功能.");

            /*
             * server_socket.Send(new Dictionary<String, String>()
             * {
             *  ["identifier"] = "lobby_draw",
             *  ["message"] = "draw"
             * });
             * button_draw.Enabled = false;
             */
        }
示例#18
0
        private static void AddRestore <Modal>(UIHelper group, string buttonText, string caption, string message)
            where Modal : ImportMessageBox
        {
            AddButton(group, buttonText, Click, 600);

            void Click()
            {
                var messageBox = MessageBoxBase.ShowModal <Modal>();

                messageBox.CaprionText = caption;
                messageBox.MessageText = message;
            }
        }
示例#19
0
        private void SaveChanges()
        {
            var name       = NameProperty.Value;
            var messageBox = default(YesNoMessageBox);

            if (!string.IsNullOrEmpty(name) && name != EditObject.Name && (EditObject.Manager as TemplateManager <TemplateType>).ContainsName(name, EditObject))
            {
                messageBox                = MessageBoxBase.ShowModal <YesNoMessageBox>();
                messageBox.CaprionText    = NodeMarkup.Localize.TemplateEditor_NameExistCaption;
                messageBox.MessageText    = string.Format(NameExistMessage, name);
                messageBox.OnButton1Click = AgreeExistName;
                messageBox.OnButton2Click = EditName;
            }
            else
            {
                AgreeExistName();
            }


            bool AgreeExistName()
            {
                if (EditObject.IsAsset)
                {
                    messageBox ??= MessageBoxBase.ShowModal <YesNoMessageBox>();
                    messageBox.CaprionText    = RewriteCaption;
                    messageBox.MessageText    = $"{IsAssetMessage} {RewriteMessage}";
                    messageBox.OnButton1Click = Save;
                    return(false);
                }
                else
                {
                    return(Save());
                }
            }

            bool EditName()
            {
                NameProperty.Edit();
                return(true);
            }

            bool Save()
            {
                OnApplyChanges();
                (EditObject.Manager as TemplateManager <TemplateType>).TemplateChanged(EditObject);
                EndEditTemplate();
                SelectItem.Refresh();
                return(true);
            }
        }
示例#20
0
 private void ShowBetaWarning()
 {
     if (!Mod.IsBeta)
     {
         Settings.BetaWarning.value = true;
     }
     else if (Settings.BetaWarning.value)
     {
         var messageBox = MessageBoxBase.ShowModal <TwoButtonMessageBox>();
         messageBox.CaprionText    = Localize.Mod_BetaWarningCaption;
         messageBox.MessageText    = string.Format(Localize.Mod_BetaWarningMessage, Mod.ShortName);
         messageBox.Button1Text    = Localize.Mod_BetaWarningAgree;
         messageBox.Button2Text    = Localize.Mod_BetaWarningGetStable;
         messageBox.OnButton1Click = AgreeClick;
         messageBox.OnButton2Click = Mod.GetStable;
示例#21
0
        public override void OnPrimaryMouseClicked(Event e)
        {
            var markup = default(Markup);

            if (IsHoverNode)
            {
                markup = MarkupManager.NodeManager.Get(HoverNodeId);
            }
            else if (IsHoverSegment)
            {
                markup = MarkupManager.SegmentManager.Get(HoverSegmentId);
            }
            else
            {
                return;
            }

            Mod.Logger.Debug($"Select marking {markup}");
            Tool.SetMarkup(markup);

            if (markup.NeedSetOrder)
            {
                var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();
                messageBox.CaprionText    = Localize.Tool_RoadsWasChangedCaption;
                messageBox.MessageText    = Localize.Tool_RoadsWasChangedMessage;
                messageBox.OnButton1Click = OnYes;
                messageBox.OnButton2Click = OnNo;
            }
            else
            {
                OnNo();
            }

            bool OnYes()
            {
                BaseOrderToolMode.IntersectionTemplate = markup.Backup;
                Tool.SetMode(ToolModeType.EditEntersOrder);
                markup.NeedSetOrder = false;
                return(true);
            }

            bool OnNo()
            {
                Tool.SetDefaultMode();
                markup.NeedSetOrder = false;
                return(true);
            }
        }
示例#22
0
        /// <summary>
        /// Check if there's been an update since the last notification, and if so, show the update.
        /// </summary>
        internal static void ShowWhatsNew()
        {
            // Get last notified version and current mod version.
            Version         whatsNewVersion = new Version(ModSettings.whatsNewVersion);
            WhatsNewMessage latestMessage   = WhatsNewMessages[0];

            // Don't show notification if we're already up to (or ahead of) the first what's new message (including Beta updates).
            if (whatsNewVersion < latestMessage.version || (whatsNewVersion == latestMessage.version && ModSettings.whatsNewBetaVersion < latestMessage.betaVersion))
            {
                // Show messagebox.
                WhatsNewMessageBox messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();
                messageBox.Title = RealPopMod.ModName + " " + RealPopMod.Version;
                messageBox.DSAButton.eventClicked += (component, clickEvent) => DontShowAgain();
                messageBox.SetMessages(whatsNewVersion, WhatsNewMessages);
            }
        }
示例#23
0
文件: WhatsNew.cs 项目: Alexof/BOB
        /// <summary>
        /// Check if there's been an update since the last notification, and if so, show the update.
        /// </summary>
        internal static void ShowWhatsNew()
        {
            // Get last notified version and current mod version.
            Version         whatsNewVersion = new Version(ModSettings.whatsNewVersion);
            WhatsNewMessage latestMessage   = WhatsNewMessages[0];

            // Don't show notification if we're already up to (or ahead of) the first what's new message.
            if (whatsNewVersion < latestMessage.version)
            {
                Logging.Message("displaying what's new message");

                // Show messagebox.
                WhatsNewMessageBox messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();
                messageBox.Title = BOBMod.ModName + " " + BOBMod.Version;
                messageBox.DSAButton.eventClicked += (component, clickEvent) => DontShowAgain();
                messageBox.SetMessages(whatsNewVersion, WhatsNewMessages);
            }
        }
示例#24
0
        /// <summary>
        /// Called by the game when level loading is complete.
        /// </summary>
        /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            // Check watchdog flag.
            if (!patchOperating)
            {
                // Patch wasn't operating; display harmony error and abort.
                harmonyLoaded = false;
                isModEnabled  = false;
            }

            // Check to see that Harmony 2 was properly loaded.
            if (!harmonyLoaded)
            {
                // Harmony 2 wasn't loaded; display warning notification and exit.
                ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("PRR_ERR_HAR"), Translations.Translate("PRR_ERR_FAT"), Translations.Translate("ERR_HAR1"));

                // List of dot points.
                harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3"));

                // Closing para.
                harmonyBox.AddParas(Translations.Translate("MES_PAGE"));
            }

            // Check to see if a conflicting mod has been detected.
            if (conflictingMod)
            {
                // Mod conflict detected - display warning notification and exit.
                ListMessageBox modConflictBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                modConflictBox.AddParas(Translations.Translate("ERR_CON0"), Translations.Translate("PRR_ERR_CON0"), Translations.Translate("PRR_ERR_FAT"), Translations.Translate("ERR_CON1"));

                // Add conflicting mod name(s).
                modConflictBox.AddList(ModUtils.conflictingModNames.ToArray());

                // Closing para.
                modConflictBox.AddParas(Translations.Translate("PRR_ERR_CON1"));
            }
        }
示例#25
0
        /// <summary>
        /// Check if there's been an update since the last notification, and if so, show the update.
        /// </summary>
        internal static void ShowWhatsNew()
        {
            Logging.KeyMessage("checking for update notifications");

            // Get last notified version and current mod version.
            Version         whatsNewVersion = new Version(ModSettings.whatsNewVersion);
            WhatsNewMessage latestMessage   = WhatsNewMessages[0];

            // Don't show notification if we're already up to (or ahead of) the first what's new message (including Beta updates).
            if (whatsNewVersion < latestMessage.version || (whatsNewVersion == latestMessage.version && ModSettings.whatsNewBetaVersion < latestMessage.betaVersion))
            {
                // Show messagebox.
                Logging.KeyMessage("showing What's New messagebox");
                WhatsNewMessageBox messageBox = MessageBoxBase.ShowModal <WhatsNewMessageBox>();
                messageBox.Title = LifecycleRebalanceMod.ModName + " " + LifecycleRebalanceMod.Version;
                messageBox.DSAButton.eventClicked += (component, clickEvent) => DontShowAgain();
                messageBox.SetMessages(whatsNewVersion, WhatsNewMessages);
                Logging.KeyMessage("What's New messagebox complete");
            }
        }
示例#26
0
        private static void AddDeleteAll(UIHelper group, string buttonText, string caption, string message, Action process)
        {
            var button = AddButton(group, buttonText, Click, 600);

            button.textColor = Color.red;

            void Click()
            {
                var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>();

                messageBox.CaprionText    = caption;
                messageBox.MessageText    = message;
                messageBox.OnButton1Click = Сonfirmed;
            }

            bool Сonfirmed()
            {
                process();
                return(true);
            }
        }
示例#27
0
        private void Exit()
        {
            var messageBox = MessageBoxBase.ShowModal <ThreeButtonMessageBox>();

            messageBox.CaptionText    = EndCaption;
            messageBox.MessageText    = EndMessage;
            messageBox.Button1Text    = Localize.Tool_Apply;
            messageBox.OnButton1Click = OnApply;
            messageBox.Button2Text    = Localize.Tool_NotApply;
            messageBox.OnButton2Click = OnNotApply;
            messageBox.Button3Text    = Localize.Tool_Continue;

            bool OnApply()
            {
                ApplyClick();
                return(true);
            }

            bool OnNotApply()
            {
                NotApplyClick();
                return(true);
            }
        }
示例#28
0
        public override void OnSecondaryMouseClicked()
        {
            var messageBox = MessageBoxBase.ShowModal <ThreeButtonMessageBox>();

            messageBox.CaprionText    = EndCaption;
            messageBox.MessageText    = EndMessage;
            messageBox.Button1Text    = Localize.Tool_Apply;
            messageBox.OnButton1Click = OnApply;
            messageBox.Button2Text    = Localize.Tool_NotApply;
            messageBox.OnButton2Click = OnNotApply;
            messageBox.Button3Text    = Localize.Tool_Continue;

            bool OnApply()
            {
                ApplyClick();
                return(true);
            }

            bool OnNotApply()
            {
                NotApplyClick();
                return(true);
            }
        }
示例#29
0
文件: Loading.cs 项目: Alexof/BOB
        /// <summary>
        /// Called by the game when level loading is complete.
        /// </summary>
        /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            Logging.Message("commencing loading checks");

            base.OnLevelLoaded(mode);

            // Don't do anything further if we're not operating.
            if (!isModEnabled)
            {
                Logging.Message("exiting");
                return;
            }

            // Check to see that Harmony 2 was properly loaded.
            if (!Patcher.Patched)
            {
                // Harmony 2 wasn't loaded; abort.
                Logging.Error("Harmony patches not applied; aborting");
                isModEnabled = false;

                // Display warning message.
                ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("BOB_ERR_HAR"), Translations.Translate("BOB_ERR_FAT"), Translations.Translate("ERR_HAR1"));

                // List of dot points.
                harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3"));

                // Closing para.
                harmonyBox.AddParas(Translations.Translate("MES_PAGE"));

                // Don't do anything further.
                return;
            }

            Logging.Message("loading checks passed");

            // Build lists of loaded prefabs.
            PrefabLists.BuildLists();

            // Load prop packs.
            new NetworkPackReplacement();

            // Load configuration file.
            ConfigurationUtils.LoadConfig();

            // Set up BOB tool.
            ToolsModifierControl.toolController.gameObject.AddComponent <BOBTool>();

            // Display update notification.
            WhatsNew.ShowWhatsNew();

            // Set up Network Skins 2 reflection.
            ModUtils.NS2Reflection();

            // Enable thin wires, if applicable.
            if (ModSettings.ThinnerWires)
            {
                ElectricalWires.Instance.ApplyThinnerWires();
            }

            // Force update of any dirty net or building prefabs from replacement process.
            Logging.Message("updating dirty prefabs");
            BuildingData.Update();
            NetData.Update();

            // Set up options panel event handler.
            OptionsPanel.OptionsEventHook();

            // Display any exception message that occured during load.
            InfoPanelManager.CheckException();

            // Activate tool hotkey.
            UIThreading.Operating = true;

            Logging.Message("loading complete");
        }
        /// <summary>
        /// Called by the game when level loading is complete.
        /// </summary>
        /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param>
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            // Check to see that Harmony 2 was properly loaded.
            if (!harmonyLoaded)
            {
                // Harmony 2 wasn't loaded; display warning notification and exit.
                ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("RPR_ERR_HAR"), Translations.Translate("RPR_ERR_FAT"), Translations.Translate("ERR_HAR1"));

                // List of dot points.
                harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3"));

                // Closing para.
                harmonyBox.AddParas(Translations.Translate("MES_PAGE"));
            }

            // Check to see if a conflicting mod has been detected.
            if (conflictingMod)
            {
                // Mod conflict detected - display warning notification and exit.
                ListMessageBox modConflictBox = MessageBoxBase.ShowModal <ListMessageBox>();

                // Key text items.
                modConflictBox.AddParas(Translations.Translate("ERR_CON0"), Translations.Translate("RPR_ERR_CON0"), Translations.Translate("RPR_ERR_FAT"), Translations.Translate("ERR_CON1"));

                // Add conflicting mod name(s).
                modConflictBox.AddList(ModUtils.conflictingModNames.ToArray());

                // Closing para.
                modConflictBox.AddParas(Translations.Translate("RPR_ERR_CON1"));
            }

            // Don't do anything further if mod hasn't activated for whatever reason (mod conflict, harmony error, something else).
            if (!isModEnabled)
            {
                // Disable keystrokes.
                UIThreading.operating = false;

                return;
            }

            // Show legacy choice message box if this save hasn't been flagged as being from Realistic Population 2.
            if (!ModSettings.isRealPop2Save)
            {
                MessageBoxBase.ShowModal <LegacyChoiceMessageBox>();
            }

            // Record initial (default) school settings and apply ours over the top.
            SchoolData.instance.OnLoad();

            // IF a legacy file exists, flag it for writing.
            if (File.Exists(DataStore.currentFileLocation))
            {
                Logging.KeyMessage("found legacy settings file");
                XMLUtilsWG.writeToLegacy = true;
            }

            // Add button to building info panels.
            BuildingDetailsPanel.AddInfoPanelButton();

            Logging.KeyMessage("loading complete");

            // Display update notification.
            WhatsNew.ShowWhatsNew();

            // Set up options panel event handler.
            OptionsPanel.OptionsEventHook();

            // Check and record CitizenUnits count.
            Logging.KeyMessage("citizen unit count is currently ", ColossalFramework.Singleton <CitizenManager> .instance.m_unitCount.ToString());
        }