diff --git a/data/images/game/cyclopedia/bestiary_off.png b/data/images/game/cyclopedia/bestiary_off.png new file mode 100644 index 0000000000..b62a5f8a4c Binary files /dev/null and b/data/images/game/cyclopedia/bestiary_off.png differ diff --git a/data/images/game/cyclopedia/bestiary_on.png b/data/images/game/cyclopedia/bestiary_on.png new file mode 100644 index 0000000000..a936cc1280 Binary files /dev/null and b/data/images/game/cyclopedia/bestiary_on.png differ diff --git a/data/images/game/cyclopedia/bossSlot_off.png b/data/images/game/cyclopedia/bossSlot_off.png new file mode 100644 index 0000000000..02f9847c94 Binary files /dev/null and b/data/images/game/cyclopedia/bossSlot_off.png differ diff --git a/data/images/game/cyclopedia/bossSlot_on.png b/data/images/game/cyclopedia/bossSlot_on.png new file mode 100644 index 0000000000..cc6973ffb7 Binary files /dev/null and b/data/images/game/cyclopedia/bossSlot_on.png differ diff --git a/data/images/game/cyclopedia/bosstiary_off.png b/data/images/game/cyclopedia/bosstiary_off.png new file mode 100644 index 0000000000..c7a864ca06 Binary files /dev/null and b/data/images/game/cyclopedia/bosstiary_off.png differ diff --git a/data/images/game/cyclopedia/bosstiary_on.png b/data/images/game/cyclopedia/bosstiary_on.png new file mode 100644 index 0000000000..0d180f53dc Binary files /dev/null and b/data/images/game/cyclopedia/bosstiary_on.png differ diff --git a/data/images/game/cyclopedia/character_off.png b/data/images/game/cyclopedia/character_off.png new file mode 100644 index 0000000000..eb3ce4c21a Binary files /dev/null and b/data/images/game/cyclopedia/character_off.png differ diff --git a/data/images/game/cyclopedia/character_on.png b/data/images/game/cyclopedia/character_on.png new file mode 100644 index 0000000000..ec13d60389 Binary files /dev/null and b/data/images/game/cyclopedia/character_on.png differ diff --git a/data/images/game/cyclopedia/charms_off.png b/data/images/game/cyclopedia/charms_off.png new file mode 100644 index 0000000000..4d584ea432 Binary files /dev/null and b/data/images/game/cyclopedia/charms_off.png differ diff --git a/data/images/game/cyclopedia/charms_on.png b/data/images/game/cyclopedia/charms_on.png new file mode 100644 index 0000000000..ab4aa91cf1 Binary files /dev/null and b/data/images/game/cyclopedia/charms_on.png differ diff --git a/data/images/game/cyclopedia/houses_off.png b/data/images/game/cyclopedia/houses_off.png new file mode 100644 index 0000000000..a69605b03e Binary files /dev/null and b/data/images/game/cyclopedia/houses_off.png differ diff --git a/data/images/game/cyclopedia/houses_on.png b/data/images/game/cyclopedia/houses_on.png new file mode 100644 index 0000000000..1bde4c8f6d Binary files /dev/null and b/data/images/game/cyclopedia/houses_on.png differ diff --git a/data/images/game/cyclopedia/items_off.png b/data/images/game/cyclopedia/items_off.png new file mode 100644 index 0000000000..e4f7506dff Binary files /dev/null and b/data/images/game/cyclopedia/items_off.png differ diff --git a/data/images/game/cyclopedia/items_on.png b/data/images/game/cyclopedia/items_on.png new file mode 100644 index 0000000000..9cf56260f8 Binary files /dev/null and b/data/images/game/cyclopedia/items_on.png differ diff --git a/data/images/game/cyclopedia/map_off.png b/data/images/game/cyclopedia/map_off.png new file mode 100644 index 0000000000..5a0d9d7161 Binary files /dev/null and b/data/images/game/cyclopedia/map_off.png differ diff --git a/data/images/game/cyclopedia/map_on.png b/data/images/game/cyclopedia/map_on.png new file mode 100644 index 0000000000..e3dce516d4 Binary files /dev/null and b/data/images/game/cyclopedia/map_on.png differ diff --git a/data/images/game/cyclopedia/off.psd b/data/images/game/cyclopedia/off.psd new file mode 100644 index 0000000000..7e59fd932a Binary files /dev/null and b/data/images/game/cyclopedia/off.psd differ diff --git a/data/images/game/cyclopedia/on.psd b/data/images/game/cyclopedia/on.psd new file mode 100644 index 0000000000..b5d26577ea Binary files /dev/null and b/data/images/game/cyclopedia/on.psd differ diff --git a/modules/game_cyclopedia/game_cyclopedia.lua b/modules/game_cyclopedia/game_cyclopedia.lua new file mode 100644 index 0000000000..4735d37d79 --- /dev/null +++ b/modules/game_cyclopedia/game_cyclopedia.lua @@ -0,0 +1,173 @@ +local contentContainer = nil +local buttonSelection = nil +local items = nil +local bestiary = nil +local charms = nil +local map = nil +local houses = nil +local character = nil +local CyclopediaButton = nil +local bosstiary = nil +local bossSlot = nil + +function toggle() + if not controllerCyclopedia.ui then + return + end + if controllerCyclopedia.ui:isVisible() then + return hide() + end + show() +end + +controllerCyclopedia = Controller:new() +controllerCyclopedia:setUI('game_cyclopedia') +function controllerCyclopedia:onInit() + CyclopediaButton = modules.game_mainpanel.addToggleButton('CyclopediaButton', tr('Cyclopedia'), + '/images/options/cooldowns', toggle, false, 7) + CyclopediaButton:setOn(false) + contentContainer = controllerCyclopedia.ui:recursiveGetChildById('contentContainer') + buttonSelection = controllerCyclopedia.ui:recursiveGetChildById('buttonSelection') + items = buttonSelection:recursiveGetChildById('items') + bestiary = buttonSelection:recursiveGetChildById('bestiary') + charms = buttonSelection:recursiveGetChildById('charms') + map = buttonSelection:recursiveGetChildById('map') + houses = buttonSelection:recursiveGetChildById('houses') + character = buttonSelection:recursiveGetChildById('character') + bosstiary = buttonSelection:recursiveGetChildById('bosstiary') + bossSlot = buttonSelection:recursiveGetChildById('bossSlot') + + --[[ note: + if not g_game.getFeature(GameCyclopedia) then + return CyclopediaButton:hide() + end +]] +end + +function controllerCyclopedia:onGameStart() + +end + +function controllerCyclopedia:onGameEnd() + + hide() +end + +function controllerCyclopedia:onTerminate() + local widgets = {CyclopediaButton, contentContainer, buttonSelection, items, bestiary, charms, map, houses, + character, bosstiary, bossSlot} + + for i = 1, #widgets do + local widget = widgets[i] + if widget then + widget:destroy() + widgets[i] = nil + end + end + +end + +function hide() + if not controllerCyclopedia.ui then + return + end + controllerCyclopedia.ui:hide() +end + +function show() + if not controllerCyclopedia.ui or not CyclopediaButton then + return + end + + controllerCyclopedia.ui:show() + controllerCyclopedia.ui:raise() + controllerCyclopedia.ui:focus() +end + + +function SelectWindow(type) + local windowTypes = { + items = {obj = items,func = showItems}, + bestiary = {obj = bestiary,func = showBestiary}, + charms = {obj = charms,func = showCharms}, + map = {obj = map,func = showMap}, + houses = {obj = houses,func = showHouse}, + character = {obj = character,func = showCharacter}, + bosstiary = {obj = bosstiary,func = showBosstiary}, + bossSlot = {obj = bossSlot,func = showBossSlot} + } + + if previousType then + previousType.obj:enable() + previousType.obj:setOn(false) + end + contentContainer:destroyChildren() + + local window = windowTypes[type] + if window then + window.obj:setOn(true) + window.obj:disable() + previousType = window + if window.func then + window.func(contentContainer) + end + end +end + +function showItems() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showItems") +end + +function showBestiary() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showBestiary") +end + +function showCharms() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showCharms") +end + +function showMap() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showMap") +end + +function showHouse() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showHouse") +end + +function showCharacter() + + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showCharacter") +end + +function showBossSlot() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showBossSlot") +end + +function showBosstiary() + local test = g_ui.createWidget("Label", contentContainer) + test:addAnchor(AnchorLeft, 'parent', AnchorLeft) + test:addAnchor(AnchorTop, 'parent', AnchorTop) + test:setText("showBosstiary") +end + diff --git a/modules/game_cyclopedia/game_cyclopedia.otmod b/modules/game_cyclopedia/game_cyclopedia.otmod new file mode 100644 index 0000000000..c401173516 --- /dev/null +++ b/modules/game_cyclopedia/game_cyclopedia.otmod @@ -0,0 +1,7 @@ +Module + name: game_cyclopedia + description: game_cyclopedia + scripts: [ game_cyclopedia ] + sandboxed: true + @onLoad: controllerCyclopedia:init() + @onUnload: controllerCyclopedia:terminate() diff --git a/modules/game_cyclopedia/game_cyclopedia.otui b/modules/game_cyclopedia/game_cyclopedia.otui new file mode 100644 index 0000000000..bb38c7a2ae --- /dev/null +++ b/modules/game_cyclopedia/game_cyclopedia.otui @@ -0,0 +1,220 @@ +MainWindow + size: 700 538 + !text: tr('Cyclopedia') + visible: false + @onEscape: toggle() + + UIWidget + id: buttonSelection + anchors.top: parent.top + anchors.left: parent.left + size: 668 36 + background-color: #404040 + border-width-top: 1 + border-color-top: black + border-width-left: 1 + border-color-left: black + border-width-bottom: 1 + border-color-bottom: #747474 + border-width-right: 1 + border-color-right: #747474 + + UIButton + id: items + anchors.top: parent.top + anchors.left: parent.left + margin-left: 1 + size: 668 36 + @onClick: SelectWindow("items") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/items_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/items_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/items_off + + UIButton + id: bestiary + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("bestiary") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/bestiary_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/bestiary_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/bestiary_off + + UIButton + id: charms + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("charms") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/charms_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/charms_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/charms_off + + UIButton + id: map + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("map") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/map_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/map_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/map_off + + UIButton + id: houses + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("houses") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/houses_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/houses_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/houses_off + + UIButton + id: character + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("character") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/character_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/character_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/character_off + + UIButton + id: bosstiary + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("bosstiary") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/bosstiary_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/bosstiary_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/bosstiary_off + + UIButton + id: bossSlot + anchors.top: prev.top + anchors.left: prev.right + margin-left: 1 + @onClick: SelectWindow("bossSlot") + + $on: + size: 150 34 + image-clip: 0 0 150 34 + image-source: /images/game/cyclopedia/bossSlot_on + + $!on: + size: 34 34 + image-clip: 0 0 34 34 + image-source: /images/game/cyclopedia/bossSlot_off + + $pressed: + size: 34 34 + image-clip: 0 34 34 34 + image-source: /images/game/cyclopedia/bossSlot_off + + UIWidget + id: contentContainer + anchors.top: prev.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + margin-top: 5 + + + HorizontalSeparator + id: separator + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + margin-bottom: 30 + + Button + anchors.bottom: parent.bottom + anchors.right: parent.right + text: Close + width: 60 + @onClick: toggle() diff --git a/modules/game_interface/interface.otmod b/modules/game_interface/interface.otmod index 1ee64fdb33..af37c4a60b 100644 --- a/modules/game_interface/interface.otmod +++ b/modules/game_interface/interface.otmod @@ -36,5 +36,6 @@ Module - game_stash - game_healthcircle - game_shop + - game_cyclopedia @onLoad: init() @onUnload: terminate()