diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/SetNumVisibleAvs.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/console/SetNumVisibleAvs.java')
| -rw-r--r-- | NET/worlds/console/SetNumVisibleAvs.java | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/NET/worlds/console/SetNumVisibleAvs.java b/NET/worlds/console/SetNumVisibleAvs.java new file mode 100644 index 0000000..b1fea7d --- /dev/null +++ b/NET/worlds/console/SetNumVisibleAvs.java @@ -0,0 +1,101 @@ +package NET.worlds.console; + +import NET.worlds.core.IniFile; +import NET.worlds.network.Galaxy; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Event; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; + +public class SetNumVisibleAvs extends PolledDialog { + private static final long serialVersionUID = -1189914406658113132L; + private Button okButton = new Button(Console.message("Apply-Vis")); + CheckboxGroup numAvsChoice = new CheckboxGroup(); + CheckboxGroup fullAvsChoice = new CheckboxGroup(); + private static Font font = new Font(Console.message("MenuFont"), 0, 12); + + public SetNumVisibleAvs() { + super(Console.getFrame(), null, Console.message("Num-Visible"), true); + this.ready(); + } + + @Override + protected void build() { + this.setLayout(new BorderLayout()); + this.add("North", new Filler(5, 5)); + this.add("South", new Filler(10, 10)); + this.add("East", new Filler(5, 5)); + this.add("West", new Filler(5, 5)); + Panel main = new Panel(new BorderLayout()); + main.setFont(font); + main.add("North", new MultiLineLabel(Console.message("sel-max-av"), 5, 5)); + Panel choices = new Panel(new GridLayout(10, 2)); + int numAvs = IniFile.gamma().getIniInt("avatars", 24); + choices.add(new Label("")); + choices.add(new Label(Console.message("Max-Avs"))); + choices.add(new Label(Console.message("Slower"), 1)); + choices.add(new Checkbox("100", this.numAvsChoice, numAvs == 100)); + choices.add(new Label("")); + choices.add(new Checkbox("80", this.numAvsChoice, numAvs == 80)); + choices.add(new Label("")); + choices.add(new Checkbox("60", this.numAvsChoice, numAvs == 60)); + choices.add(new Label("")); + choices.add(new Checkbox("40", this.numAvsChoice, numAvs == 40)); + choices.add(new Label("")); + choices.add(new Checkbox("32", this.numAvsChoice, numAvs == 32)); + choices.add(new Label("")); + choices.add(new Checkbox("24", this.numAvsChoice, numAvs == 24)); + choices.add(new Label("")); + choices.add(new Checkbox("16", this.numAvsChoice, numAvs == 16)); + choices.add(new Label("")); + choices.add(new Checkbox("8", this.numAvsChoice, numAvs == 8)); + choices.add(new Label(Console.message("Faster"), 1)); + choices.add(new Checkbox("4", this.numAvsChoice, numAvs == 4)); + main.add("Center", choices); + main.add("South", this.okButton); + this.add("Center", main); + } + + @Override + public boolean action(Event event, Object what) { + Object target = event.target; + if (target == this.okButton) { + this.done(true); + return true; + } else { + return false; + } + } + + @Override + protected boolean done(boolean confirmed) { + if (confirmed) { + Checkbox c = this.numAvsChoice.getSelectedCheckbox(); + if (c != null) { + try { + IniFile.gamma().setIniInt("avatars", Integer.parseInt(c.getLabel())); + } catch (NumberFormatException var5) { + } + } + + c = this.fullAvsChoice.getSelectedCheckbox(); + if (c != null) { + try { + String s = c.getLabel(); + s = s.substring(0, s.length() - 1); + IniFile.gamma().setIniInt("fullavpercent", Integer.parseInt(s)); + } catch (NumberFormatException var4) { + } + } + + Galaxy.forceOffline(true); + } + + return super.done(confirmed); + } +} |