Ticket #3512: t3512_phaseNotif_WIP_v0.2.patch
File t3512_phaseNotif_WIP_v0.2.patch, 7.9 KB (added by , 8 years ago) |
---|
-
binaries/data/config/default.cfg
54 54 display = 0 55 55 56 56 ; Emulate right-click with Ctrl+Click on Mac mice 57 57 macmouse = false 58 58 59 ; > GAMEPLAY SETTINGS 60 teamNotification = true 61 59 62 ; System settings: 60 63 61 64 ; if false, actors won't be rendered but anything entity will be. 62 65 renderactors = true 63 66 -
binaries/data/mods/public/gui/options/options.json
200 200 "label": "UI Gain", 201 201 "tooltip": "UI sound gain", 202 202 "parameters": { "config": "sound.uigain", "function": "SetUIGain", "min": "0" } 203 203 } 204 204 ], 205 "gameplaySetting": 206 [ 207 { 208 "type": "boolean", 209 "label": "Team Notifications", 210 "tooltip": "Automatically send notifications to your allies when phasing up", 211 "parameters": { "config": "teamNotification" } 212 } 213 ], 205 214 "lobbySetting": 206 215 [ 207 216 { 208 217 "type": "number", 209 218 "label": "Chat Backlog", -
binaries/data/mods/public/gui/options/options.xml
41 41 <object name="graphicsSettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/> 42 42 <object name="graphicsSettingDropdown[n]" size="70% 0 100%-8 100%" type="dropdown" style="ModernDropDown" hidden="true"/> 43 43 </object> 44 44 </repeat> 45 45 </object> 46 <object name="SoundSettings" type="image" sprite="ModernDarkBoxGold" size="620 16 916 50%-4">46 <object name="SoundSettings" type="image" sprite="ModernDarkBoxGold" size="620 16 916 40%-4"> 47 47 <object style="ModernLabelText" type="text" size="0 5 100% 25"> 48 48 <translatableAttribute id="caption">Sound Settings</translatableAttribute> 49 49 </object> 50 50 <repeat count="10"> 51 51 <object name="soundSetting[n]" size="0 25 100% 50" hidden="true"> … … 54 54 <object name="soundSettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/> 55 55 <object name="soundSettingDropdown[n]" size="70% 0 100%-8 100%" type="dropdown" style="ModernDropDown" hidden="true"/> 56 56 </object> 57 57 </repeat> 58 58 </object> 59 <object name="LobbySettings" type="image" sprite="ModernDarkBoxGold" size="620 50%+4 916 100%-52"> 59 60 <object name="gameplaySetting" type="image" sprite="ModernDarkBoxGold" size="620 40%+4 916 70%-4"> 61 <object style="ModernLabelText" type="text" size="0 5 100% 25"> 62 <translatableAttribute id="caption">Gameplay Settings</translatableAttribute> 63 </object> 64 <repeat count="1"> 65 <object name="gameplaySetting[n]" size="0 25 100% 50" hidden="true"> 66 <object name="gameplaySettingLabel[n]" size="0 0 65% 100%" type="text" style="ModernLabelText" text_align="left"/> 67 <object name="gameplaySettingTickbox[n]" size="90% 5 100% 100%+5" type="checkbox" style="ModernTickBox" hidden="true"/> 68 <object name="gameplaySettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/> 69 <object name="gameplaySettingDropdown[n]" size="70% 0 100%-8 100%" type="dropdown" style="ModernDropDown" hidden="true"/> 70 </object> 71 </repeat> 72 </object> 73 74 <object name="LobbySettings" type="image" sprite="ModernDarkBoxGold" size="620 70%+4 916 100%-52"> 60 75 <object style="ModernLabelText" type="text" size="0 5 100% 25"> 61 76 <translatableAttribute id="caption">Lobby Settings</translatableAttribute> 62 77 </object> 63 78 <repeat count="10"> 64 79 <object name="lobbySetting[n]" size="0 25 100% 50" hidden="true"> … … 67 82 <object name="lobbySettingInput[n]" size="70% 0 100%-8 100%" type="input" style="ModernInput" hidden="true"/> 68 83 <object name="lobbySettingDropdown[n]" size="70% 0 100%-8 100%" type="dropdown" style="ModernDropDown" hidden="true"/> 69 84 </object> 70 85 </repeat> 71 86 </object> 87 72 88 <object type="button" style="ModernButtonRed" size="50%-236 100%-44 50%-136 100%-16"> 73 89 <translatableAttribute id="caption">Reset</translatableAttribute> 74 90 <translatableAttribute id="tooltip">Resets user settings to their game default</translatableAttribute> 75 91 <action on="Press">setDefaults();</action> 76 92 </object> -
binaries/data/mods/public/gui/session/messages.js
34 34 "rejoined": msg => addChatMessage({ "type": "rejoined", "guid": msg.guid }), 35 35 "kicked": msg => addChatMessage({ "type": "system", "text": sprintf(translate("%(username)s has been kicked"), { "username": msg.username }) }), 36 36 "banned": msg => addChatMessage({ "type": "system", "text": sprintf(translate("%(username)s has been banned"), { "username": msg.username }) }), 37 37 "chat": msg => addChatMessage({ "type": "message", "guid": msg.guid, "text": msg.text }), 38 38 "aichat": msg => addChatMessage({ "type": "message", "guid": msg.guid, "text": msg.text, "translate": true }), 39 //"AutoTeamMsg": msg => addChatMessage({ "type": "message", "guid": msg.guid, "text": msg.text, "translate": true }), 39 40 "gamesetup": msg => "", // Needed for autostart 40 41 "start": msg => "" 41 42 }; 42 43 43 44 var g_FormatChatMessage = { … … 178 179 continue; 179 180 180 181 message.parameters[param] = colorizePlayernameByID(message.parameters[param]); 181 182 } 182 183 } 183 184 185 addChatMessage(message); 186 }, 187 "AutoTeamMsg": function(notification, player) 188 { 189 // if the option is not enabled OR player has no allies, return 190 if (Engine.ConfigDB_GetValue("user", "teamNotification") != "true") 191 return; 192 193 let message = { 194 "guid": findGuidForPlayerID(player) || -1, 195 "type": "message", 196 "text": notification.message, 197 "translate": true 198 }; 199 200 if (message.guid == -1) 201 message.player = player; 202 203 if (notification.translateParameters) 204 { 205 message.translateParameters = notification.translateParameters; 206 message.parameters = notification.parameters; 207 } 208 184 209 addChatMessage(message); 185 210 }, 186 211 "defeat": function(notification, player) 187 212 { 188 213 addChatMessage({ -
binaries/data/mods/public/simulation/helpers/Commands.js
302 302 else 303 303 queue.AddBatch(cmd.template, "unit", +cmd.count); 304 304 } 305 305 }, 306 306 307 /* 308 * 309 * name: g_Commands.research 310 * @param 311 * @return 312 * 313 */ 307 314 "research": function(player, cmd, data) 308 315 { 309 316 if (!CanControlUnit(cmd.entity, player, data.controlAllUnits)) 310 317 { 311 318 if (g_DebugCommands) … … 322 329 } 323 330 324 331 var queue = Engine.QueryInterface(cmd.entity, IID_ProductionQueue); 325 332 if (queue) 326 333 queue.AddBatch(cmd.template, "technology"); 327 }, 334 335 // if the researched technology is phasing, send a notification to GUI 336 if (cmd.template == "phase_town" || cmd.template == "phase_city") 337 { 338 if (cmd.template == "phase_town") 339 var _phase_ = "Town Phase"; 340 else 341 var _phase_ = "City Phase"; 328 342 343 var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); 344 345 cmpGuiInterface.PushNotification({ 346 "type": "AutoTeamMsg", 347 "players": [player], 348 "message": "/allies " + markForTranslation("I am advancing to the %(phase)s."), 349 "translateParameters": ["phase"], 350 "parameters": { "phase": _phase_ }, 351 "translateMessage": true 352 }); 353 } 354 }, 329 355 "stop-production": function(player, cmd, data) 330 356 { 331 357 if (!CanControlUnit(cmd.entity, player, data.controlAllUnits)) 332 358 { 333 359 if (g_DebugCommands)