Пример #1
0
        /// <summary>
        /// Sets up tool options in the tool parameter menu.
        /// </summary>
        /// <param name="menu">The menu to configure.</param>
        /// <param name="options">The available modes.</param>
        /// <returns>A dictionary which is updated in real time to contain the actual state of each mode.</returns>
        public static IDictionary <string, ToolParameterMenu.ToggleState> PopulateMenu(
            ToolParameterMenu menu, ICollection <PToolMode> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var kOpt = new Dictionary <string, ToolParameterMenu.ToggleState>(options.Count);

            // Add to Klei format, yes it loses the order but it means less of a mess
            foreach (var option in options)
            {
                string key = option.Key;
                if (!string.IsNullOrEmpty(option.Title))
                {
                    Strings.Add("STRINGS.UI.TOOLS.FILTERLAYERS." + key, option.Title);
                }
                kOpt.Add(key, option.State);
            }
            menu.PopulateMenu(kOpt);
            return(kOpt);
        }
Пример #2
0
 public override void UpdateHoverElements(List <KSelectable> selected)
 {
     if (!((Object)ToolMenu.Instance.PriorityScreen == (Object)null))
     {
         HoverTextScreen instance        = HoverTextScreen.Instance;
         HoverTextDrawer hoverTextDrawer = instance.BeginDrawing();
         hoverTextDrawer.BeginShadowBar(false);
         DrawTitle(instance, hoverTextDrawer);
         DrawInstructions(HoverTextScreen.Instance, hoverTextDrawer);
         hoverTextDrawer.NewLine(26);
         HoverTextDrawer hoverTextDrawer2     = hoverTextDrawer;
         string          format               = UI.TOOLS.PRIORITIZE.SPECIFIC_PRIORITY;
         PrioritySetting lastSelectedPriority = ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority();
         hoverTextDrawer2.DrawText(string.Format(format, lastSelectedPriority.priority_value.ToString()), Styles_Title.Standard);
         ToolParameterMenu toolParameterMenu = ToolMenu.Instance.toolParameterMenu;
         string            lastEnabledFilter = toolParameterMenu.GetLastEnabledFilter();
         if (lastEnabledFilter != null && lastEnabledFilter != "ALL")
         {
             ConfigureTitle(instance);
         }
         hoverTextDrawer.EndShadowBar();
         hoverTextDrawer.EndDrawing();
     }
 }