Ticket #3395: ticket3394unitactions_3.2.diff
File ticket3394unitactions_3.2.diff, 8.8 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/common/tooltips.js
157 157 else 158 158 var rateLabel = txtFormats.header[0] + translate("Rate:") + txtFormats.header[1]; 159 159 160 for ( vartype in template.attack)160 for (let type in template.attack) 161 161 { 162 162 if (type == "Slaughter") 163 163 continue; // Slaughter is not a real attack, so do not show it. … … 219 219 return attacks.join("\n"); 220 220 } 221 221 222 function getRepairTimeRatioTooltip(ratio) 223 { 224 var unit = sprintf(translate("%(health)s / %(second)s / %(worker)s"), { 225 health: txtFormats.unit[0] + translate("Health") + txtFormats.unit[1], 226 second: txtFormats.unit[0] + translate("second") + txtFormats.unit[1], 227 worker: txtFormats.unit[0] + translate("worker") + txtFormats.unit[1] 228 }); 229 230 return "\n" + sprintf(translate("%(repairRateLabel)s %(detail)s %(unit)s"), { 231 repairRateLabel: txtFormats.header[0] + translate("Repair Rate:") + txtFormats.header[1], 232 detail: ratio, 233 unit: unit 234 }); 235 } 236 222 237 /** 223 238 * Translates a cost component identifier as they are used internally 224 239 * (e.g. "population", "food", etc.) to proper display names. -
binaries/data/mods/public/gui/session/selection_details.js
254 254 var armorString = getArmorTooltip(entState.armour); 255 255 256 256 // Attack and Armor 257 if ( "attack" in entState &&entState.attack)257 if (entState.attack) 258 258 Engine.GetGUIObjectByName("attackAndArmorStats").tooltip = getAttackTooltip(entState) + "\n" + armorString; 259 259 else 260 260 Engine.GetGUIObjectByName("attackAndArmorStats").tooltip = armorString; 261 261 262 // Repair Rate 263 if (entState.repairTimeRatio) 264 Engine.GetGUIObjectByName("attackAndArmorStats").tooltip += getRepairTimeRatioTooltip(entState.repairTimeRatio); 265 262 266 // Icon Tooltip 263 267 var iconTooltip = ""; 264 268 -
binaries/data/mods/public/gui/session/unit_actions.js
677 677 count += state.garrisonHolder.entities.length; 678 678 } 679 679 return { 680 "tooltip": translate("Unload All"),680 "tooltip": '[font="sans-bold-16"]' + translate("Unload All") + "[/font]\n" + translate("Release all garrisoned units"), 681 681 "icon": "garrison-out.png", 682 682 "count": count, 683 683 }; … … 705 705 706 706 707 707 return { 708 "tooltip": translate("Delete"),708 "tooltip": '[font="sans-bold-16"]' + translate("Delete") + "[/font]\n" + translate("Destroy everything selected"), 709 709 "icon": "kill_small.png" 710 710 }; 711 711 }, … … 731 731 if (!entState.unitAI) 732 732 return false; 733 733 return { 734 "tooltip": translate("Stop"),734 "tooltip": '[font="sans-bold-16"]' + translate("Stop") + "[/font]\n" + translate("Cancel all existing orders"), 735 735 "icon": "stop.png" 736 736 }; 737 737 }, … … 749 749 if (!entState.unitAI || entState.turretParent) 750 750 return false; 751 751 return { 752 "tooltip": translate("Garrison"),752 "tooltip": '[font="sans-bold-16"]' + translate("Garrison") + "[/font]\n" + translate("Lock selected units inside and shoot arrows from warships and defensive buildings"), 753 753 "icon": "garrison.png" 754 754 }; 755 755 }, … … 770 770 if (!p.garrisonHolder || p.garrisonHolder.entities.indexOf(entState.id) == -1) 771 771 return false; 772 772 return { 773 "tooltip": translate("Unload"),773 "tooltip": '[font="sans-bold-16"]' + translate("Unload") + "[/font]\n" + translate("Release one unit"), 774 774 "icon": "garrison-out.png" 775 775 }; 776 776 }, … … 786 786 if (!entState.builder) 787 787 return false; 788 788 return { 789 "tooltip": translate("Repair"),789 "tooltip": '[font="sans-bold-16"]' + translate("Repair") + "[/font]\n" + translate("Restore health, rate depends on structure"), 790 790 "icon": "repair.png" 791 791 }; 792 792 }, … … 803 803 if (!entState.rallyPoint) 804 804 return false; 805 805 return { 806 "tooltip": translate("Focus on Rally Point"),806 "tooltip": '[font="sans-bold-16"]' + translate("Focus on Rally Point") + "[/font]\n" + translate("Move camera to entity"), 807 807 "icon": "focus-rally.png" 808 808 }; 809 809 }, … … 826 826 if (!entState.unitAI || !entState.unitAI.hasWorkOrders) 827 827 return false; 828 828 return { 829 "tooltip": translate("Back to Work"),829 "tooltip": '[font="sans-bold-16"]' + translate("Back to Work") + "[/font]\n" + translate("Order unit the last given task"), 830 830 "icon": "production.png" 831 831 }; 832 832 }, … … 842 842 if (!entState.unitAI || !entState.unitAI.canGuard || entState.unitAI.isGuarding) 843 843 return false; 844 844 return { 845 "tooltip": translate("Guard"),845 "tooltip": '[font="sans-bold-16"]' + translate("Guard") + "[/font]\n" + translate("Follow another entity, repair/heal it and protect when attacked"), 846 846 "icon": "add-guard.png" 847 847 }; 848 848 }, … … 859 859 if (!entState.unitAI || !entState.unitAI.isGuarding) 860 860 return false; 861 861 return { 862 "tooltip": translate("Remove guard"),862 "tooltip": '[font="sans-bold-16"]' + translate("Remove guard") +"[/font]\n" + translate("Stop guarding"), 863 863 "icon": "remove-guard.png" 864 864 }; 865 865 }, … … 910 910 } 911 911 } 912 912 return { 913 "tooltip": translate("Unload All"),913 "tooltip": '[font="sans-bold-16"]' + translate("Unload All") + "[/font]\n" + translate("Release all garrisoned units"), 914 914 "icon": "garrison-out.png", 915 915 "count": count, 916 916 }; -
binaries/data/mods/public/simulation/components/GuiInterface.js
343 343 344 344 var cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); 345 345 if (cmpOwnership) 346 {347 346 ret.player = cmpOwnership.GetOwner(); 348 }349 347 350 348 var cmpRallyPoint = Engine.QueryInterface(ent, IID_RallyPoint); 351 349 if (cmpRallyPoint) 352 {353 350 ret.rallyPoint = {'position': cmpRallyPoint.GetPositions()[0]}; // undefined or {x,z} object 354 }355 351 356 352 var cmpGarrisonHolder = Engine.QueryInterface(ent, IID_GarrisonHolder); 357 353 if (cmpGarrisonHolder) … … 433 429 "obstruction": null, 434 430 "turretParent":null, 435 431 "promotion": null, 432 "repairTimeRatio": null, 436 433 "resourceDropsite": null, 437 434 "resourceGatherRates": null, 438 435 "resourceSupply": null, … … 489 486 490 487 var cmpArmour = Engine.QueryInterface(ent, IID_DamageReceiver); 491 488 if (cmpArmour) 492 {493 489 ret.armour = cmpArmour.GetArmourStrengths(); 494 }495 490 496 491 var cmpAuras = Engine.QueryInterface(ent, IID_Auras) 497 492 if (cmpAuras) 498 {499 493 ret.auras = cmpAuras.GetDescriptions(); 500 }501 494 502 495 var cmpBuildingAI = Engine.QueryInterface(ent, IID_BuildingAI); 503 496 if (cmpBuildingAI) … … 523 516 if (cmpPosition && cmpPosition.GetTurretParent() != INVALID_ENTITY) 524 517 ret.turretParent = cmpPosition.GetTurretParent(); 525 518 519 var cmpRepairTimeRatio = Engine.QueryInterface(ent, IID_Repairable); 520 if (cmpRepairTimeRatio) 521 ret.repairTimeRatio = cmpRepairTimeRatio.GetRepairTimeRatio(); 522 526 523 var cmpResourceSupply = QueryMiragedInterface(ent, IID_ResourceSupply); 527 524 if (cmpResourceSupply) 528 525 { … … 539 536 540 537 var cmpResourceGatherer = Engine.QueryInterface(ent, IID_ResourceGatherer); 541 538 if (cmpResourceGatherer) 542 {543 539 ret.resourceGatherRates = cmpResourceGatherer.GetGatherRates(); 544 }545 540 546 541 var cmpResourceDropsite = Engine.QueryInterface(ent, IID_ResourceDropsite); 547 542 if (cmpResourceDropsite) -
binaries/data/mods/public/simulation/components/Repairable.js
74 74 Engine.PostMessage(this.entity, MT_ConstructionFinished, { "entity": this.entity, "newentity": this.entity }); 75 75 }; 76 76 77 Repairable.prototype.GetRepairTimeRatio = function() 78 { 79 return this.repairTimeRatio; 80 }; 81 77 82 Engine.RegisterComponentType(IID_Repairable, "Repairable", Repairable); -
binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
508 508 obstruction: null, 509 509 turretParent: null, 510 510 promotion: null, 511 repairTimeRatio: null, 511 512 resourceDropsite: null, 512 513 resourceGatherRates: null, 513 514 resourceSupply: null,