Skip to content

Instantly share code, notes, and snippets.

@nakosung
Last active December 1, 2015 05:21
Show Gist options
  • Save nakosung/756aed5399da66ed40d7 to your computer and use it in GitHub Desktop.
Save nakosung/756aed5399da66ed40d7 to your computer and use it in GitHub Desktop.
const THE_URL = "https://gist.githubusercontent.com/nakosung/ee76a5f41a59627f22cf/raw"
let actor = null
function write(something) {
if (actor == null) {
actor = new TextRenderActor(GWorld, { X: 800, Z: 100 }, { Yaw: 180 })
actor.TextRender.SetHorizontalAlignment('EHTA_Center')
}
actor.TextRender.K2_SetText(something)
}
function load(url) {
write("loading " + url)
return new Promise((resolve, reject) => {
var req = new JavascriptHttpRequest()
req.SetVerb("GET")
req.SetURL(url)
req.OnComplete.Add(function (success) {
if (success) {
let result = eval(req.GetContentAsString())
write("loading " + url + ":done")
try {
resolve(result)
write("done!!!")
} catch (e) {
write(String(e))
}
} else {
write("loading " + url + ":fail")
reject()
}
})
req.ProcessRequest()
})
}
load("https://gist.githubusercontent.com/nakosung/447be3145bbf2d8c1f9d/raw/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment