-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1258 from PyPlanet/feature/1087
Live Rankings: clickable player names to switch spectator target.
- Loading branch information
Showing
3 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
pyplanet/apps/contrib/live_rankings/templates/widget.Script.txt
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,40 @@ | ||
main() { | ||
declare Boolean Prev_DistractionFreeMode = False; | ||
declare netwrite Boolean Net_DistractionFreeMode for UI; | ||
|
||
if (Net_DistractionFreeMode == True) { | ||
Page.GetClassChildren("distraction-hide", Page.MainFrame, True); | ||
foreach (Control in Page.GetClassChildren_Result) { | ||
Control.Hide(); | ||
} | ||
} | ||
|
||
while(True) { | ||
yield; | ||
|
||
foreach (Event in PendingEvents) { | ||
if (Event.Type == CMlScriptEvent::Type::MouseClick && Event.Control.HasClass("toggleSpec")) { | ||
if (InputPlayer.RequestsSpectate) { | ||
declare frame <=> Event.Control.Parent; | ||
SetSpectateTarget(frame.DataAttributeGet("login")); | ||
} | ||
} | ||
} | ||
|
||
if (Prev_DistractionFreeMode != Net_DistractionFreeMode) { | ||
Prev_DistractionFreeMode = Net_DistractionFreeMode; | ||
|
||
if (Net_DistractionFreeMode == True) { | ||
Page.GetClassChildren("distraction-hide", Page.MainFrame, True); | ||
foreach (Control in Page.GetClassChildren_Result) { | ||
Control.Hide(); | ||
} | ||
} else { | ||
Page.GetClassChildren("distraction-hide", Page.MainFrame, True); | ||
foreach (Control in Page.GetClassChildren_Result) { | ||
Control.Show(); | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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