Giter VIP home page Giter VIP logo

Comments (4)

mad2342 avatar mad2342 commented on August 21, 2024 1

If you like you can have a look at
https://github.com/Mad-Mods-Phoenix-Point/AssortedAdjustments/blob/main/Source/AssortedAdjustments/Settings.cs
That's my first attempt to add atributes and do sth. useful with them (export current settings as md/html with descriptions, default values and a marker if the currently applied setting is the mods default(very! raw, but works well enough))
Best regards, Mad

from modnix.

Sheep-y avatar Sheep-y commented on August 21, 2024

For now it should be best to note the config in the mod's readme.

The main problem is that even if I preserve the comment in initial config, it would be erased when the user delete the config or reset it to default.

One of the solutions I envisioned is to use vanilla .Net Annotation to add meta data to config properties, for example min, max, and of course comments. But it is not on the immediate roadmap of the next Modnix 3 release. Code patch is welcomed ;)

from modnix.

mad2342 avatar mad2342 commented on August 21, 2024

Hi Sheepy, thx for your reply.
I'll fiddle around a bit (but all that stuff is new to me, coming from web-dev, js and such) and only started c# with Battletech in my limited free time...
You mean something like https://docs.microsoft.com/en-gb/dotnet/api/system.attribute, right?

from modnix.

mad2342 avatar mad2342 commented on August 21, 2024

For now i have sth like this:

    [AttributeUsage(AttributeTargets.All)]
    public class Annotation : Attribute
    {
        private string description;
        private string defaultValue;
        private bool startSection;
        private bool endSection;
        private string sectionLabel;

        public Annotation(string description, string defaultValue, bool startSection = false, string sectionLabel = "", bool endSection = false)
        {

and use it like this (Settings.cs):

        [Annotation("General switch to enable the related subfeatures", "True", true, "")]
        public bool EnableMissionAdjustments = true;

Didn't touch Modnix, but in a console app it's working ok (as a poc).
Just wanted to make sure that this is no deadend, what do you think?
Thx for feedback and best regards, Mad

from modnix.

Related Issues (20)

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.