- Reaction score
- 293
For previous maps I just searched SC2mapster for a voting system instead of writing my own but I felt all the ones I found lacked some key features. So for my new map I decided to write a very customizable voting system with all the features I feel are needed.
You specify the amount of things to vote for, the amount of choices each thing you vote for has(so you can vote for one thing that has two options and one that has three), you also specify the names of the different things, possibly the timeout timer.
You can also specify some constants on the dialog but they come with some decent values.
One of the things I like about it is that it automatically scales up your dialog depending on the amount of buttons you have so you don't have to specify the exact width and height.
The colored line shows the different constants you can change to change the dialog's size.
Blue is Vote Edge Offset.
Red is Choice Gap
Yellow is Vote gap(basically the distance between the different things you vote for)
Pink is Choice Button Width
White is Choice Button height.
Features:
Tutorial:
Basically, there are 2 parts to edit.
* The appearence of the dialog box
* The polls and all the button info.
Dialog Appearence:
The library comes with some default values that work fine. If you do want to edit it, the variables you need to edit are: Vote edge offset, choice gap, vote gap, choice button width and choice button height. Use the picture above for reference on how to use them.
Poll info:
There's a couple of places to modify to fix this part.
First place is the Init Vote Options function. It comes with some default stuff(that you probably want to change) but it should help you to get started.
Basically:
Vote Options.Polls = the amount of polls(things to vote for)
Vote Options.Choices[x] = the amount of choices for the Xth poll.
Vote Option.Choice Names[x][y] = The name of the Yth choice on the Xth poll
Vote Options.Poll names[x] = Name of the Xth poll.
To modify the things that happens when a choice is voted for, go to Apply vote results. For each poll you need a switch and for each choice you need a case in the switch. You should be able to figure it out from the defaults in there.
You might also want to modify the Timeout time. That is the time you have to vote before the vote expires.
Download: View attachment JAVA.SC2Lib
You specify the amount of things to vote for, the amount of choices each thing you vote for has(so you can vote for one thing that has two options and one that has three), you also specify the names of the different things, possibly the timeout timer.
You can also specify some constants on the dialog but they come with some decent values.
One of the things I like about it is that it automatically scales up your dialog depending on the amount of buttons you have so you don't have to specify the exact width and height.

The colored line shows the different constants you can change to change the dialog's size.
Blue is Vote Edge Offset.
Red is Choice Gap
Yellow is Vote gap(basically the distance between the different things you vote for)
Pink is Choice Button Width
White is Choice Button height.
Features:
- Automatically scales width and height to fit your settings.
- Allows you to vote for several different things with different amount of choices.
- Timeout timer
- Allows you to change your votes around.
Tutorial:
Basically, there are 2 parts to edit.
* The appearence of the dialog box
* The polls and all the button info.
Dialog Appearence:
The library comes with some default values that work fine. If you do want to edit it, the variables you need to edit are: Vote edge offset, choice gap, vote gap, choice button width and choice button height. Use the picture above for reference on how to use them.
Poll info:
There's a couple of places to modify to fix this part.
First place is the Init Vote Options function. It comes with some default stuff(that you probably want to change) but it should help you to get started.
Basically:
Vote Options.Polls = the amount of polls(things to vote for)
Vote Options.Choices[x] = the amount of choices for the Xth poll.
Vote Option.Choice Names[x][y] = The name of the Yth choice on the Xth poll
Vote Options.Poll names[x] = Name of the Xth poll.
To modify the things that happens when a choice is voted for, go to Apply vote results. For each poll you need a switch and for each choice you need a case in the switch. You should be able to figure it out from the defaults in there.
You might also want to modify the Timeout time. That is the time you have to vote before the vote expires.
Download: View attachment JAVA.SC2Lib