Ticket #1539: gate-cost-2.patch
File gate-cost-2.patch, 4.0 KB (added by , 12 years ago) |
---|
-
binaries/data/mods/public/gui/session/session.xml
863 863 size="10 12 100% 100%" 864 864 > 865 865 <object size="0 0 100% 100%"> 866 <repeat count=" 1">867 <object name="unitGateButton[n]" style="iconButton" type="button" size="0 0 46 46" tooltip_style="sessionToolTipBottom">866 <repeat count="2"> 867 <object name="unitGateButton[n]" hidden="true" style="iconButton" type="button" size="0 0 46 46" tooltip_style="sessionToolTipBottom"> 868 868 <object name="unitGateIcon[n]" type="image" ghost="true" size="3 3 43 43"/> 869 869 <object name="unitGateSelection[n]" hidden="true" type="image" ghost="true" size="3 3 43 43" sprite="stretched:session/icons/corners.png"/> 870 870 </object> -
binaries/data/mods/public/gui/session/unit_commands.js
25 25 const BARTER_RESOURCES = ["food", "wood", "stone", "metal"]; 26 26 const BARTER_ACTIONS = ["Sell", "Buy"]; 27 27 28 // Gate constants 29 const GATE_ACTIONS = ["lock", "unlock"]; 30 28 31 // The number of currently visible buttons (used to optimise showing/hiding) 29 32 var g_unitPanelButtons = {"Selection": 0, "Queue": 0, "Formation": 0, "Garrison": 0, "Training": 0, "Research": 0, "Barter": 0, "Trading": 0, "Construction": 0, "Command": 0, "Stance": 0, "Gate": 0}; 30 33 … … 206 209 break; 207 210 208 211 case GATE: 209 if(numberOfItems > 1)210 numberOfItems = 1;212 if(numberOfItems > 2) 213 numberOfItems = 2; 211 214 break; 212 215 213 216 default: … … 324 327 getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (count > 1 ? count : ""); 325 328 break; 326 329 330 case GATE: 331 var tooltip = toTitleCase(item.tooltip); 332 if (item.template) 333 tooltip += "\n" + getEntityCostTooltip( GetTemplateData(item.template) ); 334 break; 335 327 336 case STANCE: 328 337 case FORMATION: 329 case GATE:330 338 var tooltip = toTitleCase(item); 331 339 break; 332 340 … … 504 512 var gateIcon; 505 513 // If already a gate, show (un)lock icon 506 514 if (unitEntState.gate) 507 gateIcon = unitEntState.gate.locked ? "gate_unlocked.png" : "gate_locked.png"; 515 { 516 gateIcon = "lock_" + GATE_ACTIONS[i] + "ed.png"; 517 selection.hidden = unitEntState.gate.locked != item.locked; 518 } 519 // otherwise show gate upgrade icon 508 520 else 509 // otherwise show gate upgrade icon 510 gateIcon = "production.png"; 521 { 522 gateIcon = "gate_locked.png"; 523 selection.hidden = true; 524 } 511 525 512 526 icon.sprite = "stretched:session/icons/" + gateIcon; 513 527 } … … 828 842 { 829 843 if (entState.gate) 830 844 { 831 var action = entState.gate.locked ? "Unlock gate": "Lock gate"; 832 setupUnitPanel(GATE, usedPanels, entState, [action], 833 function (item) { lockGate(!entState.gate.locked); } ); 845 var items = []; 846 for (var i = 0; i < GATE_ACTIONS.length; ++i) 847 items.push({ 848 "tooltip": toTitleCase(GATE_ACTIONS[i]) + " Gate", 849 "locked": Boolean(!i) 850 }); 851 setupUnitPanel(GATE, usedPanels, entState, items, 852 function (item) { lockGate(item.locked); } ); 834 853 } 835 854 else // Wall 836 855 { … … 838 857 var longPos = entState.template.indexOf("long"); 839 858 if (longPos != -1) 840 859 { 841 var template = entState.template.substr(0, longPos) + "gate"; 842 setupUnitPanel(GATE, usedPanels, entState, ["Convert to gate"], 843 function (item) { transformWallToGate(template); } ); 860 var action = { "tooltip": "Convert to Gate" }; 861 action.template = entState.template.substr(0, longPos) + "gate"; 862 setupUnitPanel(GATE, usedPanels, entState, [action], 863 function (item) { transformWallToGate(action.template); } ); 844 864 } 845 865 } 846 866 }