-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported Interest Scaleform to panorama
- Loading branch information
Showing
9 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+10.9 KB
content/dota_addons/element_td/panorama/images/custom_game/interest/gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.87 KB
...t/dota_addons/element_td/panorama/images/custom_game/interest/interest_gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.04 KB
...t/dota_addons/element_td/panorama/images/custom_game/interest/interest_gray.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+968 Bytes
...ota_addons/element_td/panorama/images/custom_game/interest/interest_overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
content/dota_addons/element_td/panorama/layout/custom_game/interest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<root> | ||
<styles> | ||
<include src="s2r://panorama/styles/dotastyles.vcss_c" /> | ||
<include src="file://{resources}/styles/custom_game/interest.css" /> | ||
</styles> | ||
<scripts> | ||
<include src="file://{resources}/scripts/custom_game/interest.js" /> | ||
</scripts> | ||
<Panel hittest="false" class="BaseHud"> | ||
<Panel hittest="false" id="Interest"> | ||
<Panel hittest="false" id="InterestBar" onmouseover="RemoveStyle(InterestTooltip, hide)" onmouseout="AddStyle(InterestTooltip, hide)"> | ||
<Panel hittest="false" id="InterestBarGold"/> | ||
<Panel hittest="false" id="InterestBarOverlay"/> | ||
<Image id="InterestCoin" src="file://{images}/custom_game/interest/gold.png"/> | ||
<Label id="InterestLabel" text="Interest (2%)"/> | ||
</Panel> | ||
<Panel hittest="false" id="InterestTooltip" class="hide"> | ||
<Label id="TooltipLabel" text="Total Gold From Interest"/> | ||
<Label id="TooltipAmount" text="0"/> | ||
</Panel> | ||
</Panel> | ||
</Panel> | ||
</root> |
53 changes: 53 additions & 0 deletions
53
content/dota_addons/element_td/panorama/scripts/custom_game/interest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"use strict"; | ||
|
||
var INTEREST_INTERVAL = 15; | ||
var INTEREST_RATE = 0.02; | ||
|
||
var INTEREST_REFRESH = 0.05; | ||
|
||
var interest = $( "#Interest" ); | ||
var interestBarGold = $( "#InterestBarGold" ); | ||
var tooltipAmount = $( "#TooltipAmount" ); | ||
|
||
var timerEnd = 0; | ||
var totalGoldEarned = 0; | ||
var enabled = false; | ||
var timerStart = 0; | ||
|
||
function UpdateInterest() { | ||
if (enabled) { | ||
if ( Game.GetGameTime() > timerEnd ) { | ||
timerStart = timerEnd; | ||
timerEnd += INTEREST_INTERVAL; | ||
} | ||
var widthPercentage = 100 - Math.floor((timerEnd - Game.GetGameTime())/INTEREST_INTERVAL * 100); | ||
interestBarGold.style["width"] = widthPercentage+"%"; | ||
} | ||
$.Schedule(INTEREST_REFRESH, function(){UpdateInterest();}); | ||
} | ||
|
||
function DisplayInterest( table ) { | ||
timerStart = Game.GetGameTime(); | ||
timerEnd = Game.GetGameTime() + INTEREST_INTERVAL; | ||
interest.visible = true; | ||
enabled = table.enabled; | ||
INTEREST_INTERVAL = table.interval; | ||
INTEREST_RATE = table.rate; | ||
} | ||
|
||
function InterestEarned( table ) { | ||
enabled = true; | ||
interest.visible = true; | ||
// Sync | ||
timerStart = Game.GetGameTime(); | ||
timerEnd = timerStart + INTEREST_INTERVAL; | ||
totalGoldEarned += table.goldEarned; | ||
tooltipAmount.text = totalGoldEarned; | ||
} | ||
|
||
(function () { | ||
UpdateInterest(); | ||
interest.visible = false; | ||
GameEvents.Subscribe( "etd_display_interest", DisplayInterest ); | ||
GameEvents.Subscribe( "etd_earned_interest", InterestEarned ); | ||
})(); |
94 changes: 94 additions & 0 deletions
94
content/dota_addons/element_td/panorama/styles/custom_game/interest.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
.BaseHud | ||
{ | ||
width: 100%; | ||
height: 100%; | ||
flow-children: down; | ||
} | ||
|
||
#Interest | ||
{ | ||
horizontal-align: right; | ||
margin-top: 4px; | ||
margin-right: 14px; | ||
z-index: 15; | ||
flow-children: down; | ||
} | ||
|
||
#InterestBar | ||
{ | ||
width: 240px; | ||
height: 36px; | ||
background-image: url("file://{resources}/images/custom_game/interest/interest_gray.png"); | ||
background-size: 100%; | ||
margin-bottom: 10px; | ||
} | ||
|
||
#InterestBarGold | ||
{ | ||
width: 100%; | ||
height: 100%; | ||
background-image: url("file://{resources}/images/custom_game/interest/interest_gold.png"); | ||
background-size: 100%; | ||
} | ||
|
||
#InterestBarOverlay | ||
{ | ||
width: 100%; | ||
height: 100%; | ||
background-image: url("file://{resources}/images/custom_game/interest/interest_overlay.png"); | ||
background-size: 100%; | ||
} | ||
|
||
#InterestTooltip | ||
{ | ||
width: 240px; | ||
height: 70px; | ||
background-color: #111111; | ||
padding: 8px; | ||
flow-children: down; | ||
} | ||
|
||
.hide | ||
{ | ||
visibility: collapse; | ||
} | ||
|
||
#InterestCoin | ||
{ | ||
margin-top: 3px; | ||
width: 30px; | ||
height: 30px; | ||
margin-left: 20px; | ||
} | ||
|
||
#InterestLabel | ||
{ | ||
margin-top: 4px; | ||
font-size: 23px; | ||
font-weight: bold; | ||
color: #FF9900; | ||
text-shadow: 0px 0px 3px 4.0 #000; | ||
text-align: center; | ||
width: 100%; | ||
text-align: center; | ||
} | ||
|
||
#TooltipLabel | ||
{ | ||
width: 100%; | ||
font-size: 20px; | ||
font-weight: bold; | ||
color: #FFF; | ||
text-shadow: 5px 5px #000; | ||
text-align: center; | ||
} | ||
|
||
#TooltipAmount | ||
{ | ||
width: 100%; | ||
text-align: center; | ||
font-size: 24px; | ||
font-weight: bold; | ||
color: #FF9900; | ||
text-shadow: 0px 0px 5px 5.0 #000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2b859ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get rid of the FireGameEvents and flash3/custom_ui.txt elements too, right?
2b859ce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll do that once all Scaleform elements have been ported, I'm just leaving it alone for now.