sway2020 / YetAnotherToolbar

Yet Another Toolbar mod for Cities Skylines
https://steamcommunity.com/sharedfiles/filedetails/?id=2448994345
GNU General Public License v3.0
1 stars 0 forks source link

Add option to hide filter panels #6

Open coldrifting opened 3 years ago

coldrifting commented 3 years ago

Especially with find it, they clutter up the screen and seem a bit redundant. Here's some example code that should do the job. I'd make a pull request, but I'm not that familiar with the UI, and I don't know where the best place to insert this kind of thing would go, along with code to add it to the settings menu. Untitled

private void HideFilterPanel(bool hide)
{
    UIPanel[] panels = GameObject.FindObjectsOfType<UIPanel>();
    foreach (UIPanel panel in panels)
    {
        if (panel.name == "FilterPanel")
        {
            if (hide)
            {
                panel.Hide();
            }
            else
            {
                panel.Show();
            }
        }
    }
}
sway2020 commented 3 years ago

Thanks for the pull request! I am a bit busy this week so I'll probably test it and merge it next weekend.

coldrifting commented 3 years ago

Just realized there's probably issues with my implementation when the game is played without the unlock all mod. I'll have to test and figure out what's going on in a bit.

coldrifting commented 3 years ago

I've done some more testing, and I don't think the issue was with my additions. The mod seems to have issues when loading a new game with scaling settings that aren't 100 and no unlock mods. Loading an existing save doesn't seem to have this issue.

sway2020 commented 3 years ago

I always had the built-in unlock all mod enabled so I didn't test that part. I'll check it when I have time. I think there are a few other potential bugs I need to test/fix too. I'll probably add the option to hide the advisor button first because it should be rather simple and not related to other things.

sway2020 commented 3 years ago

I think I figured out the issue. The asset thumbnail buttons are only created when they become unlocked, but they are generated at the original scaling if they are unlocked in-game, so the layout becomes messed up if the panels are already scaled down or up. The only fix I can think of is to patch the vanilla game code using harmony, or maybe I'll just limit the panel scaling feature to players who are already using the unlock all mod

zengfanfan commented 1 year ago

there is an option in the config file: <hideFilterPanels>true</hideFilterPanels>. but not working.