示例#1
0
        static void DoLeft(Rect leftRect)
        {
            //List<string> rootMembers = ToggleManager.Toggles.Select(x => x.Root).Distinct().ToList();
            //float leftY = (rootMembers.Count() + 20) * 30f;
            float leftY = 25 * 30f;

            var leftView = new Listing_Toggles();

            leftView.BeginListing(leftRect, ref scrollPositionLeft, leftY);

            // Hotkey button
            MarkButton(leftView, ButtonCat.MetaModSettings);

            leftView.GapLine(24);

            // Sets up category labels in the left view according to each unique toggle root.
            foreach (string root in ToggleManager.Toggles.Select(x => x.Root).Distinct().OrderBy(x => x))
            {
                leftView.Label(root.Translate());
                // Populates each root label with each respective toggles according to their group.
                foreach (string group in ToggleManager.Toggles.Where(x => x.Root.Equals(root)).Select(x => x.Group).Distinct().OrderBy(x => x))
                {
                    MarkButton(leftView, group);
                }

                leftView.Gap();
            }

            leftView.EndListing();
        }
示例#2
0
        static void DoMetaSettingsView(Rect middleRect)
        {
            float middleY = 10 * 25f;

            var view = new Listing_Toggles();

            view.BeginListing(middleRect, ref scrollPositionMiddle, middleY);

            view.CustomLabel("HotkeysHeader".Translate(), -1, "HotkeysDesc".Translate());

            foreach (string defName in HotkeyHandler.HotKeyDict.Keys)
            {
                Hotkey hotkey = HotkeyHandler.HotKeyDict.TryGetValue(defName);
                hotkey.CustomLabel = view.TextEntry(hotkey.CustomLabel);
            }
            view.Gap();
            if (view.ButtonText("KeyBindingsButton".Translate(), width: 100f))
            {
                Find.WindowStack.Add(new Dialog_KeyBindings());
            }
            view.EndListing();
        }