- Timestamp:
- 08/31/11 04:58:57 (13 years ago)
- Location:
- ps/trunk/binaries/data/mods/public/gui
- Files:
-
- 4 edited
-
msgbox/msgbox.xml (modified) (4 diffs)
-
session/input.js (modified) (30 diffs)
-
session/menu.js (modified) (1 diff)
-
session/session.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/gui/msgbox/msgbox.xml
r10122 r10147 8 8 var mbTitleObj = getGUIObjectByName("mbTitleBar"); 9 9 var mbTextObj = getGUIObjectByName("mbText"); 10 10 11 11 var mbButton1Obj = getGUIObjectByName("mbButton1"); 12 12 var mbButton2Obj = getGUIObjectByName("mbButton2"); … … 16 16 var mbLRDiff = data.width / 2; // Message box left/right difference from 50% of screen 17 17 var mbUDDiff = data.height / 2; // Message box up/down difference from 50% of screen 18 18 19 19 var mbSizeString = "50%-" + mbLRDiff + " 50%-" + mbUDDiff + " 50%+" + mbLRDiff + " 50%+" + mbUDDiff; 20 20 21 21 mbMainObj.size = mbSizeString; 22 22 23 23 // Texts 24 24 mbTitleObj.caption = data.title; … … 101 101 type="text" 102 102 style="CenteredLabelText" 103 size=" 30 30 100%-30 100%-100"103 size="5% 20% 95% 100%-96" 104 104 /> 105 105 106 106 <object name="mbButton1" 107 107 style="StoneButton" 108 108 type="button" 109 109 hidden="true" 110 size="40 100%-50 33%-30 100%-20" 110 size="40 100%-50 33%-30 100%-20" 111 111 /> 112 112 <object name="mbButton2" … … 114 114 type="button" 115 115 hidden="true" 116 size="33%+30 100%-50 66%-40 100%-20" 116 size="33%+30 100%-50 66%-40 100%-20" 117 117 /> 118 118 <object name="mbButton3" -
ps/trunk/binaries/data/mods/public/gui/session/input.js
r10007 r10147 88 88 }); 89 89 } 90 90 91 91 return false; 92 92 } … … 114 114 { 115 115 var selection = g_Selection.toList(); 116 116 117 117 // If the selection doesn't exist, no action 118 118 var entState = GetEntityState(selection[0]); … … 126 126 return entState && entState.player == playerID; 127 127 }); 128 128 129 129 if (!g_DevSettings.controlAll && !allOwnedByPlayer) 130 130 return {"possible": false}; … … 136 136 }); 137 137 138 138 139 139 if (!target) 140 140 { … … 149 149 if (haveRallyPoints && selection.indexOf(target) != -1 && action == "unset-rallypoint") 150 150 return {"possible": true}; 151 151 152 152 // Look at the first targeted entity 153 153 // (TODO: maybe we eventually want to look at more, and be more context-sensitive? … … 164 164 // can return to the dropsite, can build the foundation, or can attack the enemy 165 165 var simState = Engine.GuiInterfaceCall("GetSimulationState"); 166 166 167 167 for each (var entityID in selection) 168 168 { … … 170 170 if (!entState) 171 171 continue; 172 172 173 173 var playerState = simState.players[entState.player]; 174 174 var playerOwned = (targetState.player == entState.player); … … 176 176 var enemyOwned = playerState.isEnemy[targetState.player]; 177 177 var gaiaOwned = (targetState.player == 0); 178 178 179 179 // Find the resource type we're carrying, if any 180 180 var carriedType = undefined; … … 240 240 return undefined; 241 241 } 242 242 243 243 // If the selection doesn't exist, no action 244 244 var entState = GetEntityState(selection[0]); … … 252 252 return entState && entState.player == playerID; 253 253 }); 254 254 255 255 if (!g_DevSettings.controlAll && !allOwnedByPlayer) 256 256 return undefined; … … 289 289 return {"type": "repair", "cursor": "action-repair", "target": target}; 290 290 else 291 return {"type": "none", "cursor": "action-repair-disabled", "target": undefined}; 291 return {"type": "none", "cursor": "action-repair-disabled", "target": undefined}; 292 292 break; 293 293 } … … 308 308 return {"type": "returnresource", "cursor": actionInfo.cursor, "target": target}; 309 309 else if (getActionInfo("build", target).possible) 310 return {"type": "build", "cursor": "action-build", "target": target}; 310 return {"type": "build", "cursor": "action-build", "target": target}; 311 311 else if (getActionInfo("repair", target).possible) 312 312 return {"type": "build", "cursor": "action-repair", "target": target}; … … 374 374 375 375 entStateList.push(entState); 376 } 376 } 377 377 378 378 // If there are no units, check if there are defensive entities in the selection … … 407 407 // be processed here before being passed on, and propagation will stop if this function 408 408 // returns true) 409 // 409 // 410 410 // TODO: it'd probably be nice to have a better state-machine system, with guaranteed 411 411 // entry/exit functions, since this is a bit broken now … … 452 452 var preferredEntities = getPreferredEntities(ents) 453 453 454 if (preferredEntities.length) 454 if (preferredEntities.length) 455 455 ents = preferredEntities; 456 456 … … 483 483 484 484 g_Selection.setHighlightList([]); 485 485 486 486 inputState = INPUT_NORMAL; 487 487 return true; … … 490 490 } 491 491 break; 492 492 493 493 case INPUT_BUILDING_CLICK: 494 494 switch (ev.type) … … 569 569 placementPosition.z = snapData.z; 570 570 } 571 571 572 572 updateBuildingPlacementPreview(); 573 573 break; … … 719 719 var dragDeltaX = ev.x - dragStart[0]; 720 720 var dragDeltaY = ev.y - dragStart[1]; 721 721 722 722 if (Math.abs(dragDeltaX) >= maxDragDelta || Math.abs(dragDeltaY) >= maxDragDelta) 723 723 { … … 744 744 var selectedEntity = ents[0]; 745 745 var now = new Date(); 746 746 747 747 // If camera following and we select different unit, stop 748 748 if (Engine.GetFollowedEntity() != selectedEntity) … … 757 757 var matchRank = true; 758 758 var templateToMatch; 759 759 760 760 // Check for double click or triple click 761 761 if (!doubleClicked) … … 782 782 } 783 783 } 784 784 785 785 // TODO: Should we handle "control all units" here as well? 786 786 ents = Engine.PickSimilarFriendlyEntities(templateToMatch, showOffscreen, matchRank); … … 811 811 g_Selection.addList(ents); 812 812 } 813 813 814 814 inputState = INPUT_NORMAL; 815 815 return true; … … 835 835 placementPosition.z = snapData.z; 836 836 } 837 837 838 838 updateBuildingPlacementPreview(); 839 839 … … 922 922 // TODO: Play a sound? 923 923 return true; 924 924 925 925 case "set-rallypoint": 926 926 var target = Engine.GetTerrainAtPoint(ev.x, ev.y); … … 942 942 }); 943 943 return true; 944 944 945 945 case "none": 946 946 return true; 947 947 948 948 default: 949 949 error("Invalid action.type "+action.type); … … 1078 1078 var template = GetTemplateData(entState.template); 1079 1079 var unitName = getEntityName(template); 1080 1080 1081 1081 var playerID = Engine.GetPlayerID(); 1082 1082 if (entState.player == playerID || g_DevSettings.controlAll) … … 1089 1089 if (selection.length > 0) 1090 1090 { 1091 var message = "Are you sure you want to\ndelete the selected units?"; 1092 1093 var deleteFunction = function () 1094 { 1091 closeMenu(); 1092 closeOpenDialogs(); 1093 1094 var deleteFunction = function () 1095 { 1095 1096 Engine.PostNetworkCommand({"type": "delete-entities", "entities": selection}); 1096 1097 }; 1097 1098 1098 g_SessionDialog.open("Delete", message, null, 340, 160, deleteFunction); 1099 var btCaptions = ["Yes", "No"]; 1100 var btCode = [deleteFunction, null]; 1101 1102 messageBox(400, 200, "Destroy everything currently selected?", "Delete", 0, btCaptions, btCode); 1099 1103 } 1100 1104 break; … … 1213 1217 var data = { prevUnit: lastIdleUnit, idleClass: classes[currIdleClass] }; 1214 1218 var newIdleUnit = Engine.GuiInterfaceCall("FindIdleUnit", data); 1215 1219 1216 1220 // Check if we have new valid entity 1217 1221 if (newIdleUnit && newIdleUnit != lastIdleUnit) … … 1221 1225 g_Selection.addList([lastIdleUnit]); 1222 1226 Engine.CameraFollow(lastIdleUnit); 1223 1227 1224 1228 return; 1225 1229 } 1226 1230 1227 1231 lastIdleUnit = 0; 1228 1232 currIdleClass = (currIdleClass + 1) % classes.length; 1229 1233 } 1230 1234 1231 1235 // TODO: display a message or play a sound to indicate no more idle units, or something 1232 1236 // Reset for next cycle -
ps/trunk/binaries/data/mods/public/gui/session/menu.js
r10146 r10147 133 133 } 134 134 135 function escapeKeyAction()135 function closeOpenDialogs() 136 136 { 137 137 closeMenu(); -
ps/trunk/binaries/data/mods/public/gui/session/session.xml
r10146 r10147 43 43 44 44 <object hotkey="leave"> 45 <action on="Press"> escapeKeyAction();</action>45 <action on="Press">closeOpenDialogs();</action> 46 46 </object> 47 47 … … 422 422 <action on="Press"> 423 423 closeMenu(); 424 escapeKeyAction();424 closeOpenDialogs(); 425 425 <![CDATA[ 426 426 var btCaptions = ["Yes", "No"];
Note:
See TracChangeset
for help on using the changeset viewer.
