Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oaa dashboard #2337

Merged
merged 3 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions content/panorama/layout/custom_game/timer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<include src="file://{resources}/styles/custom_game/timer.css" />
</styles>
<scripts>
<include src="file://{resources}/scripts/custom_game/util.js" />
<include src="file://{resources}/scripts/custom_game/timer.js" />
</scripts>
<Panel class="CustomTimer">
Expand All @@ -18,6 +19,14 @@
<DOTAHeroImage id="NightstalkerNight" class="TimeOfDayIcon" heroname="npc_dota_hero_night_stalker" heroimagestyle="icon"/>
<Label id="GameTime" text="{s:time_of_day}" hittest="false"/>
</Panel>
<Panel id="ExtraInfo">
<Label id="TimeToNextCapture" text="#NextCaptureLabel" hittest="false"/>
<Label id="TimeToNextDuel" text="#NextDuelLabel" hittest="false"/>
<Label id="KillLimit" text="#ScoreLimit" hittest="false"/>
<Label id="TimeToNextCaptureValue" hittest="false"/>
<Label id="KillLimitValue" hittest="false"/>
<Label id="TimeToNextDuelValue" text="{s:time_of_day}" hittest="false"/>
</Panel>
</Panel>
</Panel>
</root>
30 changes: 28 additions & 2 deletions content/panorama/scripts/custom_game/timer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
/* global CustomNetTables $ */
/* global CustomNetTables $ FindDotaHudElement */
var topBar = FindDotaHudElement('topbar');
var extraInfo = FindDotaHudElement('ExtraInfo');
var killLimit = FindDotaHudElement('KillLimitValue');
var nextDuel = FindDotaHudElement('TimeToNextDuelValue');
var nextCapture = FindDotaHudElement('TimeToNextCaptureValue');

if (extraInfo.GetParent().id !== 'topbar') {
extraInfo.SetParent(topBar);
extraInfo = null;
killLimit = null;
nextDuel = null;
nextCapture = null;
}

(function () {
CustomNetTables.SubscribeNetTableListener('timer', UpdateClock);
Expand All @@ -9,8 +22,21 @@ function UpdateClock (table, name, data) {
if (!data || data.time === undefined) {
return;
}
$('#TimeHider').style.visibility = 'visible';
if (killLimit === null) {
killLimit = FindDotaHudElement('KillLimitValue');
}
if (nextDuel === null) {
nextDuel = FindDotaHudElement('TimeToNextDuelValue');
}
if (nextCapture === null) {
nextCapture = FindDotaHudElement('TimeToNextCaptureValue');
}

killLimit.text = data.killLimit;
nextDuel.text = formatTime(data.timeToNextDuel);
nextCapture.text = formatTime(data.timeToNextCapture);

$('#TimeHider').style.visibility = 'visible';
$('#GameTime').text = formatTime(data.time);
var dayTime = $('#DayTime');
var nightTime = $('#NightTime');
Expand Down
61 changes: 60 additions & 1 deletion content/panorama/styles/custom_game/timer.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.CustomTimer {
width: 100%;
height: 60px;
height: 160px;
vertical-align: top;
}

Expand All @@ -20,3 +20,62 @@
.HIDE_TOP_TIMEOFDAY #TimeOfDay, .HIDE_TOP_TIMEOFDAY #TimeOfDayBG {
visibility: visible;
}

#ExtraInfo{
width: 160px;
height: 0px;
horizontal-align: center;
vertical-align: top;
margin-top: 40px;
background-image: url("s2r://panorama/images/hud/reborn/bg_timer_psd.vtex");
background-size: 100% 100%;
transition-property: height;
transition-duration: 0.20s;
transition-timing-function: ease-in-out;
}

.AltPressed #ExtraInfo
{
height: 76px;
}

#ExtraInfo Label
{
font-size: 16px;
vertical-align: top;
horizontal-align: left;
font-family: Radiance,FZLanTingHei-R-GBK,TH Sarabun New,YDYGO 540,Gulim,MingLiU;
}

#TimeToNextCapture {
margin-top: 5px;
margin-left: 15px;
}

#TimeToNextDuel {
margin-top: 25px;
margin-left: 25px;
}

#KillLimit {
margin-top: 45px;
margin-left: 32px;
}

#TimeToNextCaptureValue {
margin-top: 5px;
margin-left: 120px;
color: red;
}

#TimeToNextDuelValue {
margin-top: 25px;
margin-left: 110px;
color: red;
}

#KillLimitValue {
margin-top: 45px;
margin-left: 109px;
color: red;
}
6 changes: 6 additions & 0 deletions game/resource/English/panorama/OAADashboard.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//=============================================================================
// OAA Dashboard
//=============================================================================
"NextCaptureLabel" "Next Capture in:"
"NextDuelLabel" "Next Duel in:"
"ScoreLimit" "Score Limit"
12 changes: 12 additions & 0 deletions game/scripts/vscripts/components/capturepoints/capturepoints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function CapturePoints:Init ()

self.currentCapture = nil

CapturePoints.nextCaptureTime = HudTimer:GetGameTime() + INITIAL_CAPTURE_POINT_DELAY
Timers:CreateTimer(INITIAL_CAPTURE_POINT_DELAY - 60, function ()
self:ScheduleCapture()
end)
Expand Down Expand Up @@ -113,12 +114,20 @@ function CapturePoints:MinimapPing()
end
end

function CapturePoints:GetCaptureTime()
if CapturePoints.nextCaptureTime == nil or CapturePoints.nextCaptureTime < 0 then return 0 end
return CapturePoints.nextCaptureTime
end

function CapturePoints:ScheduleCapture()
if self.scheduleCaptureTimer then
Timers:RemoveTimer(self.scheduleCaptureTimer)
self.scheduleCaptureTimer = nil
end
PrepareCapture.broadcast(true)

CapturePoints.nextCaptureTime = HudTimer:GetGameTime() + CAPTURE_INTERVAL + CAPTURE_FIRST_WARN

self.scheduleCaptureTimer = Timers:CreateTimer(CAPTURE_INTERVAL, function ()
self:ScheduleCapture()
end)
Expand Down Expand Up @@ -151,6 +160,8 @@ function CapturePoints:ScheduleCapture()
end

function CapturePoints:StartCapture(color)
CapturePoints.nextCaptureTime = HudTimer:GetGameTime() + CAPTURE_FIRST_WARN

self.currentCapture = {
y = 1
}
Expand All @@ -169,6 +180,7 @@ function CapturePoints:StartCapture(color)

Timers:CreateTimer(CAPTURE_FIRST_WARN, function ()
self:ActuallyStartCapture()
CapturePoints.nextCaptureTime = HudTimer:GetGameTime() + CAPTURE_INTERVAL + CAPTURE_FIRST_WARN
end)
end

Expand Down
12 changes: 11 additions & 1 deletion game/scripts/vscripts/components/duels/duels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function Duels:Init ()
self:CountPlayerDeath(player)
end
end)

Duels.nextDuelTime = HudTimer:GetGameTime() + INITIAL_DUEL_DELAY + DUEL_START_WARN_TIME
Timers:CreateTimer(INITIAL_DUEL_DELAY, function ()
self:StartDuel({
players = 0,
Expand Down Expand Up @@ -496,6 +496,15 @@ function Duels:TimeoutDuel ()
})
end

function Duels:SetNextDuelTime()
Duels.nextDuelTime = HudTimer:GetGameTime() + DUEL_INTERVAL + DUEL_START_WARN_TIME
end

function Duels:GetNextDuelTime()
if Duels:IsActive() then return HudTimer:GetGameTime() end
return Duels.nextDuelTime
end

function Duels:EndDuel ()
if self.currentDuel == nil then
DebugPrint ('There is no duel running')
Expand All @@ -508,6 +517,7 @@ function Duels:EndDuel ()
Music:PlayBackground(1, 7)

local nextDuelIn = DUEL_INTERVAL
Duels:SetNextDuelTime()

if self.startDuelTimer then
Timers:RemoveTimer(self.startDuelTimer)
Expand Down
13 changes: 12 additions & 1 deletion game/scripts/vscripts/components/statprovider/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,21 @@ function HudTimer:Init()
self.isPaused = false
self.gameTime = 0
Timers:CreateTimer(function()
local timeToNextDuel = Duels:GetNextDuelTime()
if timeToNextDuel == nil then timeToNextDuel = 0 else timeToNextDuel = timeToNextDuel - self.gameTime end
if timeToNextDuel < 0 then timeToNextDuel = 0 end

local timeToNextCapture = CapturePoints:GetCaptureTime()
if timeToNextCapture == nil then timeToNextCapture = 0 else timeToNextCapture = timeToNextCapture - self.gameTime end
if timeToNextCapture < 0 then timeToNextCapture = 0 end

CustomNetTables:SetTableValue( 'timer', 'data', {
time = self.gameTime,
isDay = GameRules:IsDaytime(),
isNightstalker = GameRules:IsNightstalkerNight()
isNightstalker = GameRules:IsNightstalkerNight(),
killLimit = PointsManager:GetLimit(),
timeToNextDuel = timeToNextDuel,
timeToNextCapture = timeToNextCapture
})

if not self.isPaused then
Expand Down