diff --git a/core/src/cn/harryh/arkpets/ArkChar.java b/core/src/cn/harryh/arkpets/ArkChar.java
index 88bbdcfd..3a4e49a7 100644
--- a/core/src/cn/harryh/arkpets/ArkChar.java
+++ b/core/src/cn/harryh/arkpets/ArkChar.java
@@ -85,8 +85,8 @@ public ArkChar(String assetLocation, AssetItem.AssetAccessor assetAccessor, floa
animList = new AnimClipGroup(skeletonData.getAnimations().toArray(Animation.class));
// 4.Animation mixing
AnimationStateData asd = new AnimationStateData(skeletonData);
- for (AnimClip i: animList)
- for (AnimClip j: animList)
+ for (AnimClip i : animList)
+ for (AnimClip j : animList)
if (!i.fullName.equals(j.fullName))
asd.setMix(i.fullName, j.fullName, easingDuration);
// 5.Animation state setup
@@ -105,6 +105,7 @@ protected void onApply(AnimData playing) {
setCanvas(new Color(0, 0, 0, 0));
stageInsertMap = new HashMap<>();
for (AnimStage stage : animList.clusterByStage().keySet()) {
+ // Figure out the suitable canvas size
AnimClipGroup stageClips = animList.findAnimations(stage);
double maxHypSize = 0;
for (int i = 0; i < stageClips.size(); i++) {
@@ -118,12 +119,16 @@ protected void onApply(AnimData playing) {
stageInsertMap.put(stage, camera.getInsert().clone());
}
}
+ // See if it succeeded
if (!stageInsertMap.containsKey(stage)) {
stageInsertMap.put(stage, new Insert((canvasReserveLength << 1) - (canvasMaxSize >> 1)));
Logger.warn("Character", stage + " figuring camera size failed");
+ } else {
+ camera.setInsert(stageInsertMap.get(stage));
+ Logger.info("Character", stage + " using " + camera);
}
- Logger.info("Character", stage + " using " + camera);
}
+ camera.setInsertMaxed();
}
/** Sets the canvas with the specified background color.
@@ -220,7 +225,7 @@ protected void renderToBatch() {
}
- public static class AnimComposer {
+ protected static class AnimComposer {
protected final AnimationState state;
protected AnimData playing;
diff --git a/core/src/cn/harryh/arkpets/ArkPets.java b/core/src/cn/harryh/arkpets/ArkPets.java
index 1bab7661..c34bbce9 100644
--- a/core/src/cn/harryh/arkpets/ArkPets.java
+++ b/core/src/cn/harryh/arkpets/ArkPets.java
@@ -88,7 +88,7 @@ public void create() {
ArkConfig.Monitor primaryMonitor = ArkConfig.Monitor.getMonitors()[0];
initWindow((int)(primaryMonitor.size[0] * 0.1f), (int)(primaryMonitor.size[0] * 0.1f));
// 5.Tray icon setup
- tray = new MemberTrayImpl(this, new SocketClient(), UUID.randomUUID());
+ tray = new MemberTrayImpl(this, new SocketClient());
// Setup complete
Logger.info("App", "Render");
}
@@ -166,11 +166,8 @@ public void setAlwaysTransparent(boolean alwaysTransparent) {
}
private void changeAnimation(AnimData animData) {
- if (animData != null && !animData.isEmpty()) {
- // If it is needed to change animation:
- if (cha.setAnimation(animData))
- offsetY = (int)(animData.offsetY() * config.display_scale);
- }
+ if (cha.setAnimation(animData))
+ offsetY = (int)(animData.offsetY() * config.display_scale);
}
/* INPUT PROCESS */
@@ -209,7 +206,7 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
- Logger.debug("Input", "Dragged to " + screenX + ", " + screenY);
+ //Logger.debug("Input", "Dragged to " + screenX + ", " + screenY);
if (pointer <= 0) {
if (isMouseAtSolidPixel()) {
mouse_drag = true;
diff --git a/core/src/cn/harryh/arkpets/tray/MemberTray.java b/core/src/cn/harryh/arkpets/tray/MemberTray.java
index 5374ed96..1ebb6153 100644
--- a/core/src/cn/harryh/arkpets/tray/MemberTray.java
+++ b/core/src/cn/harryh/arkpets/tray/MemberTray.java
@@ -24,8 +24,11 @@ public abstract class MemberTray {
Const.FontsConfig.loadFontsToSwing();
}
- public MemberTray(UUID uuid, String name) {
- this.uuid = uuid;
+ /** Initializes a tray icon instance for a ArkPets.
+ * @param name The name to be displayed in the menu, in the icon tooltip, etc.
+ */
+ public MemberTray(String name) {
+ this.uuid = UUID.randomUUID();
this.name = name;
optKeepAnimEn .addActionListener(e -> onKeepAnimEn());
diff --git a/core/src/cn/harryh/arkpets/tray/MemberTrayImpl.java b/core/src/cn/harryh/arkpets/tray/MemberTrayImpl.java
index cd725f57..4d5f2a0f 100644
--- a/core/src/cn/harryh/arkpets/tray/MemberTrayImpl.java
+++ b/core/src/cn/harryh/arkpets/tray/MemberTrayImpl.java
@@ -18,7 +18,6 @@
import java.awt.geom.AffineTransform;
import java.util.Timer;
import java.util.TimerTask;
-import java.util.UUID;
import static cn.harryh.arkpets.Const.iconFilePng;
import static cn.harryh.arkpets.Const.easingDuration;
@@ -32,12 +31,13 @@ public class MemberTrayImpl extends MemberTray {
private TrayIcon icon;
public AnimData keepAnim;
- /** Initializes the ArkPets tray icon instance.
+ /** Initializes a per-character tray icon instance for an ArkPets.
* Must be used after Gdx.app was initialized.
* @param boundArkPets The ArkPets instance that bound to the tray icon.
+ * @param client The socket client that bound to the tray icon.
*/
- public MemberTrayImpl(ArkPets boundArkPets, SocketClient client, UUID uuid) {
- super(uuid, getName(boundArkPets));
+ public MemberTrayImpl(ArkPets boundArkPets, SocketClient client) {
+ super(getName(boundArkPets));
arkPets = boundArkPets;
this.client = client;
diff --git a/core/src/cn/harryh/arkpets/tray/MemberTrayProxy.java b/core/src/cn/harryh/arkpets/tray/MemberTrayProxy.java
index 23cd7d8c..f0fe4efa 100644
--- a/core/src/cn/harryh/arkpets/tray/MemberTrayProxy.java
+++ b/core/src/cn/harryh/arkpets/tray/MemberTrayProxy.java
@@ -15,8 +15,13 @@ public class MemberTrayProxy extends MemberTray {
private final HostTray hostTray;
private final JMenu popMenu;
+ /** Initializes a host-proxy tray icon instance for a registering ArkPets.
+ * @param socketData The ArkPets login data.
+ * @param session The session to communicate with that ArkPets.
+ * @param hostTray The host tray to apply this tray instance.
+ */
public MemberTrayProxy(SocketData socketData, SocketSession session, HostTray hostTray) {
- super(socketData.uuid, socketData.getMsgString());
+ super(socketData.getMsgString());
this.session = session;
this.hostTray = hostTray;
diff --git a/core/src/cn/harryh/arkpets/utils/DynamicOrthographicCamara.java b/core/src/cn/harryh/arkpets/utils/DynamicOrthographicCamara.java
index 04af6899..30596723 100644
--- a/core/src/cn/harryh/arkpets/utils/DynamicOrthographicCamara.java
+++ b/core/src/cn/harryh/arkpets/utils/DynamicOrthographicCamara.java
@@ -249,7 +249,7 @@ public int hashCode() {
@Override
public String toString() {
- return "^" + top + "\tv" + bottom + "\t<" + left + "\t>" + right;
+ return "^" + top + " v" + bottom + " <" + left + " >" + right;
}
}
}
diff --git a/core/src/cn/harryh/arkpets/utils/HWndCtrl.java b/core/src/cn/harryh/arkpets/utils/HWndCtrl.java
index 2177a13a..a04d34b3 100644
--- a/core/src/cn/harryh/arkpets/utils/HWndCtrl.java
+++ b/core/src/cn/harryh/arkpets/utils/HWndCtrl.java
@@ -10,7 +10,6 @@
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.platform.win32.WinUser;
-import com.sun.jna.win32.W32APIOptions;
import java.util.ArrayList;
@@ -287,13 +286,6 @@ public int hashCode() {
@Override
public String toString() {
- return "‘" + windowText + "’ " + windowWidth + "*" + windowHeight;
- }
-
-
- private interface GDI32Extended extends com.sun.jna.platform.win32.GDI32 {
- GDI32Extended INSTANCE = Native.load("gdi32", GDI32Extended.class, W32APIOptions.DEFAULT_OPTIONS);
-
- int GetPixel(WinDef.HDC hdc, int x, int y);
+ return "‘" + windowText + "’ " + windowWidth + "*" + windowHeight + " style=" + getWindowExStyle();
}
}
diff --git a/core/src/cn/harryh/arkpets/utils/Version.java b/core/src/cn/harryh/arkpets/utils/Version.java
index 000ac18b..8e85cfc3 100644
--- a/core/src/cn/harryh/arkpets/utils/Version.java
+++ b/core/src/cn/harryh/arkpets/utils/Version.java
@@ -15,10 +15,10 @@
* @see semver.org
*/
public class Version {
- protected int major;
- protected int minor;
- protected int patch;
- protected static final int defaultNumber = 0;
+ private final int major;
+ private final int minor;
+ private final int patch;
+ private static final int defaultNumber = 0;
public Version(int major, int minor, int patch) {
this.major = major;