Version 0.999 BETA - a lot of bug fixes, improvments and more advanced bot

This commit is contained in:
OTCv8
2019-10-31 05:46:22 +01:00
parent 017fa290b4
commit 06b08af1df
36 changed files with 1513 additions and 415 deletions

View File

@@ -0,0 +1,56 @@
local activeWindow
function init()
g_ui.importStyle('textedit')
connect(g_game, { onGameEnd = destroyWindow })
end
function terminate()
disconnect(g_game, { onGameEnd = destroyWindow })
destroyWindow()
end
function destroyWindow()
if activeWindow then
activeWindow:destroy()
activeWindow = nil
end
end
function show(widget)
if not widget then
return
end
if activeWindow then
destroyWindow()
end
local window = g_ui.createWidget('TextEditWindow', rootWidget)
local destroy = function()
window:destroy()
if window == activeWindow then
activeWindow = nil
end
end
local doneFunc = function()
widget:setText(window.text:getText())
destroy()
end
window.okButton.onClick = doneFunc
window.cancelButton.onClick = destroy
window.onEnter = doneFunc
window.onEscape = destroy
window.text:setText(widget:getText())
activeWindow = window
activeWindow:raise()
activeWindow:focus()
end
function hide()
destroyWindow()
end

View File

@@ -0,0 +1,10 @@
Module
name: game_textedit
description: Allow to edit text
author: OTClientV8
website: https://github.com/OTCv8/otclientv8
sandboxed: true
dependencies: [ game_interface ]
scripts: [ textedit ]
@onLoad: init()
@onUnload: terminate()

View File

@@ -0,0 +1,25 @@
TextEditWindow < MainWindow
id: textedit
size: 260 105
!text: tr("Edit text")
TextEdit
id: text
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
Button
id: okButton
!text: tr('Ok')
anchors.bottom: parent.bottom
anchors.right: next.left
margin-right: 10
width: 60
Button
id: cancelButton
!text: tr('Cancel')
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60