Пример #1
0
        static void ListSelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox        listBox = (ListBox)sender;
            ListBoxTagData tagData = ((JsonFormTag)listBox.Tag).listBoxData;

            WinformsUtil.Resetting++;
            if (listBox.SelectedItem != null)
            {
                tagData.keyControl.Enabled = true;
                tagData.keyControl.Text    = ((GroupedData)listBox.SelectedItem).Id;
                if (tagData.valueControl != null)
                {
                    tagData.valueControl.Enabled = true;
                    tagData.valueControl.Value   = ((GroupedData)listBox.SelectedItem).Value;
                }

                tagData.deleteButton.Enabled = true;
            }
            else if (!changingListValues)
            {
                tagData.keyControl.Enabled = false;
                tagData.keyControl.Text    = "";
                if (tagData.valueControl != null)
                {
                    tagData.valueControl.Enabled = false;
                    tagData.valueControl.Value   = 0;
                }

                tagData.deleteButton.Enabled = false;
            }
            WinformsUtil.Resetting--;
        }
Пример #2
0
        public ItemGroupValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "id",
                "A unique string identifier for this item group,");
            itemidTextBox.Tag = new JsonFormTag(
                null,
                "The id of the item to spawn.");
            ((JsonFormTag)itemidTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            freqNumeric.Tag = new JsonFormTag(
                null,
                "The relative frequency of this item to spawn.");
            itemsListBox.Tag = new JsonFormTag(
                "items",
                "The list of items in this group and their relative frequencies.");
            ListBoxTagData listBoxData = new ListBoxTagData();
            listBoxData.backingList = items;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteButton;
            listBoxData.newButton = newButton;
            listBoxData.keyControl = itemidTextBox;
            listBoxData.valueControl = freqNumeric;
            ((JsonFormTag)itemsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }
Пример #3
0
        static void ListBoxNewClicked(object sender, EventArgs e)
        {
            ListBox        owner       = ((JsonFormTag)((Control)sender).Tag).ownerListBox;
            ListBoxTagData listBoxData = ((JsonFormTag)owner.Tag).listBoxData;

            //Add a new entry with the default data
            if (listBoxData.defaultValue is object[])
            {
                object[] defArr = ((object[])listBoxData.defaultValue);
                object[] data   = new object[defArr.Length];
                defArr.CopyTo(data, 0);
                listBoxData.backingList.Add(new GroupedData(data));
            }
            else if (listBoxData.defaultValue is Dictionary <string, object> )
            {
                Dictionary <string, object> defDict = ((Dictionary <string, object>)listBoxData.defaultValue);
                Dictionary <string, object> data    = new Dictionary <string, object>();
                foreach (KeyValuePair <string, object> kv in defDict)
                {
                    data.Add(kv.Key, kv.Value);
                }
                listBoxData.backingList.Add(new GroupedData(data));
            }
            else
            {
                listBoxData.backingList.Add(new GroupedData(listBoxData.defaultValue));
            }

            owner.SelectedIndex = owner.Items.Count - 1;
        }
Пример #4
0
        public ItemGroupValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "id",
                "A unique string identifier for this item group,");
            itemidTextBox.Tag = new JsonFormTag(
                null,
                "The id of the item to spawn.");
            ((JsonFormTag)itemidTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            freqNumeric.Tag = new JsonFormTag(
                null,
                "The relative frequency of this item to spawn.");
            itemsListBox.Tag = new JsonFormTag(
                "items",
                "The list of items in this group and their relative frequencies.");
            ListBoxTagData listBoxData = new ListBoxTagData();

            listBoxData.backingList  = items;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteButton;
            listBoxData.newButton    = newButton;
            listBoxData.keyControl   = itemidTextBox;
            listBoxData.valueControl = freqNumeric;
            ((JsonFormTag)itemsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }
Пример #5
0
        private static void ControlsFillTags(Control control)
        {
            foreach (Control c in control.Controls)
            {
                if (c.Tag is JsonFormTag)
                {
                    //Fill in list component owner fields
                    ListBoxTagData listBoxData = ((JsonFormTag)c.Tag).listBoxData;
                    if (listBoxData != null)
                    {
                        //TODO: better error checking
                        listBoxData.newButton.Tag = new JsonFormTag(null, null);
                        ((JsonFormTag)listBoxData.newButton.Tag).ownerListBox = (ListBox)c;

                        listBoxData.deleteButton.Tag = new JsonFormTag(null, null);
                        ((JsonFormTag)listBoxData.deleteButton.Tag).ownerListBox = (ListBox)c;

                        ((JsonFormTag)listBoxData.keyControl.Tag).ownerListBox = (ListBox)c;

                        if (listBoxData.valueControl != null)
                        {
                            ((JsonFormTag)listBoxData.valueControl.Tag).ownerListBox = (ListBox)c;
                        }
                    }
                }
                if (c.Controls.Count > 0)
                {
                    ControlsFillTags(c);
                }
            }
        }
Пример #6
0
        static void ListBoxDeleteClicked(object sender, EventArgs e)
        {
            ListBox        owner       = ((JsonFormTag)((Control)sender).Tag).ownerListBox;
            ListBoxTagData listBoxData = ((JsonFormTag)owner.Tag).listBoxData;

            if (owner.SelectedItem != null)
            {
                listBoxData.backingList.Remove((GroupedData)owner.SelectedItem);
            }
        }
Пример #7
0
        public RecipeControl()
        {
            InitializeComponent();

            resultTextBox.Tag = new JsonFormTag(
                "result",
                "The id of the item this recipe produces.");
            ((JsonFormTag)resultTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            suffixTextBox.Tag = new JsonFormTag(
                "id_suffix",
                "You need to set this to a unique value if multiple recipes produce the same item.",
                false);
            skill1ComboBox.Tag = new JsonFormTag(
                "skill_used",
                "The main skill used in crafting this recipe.",
                false);
            ((JsonFormTag)skill1ComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            diffNumeric.Tag = new JsonFormTag(
                "difficulty",
                "The skill level required to craft this recipe.");
            timeNumeric.Tag = new JsonFormTag(
                "time",
                "The amount of time required to craft this recipe (in seconds?).");
            categoryComboBox.Tag = new JsonFormTag(
                "category",
                "The tab this recipe appears under in the crafting menu.");
            ((JsonFormTag)categoryComboBox.Tag).dataSource = JsonFormTag.DataSourceType.CRAFT_CATEGORIES;
            autolearnCheckBox.Tag = new JsonFormTag(
                "autolearn",
                "Is this recipe automatically learned at the appropriate skill level?",
                true,
                true);
            reversibleCheckBox.Tag = new JsonFormTag(
                "reversible",
                "Can this recipe be used to take the result item apart?",
                false,
                false);
            disLearnNumeric.Tag = new JsonFormTag(
                "decomp_learn",
                "The skill level required to learn this recipe by disassembling the result item (-1 forbids this).",
                false,
                -1);

            //Fields that aren't saved directly
            toolsListBox.Tag = new JsonFormTag(
                null,
                "A list of tool items required to craft this recipe.");
            componentsListBox.Tag = new JsonFormTag(
                null,
                "A list of ingredients needed to craft this recipe.");
            itemsListBox.Tag = new JsonFormTag(
                null,
                "A list of interchangeable items used by this particular component or tool group.");
            itemIdTextField.Tag = new JsonFormTag(
                null,
                "The string id of this item.");
            ((JsonFormTag)itemIdTextField.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            quantityNumeric.Tag = new JsonFormTag(
                null,
                "For components, the quantity used. For tools, the number of charges used (-1 for no charges).");

            bookIdTextBox.Tag = new JsonFormTag(
                null,
                "The string id of the book.");
            ((JsonFormTag)bookIdTextBox.Tag).dataSource = JsonFormTag.DataSourceType.BOOKS;
            bookReqLevelNumeric.Tag = new JsonFormTag(
                null,
                "The level required before this recipe can be learned from this book.");
            booksListBox.Tag = new JsonFormTag(
                "book_learn",
                "A list of books that this recipe might be learned from.",
                false);
            ListBoxTagData listBoxData = new ListBoxTagData();

            listBoxData.backingList  = bookGroup;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteBook;
            listBoxData.newButton    = newBook;
            listBoxData.keyControl   = bookIdTextBox;
            listBoxData.valueControl = bookReqLevelNumeric;
            ((JsonFormTag)booksListBox.Tag).listBoxData = listBoxData;

            reqSkillComboBox.Tag = new JsonFormTag(
                null,
                "The identifier of the skill required.");
            ((JsonFormTag)reqSkillComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            reqSkillLevelNumeric.Tag = new JsonFormTag(
                null,
                "The required level in the specified skill.");
            skillsListBox.Tag = new JsonFormTag(
                "requires_skills",
                "A list of skill levels required to craft this item.",
                false);
            listBoxData              = new ListBoxTagData();
            listBoxData.backingList  = requireSkills;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteSkillButton;
            listBoxData.newButton    = newSkillButton;
            listBoxData.keyControl   = reqSkillComboBox;
            listBoxData.valueControl = reqSkillLevelNumeric;
            ((JsonFormTag)skillsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);

            toolsListBox.DataSource    = toolGroups;
            toolsListBox.DisplayMember = "Display";

            componentsListBox.DataSource    = componentGroups;
            componentsListBox.DisplayMember = "Display";

            WinformsUtil.OnReset    += Reset;
            WinformsUtil.OnLoadItem += LoadItem;
        }
Пример #8
0
        public ShipValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "id",
                "A unique string identifier for this ship.");
            nameTextBox.Tag = new JsonFormTag(
                "name",
                "The display name of this class of ship.");
            shortDescTextBox.Tag = new JsonFormTag(
                "descShort",
                "A short description of this ship’s main attributes for menus.");
            descriptionTextBox.Tag = new JsonFormTag(
                "desc",
                "A description of a few sentences or a paragraph giving the characteristics and flavor of this ship.");
            textureFileTextBox.Tag = new JsonFormTag(
                "textureFile",
                "Path to the main texture for this ship. Paths are relative to the 'data' folder.");
            textureWNumeric.Tag = new JsonFormTag(
                "textureSize.x",
                "The width of the texture image.");
            textureHNumeric.Tag = new JsonFormTag(
                "textureSize.y",
                "The height of the texture image.");
            maskFileTextBox.Tag = new JsonFormTag(
                "maskFile",
                "Path to the mask texture for this ship.");
            damageFileTextBox.Tag = new JsonFormTag(
                "damageFile",
                "Path to the damaged texture for this ship.");
            coreXNumeric.Tag = new JsonFormTag(
                "coreOffset.x",
                "The x position of the core in pixels relative to the image top-left.");
            coreYNumeric.Tag = new JsonFormTag(
                "coreOffset.y",
                "The y position of the core in pixels relative to the image top-left.");
            coreRadiusNumeric.Tag = new JsonFormTag(
                "coreRadius",
                "The radius, in pixels, of the core.",
                true, 12m);
            maxSpeedNumeric.Tag = new JsonFormTag(
                "stat.movementStats.maxSpeed",
                "The maximum movement speed of this ship (pixels per second).");
            minSpeedNumeric.Tag = new JsonFormTag(
                "stat.movementStats.minSpeed",
                "The minimum movement speed of this ship (pixels per second).",
                false);
            maxAccelNumeric.Tag = new JsonFormTag(
                "stat.movementStats.maxAccel",
                "The acceleration of this ship (pixels per second per second).");
            minDecelNumeric.Tag = new JsonFormTag(
                "stat.movementStats.minDecel",
                "The minimum decceleration of this ship when no input is given (pixels per second per second).");

            hardpointsListBox.Tag = new JsonFormTag(
                "hardpoints",
                "A list of mount points where weapons or equipment can be attached.");
            ListBoxTagData listBoxData = new ListBoxTagData();
            listBoxData.backingList = hardpointData;
            listBoxData.defaultValue = new Dictionary<string, object>();
            listBoxData.deleteButton = deleteHardpointButton;
            listBoxData.newButton = newHardpointButton;
            ((JsonFormTag)hardpointsListBox.Tag).listBoxData = listBoxData;

            wtemplateTextBox.Tag = new JsonFormTag(
                "hardpoints[].template",
                "Optionally, the identifier of a weapon that must be in this slot.",
                false);
            ((JsonFormTag)wtemplateTextBox.Tag).ownerListBox = hardpointsListBox;
            wclassNumeric.Tag = new JsonFormTag(
                "hardpoints[].wclass",
                "The maximum rating for weapons that can be attached to this point.");
            ((JsonFormTag)wclassNumeric.Tag).ownerListBox = hardpointsListBox;
            woffsetXNumeric.Tag = new JsonFormTag(
                "hardpoints[].offset.x",
                "The x offset of this point from the top-left corner of the ship graphic.");
            ((JsonFormTag)woffsetXNumeric.Tag).ownerListBox = hardpointsListBox;
            woffsetYNumeric.Tag = new JsonFormTag(
                "hardpoints[].offset.y",
                "The y offset of this point from the top-left corner of the ship graphic.");
            ((JsonFormTag)woffsetYNumeric.Tag).ownerListBox = hardpointsListBox;

            textureFileTextBox.TextChanged += TextureFileChanged;
            maskFileTextBox.TextChanged += MaskFileChanged;
            damageFileTextBox.TextChanged += DamageFileChanged;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }
Пример #9
0
        public RecipeControl()
        {
            InitializeComponent();

            resultTextBox.Tag = new JsonFormTag(
                "result",
                "The id of the item this recipe produces.");
            ((JsonFormTag)resultTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            suffixTextBox.Tag = new JsonFormTag(
                "id_suffix",
                "You need to set this to a unique value if multiple recipes produce the same item.",
                false);
            skill1ComboBox.Tag = new JsonFormTag(
                "skill_used",
                "The main skill used in crafting this recipe.",
                false);
            ((JsonFormTag)skill1ComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            diffNumeric.Tag = new JsonFormTag(
                "difficulty",
                "The skill level required to craft this recipe.");
            timeNumeric.Tag = new JsonFormTag(
                "time",
                "The amount of time required to craft this recipe (in seconds?).");
            categoryComboBox.Tag = new JsonFormTag(
                "category",
                "The tab this recipe appears under in the crafting menu.");
            ((JsonFormTag)categoryComboBox.Tag).dataSource = JsonFormTag.DataSourceType.CRAFT_CATEGORIES;
            autolearnCheckBox.Tag = new JsonFormTag(
                "autolearn",
                "Is this recipe automatically learned at the appropriate skill level?",
                true,
                true);
            reversibleCheckBox.Tag = new JsonFormTag(
                "reversible",
                "Can this recipe be used to take the result item apart?",
                false,
                false);
            disLearnNumeric.Tag = new JsonFormTag(
                "decomp_learn",
                "The skill level required to learn this recipe by disassembling the result item (-1 forbids this).",
                false,
                -1);

            //Fields that aren't saved directly
            toolsListBox.Tag = new JsonFormTag(
                null,
                "A list of tool items required to craft this recipe.");
            componentsListBox.Tag = new JsonFormTag(
                null,
                "A list of ingredients needed to craft this recipe.");
            itemsListBox.Tag = new JsonFormTag(
                null,
                "A list of interchangeable items used by this particular component or tool group.");
            itemIdTextField.Tag = new JsonFormTag(
                null,
                "The string id of this item.");
            ((JsonFormTag)itemIdTextField.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            quantityNumeric.Tag = new JsonFormTag(
                null,
                "For components, the quantity used. For tools, the number of charges used (-1 for no charges).");

            bookIdTextBox.Tag = new JsonFormTag(
                null,
                "The string id of the book.");
            ((JsonFormTag)bookIdTextBox.Tag).dataSource = JsonFormTag.DataSourceType.BOOKS;
            bookReqLevelNumeric.Tag = new JsonFormTag(
                null,
                "The level required before this recipe can be learned from this book.");
            booksListBox.Tag = new JsonFormTag(
                "book_learn",
                "A list of books that this recipe might be learned from.",
                false);
            ListBoxTagData listBoxData = new ListBoxTagData();
            listBoxData.backingList = bookGroup;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteBook;
            listBoxData.newButton = newBook;
            listBoxData.keyControl = bookIdTextBox;
            listBoxData.valueControl = bookReqLevelNumeric;
            ((JsonFormTag)booksListBox.Tag).listBoxData = listBoxData;

            reqSkillComboBox.Tag = new JsonFormTag(
                null,
                "The identifier of the skill required.");
            ((JsonFormTag)reqSkillComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            reqSkillLevelNumeric.Tag = new JsonFormTag(
                null,
                "The required level in the specified skill.");
            skillsListBox.Tag = new JsonFormTag(
                "requires_skills",
                "A list of skill levels required to craft this item.",
                false);
            listBoxData = new ListBoxTagData();
            listBoxData.backingList = requireSkills;
            listBoxData.defaultValue = new object[] { "null", 0 };
            listBoxData.deleteButton = deleteSkillButton;
            listBoxData.newButton = newSkillButton;
            listBoxData.keyControl = reqSkillComboBox;
            listBoxData.valueControl = reqSkillLevelNumeric;
            ((JsonFormTag)skillsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);

            toolsListBox.DataSource = toolGroups;
            toolsListBox.DisplayMember = "Display";

            componentsListBox.DataSource = componentGroups;
            componentsListBox.DisplayMember = "Display";

            WinformsUtil.OnReset += Reset;
            WinformsUtil.OnLoadItem += LoadItem;
        }
Пример #10
0
        public WeaponValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "id",
                "A unique string identifier for this ship.");
            nameTextBox.Tag = new JsonFormTag(
                "name",
                "The display name of this type of weapon.");
            shortDescTextBox.Tag = new JsonFormTag(
                "desc",
                "A description of a few sentences giving the characteristics and flavor of this weapon.");
            textureFileTextBox.Tag = new JsonFormTag(
                "textureFile",
                "Path to the main texture for this weapon. Paths are relative to the 'data' folder.");
            textureWNumeric.Tag = new JsonFormTag(
                "textureSize.x",
                "The width of the texture image.");
            textureHNumeric.Tag = new JsonFormTag(
                "textureSize.y",
                "The height of the texture image.");
            classNumeric.Tag = new JsonFormTag(
                "wclass",
                "The minimum hardpoint rating required to support this weapon.",
                true, 1m);
            autoFireCheckBox.Tag = new JsonFormTag(
                "stat.autoFire",
                "If true, the weapon can fire with the control held down.",
                false);
            bindsControlNumeric.Tag = new JsonFormTag(
                "stat.bindsControl",
                "The button that controls fires this weapon.  Use -1 and -3 for left and right mouse, 0-9 for number keys.");
            overrideAngleNumeric.Tag = new JsonFormTag(
                "stat.overrideAngle",
                "Locks the gun to the specified angle in radians.",
                false);
            ((JsonFormTag)overrideAngleNumeric.Tag).hasValue = overrideAngleCheck;
            overrideAngleCheck.Tag = new JsonFormTag(
                null,
                "Uncheck this box to set no value for the override angle.");
            ((JsonFormTag)overrideAngleCheck.Tag).hasValueOwner = overrideAngleNumeric;

            firesListBox.Tag = new JsonFormTag(
                "stat.fires",
                "The list of projectiles this weapon fires.");
            ListBoxTagData listBoxData = new ListBoxTagData();
            listBoxData.backingList = firesData;
            listBoxData.defaultValue = new Dictionary<string, object>();
            listBoxData.deleteButton = deleteFiresButton;
            listBoxData.newButton = newFiresButton;
            ((JsonFormTag)firesListBox.Tag).listBoxData = listBoxData;

            projectileTemplateTextBox.Tag = new JsonFormTag(
                "stat.fires[].template",
                "The string ID of the projectile this source fires.",
                false);
            ((JsonFormTag)projectileTemplateTextBox.Tag).ownerListBox = firesListBox;
            fireRateNumeric.Tag = new JsonFormTag(
                "stat.fires[].rate",
                "The fire rate of this source in shots per second.");
            ((JsonFormTag)fireRateNumeric.Tag).ownerListBox = firesListBox;
            atAngleNumeric.Tag = new JsonFormTag(
                "stat.fires[].atAngle",
                "An angle value in radians to add to the player's aim angle.",
                false);
            ((JsonFormTag)atAngleNumeric.Tag).ownerListBox = firesListBox;
            firePointXNumeric.Tag = new JsonFormTag(
                "stat.fires[].firePoint.x",
                "The X offset from the weapon where the projectile spawns.",
                false);
            ((JsonFormTag)firePointXNumeric.Tag).ownerListBox = firesListBox;
            firePointYNumeric.Tag = new JsonFormTag(
                "stat.fires[].firePoint.y",
                "The Y offset from the weapon where the projectile spawns.",
                false);
            ((JsonFormTag)firePointYNumeric.Tag).ownerListBox = firesListBox;
            spreadMeanNumeric.Tag = new JsonFormTag(
                "stat.fires[].spread.mean",
                "The mean fire spread, in radians.",
                false);
            ((JsonFormTag)spreadMeanNumeric.Tag).ownerListBox = firesListBox;
            stdDevNumeric.Tag = new JsonFormTag(
                "stat.fires[].spread.stdDev",
                "The standard deviation of the spread, in radians.",
                false);
            ((JsonFormTag)stdDevNumeric.Tag).ownerListBox = firesListBox;
            soundFileTextBox.Tag = new JsonFormTag(
                "stat.fires[].soundFile",
                "Relative path to a sound to play when the weapon is fired.",
                false);
            ((JsonFormTag)soundFileTextBox.Tag).ownerListBox = firesListBox;
            kickNumeric.Tag = new JsonFormTag(
                "stat.fires[].kick",
                "Pixels of kick to apply to the screen of the weapon's user when fired.",
                false);
            ((JsonFormTag)kickNumeric.Tag).ownerListBox = firesListBox;

            textureFileTextBox.TextChanged += TextureFileChanged;
            soundFileTextBox.TextChanged += SoundFileChanged;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }
Пример #11
0
        public ProfessionValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "ident",
                "A unique string identifier for this profession.");
            nameTextBox.Tag = new JsonFormTag(
                "name",
                "The displayed name of this profession.");
            descTextBox.Tag = new JsonFormTag(
                "description",
                "A description, in a few sentences, of this profession and its perks.");
            pointsNumeric.Tag = new JsonFormTag(
                "points",
                "The number of character creation points this profession costs.");

            //TODO: flags?

            itemIdTextBox.Tag = new JsonFormTag(
                null,
                "The string identifier for this item.");
            ((JsonFormTag)itemIdTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            itemListBox.Tag = new JsonFormTag(
                "items",
                "A list of items a player choosing this profession starts with.");
            ListBoxTagData listBoxData = new ListBoxTagData();

            listBoxData.backingList  = items;
            listBoxData.defaultValue = "null";
            listBoxData.deleteButton = deleteItemButton;
            listBoxData.newButton    = newItemButton;
            listBoxData.keyControl   = itemIdTextBox;
            listBoxData.valueControl = null;
            ((JsonFormTag)itemListBox.Tag).listBoxData = listBoxData;

            skillComboBox.Tag = new JsonFormTag(
                null,
                "The string identifier for the skill used.");
            ((JsonFormTag)skillComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            skillLevelNumeric.Tag = new JsonFormTag(
                null,
                "The number of levels given to the specified skill.");
            skillsListBox.Tag = new JsonFormTag(
                "skills",
                "A list of skills a player choosing this profession starts with.");
            listBoxData             = new ListBoxTagData();
            listBoxData.backingList = skills;
            Dictionary <string, object> newitem = new Dictionary <string, object>();

            newitem.Add("name", "null");
            newitem.Add("level", 0);
            listBoxData.defaultValue = newitem;
            listBoxData.deleteButton = deleteSkillButton;
            listBoxData.newButton    = newSkillButton;
            listBoxData.keyControl   = skillComboBox;
            listBoxData.valueControl = skillLevelNumeric;
            ((JsonFormTag)skillsListBox.Tag).listBoxData = listBoxData;

            addictionTypeComboBox.Tag = new JsonFormTag(
                null,
                "The string identifier for this addiction.");
            ((JsonFormTag)addictionTypeComboBox.Tag).dataSource = JsonFormTag.DataSourceType.ADDICTION_TYPES;
            addictionStrengthNumeric.Tag = new JsonFormTag(
                null,
                "The initial strength of the addiction.");
            addictionsListBox.Tag = new JsonFormTag(
                "addictions",
                "A list of addictions a player choosing this profession starts with.");
            listBoxData             = new ListBoxTagData();
            listBoxData.backingList = addictions;
            newitem = new Dictionary <string, object>();
            newitem.Add("type", "null");
            newitem.Add("intensity", 0);
            listBoxData.defaultValue = newitem;
            listBoxData.deleteButton = deleteAddiction;
            listBoxData.newButton    = newAddiction;
            listBoxData.keyControl   = addictionTypeComboBox;
            listBoxData.valueControl = addictionStrengthNumeric;
            ((JsonFormTag)addictionsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }
Пример #12
0
        public ProfessionValues()
        {
            InitializeComponent();

            idTextBox.Tag = new JsonFormTag(
                "ident",
                "A unique string identifier for this profession.");
            nameTextBox.Tag = new JsonFormTag(
                "name",
                "The displayed name of this profession.");
            descTextBox.Tag = new JsonFormTag(
                "description",
                "A description, in a few sentences, of this profession and its perks.");
            pointsNumeric.Tag = new JsonFormTag(
                "points",
                "The number of character creation points this profession costs.");

            //TODO: flags?

            itemIdTextBox.Tag = new JsonFormTag(
                null,
                "The string identifier for this item.");
            ((JsonFormTag)itemIdTextBox.Tag).dataSource = JsonFormTag.DataSourceType.ITEMS;
            itemListBox.Tag = new JsonFormTag(
                "items",
                "A list of items a player choosing this profession starts with.");
            ListBoxTagData listBoxData = new ListBoxTagData();
            listBoxData.backingList = items;
            listBoxData.defaultValue = "null";
            listBoxData.deleteButton = deleteItemButton;
            listBoxData.newButton = newItemButton;
            listBoxData.keyControl = itemIdTextBox;
            listBoxData.valueControl = null;
            ((JsonFormTag)itemListBox.Tag).listBoxData = listBoxData;

            skillComboBox.Tag = new JsonFormTag(
                null,
                "The string identifier for the skill used.");
            ((JsonFormTag)skillComboBox.Tag).dataSource = JsonFormTag.DataSourceType.SKILLS;
            skillLevelNumeric.Tag = new JsonFormTag(
                null,
                "The number of levels given to the specified skill.");
            skillsListBox.Tag = new JsonFormTag(
                "skills",
                "A list of skills a player choosing this profession starts with.");
            listBoxData = new ListBoxTagData();
            listBoxData.backingList = skills;
            Dictionary<string, object> newitem = new Dictionary<string, object>();
            newitem.Add("name", "null");
            newitem.Add("level", 0);
            listBoxData.defaultValue = newitem;
            listBoxData.deleteButton = deleteSkillButton;
            listBoxData.newButton = newSkillButton;
            listBoxData.keyControl = skillComboBox;
            listBoxData.valueControl = skillLevelNumeric;
            ((JsonFormTag)skillsListBox.Tag).listBoxData = listBoxData;

            addictionTypeComboBox.Tag = new JsonFormTag(
                null,
                "The string identifier for this addiction.");
            ((JsonFormTag)addictionTypeComboBox.Tag).dataSource = JsonFormTag.DataSourceType.ADDICTION_TYPES;
            addictionStrengthNumeric.Tag = new JsonFormTag(
                null,
                "The initial strength of the addiction.");
            addictionsListBox.Tag = new JsonFormTag(
                "addictions",
                "A list of addictions a player choosing this profession starts with.");
            listBoxData = new ListBoxTagData();
            listBoxData.backingList = addictions;
            newitem = new Dictionary<string, object>();
            newitem.Add("type", "null");
            newitem.Add("intensity", 0);
            listBoxData.defaultValue = newitem;
            listBoxData.deleteButton = deleteAddiction;
            listBoxData.newButton = newAddiction;
            listBoxData.keyControl = addictionTypeComboBox;
            listBoxData.valueControl = addictionStrengthNumeric;
            ((JsonFormTag)addictionsListBox.Tag).listBoxData = listBoxData;

            WinformsUtil.ControlsAttachHooks(this);
            WinformsUtil.TagsSetDefaults(this);
        }