This commit is contained in:
Dayve
2016-05-18 19:31:04 +10:00
7 changed files with 39 additions and 25 deletions

View File

@@ -319,7 +319,7 @@ function TreeViewClass:DrawTree(build, viewPort, inputEvents)
if node.ascendancyName and node.ascendancyName ~= spec.curAscendClassName then
SetDrawColor(0.5, 0.5, 0.5)
end
if IsKeyDown("ALT") then
if launch.devMode and IsKeyDown("ALT") then
if node.extra then
SetDrawColor(1, 0, 0)
elseif node.unknown then
@@ -456,7 +456,7 @@ function TreeViewClass:AddNodeTooltip(node, build)
if jewel then
build.items:AddItemTooltip(jewel, build)
else
main:AddTooltipLine(24, "^7"..node.dn..(IsKeyDown("ALT") and " ["..node.id.."]" or ""))
main:AddTooltipLine(24, "^7"..node.dn..(launch.devMode and IsKeyDown("ALT") and " ["..node.id.."]" or ""))
end
main:AddTooltipSeperator(14)
main:AddTooltipLine(14, "^x80A080Tip: Right click this socket to go to the items page and choose the jewel for this socket.")
@@ -464,8 +464,8 @@ function TreeViewClass:AddNodeTooltip(node, build)
end
-- Node name
main:AddTooltipLine(24, "^7"..node.dn..(IsKeyDown("ALT") and " ["..node.id.."]" or ""))
if IsKeyDown("ALT") and node.power and node.power.dps then
main:AddTooltipLine(24, "^7"..node.dn..(launch.devMode and IsKeyDown("ALT") and " ["..node.id.."]" or ""))
if launch.devMode and IsKeyDown("ALT") and node.power and node.power.dps then
main:AddTooltipLine(16, string.format("DPS power: %g Defence power: %g", node.power.dps, node.power.def))
end
@@ -474,7 +474,7 @@ function TreeViewClass:AddNodeTooltip(node, build)
main:AddTooltipLine(16, "")
for i, line in ipairs(node.sd) do
if node.mods[i].list then
if IsKeyDown("ALT") then
if launch.devMode and IsKeyDown("ALT") then
local modStr
for k, v in pairs(node.mods[i].list) do
modStr = (modStr and modStr..", " or "^2") .. string.format("%s = %s", k, tostring(v))

View File

@@ -13,6 +13,11 @@ local launch = { }
SetMainObject(launch)
function launch:OnInit()
if GetScriptPath() ~= GetRuntimePath() then
-- We are running from an external runtime
-- Force developer mode to disable update checks
self.devMode = true
end
ConPrintf("Loading main script...")
local mainFile = io.open("Modules/Main.lua")
if mainFile then
@@ -40,7 +45,10 @@ function launch:OnInit()
self:ShowErrMsg("In 'Init': %s", errMsg)
end
end
self:CheckForUpdate(true)
if not self.devMode then
-- Run a background update check if developer mode is off
self:CheckForUpdate(true)
end
end
function launch:OnExit()
@@ -78,7 +86,9 @@ function launch:OnKeyDown(key, doubleClick)
if key == "F5" then
self.doRestart = true
elseif key == "u" and IsKeyDown("CTRL") then
self:CheckForUpdate()
if not self.devMode then
self:CheckForUpdate()
end
elseif self.promptMsg then
local errMsg, ret = PCall(self.promptFunc, key)
if errMsg then
@@ -157,7 +167,7 @@ function launch:ApplyUpdate(mode)
-- Update can be applied while normal environment is running
LoadModule("Update")
Restart()
self.doRestart = true -- Will show "Restarting" message if main window is showing
self.doRestart = true -- Will show "Restarting" message if main window is open
end
end
@@ -166,7 +176,7 @@ function launch:CheckForUpdate(inBackground)
self.updateChecking = not inBackground
self.updateMsg = ""
local update = io.open("Update.lua", "r")
LaunchSubScript(update:read("*a"), "MakeDir", "ConPrintf", "CHECK")
LaunchSubScript(update:read("*a"), "GetWorkDir,MakeDir", "ConPrintf", "CHECK")
update:close()
end
end

View File

@@ -318,7 +318,7 @@ function items:AddItemTooltip(item)
end
end
end
if IsKeyDown("ALT") then
if launch.devMode and IsKeyDown("ALT") then
main:AddTooltipSeperator(10)
local nameList = { }
for k in pairs(modList) do

View File

@@ -75,6 +75,10 @@ function main:OnFrame()
common.controlsDraw(self)
if launch.devMode then
DrawString(4, 4, "RIGHT", 18, "VAR", "^1Dev Mode")
end
wipeTable(self.inputEvents)
end
@@ -139,7 +143,7 @@ function main:LoadSettings()
end
self.buildPath = node.attrib.path
elseif node.elem == "DevMode" then
self.devMode = node.attrib.enable == "true"
launch.devMode = node.attrib.enable == "true"
end
end
end
@@ -161,7 +165,7 @@ function main:SaveSettings()
end
t_insert(setXML, mode)
t_insert(setXML, { elem = "BuildPath", attrib = { path = self.buildPath } })
t_insert(setXML, { elem = "DevMode", attrib = { enable = self.devMode and "true" or "false" } })
t_insert(setXML, { elem = "DevMode", attrib = { enable = launch.devMode and "true" or "false" } })
local res, errMsg = common.xml.SaveXMLFile(setXML, "Settings.xml")
if not res then
launch:ShowErrMsg("Error saving 'Settings.xml': %s", errMsg)

View File

@@ -210,22 +210,21 @@ if mode == "CHECK" then
xml.SaveXMLFile(localManXML, "Update/manifest.xml")
-- Build list of operations to apply the update
local coreUpdate = false
local updateMode = "normal"
local ops = { }
for _, data in pairs(updateFiles) do
if data.platform then
-- Core platform file, will need to update from the basic environment
coreUpdate = true
-- Tell update code to pause until this file is writable
table.insert(ops, 'wait "'..data.name..'"')
end
end
for _, data in pairs(updateFiles) do
-- Ensure that the destination path of this file exists
local dirStr = ""
for dir in data.name:gmatch("([^/]+/)") do
dirStr = dirStr .. dir
MakeDir(dirStr)
end
if data.platform then
-- Core platform file, will need to update from the basic environment
updateMode = "basic"
-- Tell update code to pause until this file is writable
table.insert(ops, 'wait "'..data.name..'"')
end
table.insert(ops, 'copy "'..data.updateFileName..'" "'..data.name..'"')
table.insert(ops, 'delete "'..data.updateFileName..'"')
end
@@ -234,7 +233,8 @@ if mode == "CHECK" then
end
table.insert(ops, 'copy "Update/manifest.xml" "manifest.xml"')
table.insert(ops, 'delete "Update/manifest.xml"')
if coreUpdate then
if updateMode == "basic" then
-- Update script will need to relaunch the normal environment after updating
table.insert(ops, 'launch')
end
@@ -244,7 +244,7 @@ if mode == "CHECK" then
opFile:close()
ConPrintf("Update is ready.")
return coreUpdate and "basic" or "normal"
return updateMode
end
print("Applying update...")

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<PoBVersion>
<Version number="0.1.0"/>
<Source part="program" url="https://raw.githubusercontent.com/Openarl/PathOfBuilding/master/"/>
<Source url="https://raw.githubusercontent.com/Openarl/PathOfBuilding/master/runtime-win32.zip" part="runtime" platform="win32"/>
<Source part="program" url="https://raw.githubusercontent.com/Openarl/PathOfBuilding/dev/"/>
<Source url="https://raw.githubusercontent.com/Openarl/PathOfBuilding/dev/runtime-win32.zip" part="runtime" platform="win32"/>
<File sha1="e95fac891f87e79401f3158bf4baf4545c32dbc0" name="Launch.lua" part="program"/>
<File sha1="e33daa13951d2002db2d273fe139301c8bee5efb" name="Update.lua" part="program"/>
<File sha1="434890f159cb67a73b0489e07471a101582e7168" name="Classes/ButtonControl.lua" part="program"/>

BIN
runtime-win32.zip Normal file

Binary file not shown.