POC for new UI
This commit is contained in:
@@ -5,8 +5,6 @@ local CutLimbAction = require("TimedActions/TOC_CutLimbAction")
|
||||
local CutLimbHandler = BaseHandler:derive("CutLimbHandler")
|
||||
|
||||
|
||||
local contextMenuCutLimb = "Cut"
|
||||
|
||||
---Creates new CutLimbHandler
|
||||
---@param panel any
|
||||
---@param bodyPart any
|
||||
@@ -28,7 +26,7 @@ end
|
||||
function CutLimbHandler:addToMenu(context)
|
||||
local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
if #types > 0 then
|
||||
local option = context:addOption(contextMenuCutLimb, self, self.onMenuOptionSelected)
|
||||
context:addOption(getText("ContextMenu_Amputate"), self, self.onMenuOptionSelected)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,40 +3,43 @@ local CutLimbHandler = require("UI/TOC_CutLimbHandler")
|
||||
-- TODO Use this to replace the sprites once a limb is cut
|
||||
ISHealthBodyPartPanel = ISBodyPartPanel:derive("ISHealthBodyPartPanel")
|
||||
|
||||
function ISHealthBodyPartPanel:onMouseUp(x, y)
|
||||
if self.selectedBp then
|
||||
local dragging = ISInventoryPane.getActualItems(ISMouseDrag.dragging)
|
||||
self.parent:dropItemsOnBodyPart(self.selectedBp.bodyPart, dragging)
|
||||
end
|
||||
end
|
||||
|
||||
function ISHealthBodyPartPanel:prerender()
|
||||
self.nodeAlpha = 0.0
|
||||
self.selectedAlpha = 0.1
|
||||
if self.selectedBp then
|
||||
for index,item in ipairs(self.parent.listbox.items) do
|
||||
if item.item.bodyPart == self.selectedBp.bodyPart then
|
||||
self.nodeAlpha = 1.0
|
||||
self.selectedAlpha = 0.5
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
ISBodyPartPanel.prerender(self)
|
||||
end
|
||||
--ISBodyPartPanel
|
||||
|
||||
function ISHealthBodyPartPanel:cbSetSelected(bp)
|
||||
if bp == nil then
|
||||
self.parent.listbox.selected = 0
|
||||
return
|
||||
end
|
||||
for index,item in ipairs(self.parent.listbox.items) do
|
||||
if item.item.bodyPart == bp.bodyPart then
|
||||
self.parent.listbox.selected = index
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
-- function ISHealthBodyPartPanel:onMouseUp(x, y)
|
||||
-- if self.selectedBp then
|
||||
-- local dragging = ISInventoryPane.getActualItems(ISMouseDrag.dragging)
|
||||
-- self.parent:dropItemsOnBodyPart(self.selectedBp.bodyPart, dragging)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function ISHealthBodyPartPanel:prerender()
|
||||
-- self.nodeAlpha = 0.0
|
||||
-- self.selectedAlpha = 0.1
|
||||
-- if self.selectedBp then
|
||||
-- for index,item in ipairs(self.parent.listbox.items) do
|
||||
-- if item.item.bodyPart == self.selectedBp.bodyPart then
|
||||
-- self.nodeAlpha = 1.0
|
||||
-- self.selectedAlpha = 0.5
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- ISBodyPartPanel.prerender(self)
|
||||
-- end
|
||||
|
||||
-- function ISHealthBodyPartPanel:cbSetSelected(bp)
|
||||
-- if bp == nil then
|
||||
-- self.parent.listbox.selected = 0
|
||||
-- return
|
||||
-- end
|
||||
-- for index,item in ipairs(self.parent.listbox.items) do
|
||||
-- if item.item.bodyPart == bp.bodyPart then
|
||||
-- self.parent.listbox.selected = index
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
local og_ISHealthPanel_dropItemsOnBodyPart = ISHealthPanel.dropItemsOnBodyPart
|
||||
@@ -63,4 +66,101 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
|
||||
local context = getPlayerContextMenu(playerNum) -- To not recreate it but reuse the one that has been created in the original method
|
||||
local cutLimbHandler = CutLimbHandler:new(self, bodyPart)
|
||||
cutLimbHandler:addToMenu(context)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
local og_ISHealthPanel_render = ISHealthPanel.render
|
||||
|
||||
function ISHealthPanel:render()
|
||||
|
||||
og_ISHealthPanel_render(self)
|
||||
|
||||
-- Left Texture
|
||||
local handL = getTexture("media/ui/Hand_L.png")
|
||||
local forearmL = getTexture("media/ui/ForeArm_L.png")
|
||||
local upperarmL = getTexture("media/ui/UpperArm_L.png")
|
||||
|
||||
self:drawTextureScaled(forearmL, self.healthPanel.x/2 - 2, self.healthPanel.y/2, 123, 302, 1, 1, 0, 0)
|
||||
|
||||
-- Right Texture
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
function ISCharacterInfoWindow:render()
|
||||
ISCollapsableWindow.render(self)
|
||||
|
||||
self.backgroundColor.a = 1
|
||||
if JoypadState.players[self.playerNum+1] then
|
||||
for _,view in pairs(self.panel.viewList) do
|
||||
if JoypadState.players[self.playerNum+1].focus == view.view then
|
||||
self:drawRectBorder(0, 0, self:getWidth(), self:getHeight(), 0.4, 0.2, 1.0, 1.0);
|
||||
self:drawRectBorder(1, 1, self:getWidth()-2, self:getHeight()-2, 0.4, 0.2, 1.0, 1.0);
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- function ISHealthPanel:createChildren()
|
||||
-- self.healthPanel = ISNewHealthPanel:new(0, 8, self.character)
|
||||
-- self.healthPanel:initialise()
|
||||
-- self.healthPanel:instantiate()
|
||||
-- self.healthPanel:setVisible(true)
|
||||
-- self:addChild(self.healthPanel)
|
||||
|
||||
-- self.listbox = ISHealthBodyPartListBox:new(180 - 15, 59, self.width - (180 - 15), self.height);
|
||||
-- self.listbox:initialise();
|
||||
-- self.listbox:instantiate();
|
||||
-- self.listbox:setAnchorLeft(true);
|
||||
-- self.listbox:setAnchorRight(true);
|
||||
-- self.listbox:setAnchorTop(true);
|
||||
-- self.listbox:setAnchorBottom(false);
|
||||
-- self.listbox.itemheight = 128;
|
||||
-- self.listbox.drawBorder = false
|
||||
-- self.listbox.backgroundColor.a = 0
|
||||
-- self.listbox.drawText = ISHealthPanel.drawText;
|
||||
-- self:addChild(self.listbox)
|
||||
|
||||
-- self.bodyPartPanel = ISHealthBodyPartPanel:new(self.character, 0, 8);
|
||||
-- self.bodyPartPanel:initialise();
|
||||
-- self.bodyPartPanel:setAlphas(0.0, 1.0, 0.5, 0.0, 0.0)
|
||||
-- -- self.bodyPartPanel:setEnableSelectLines( true, self.bpAnchorX, self.bpAnchorY );
|
||||
-- self.bodyPartPanel:enableNodes( "media/ui/Client_Icon_On.png", "media/ui/Client_Icon_On.png" )
|
||||
-- self.bodyPartPanel:overrideNodeTexture( BodyPartType.Torso_Upper, "media/ui/BodyParts/bps_node_big", "media/ui/BodyParts/bps_node_big_outline" );
|
||||
-- -- self.bodyPartPanel:setColorScheme(self.colorScheme);
|
||||
-- self:addChild(self.bodyPartPanel);
|
||||
|
||||
-- self.fitness = ISButton:new(self.healthPanel.x + 165, self.healthPanel.y, 100, 20, getText("ContextMenu_Fitness"), self, ISNewHealthPanel.onClick);
|
||||
-- self.fitness.internal = "FITNESS";
|
||||
-- self.fitness.anchorTop = false
|
||||
-- self.fitness.anchorBottom = true
|
||||
-- self.fitness:initialise();
|
||||
-- self.fitness:instantiate();
|
||||
-- -- self.fitness.borderColor = self.buttonBorderColor;
|
||||
-- self:addChild(self.fitness);
|
||||
-- if getCore():getGameMode() == "Tutorial" then
|
||||
-- self.fitness:setVisible(false);
|
||||
-- end
|
||||
-- self.blockingAlpha = 0.0;
|
||||
-- -- print "instant";
|
||||
|
||||
-- end
|
||||
@@ -1,3 +1,4 @@
|
||||
ContextMenu_EN = {
|
||||
|
||||
ContextMenu_Amputate = "Amputate",
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user