Skip to content

Commit 31355b9

Browse files
carlosrpgchrisinajar
authored andcommitted
Dramatically improve load time (#2592)
* revert pick screen and fix game state machine * Test vanila picking screen * Some fixes * revert changes to tooltip * re add custom pick screen for non all pick mode * remove some test changes * more reverting tests * Add custom picking screen to other modes * fixes * removing MK agani * travis stuff * more travis * cmon travis * not the best but better than placehold text
1 parent 3333828 commit 31355b9

29 files changed

+1892
-398
lines changed
Loading
Loading

content/panorama/layout/custom_game/custom_ui_manifest.xml

+22-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Uncomment any of the following lines in order to disable that portion of the default UI
1717

1818
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_TOP_TIMEOFDAY, false ); //Time of day (clock).
19-
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_TOP_HEROES, false ); //Heroes and team score at the top of the HUD.
19+
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_TOP_HEROES, true ); //Heroes and team score at the top of the HUD.
2020
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_FLYOUT_SCOREBOARD, false ); //Lefthand flyout scoreboard.
2121
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_ACTION_PANEL, false ); //Hero actions UI.
2222
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_ACTION_MINIMAP, false ); //Minimap.
@@ -28,9 +28,9 @@
2828
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_INVENTORY_PROTECT, false ); //Glyph.
2929
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_INVENTORY_GOLD, false ); //Gold display.
3030
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_SHOP_SUGGESTEDITEMS, false ); //Suggested items shop panel.
31-
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_TEAMS, false ); //Hero selection Radiant and Dire player lists.
32-
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_GAME_NAME, false ); //Hero selection game mode name display.
33-
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_CLOCK, false ); //Hero selection clock.
31+
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_TEAMS, true ); //Hero selection Radiant and Dire player lists.
32+
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_GAME_NAME, true ); //Hero selection game mode name display.
33+
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_HERO_SELECTION_CLOCK, true ); //Hero selection clock.
3434
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_TOP_MENU_BUTTONS, false ); //Top-left menu buttons in the HUD.
3535
GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_ENDGAME, false ); //Endgame scoreboard.
3636
//GameUI.SetDefaultUIEnabled( DotaDefaultUIElement_t.DOTA_DEFAULT_UI_TOP_BAR_BACKGROUND, false ); //Top-left menu buttons in the HUD.
@@ -69,6 +69,22 @@
6969
GameEvents.Subscribe("onGameInCheatMode", function () {
7070
$.Msg("\nThis Match is in Cheat Mode!\n")
7171
})
72+
function HidePickScreen() {
73+
var dotaHud = $.GetContextPanel().GetParent().GetParent();
74+
if (Game.GameStateIsBefore(DOTA_GameState.DOTA_GAMERULES_STATE_HERO_SELECTION)) {
75+
dotaHud.FindChild("PreGame").visible = false;
76+
}
77+
else if (Game.GameStateIs(DOTA_GameState.DOTA_GAMERULES_STATE_HERO_SELECTION)) {
78+
dotaHud.FindChild("PreGame").visible = true;
79+
}
80+
else if (Game.GameStateIs(DOTA_GameState.DOTA_GAMERULES_STATE_PRE_GAME)) {
81+
dotaHud.FindChild("PreGame").visible = false;
82+
}
83+
}
84+
(function()
85+
{
86+
GameEvents.Subscribe( "game_rules_state_change", HidePickScreen );
87+
})();
7288
</script>
7389

7490
<Panel>
@@ -91,8 +107,9 @@
91107
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/stat_display.xml" />
92108
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/oaa_game_info.xml" />
93109
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/timer.xml" />
94-
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/hero_selection.xml" />
110+
<CustomUIElement type="HeroSelection" layoutfile="file://{resources}/layout/custom_game/hero_selection.xml" />
95111
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/discord.xml" />
112+
<CustomUIElement type="HeroSelection" layoutfile="file://{resources}/layout/custom_game/talent_branch_tooltip.xml" />
96113
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/precache.xml" />
97114
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/bottle_announcement.xml" />
98115
<CustomUIElement type="Hud" layoutfile="file://{resources}/layout/custom_game/surrender.xml" />

content/panorama/layout/custom_game/hero_selection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<root>
22
<styles>
33
<include src="file://{resources}/styles/custom_game/hero_selection.css" />
4+
<include src="file://{resources}/styles/custom_game/bottlepass_rewards.css" />
45
</styles>
56
<scripts>
67
<include src="file://{resources}/scripts/custom_game/util.js" />

content/panorama/layout/custom_game/precache.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
<Panel id="container" style="visibility:collapse;">
44
<Image src="file://panorama/images/heroes/npc_dota_hero_sohei.png" hittest="false" />
55
<Image src="file://panorama/images/heroes/npc_dota_hero_electrician.png" hittest="false" /> <!-- Cookies: Find out why it doesn't precache the image, and then hide it just like the other one -->
6-
<!-- <Image src="file://panorama/images/heroes/icons/npc_dota_hero_sohei.png" hittest="false" /> -->
6+
<Image src="file://panorama/images/heroes/electrician/npc_dota_hero_electrician.png" hittest="false" />
7+
<Image src="file://panorama/images/heroes/selection/npc_dota_hero_electrician.png" hittest="false" />
8+
<Image src="file://panorama/images/heroes/selection/npc_dota_hero_sohei.png" hittest="false" />
9+
<Image src="file://materials/overviews/oaa.tga" hittest="false" />
710
</Panel>
811
</Panel>
912
</root>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<root>
2+
<styles>
3+
<include src="s2r://panorama/styles/tooltips/tooltip_base.vcss_c" />
4+
<include src="s2r://panorama/styles/tooltips/tooltip_stat_branch.vcss_c" />
5+
<include src="s2r://panorama/styles/ui_stat_branch.vcss_c" />
6+
<include src="s2r://panorama/styles/hud/dota_hud_stat_branch.vcss_c" />
7+
<include src="file://{resources}/styles/custom_game/talent_tooltip.css" />
8+
<include src="file://{resources}/styles/custom_game/bottlepass_rewards.css" />
9+
</styles>
10+
<scripts>
11+
<include src="file://{resources}/scripts/custom_game/util.js" />
12+
<include src="file://{resources}/scripts/custom_game/vanila_hero_selection.js"/>
13+
</scripts>
14+
<snippets>
15+
<snippet name="BottleRadio">
16+
<RadioButton class="BottleOption" group="BottleOption" onactivate="SelectBottle()" hittest="true">
17+
<Panel class="Bottle"/>
18+
</RadioButton>
19+
</snippet>
20+
<snippet name="ArcanaRadio">
21+
<RadioButton class="ArcanaOption" group="ArcanaOption" onactivate="SelectArcana()" hittest="true">
22+
<Panel class="Arcana"/>
23+
</RadioButton>
24+
</snippet>
25+
</snippets>
26+
<Panel class='Holder' hittest="false">
27+
<Panel class='DOTATooltipStatBranch ' hittest="false">
28+
<Panel id='DOTAHUDStatBranchTooltipAlt' class='TooltipContainer TopArrowVisible' hittest='false' hittestchildren='false'>
29+
<Panel id='TopArrow' hittest='false'/>
30+
<Panel id='TooltipRow' hittest='false'>
31+
<Panel id='LeftArrow' hittest='false'/>
32+
<TooltipContents id='Contents' hittest='false'>
33+
<Panel id='StatBranchAlt' >
34+
<Label id='BranchTitle' text='#DOTA_StatBranch_TooltipTitle'/>
35+
<Panel id='MainBranchContainerAlt' >
36+
37+
<Panel id='UpgradeOption4Alt' class='BranchPair' >
38+
<Panel class='BranchChoiceContainer LeftBranch' >
39+
<Button id='Upgrade8' class='BranchChoice'>
40+
<Label class='StatBonusLabel' text='{s:name_8}' />
41+
</Button>
42+
</Panel>
43+
<Panel class='BranchChoiceContainer RightBranch' >
44+
<Button id='Upgrade7' class='BranchChoice'>
45+
<Label class='StatBonusLabel' text='{s:name_7}' />
46+
</Button>
47+
</Panel>
48+
<Panel class='Center' >
49+
<Panel class='ChoiceArrow Left'/>
50+
<Panel class='LevelBG'>
51+
<Label class='ReqLabel' text='25' />
52+
</Panel>
53+
<Panel class='ChoiceArrow Right'/>
54+
</Panel>
55+
</Panel>
56+
57+
<Panel id='UpgradeOption3Alt' class='BranchPair' >
58+
<Panel class='BranchChoiceContainer LeftBranch' >
59+
<Button id='Upgrade6' class='BranchChoice'>
60+
<Label class='StatBonusLabel' text='{s:name_6}' />
61+
</Button>
62+
</Panel>
63+
<Panel class='BranchChoiceContainer RightBranch' >
64+
<Button id='Upgrade5' class='BranchChoice'>
65+
<Label class='StatBonusLabel' text='{s:name_5}' />
66+
</Button>
67+
</Panel>
68+
<Panel class='Center' >
69+
<Panel class='ChoiceArrow Left'/>
70+
<Panel class='LevelBG'>
71+
<Label class='ReqLabel' text='20' />
72+
</Panel>
73+
<Panel class='ChoiceArrow Right'/>
74+
</Panel>
75+
</Panel>
76+
77+
<Panel id='UpgradeOption2Alt' class='BranchPair' >
78+
<Panel class='BranchChoiceContainer LeftBranch' >
79+
<Button id='Upgrade4' class='BranchChoice'>
80+
<Label class='StatBonusLabel' text='{s:name_4}' />
81+
</Button>
82+
</Panel>
83+
<Panel class='BranchChoiceContainer RightBranch' >
84+
<Button id='Upgrade3' class='BranchChoice'>
85+
<Label class='StatBonusLabel' text='{s:name_3}' />
86+
</Button>
87+
</Panel>
88+
<Panel class='Center' >
89+
<Panel class='ChoiceArrow Left'/>
90+
<Panel class='LevelBG'>
91+
<Label class='ReqLabel' text='15' />
92+
</Panel>
93+
<Panel class='ChoiceArrow Right'/>
94+
</Panel>
95+
</Panel>
96+
97+
<Panel id='UpgradeOption1Alt' class='BranchPair' >
98+
<Panel class='BranchChoiceContainer LeftBranch' >
99+
<Button id='Upgrade2' class='BranchChoice'>
100+
<Label class='StatBonusLabel' text='{s:name_2}' />
101+
</Button>
102+
</Panel>
103+
<Panel class='BranchChoiceContainer RightBranch' >
104+
<Button id='Upgrade1' class='BranchChoice'>
105+
<Label class='StatBonusLabel' text='{s:name_1}' />
106+
</Button>
107+
</Panel>
108+
<Panel class='Center' >
109+
<Panel class='ChoiceArrow Left'/>
110+
<Panel class='LevelBG'>
111+
<Label class='ReqLabel' text='10' />
112+
</Panel>
113+
<Panel class='ChoiceArrow Right'/>
114+
</Panel>
115+
</Panel>
116+
</Panel>
117+
</Panel>
118+
</TooltipContents>
119+
<Panel id='RightArrow' hittest='false'/>
120+
</Panel>
121+
<Panel id='BottomArrow' hittest='false'/>
122+
</Panel>
123+
</Panel>
124+
<Panel class="BottlePassSelection" hittest="true" hittestchildren="true" >
125+
<Label id="BottlePassSelectionTitle" text="#BottlePassSelection"/>
126+
<Label id="BottleSelectionTitle" text="#BottleSelection"/>
127+
<Panel id="BottleSelection" hittest="true" hittestchildren="true" >
128+
</Panel>
129+
<Panel class="ArcanaPanel" id="ArcanaPanel">
130+
<Label id="ArcanaSelectionTitle" text="#ArcanaSelection"/>
131+
<Panel id="ArcanaSelection" hittest="true" hittestchildren="true" >
132+
</Panel>
133+
</Panel>
134+
</Panel>
135+
</Panel>
136+
</root>

content/panorama/scripts/custom_game/abilitylevels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function DisplayAbilityLevelError (data) {
1313
// Localise hero level requirement error message and insert hero level number
1414
var errorMessageText = $.Localize('#dota_hud_error_ability_cant_upgrade_hero_level').replace('%s1', data.requiredLevel);
1515

16-
var errorData = {reason: 80, message: errorMessageText};
16+
var errorData = { reason: 80, message: errorMessageText };
1717
GameEvents.SendEventClientSide('dota_hud_error_message', errorData);
1818
}
1919

content/panorama/scripts/custom_game/armor_resist_value.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global GameEvents, Entities, FindDotaHudElement */
1+
/* global GameEvents, Entities, FindDotaHudElement, $, Players */
22
'use strict';
33
(function () {
44
var statsTooltipRegion = FindDotaHudElement('stats_tooltip_region');

content/panorama/scripts/custom_game/armor_resist_value.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global GameEvents, Entities, FindDotaHudElement */
1+
/* global GameEvents, Entities, FindDotaHudElement, $, Players */
22
'use strict';
33

44
(function () {

content/panorama/scripts/custom_game/hero_selection.js

+33-24
Original file line numberDiff line numberDiff line change
@@ -97,30 +97,39 @@ var hilariousLoadingPhrases = [
9797
'The wandering boss spawns at 12:00'
9898
];
9999

100-
SetupTopBar();
101-
102-
$('#MainContent').SetHasClass(currentMap, true);
103-
104-
CustomNetTables.SubscribeNetTableListener('hero_selection', onPlayerStatChange);
105-
CustomNetTables.SubscribeNetTableListener('bottlepass', UpdateBottleList);
106-
107-
// load hero selection
108-
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_STRENGTH', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_STRENGTH'));
109-
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_AGILITY', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_AGILITY'));
110-
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_INTELLECT', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_INTELLECT'));
111-
onPlayerStatChange(null, 'herolist', CustomNetTables.GetTableValue('hero_selection', 'herolist'));
112-
113-
onPlayerStatChange(null, 'APdata', CustomNetTables.GetTableValue('hero_selection', 'APdata'));
114-
onPlayerStatChange(null, 'CMdata', CustomNetTables.GetTableValue('hero_selection', 'CMdata'));
115-
onPlayerStatChange(null, 'rankedData', CustomNetTables.GetTableValue('hero_selection', 'rankedData'));
116-
onPlayerStatChange(null, 'time', CustomNetTables.GetTableValue('hero_selection', 'time'));
117-
onPlayerStatChange(null, 'preview_table', CustomNetTables.GetTableValue('hero_selection', 'preview_table'));
118-
ReloadCMStatus(CustomNetTables.GetTableValue('hero_selection', 'CMdata'));
119-
UpdatePreviews(CustomNetTables.GetTableValue('hero_selection', 'preview_table'));
120-
changeHilariousLoadingText();
121-
UpdateBottleList();
122-
123-
$('#ARDMLoading').style.opacity = 0;
100+
init();
101+
102+
function init () {
103+
$.GetContextPanel().AddClass(currentMap);
104+
if (currentMap === 'unranked') {
105+
return;
106+
}
107+
108+
SetupTopBar();
109+
110+
$('#MainContent').SetHasClass(currentMap, true);
111+
112+
CustomNetTables.SubscribeNetTableListener('hero_selection', onPlayerStatChange);
113+
CustomNetTables.SubscribeNetTableListener('bottlepass', UpdateBottleList);
114+
115+
// load hero selection
116+
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_STRENGTH', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_STRENGTH'));
117+
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_AGILITY', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_AGILITY'));
118+
onPlayerStatChange(null, 'abilities_DOTA_ATTRIBUTE_INTELLECT', CustomNetTables.GetTableValue('hero_selection', 'abilities_DOTA_ATTRIBUTE_INTELLECT'));
119+
onPlayerStatChange(null, 'herolist', CustomNetTables.GetTableValue('hero_selection', 'herolist'));
120+
121+
onPlayerStatChange(null, 'APdata', CustomNetTables.GetTableValue('hero_selection', 'APdata'));
122+
onPlayerStatChange(null, 'CMdata', CustomNetTables.GetTableValue('hero_selection', 'CMdata'));
123+
onPlayerStatChange(null, 'rankedData', CustomNetTables.GetTableValue('hero_selection', 'rankedData'));
124+
onPlayerStatChange(null, 'time', CustomNetTables.GetTableValue('hero_selection', 'time'));
125+
onPlayerStatChange(null, 'preview_table', CustomNetTables.GetTableValue('hero_selection', 'preview_table'));
126+
ReloadCMStatus(CustomNetTables.GetTableValue('hero_selection', 'CMdata'));
127+
UpdatePreviews(CustomNetTables.GetTableValue('hero_selection', 'preview_table'));
128+
changeHilariousLoadingText();
129+
UpdateBottleList();
130+
131+
$('#ARDMLoading').style.opacity = 0;
132+
}
124133

125134
function changeHilariousLoadingText () {
126135
var incredibleWit = hilariousLoadingPhrases[~~(Math.random() * hilariousLoadingPhrases.length)];

content/panorama/scripts/custom_game/statcollection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function OnClientCheckIn (args) {
2222
$.AsyncWebRequest('https://api.getdotastats.com/s2_check_in.php',
2323
{
2424
type: 'POST',
25-
data: {payload: JSON.stringify(payload)},
25+
data: { payload: JSON.stringify(payload) },
2626
success: function (data) {
2727
$.Msg('GDS Reply: ', data);
2828
}

0 commit comments

Comments
 (0)