Skip to content
Snippets Groups Projects
Commit 7d539985 authored by DarkGod's avatar DarkGod
Browse files

useful but jsut for me

parent cc4da210
No related branches found
No related tags found
No related merge requests found
......@@ -59,8 +59,10 @@ function _M:init(mode)
cosmetic = "/data/gfx/microtxn-ui/category_cosmetic.png",
misc = "/data/gfx/microtxn-ui/category_misc.png",
}
local categories_icons_entities = {}
for i, c in pairs(self.categories_icons) do categories_icons_entities[i] = Entity.new{image=c} end
local in_cart_icon = Entity.new{image="/data/gfx/microtxn-ui/in_cart.png"}
-- local icon_frame = Entity.new{image="/data/gfx/microtxn-ui/icon_frame.png"}
local icon_frame = Entity.new{image="/data/gfx/microtxn-ui/icon_frame.png"}
self.list = {}
self.purchasables = {}
......@@ -70,10 +72,22 @@ function _M:init(mode)
self.c_waiter = Textzone.new{auto_width=1, auto_height=1, text="#YELLOW#-- connecting to server... --"}
local last_displayed_item = nil
self.c_list = VariableList.new{width=self.iw - 350 - vsep.w, max_height=self.ih, scrollbar=true, sortable=true,
direct_draw=function(item, x, y, get_size)
if get_size then return 132 end
item.img:toScreen(nil, x+2, y+2, 128, 128)
if self.cur_sel_item == item and item.demo_url then
if last_displayed_item ~= item then
self.webview.view:loadURL(item.demo_url)
end
self.webview:display(x+2, y+2, 1)
icon_frame:toScreen(nil, x+2, y+1, 128, 128)
icon_frame:toScreen(nil, x+2, y+1, 128, 128)
if categories_icons_entities[item.category] then categories_icons_entities[item.category]:toScreen(nil, x+2, y+2, 128, 128) end
last_displayed_item = item
else
item.img:toScreen(nil, x+2, y+2, 128, 128)
end
if self.cart[item.id_purchasable] and item.nb_purchase > 0 then
in_cart_icon:toScreen(nil, x+2, y+2, 128, 128)
if item.nb_purchase > 1 and item.p_txt then
......@@ -126,7 +140,8 @@ function _M:init(mode)
self:use(item.item, button)
end, select=function(item, sel) end}
-- local wv = WebView.new{width=500,height=500, url='https://te4.org/images/tmp/mtx-short.gif'}
self.webview = WebView.new{width=128,height=128, url=''}
self.webview.hide_loading = true
local uis = {
{vcenter=0, hcenter=0, ui=self.c_waiter},
......@@ -134,7 +149,6 @@ function _M:init(mode)
{left=self.c_list, top=0, ui=vsep},
{right=0, top=0, ui=self.c_recap},
{right=0, bottom=0, ui=self.c_do_purchase},
-- {left=0, top=0, ui=wv},
}
-- Only show those for steam as te4.org purchases require already having a donation up
if mode == "steam" then
......@@ -519,6 +533,8 @@ function _M:generateList()
self:toggleDisplay(self.c_waiter, false)
self:setFocus(self.c_list)
self.cur_sel_item = self.list[self.c_list.sel or 1]
self.c_coins_available.text = coins_balance_text:format((e.data.infos.balance or 0) * 10)
self.c_coins_available:generate()
self.cur_coins_left = e.data.infos.balance or 0
......
......@@ -259,7 +259,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
self.view:toScreen(x, y)
end
if self.loading < 1 then
if self.loading < 1 and not self.hide_loading then
self.loading_rotation = self.loading_rotation + nb_keyframes * 8
core.display.glMatrix(true)
core.display.glTranslate(x + self.loading_icon.w / 2, y + self.loading_icon.h / 2, 0)
......
......@@ -2008,6 +2008,9 @@ function _M:setupCommands()
print("===============")
end end,
[{"_g","ctrl"}] = function() if config.settings.cheat then
package.loaded["mod.dialogs.ShimmerDemo"] = nil
self:registerDialog(require("mod.dialogs.ShimmerDemo").new(game.player, "iron throne couture: "))
do return end
self:changeLevel(1, "tareyal+bamboo-forest")
do return end
if self.zone.short_name ~= "test" then
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2019 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local Textzone = require "engine.ui.Textzone"
local ActorFrame = require "engine.ui.ActorFrame"
local Textbox = require "engine.ui.Textbox"
local ListColumns = require "engine.ui.ListColumns"
module(..., package.seeall, class.inherit(Dialog))
function _M:init(player, what)
self.actor = player:cloneFull()
self.actor.x, self.actor.y = nil, nil
self.actor:removeAllMOs()
self.search_filter = what
self.time_cnt = 0
self.allowed_types = {}
self.objects = {}
for _, slot in ipairs{player.INVEN_MAINHAND, player.INVEN_OFFHAND, player.INVEN_BODY, player.INVEN_QUIVER, player.INVEN_FEET, player.INVEN_HANDS, player.INVEN_CLOAK, player.INVEN_HEAD} do
local o = self.actor:getInven(slot)[1]
self.objects[#self.objects+1] = {
o = o,
slot = player.inven_def[slot].short_name,
}
self.allowed_types[o.type] = true
end
Dialog.init(self, "Shimmer Demo", 680, 500)
self:generateList()
self:loadUI{}
self:setupUI(false, true)
self.key:addBinds{
EXIT = function()
game:unregisterDialog(self)
end,
}
end
function _M:search(text)
if text == "" then self.search_filter = nil
else self.search_filter = text end
self:generateList()
end
function _M:matchSearch(name)
if not self.search_filter then return true end
return name:lower():find(self.search_filter:lower(), 1, 1)
end
function _M:generateList()
local megalist = {}
for _, def in ipairs(self.objects) do
local list = {}
if def.slot ~= "BODY" then
list[#list+1] = {
moddables = {},
name = "#GREY#[Invisible]",
sortname = "--",
slot = def.slot,
object = def.o,
}
end
local unlocked = world.unlocked_shimmers and world.unlocked_shimmers[def.slot] or {}
for name, data in pairs(unlocked) do
-- if self.object.type == data.type and self.object.subtype == data.subtype then
if self.allowed_types[data.type] and self:matchSearch(name:removeColorCodes()) then
local d = {
moddables = table.clone(data.moddables, true),
name = name,
sortname = name:removeColorCodes(),
slot = def.slot,
object = def.o,
}
d.moddables.name = name
list[#list+1] = d
end
end
table.sort(list, "sortname")
megalist[def.slot] = {
olist = table.clone(list, false),
list = list,
max = 120 / #list,
cnt = 0,
}
end
self.megalist = megalist
end
function _M:changeStuff(nb_keyframes)
for slot, def in pairs(self.megalist) do
def.cnt = def.cnt + nb_keyframes
if def.cnt >= def.max then
def.cnt = 0
if #def.list == 0 then def.list = table.clone(def.olist, false) end
local item = rng.tableRemove(def.list)
if item then
item.object.shimmer_moddable = item.moddables
self.actor:updateModdableTile()
end
end
end
end
function _M:innerDisplay(x, y, nb_keyframes)
self:changeStuff(nb_keyframes)
core.display.drawQuad(-1000, -1000, 3000, 3000, 0x10, 0x0e, 0x10, 255)
-- core.display.drawQuad(-1000, -1000, 3000, 3000, 0x0e, 0x11, 0x11, 255)
self.actor:toScreen(nil, -50, -50, 100, 100)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment