Compare commits
2 Commits
805453d90c
...
88221039bb
Author | SHA1 | Date | |
---|---|---|---|
88221039bb | |||
e986454f80 |
@ -3,6 +3,7 @@ uint S_NbOfLinksInCache = 5;
|
|||||||
|
|
||||||
const string C_LinksCache = "LinksCache.txt";
|
const string C_LinksCache = "LinksCache.txt";
|
||||||
|
|
||||||
|
bool G_PermissionIssueNotified = false;
|
||||||
string G_QuickURL = "";
|
string G_QuickURL = "";
|
||||||
bool G_PressEnter = false;
|
bool G_PressEnter = false;
|
||||||
bool G_WasEditing = false;
|
bool G_WasEditing = false;
|
||||||
@ -10,6 +11,8 @@ bool G_WasEditing = false;
|
|||||||
array<string> G_LinksCache;
|
array<string> G_LinksCache;
|
||||||
|
|
||||||
void Main() {
|
void Main() {
|
||||||
|
if (!hasPermissions()) return;
|
||||||
|
|
||||||
trace("Loading links cache");
|
trace("Loading links cache");
|
||||||
string filepath = IO::FromStorageFolder(C_LinksCache);
|
string filepath = IO::FromStorageFolder(C_LinksCache);
|
||||||
IO::File file(filepath);
|
IO::File file(filepath);
|
||||||
@ -21,6 +24,8 @@ void Main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RenderMenuMain() {
|
void RenderMenuMain() {
|
||||||
|
if (!hasPermissions()) return;
|
||||||
|
|
||||||
if (!G_PressEnter && UI::BeginMenu("\\$cf9" + Icons::ExternalLink + "\\$z Quick Link Opener##QuickLinkOpenerMenu")) {
|
if (!G_PressEnter && UI::BeginMenu("\\$cf9" + Icons::ExternalLink + "\\$z Quick Link Opener##QuickLinkOpenerMenu")) {
|
||||||
G_QuickURL = UI::InputText("###quickURL", G_QuickURL, G_PressEnter, UI::InputTextFlags::EnterReturnsTrue + UI::InputTextFlags::CallbackAlways, UI::InputTextCallback(ITCB));
|
G_QuickURL = UI::InputText("###quickURL", G_QuickURL, G_PressEnter, UI::InputTextFlags::EnterReturnsTrue + UI::InputTextFlags::CallbackAlways, UI::InputTextCallback(ITCB));
|
||||||
|
|
||||||
@ -48,6 +53,7 @@ void ITCB(UI::InputTextCallbackData@ d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LoadLink(string _Url, bool _NewUrl) {
|
void LoadLink(string _Url, bool _NewUrl) {
|
||||||
|
if (!hasPermissions()) return;
|
||||||
if (_Url == "") return;
|
if (_Url == "") return;
|
||||||
|
|
||||||
string parsedURL = "";
|
string parsedURL = "";
|
||||||
@ -78,3 +84,15 @@ void LoadLink(string _Url, bool _NewUrl) {
|
|||||||
CTrackMania@ app = cast<CTrackMania>(GetApp());
|
CTrackMania@ app = cast<CTrackMania>(GetApp());
|
||||||
app.ManiaPlanetScriptAPI.OpenLink(parsedURL, CGameManiaPlanetScriptAPI::ELinkType::ManialinkBrowser);
|
app.ManiaPlanetScriptAPI.OpenLink(parsedURL, CGameManiaPlanetScriptAPI::ELinkType::ManialinkBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasPermissions() {
|
||||||
|
if (Permissions::PlayPublicClubRoom()) return true;
|
||||||
|
|
||||||
|
if (!G_PermissionIssueNotified) {
|
||||||
|
G_PermissionIssueNotified = true;
|
||||||
|
string msg = "Missing permissions: you need to be able to play on public room to use this plugin.";
|
||||||
|
warn(msg);
|
||||||
|
UI::ShowNotification(Meta::ExecutingPlugin().Name, msg, vec4(.9, .5, .3, .2), 15000);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[meta]
|
[meta]
|
||||||
name = "TMWT Interfaces Remover"
|
name = "TMWT Interfaces Remover"
|
||||||
category = "TMWT"
|
category = "TMWT"
|
||||||
version = "1.3"
|
version = "1.4"
|
||||||
siteid = 318
|
siteid = 318
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const string C_Class_UIModules = 'component-modelibs-uimodules-module';
|
const string C_Class_UIModules = 'component-cmgame-uimodules-module';
|
||||||
const string C_Id_TMWT_LiveRanking = 'TMWTCommon_LiveRanking';
|
const string C_Id_TMWT_LiveRanking = 'TMWTCommon_LiveRanking';
|
||||||
const string C_Id_TMWT_Header = 'TMWTCommon_Header';
|
const string C_Id_TMWT_Header = 'TMWTCommon_Header';
|
||||||
const string C_Id_TMWC2023_LiveRanking = 'TMWC2023_LiveRanking';
|
const string C_Id_TMWC2023_LiveRanking = 'TMWC2023_LiveRanking';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user