Integrate with loeb #35
This commit is contained in:
@@ -24,6 +24,13 @@
|
|||||||
"UICallback": {
|
"UICallback": {
|
||||||
"After": "pulseInit"
|
"After": "pulseInit"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Path": "pulse-loeb-component.nut",
|
||||||
|
"RunOn": "UI",
|
||||||
|
"UICallback": {
|
||||||
|
"After": "pulseRegisterWithLoeb"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Localisation": [
|
"Localisation": [
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ globalize_all_functions
|
|||||||
|
|
||||||
|
|
||||||
global string pulsePrefix
|
global string pulsePrefix
|
||||||
global bool pulseFailure = true
|
|
||||||
table withMapName = {}
|
table withMapName = {}
|
||||||
void function pulsePrefixSet() //Sets our prefix
|
void function pulsePrefixSet() //Sets our prefix
|
||||||
{
|
{
|
||||||
@@ -31,16 +30,13 @@ bool function pulseRequestData(string givenURL, table parameterTable, string tab
|
|||||||
} else {
|
} else {
|
||||||
pulseData[tablepath] <- DecodedJSON
|
pulseData[tablepath] <- DecodedJSON
|
||||||
}
|
}
|
||||||
pulseFailure = false
|
|
||||||
} else {
|
} else {
|
||||||
pulseFailure = true
|
|
||||||
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
pulsePrintt(format("%s, %s is unreachable.", response.statusCode, givenURL))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
void functionref (HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) : (givenURL)
|
||||||
{
|
{
|
||||||
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
pulsePrintt(format("Something went wrong, %s is unreachable", givenURL))
|
||||||
pulseFailure = true
|
|
||||||
}
|
}
|
||||||
foreach (key, value in parameterTable)
|
foreach (key, value in parameterTable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
global function pulseRegisterWithLoeb
|
||||||
|
global function pulseLoebFunc
|
||||||
|
|
||||||
|
void function pulseRegisterWithLoeb()
|
||||||
|
{
|
||||||
|
loebLogMod(pulseLoebFunc())
|
||||||
|
}
|
||||||
|
|
||||||
|
void function pulseLoebFunc()
|
||||||
|
{
|
||||||
|
print("func called")
|
||||||
|
GetStats()
|
||||||
|
}
|
||||||
|
|
||||||
|
void function GetStats()
|
||||||
|
{
|
||||||
|
loebSetLockedButton(Localize("#MENU_TITLE_STATS"), pulseGetData())
|
||||||
|
}
|
||||||
@@ -14,17 +14,34 @@ void function pulseInit()
|
|||||||
pulsePrintt("Initialized.")
|
pulsePrintt("Initialized.")
|
||||||
}
|
}
|
||||||
|
|
||||||
void function pulseGetData()
|
bool function pulseGetData()
|
||||||
{
|
{
|
||||||
|
print("data getter called")
|
||||||
string URL = GetConVarString("ToneURL")
|
string URL = GetConVarString("ToneURL")
|
||||||
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
array <string> URLpath = ["/weapons", "/weapons", "/gamemodes", "/gamemodes", "/maps"]
|
||||||
array <string> tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
array <string> tablepath = ["weaponsLocal", "weaponsGlobal", "gamemodesAll", "gamemodesSeparated", "maps"]
|
||||||
pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0])
|
if (!pulseRequestData(URL + URLpath[0], {["player"] = NSGetLocalPlayerUID()}, tablepath[0]))
|
||||||
pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1])
|
{
|
||||||
pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2])
|
return true
|
||||||
|
}
|
||||||
|
if (!pulseRequestData(URL + URLpath[1], {["player"] = "!" + NSGetLocalPlayerUID()}, tablepath[1]))
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (!pulseRequestData(URL + URLpath[2], {["player"] = NSGetLocalPlayerUID()}, tablepath[2]))
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
foreach (map in file.allMaps)
|
foreach (map in file.allMaps)
|
||||||
{
|
{
|
||||||
pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3])
|
if (!pulseRequestData(URL + URLpath[3], {["player"] = NSGetLocalPlayerUID(), ["map"] = map.slice(3)}, tablepath[3]))
|
||||||
|
{
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4])
|
}
|
||||||
|
if (!pulseRequestData(URL + URLpath[4], {["player"] = NSGetLocalPlayerUID()}, tablepath[4]))
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user