add a new folder structure redesign organized by packages

This commit is contained in:
Eduardo Bart
2011-07-17 08:52:20 -03:00
parent b1a881eb06
commit ab7394f357
56 changed files with 586 additions and 212 deletions

View File

@@ -0,0 +1,57 @@
function EnterGame_connectToLoginServer()
-- create login protocol
local protocolLogin = ProtocolLogin.new()
-- used to recreate enter game window
local recreateEnterGame = function()
loadUI("ui/entergamewindow")
end
-- display loading message box
local loadBox = displayCancelBox("Please wait", "Connecting..")
-- cancel loading callback
loadBox.onCancel = function()
-- cancel protocol and reacreate enter game window
protocolLogin:cancel()
recreateEnterGame()
end
-- error callback
protocolLogin.onError = function(error)
-- destroy loading message box
loadBox:destroy()
-- display error message
local errorBox = displayErrorBox("Login Error", error)
-- cancel protocol and reacreate enter game window
self.cancel()
errorBox.onOk = recreateEnterGame
end
-- motd callback
protocolLogin.onMotd = function(motd)
-- destroy loading message box
loadBox:destroy()
-- display motd
local motdNumber = string.sub(motd, 0, string.find(motd, "\n"))
local motdText = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
local motdBox = displayInfoBox("Message of the day", motdText)
-- cancel protocol and reacreate enter game window
self.cancel()
motdBox.onOk = recreateEnterGame
end
-- get account and password then login
local enterGameWindow = rootUI:child("enterGameWindow")
local account = enterGameWindow:child("accountNameTextEdit").text
local password = enterGameWindow:child("passwordTextEdit").text
protocolLogin:login(account, password)
-- destroy enter game window
enterGameWindow:destroy()
end

View File

@@ -0,0 +1,16 @@
require 'entergame'
function initializeApplication()
mainMenu = loadUI("ui/mainmenu")
end
function terminateApplication()
App.exit()
end
-- here is where everything starts
if not initialized then
initializeApplication()
App.onClose = terminateApplication
initialized = true
end

View File

@@ -0,0 +1,9 @@
title: Main menu
description: Used to create the main menu
author: otclient
version: 1
website: https://github.com/edubart/otclient
enabled: true
dependencies: [core]
script: init.lua

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -0,0 +1,53 @@
window#enterGameWindow
title: Enter Game
size: 236 178
anchor.centerIn: parent
lockOnLoad: true
%label
text: Account name
position: 18 33
%label
text: "Password:"
position: 18 62
%label
text: |
If you don't have
an account yet
anchors.top: parent.top
anchors.left: parent.left
margin: 87 18
%button.notImplemented
text: Create Account
anchors.top: parent.top
anchors.right: parent.right
margin: 94 18
%button.small
text: Ok
anchors.bottomRight: parent.bottomRight
margin: 10 66
onClick: EnterGame_connectToLoginServer()
%button.small.closeParent
text: Cancel
anchors.bottom: parent.bottom
anchors.right: parent.right
margin: 10 13
%textEdit#accountNameTextEdit
text: tibialua0
anchors.top: parent.top
anchors.right: parent.right
margin: 32 18
%textEdit#passwordTextEdit
text: lua123456
text-hidden: true
anchors.top: parent.top
anchors.right: parent.right
margin: 61 18

View File

@@ -0,0 +1,54 @@
%window#infoWindow
title: Info
size: 244 221
anchor.centerIn: parent
lockOnLoad: true
%panel.flat
size: 208 129
anchors.top: parent.top
anchors.left: parent.left
margin: 32 18
%label
align: center
text: |-
OTClient
Version 0.2.0
Created by edubart
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
margin.top: 20
%element.bottomSeparator
size: 190 2
anchors.top: parent.top
anchors.left: parent.left
margin: 83 9
%label
text: Official Website
anchors.bottom: parent.bottom
anchors.left: parent.left
margin: 14 9
%button
text: Github Page
size: 80 22
anchors.bottom: parent.bottom
anchors.right: parent.right
margin: 9
%element.bottomSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 40 13
%button.closeParent
text: Ok
size: 43 20
anchors.top: parent.top
anchors.left: parent.left
margin: 191 188

View File

@@ -0,0 +1,37 @@
%panel#mainBackground
image: { source: background.png; antialised: true }
anchor.fill: parent
%panel#mainMenuPanel.flat
size: 117 171
anchors.bottom: parent.bottom
anchors.left: parent.left
margin: 70 60
button
anchors.top: prev.bottom
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 6
%button.first
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin.top: 16
text: Enter Game
onClick: loadUI("entergamewindow")
%button.notImplemented
text: Access Account
%button
text: Options
onClick: loadUI("optionswindow")
%button
text: Info
onClick: loadUI("infowindow")
%button
text: Exit
onClick: terminateApplication()

View File

@@ -0,0 +1,82 @@
%window#optionsWindow
title: Options
size: 286 262
anchor.centerIn: parent
lockOnLoad: true
panel
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin.left: 18
margin.top: 3
height: 30
button
anchors.top: parent.top
anchors.left: parent.left
margin.top: 3
onClick: displayErrorBox("Error", "Not implemented yet")
label
anchors.top: parent.top
anchors.left: parent.left
margin.top: 99
%panel
anchors.top: parent.top
margin.top: 29
%button { text: General }
%label { text: "Change general\ngame options" }
%panel
%button { text: Graphics }
%label { text: "Change graphics and\nperformance settings" }
%panel
%button { text: Console }
%label { text: Customise the console }
%panel
%button { text: Hotkeys }
%label { text: Edit your hotkey texts }
%element.horizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 97 18
%panel
anchors.top: ~
anchors.bottom: parent.bottom
margin.top: 29
%button
text: Motd
anchors.left: parent.left
anchors.bottom: parent.bottom
margin: 60 18
%label
text: |
Show the most recent
Message of the Day
anchors.left: parent.left
anchors.bottom: parent.bottom
margin: 56 117
%element.horizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 40 13
%button.closeParent
text: Ok
size: 43 20
anchors.right: parent.right
anchors.bottom: parent.bottom
margin: 13 10