Skip to content

Commit

Permalink
Add New Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Dec 29, 2022
1 parent 3b5cd6f commit 3fd0d36
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/ArkPetsDefault.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"behavior_allow_sit":true,
"behavior_allow_walk":true,
"behavior_allow_sleep":false,
"behavior_do_peer_repulsion":true,
"character_recent":"",
"display_fps":30,
"display_margin_bottom":60,
Expand Down
1 change: 1 addition & 0 deletions core/src/com/isharryh/arkpets/ArkConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ArkConfig {
public boolean behavior_allow_walk;
public boolean behavior_allow_sit;
public boolean behavior_allow_interact;
public boolean behavior_do_peer_repulsion;

/** You are supposed to use the static function {@code ArkConfig.init()} to instantiate the ArkConfig,
* instead of using this constructor.
Expand Down
71 changes: 69 additions & 2 deletions desktop/src/com/isharryh/arkpets/ArkHome.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ public void changed (ChangeEvent event, Actor actor) {
});

// Help button
TextButton tButton2 = new TextButton("使用手册", skin);
TextButton tButton2 = new TextButton("帮助", skin);
tButton2.addListener(new ClickListener() {
@Override
public void clicked(InputEvent iEvent, float a, float b) {
Gdx.net.openURI("https://github.com/isHarryh/Ark-Pets#ark-pets");
mainStage = stageHelp();
}
});

Expand Down Expand Up @@ -324,6 +324,73 @@ public void clicked(InputEvent iEvent, float a, float b) {
return stage;
}

private Stage stageHelp() {
// Elements' containers
Stage stage = new Stage();
Table table = new Table();
TextButton close = new TextButton("返回", skin);
close.addListener(new ClickListener() {
@Override
public void clicked(InputEvent iEvent, float a, float b) {
mainStage = stageMainPage();
}
});
// Help button
TextButton tButton1 = new TextButton("常见问题", skin);
tButton1.addListener(new ClickListener() {
@Override
public void clicked(InputEvent iEvent, float a, float b) {
Gdx.net.openURI("https://github.com/isHarryh/Ark-Pets/blob/v1.x/docs/Q%26A.md");
}
});
TextButton tButton2 = new TextButton("门户网站", skin);
tButton2.addListener(new ClickListener() {
@Override
public void clicked(InputEvent iEvent, float a, float b) {
Gdx.net.openURI("http://arkpets.tfev.top");
}
});
TextButton tButton3 = new TextButton("项目仓库", skin);
tButton3.addListener(new ClickListener() {
@Override
public void clicked(InputEvent iEvent, float a, float b) {
Gdx.net.openURI("https://github.com/isHarryh/Ark-Pets");
}
});
CheckBox cBox1 = new CheckBox("能够被其他桌宠排斥", skin);
cBox1.setChecked(config.behavior_do_peer_repulsion);
cBox1.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
config.behavior_do_peer_repulsion = cBox1.isChecked();
config.saveConfig();
}
});
table.setFillParent(true);

// Show them
final float WD_W_CT = (float)(WD_W*0.5);
Window window = new Window(" 帮助与高级选项 ", skin);
window.defaults().spaceBottom(10);
window.setSize(WD_W, WD_H);
window.setPosition(0, 0, Align.center);
close.setPosition(WD_W - 5, 5, Align.bottomRight);
tButton1.setPosition(20, WD_H - 80);
tButton2.setPosition(20, WD_H - 120);
tButton3.setPosition(20, WD_H - 160);
cBox1.setPosition(25, WD_H - 200);

// Add actors
table.addActor(window);
table.addActor(close);
table.addActor(tButton1);
table.addActor(tButton2);
table.addActor(tButton3);
table.addActor(cBox1);
stage.addActor(table);
Gdx.input.setInputProcessor(stage);
return stage;
}

/* Functional Area */
/** Initialize the preview of model.
*/
Expand Down

0 comments on commit 3fd0d36

Please sign in to comment.