mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Allow right-click on disabled buttons.
Reviewed by: @Angen Fixes #5269 Fixes #5095 Differential Revision: https://code.wildfiregames.com/D2651 This was SVN commit r24184.
This commit is contained in:
@@ -235,7 +235,9 @@ g_SelectionPanels.Construction = {
|
||||
});
|
||||
|
||||
data.button.onPress = function() { startBuildingPlacement(data.item, data.playerState); };
|
||||
data.button.onPressRight = function() { showTemplateDetails(data.item); };
|
||||
let showTemplateFunc = () => { showTemplateDetails(data.item); };
|
||||
data.button.onPressRight = showTemplateFunc;
|
||||
data.button.onPressRightDisabled = showTemplateFunc;
|
||||
|
||||
let tooltips = [
|
||||
getEntityNamesFormatted,
|
||||
@@ -772,11 +774,14 @@ g_SelectionPanels.Research = {
|
||||
addResearchToQueue(data.item.researchFacilityId, t);
|
||||
})(tech);
|
||||
|
||||
button.onPressRight = (t => function() {
|
||||
let showTemplateFunc = (t => function() {
|
||||
showTemplateDetails(
|
||||
t,
|
||||
GetTemplateData(data.unitEntStates.find(state => state.id == data.item.researchFacilityId).template).nativeCiv);
|
||||
})(tech);
|
||||
});
|
||||
|
||||
button.onPressRight = showTemplateFunc(tech);
|
||||
button.onPressRightDisabled = showTemplateFunc(tech);
|
||||
|
||||
if (data.item.tech.pair)
|
||||
{
|
||||
@@ -976,9 +981,10 @@ g_SelectionPanels.Training = {
|
||||
if (!neededResources)
|
||||
addTrainingToQueue(unitIds, data.item, data.playerState);
|
||||
};
|
||||
data.button.onPressRight = function() {
|
||||
showTemplateDetails(data.item);
|
||||
};
|
||||
|
||||
let showTemplateFunc = () => { showTemplateDetails(data.item); };
|
||||
data.button.onPressRight = showTemplateFunc;
|
||||
data.button.onPressRightDisabled = showTemplateFunc;
|
||||
|
||||
data.countDisplay.caption = trainNum > 1 ? trainNum : "";
|
||||
|
||||
@@ -1161,9 +1167,9 @@ g_SelectionPanels.Upgrade = {
|
||||
data.button.enabled = controlsPlayer(data.player);
|
||||
data.button.tooltip = tooltip;
|
||||
|
||||
data.button.onPressRight = function() {
|
||||
showTemplateDetails(data.item.entity);
|
||||
};
|
||||
let showTemplateFunc = () => { showTemplateDetails(data.item.entity); };
|
||||
data.button.onPressRight = showTemplateFunc;
|
||||
data.button.onPressRightDisabled = showTemplateFunc;
|
||||
|
||||
data.icon.sprite = modifier + "stretched:session/" +
|
||||
(data.item.icon || "portraits/" + template.icon);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
const CStr IGUIButtonBehavior::EventNamePress = "Press";
|
||||
const CStr IGUIButtonBehavior::EventNamePressRight = "PressRight";
|
||||
const CStr IGUIButtonBehavior::EventNamePressRightDisabled = "PressRightDisabled";
|
||||
const CStr IGUIButtonBehavior::EventNameDoublePress = "DoublePress";
|
||||
const CStr IGUIButtonBehavior::EventNameDoublePressRight = "DoublePressRight";
|
||||
const CStr IGUIButtonBehavior::EventNameRelease = "Release";
|
||||
@@ -114,6 +115,7 @@ void IGUIButtonBehavior::HandleMessage(SGUIMessage& Message)
|
||||
case GUIM_MOUSE_PRESS_RIGHT:
|
||||
if (!m_pObject.IsEnabled())
|
||||
{
|
||||
m_pObject.SendEvent(GUIM_PRESSED_MOUSE_RIGHT_DISABLED, EventNamePressRightDisabled);
|
||||
m_pObject.PlaySound(m_SoundDisabled);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
protected:
|
||||
static const CStr EventNamePress;
|
||||
static const CStr EventNamePressRight;
|
||||
static const CStr EventNamePressRightDisabled;
|
||||
static const CStr EventNameDoublePress;
|
||||
static const CStr EventNameDoublePressRight;
|
||||
static const CStr EventNameRelease;
|
||||
|
||||
@@ -51,6 +51,7 @@ enum EGUIMessageType
|
||||
GUIM_GOT_FOCUS,
|
||||
GUIM_LOST_FOCUS,
|
||||
GUIM_PRESSED_MOUSE_RIGHT,
|
||||
GUIM_PRESSED_MOUSE_RIGHT_DISABLED,
|
||||
GUIM_DOUBLE_PRESSED_MOUSE_RIGHT,
|
||||
GUIM_PRESSED_MOUSE_RELEASE,
|
||||
GUIM_PRESSED_MOUSE_RELEASE_RIGHT,
|
||||
|
||||
Reference in New Issue
Block a user