Bugfixes for Steam

This commit is contained in:
Anuken
2019-11-04 22:18:34 -05:00
parent 08b730a349
commit 6153764c0d
7 changed files with 30 additions and 19 deletions
+1
View File
@@ -92,6 +92,7 @@ mods = Mods
mods.none = [LIGHT_GRAY]No mods found! mods.none = [LIGHT_GRAY]No mods found!
mods.guide = Modding Guide mods.guide = Modding Guide
mods.report = Report Bug mods.report = Report Bug
mods.openfolder = Open Mod Folder
mod.enabled = [lightgray]Enabled mod.enabled = [lightgray]Enabled
mod.disabled = [scarlet]Disabled mod.disabled = [scarlet]Disabled
mod.disable = Disable mod.disable = Disable
+1 -1
View File
@@ -198,7 +198,7 @@ public class Mods implements Loadable{
}else{ }else{
disabled.add(mod); disabled.add(mod);
} }
mod.addSteamID(file.parent().name()); mod.addSteamID(file.name());
}catch(Exception e){ }catch(Exception e){
Log.err("Failed to load mod workshop file {0}. Skipping.", file); Log.err("Failed to load mod workshop file {0}. Skipping.", file);
Log.err(e); Log.err(e);
@@ -21,8 +21,14 @@ public class ModsDialog extends FloatingDialog{
super("$mods"); super("$mods");
addCloseButton(); addCloseButton();
buttons.addImageTextButton("$mods.report", Icon.link, buttons.addImageTextButton(mobile ? "$mods.report" : "$mods.openfolder", Icon.link,
() -> Core.net.openURI(reportIssueURL)) () -> {
if(mobile){
Core.net.openURI(reportIssueURL);
}else{
Core.net.openFolder(modDirectory.absolutePath());
}
})
.size(250f, 64f); .size(250f, 64f);
buttons.row(); buttons.row();
@@ -15,27 +15,29 @@ public class RadialTreeLayout implements TreeLayout{
delta = root.height * 2.4f; delta = root.height * 2.4f;
bfs(root, true); bfs(root, true);
radialize(root, 0, 360);
ObjectSet<TreeNode> all = new ObjectSet<>(visited);
for(TreeNode node : all){
node.leaves = bfs(node, false);
}
radialize(root, startRadius, 0, 360);
} }
void radialize(TreeNode root, float from, float to){ void radialize(TreeNode root, float radius, float from, float to){
int depthOfVertex = root.number; float angle = from;
float theta = from;
float radius = startRadius + (delta * depthOfVertex);
int leavesNumber = bfs(root, false);
for(TreeNode child : root.children){ for(TreeNode child : root.children){
int lambda = bfs(child, false); float nextAngle = angle + ((float)child.leaves / root.leaves * (to - from));
float mi = theta + ((float)lambda / leavesNumber * (to - from));
float x = radius * Mathf.cos((theta + mi) / 2f * Mathf.degRad); float x = radius * Mathf.cos((angle + nextAngle) / 2f * Mathf.degRad);
float y = radius * Mathf.sin((theta + mi) / 2f * Mathf.degRad); float y = radius * Mathf.sin((angle + nextAngle) / 2f * Mathf.degRad);
child.x = x; child.x = x;
child.y = y; child.y = y;
if(child.children.length > 0) radialize(child, theta, mi); if(child.children.length > 0) radialize(child, radius + delta, angle, nextAngle);
theta = mi; angle = nextAngle;
} }
} }
@@ -54,8 +56,7 @@ public class RadialTreeLayout implements TreeLayout{
for(TreeNode child : current.children){ for(TreeNode child : current.children){
if(assign) child.number = current.number + 1; if(assign) child.number = current.number + 1;
if(!visited.contains(child)){ if(visited.add(child)){
visited.add(child);
queue.addLast(child); queue.addLast(child);
} }
} }
@@ -12,7 +12,7 @@ public interface TreeLayout{
//internal stuff //internal stuff
public float mode, prelim, change, shift; public float mode, prelim, change, shift;
public int number = -1; public int number = -1, leaves;
public TreeNode thread, ancestor; public TreeNode thread, ancestor;
public boolean isLeaf(){ public boolean isLeaf(){
@@ -83,13 +83,16 @@ public class SWorkshop implements SteamUGCCallback{
public void viewListing(Publishable p){ public void viewListing(Publishable p){
long handle = Strings.parseLong(p.getSteamID(), -1); long handle = Strings.parseLong(p.getSteamID(), -1);
SteamPublishedFileID id = new SteamPublishedFileID(handle); SteamPublishedFileID id = new SteamPublishedFileID(handle);
Log.info("Handle = " + handle);
ui.loadfrag.show(); ui.loadfrag.show();
query(ugc.createQueryUGCDetailsRequest(id), (detailsList, result) -> { query(ugc.createQueryUGCDetailsRequest(id), (detailsList, result) -> {
ui.loadfrag.hide(); ui.loadfrag.hide();
Log.info("Fetch result = " + result);
if(result == SteamResult.OK){ if(result == SteamResult.OK){
SteamUGCDetails details = detailsList.first(); SteamUGCDetails details = detailsList.first();
Log.info("Details result = " + details.getResult());
if(details.getResult() == SteamResult.OK){ if(details.getResult() == SteamResult.OK){
if(details.getOwnerID().equals(SVars.user.user.getSteamID())){ if(details.getOwnerID().equals(SVars.user.user.getSteamID())){
+1 -1
View File
@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=a9f704acf0cf17b7044a5659bf62be33cfbffb0f archash=1d0223f7e3290454b313f295e8578216c95c024e