Skip to content

Commit

Permalink
Small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Mar 8, 2023
1 parent 75c6732 commit 01c402f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
28 changes: 16 additions & 12 deletions core/src/com/isharryh/arkpets/ArkChar.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,22 @@ public ArkChar(String $fp_atlas, String $fp_skel, float $anim_scale) {
private void loadSkeletonData (String $fp_atlas, String $fp_skel, float $scale) {
// Load atlas & skel/json files to SkeletonData
TextureAtlas atlas = new TextureAtlas(Gdx.files.internal($fp_atlas));
switch ($fp_skel.substring($fp_skel.lastIndexOf(".")).toLowerCase()) {
case ".skel":
SkeletonBinary binary = new SkeletonBinary(atlas);
binary.setScale($scale);
skeletonData = binary.readSkeletonData(Gdx.files.internal($fp_skel));
break;
case ".json":
SkeletonJson json = new SkeletonJson(atlas);
json.setScale($scale);
skeletonData = json.readSkeletonData(Gdx.files.internal($fp_skel));
break;
// default:
try {
switch ($fp_skel.substring($fp_skel.lastIndexOf(".")).toLowerCase()) {
case ".skel":
SkeletonBinary binary = new SkeletonBinary(atlas);
binary.setScale($scale);
skeletonData = binary.readSkeletonData(Gdx.files.internal($fp_skel));
break;
case ".json":
SkeletonJson json = new SkeletonJson(atlas);
json.setScale($scale);
skeletonData = json.readSkeletonData(Gdx.files.internal($fp_skel));
break;
// default:
}
} catch (SerializationException e) {
throw new RuntimeException("Launch ArkPets failed, the model asset may be inaccessible.");
}
// Write animations' names to the array
Array<Animation> animations = skeletonData.getAnimations();
Expand Down
6 changes: 4 additions & 2 deletions core/src/com/isharryh/arkpets/ArkPets.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.badlogic.gdx.InputProcessor;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;

import com.sun.jna.Pointer;
Expand Down Expand Up @@ -94,8 +95,9 @@ else if (BehaviorOperBuild.match(cha.anim_list))
else if (BehaviorOperBuild3.match(cha.anim_list))
behavior = new BehaviorOperBuild3(config);
else {
Gdx.app.error("error", "AP:No suitable ArkPets behavior instance found.");
Gdx.app.exit();
Gdx.app.error("error", "AP:No suitable ArkPets behavior instance found, you can contact the developer.\n" +
"This model only contains the animation below:\n" + Arrays.toString(cha.anim_list));
throw new RuntimeException("Launch ArkPets failed due to unsupported model.");
}
Gdx.app.log("info", "AP:Use "+behavior.getClass().getName());
cha.setAnimation(behavior.defaultAnim());
Expand Down
1 change: 0 additions & 1 deletion core/src/com/isharryh/arkpets/ArkTray.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ public void mouseReleased(MouseEvent e) {
tray.add(icon);
} catch (AWTException e) {
Gdx.app.log("warning", "Tray:Unable to apply tray icon. " + e);
User32.INSTANCE.SetWindowLong(arkPets.HWND_MINE, WinUser.GWL_EXSTYLE, 0x00000008);
}
}

Expand Down

0 comments on commit 01c402f

Please sign in to comment.