Giter Site home page Giter Site logo

algernoncommons's People

Contributors

algernon-a avatar st-apps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

algernoncommons's Issues

Keybinding settings are not persisted?

Hi there, I'm trying to modernize Parallel Road Tool and I found out this great repo.
I've started rewriting stuff to use your code, but I'm having some issues with settings and keybindings.

Main issue is that I can change a keybinding, but the change will be lost as soon as I close the options panel and reopen it. It also doesn't correctly load the defaults that I'm setting.

Here are some implementation details:

// OptionsPanel.ctor
var keyBindingsGroup = (UIHelper)helper.AddGroup(Translations.Translate("GROUP_KEYBINDINGS_NAME"));
((UIPanel)keyBindingsGroup.self).gameObject.AddComponent<ToggleButtonOptionsKeymapping>();

// ToggleButtonOptionsKeymapping
public class ToggleButtonOptionsKeymapping : OptionsKeymapping
{
    public ToggleButtonOptionsKeymapping()
    {
        Label = Translations.Translate("SELECT_KEYMAPPING_TOGGLEBUTTON_LABEL");
        ButtonLabel = Translations.Translate("PRESS_ANY_KEY");
    }

    protected override InputKey KeySetting
    {
        get => ModSettings.KeyPaste.Encode();
        set => ModSettings.KeyPaste.SetKey(value);
    }
}

// ModSettings
[XmlRoot("SettingsFile")]
public class ModSettings : SettingsXMLBase
{
    ...
    [XmlElement]
    public static readonly Keybinding KeyPaste = new(KeyCode.P, true, false, false);
    ...

    internal static void Load() => XMLFileUtils.Load<ModSettings>(SettingsFileName);
    internal static void Save() => XMLFileUtils.Save<ModSettings>(SettingsFileName);
}

What I'd expect to have in my OptionsPanel would be a pre-selected CTRL+P keybinding, however, if I remove the ButtonLabel, it shows as ctrl+alt+shift+A (which rings like a default value).

Also, I click and set a new value, the value is shown correctly just for it to be reverted as soon as I close the panel.

The XML file doesn't contain anything related to the keybinding, so I assume it's not saved correctly somehow.

Can you please help me with that?

Questions about translation

Hello.
Should I translate the languages in this shared framework?
Or if you are willing to deal with Crowdin translations, we will do nothing.
If translation is needed, we will fork it and PR it.

NRE when using InGameAtlas property

Just a minor but annoying find.
If I use InGameAtlas from UITextures I get a NRE because it seems like there's no ingame atlas for me.

After some quick testing I found out that Ingame works instead (capital I), so maybe a non-breaking change could be to change that line to:

public static UITextureAtlas InGameAtlas => GetTextureAtlas("ingame") ?? GetTextureAtlas("Ingame");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.