mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 02:18:35 +00:00
Allow sending panels to SourceTV client via settings
This commit is contained in:
parent
57bdd9fdb0
commit
93bb5ebda0
@ -419,7 +419,19 @@ bool BaseMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh,
|
|||||||
time);
|
time);
|
||||||
#endif
|
#endif
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame())
|
if (!pPlayer || !pPlayer->IsInGame())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pPlayer->IsSourceTV())
|
||||||
|
{
|
||||||
|
if (!menu->IsAllowSendToSourceTV())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,6 +332,7 @@ void CRadioDisplay::Reset()
|
|||||||
m_Title.assign("");
|
m_Title.assign("");
|
||||||
m_NextPos = 1;
|
m_NextPos = 1;
|
||||||
keys = 0;
|
keys = 0;
|
||||||
|
m_SendToSourceTV = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CRadioDisplay::DirectSet(const char *str)
|
bool CRadioDisplay::DirectSet(const char *str)
|
||||||
@ -359,6 +360,16 @@ bool CRadioDisplay::SetCurrentKey(unsigned int key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRadioDisplay::IsAllowSendToSourceTV()
|
||||||
|
{
|
||||||
|
return m_SendToSourceTV;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRadioDisplay::SetSendToSourceTV(bool type)
|
||||||
|
{
|
||||||
|
m_SendToSourceTV = type;
|
||||||
|
}
|
||||||
|
|
||||||
bool CRadioDisplay::SendDisplay(int client, IMenuHandler *handler, unsigned int time)
|
bool CRadioDisplay::SendDisplay(int client, IMenuHandler *handler, unsigned int time)
|
||||||
{
|
{
|
||||||
return g_RadioMenuStyle.DoClientMenu(client, this, handler, time);
|
return g_RadioMenuStyle.DoClientMenu(client, this, handler, time);
|
||||||
|
|||||||
@ -132,11 +132,14 @@ public: //IMenuPanel
|
|||||||
int GetAmountRemaining();
|
int GetAmountRemaining();
|
||||||
unsigned int GetApproxMemUsage();
|
unsigned int GetApproxMemUsage();
|
||||||
bool DirectSet(const char *str);
|
bool DirectSet(const char *str);
|
||||||
|
bool IsAllowSendToSourceTV();
|
||||||
|
void SetSendToSourceTV(bool type);
|
||||||
private:
|
private:
|
||||||
String m_BufferText;
|
String m_BufferText;
|
||||||
String m_Title;
|
String m_Title;
|
||||||
unsigned int m_NextPos;
|
unsigned int m_NextPos;
|
||||||
int keys;
|
int keys;
|
||||||
|
bool m_SendToSourceTV;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRadioMenu : public CBaseMenu
|
class CRadioMenu : public CBaseMenu
|
||||||
|
|||||||
@ -109,6 +109,8 @@ public:
|
|||||||
int GetAmountRemaining();
|
int GetAmountRemaining();
|
||||||
unsigned int GetApproxMemUsage();
|
unsigned int GetApproxMemUsage();
|
||||||
bool DirectSet(const char *str) { return false; }
|
bool DirectSet(const char *str) { return false; }
|
||||||
|
bool IsAllowSendToSourceTV() { return false; }
|
||||||
|
void SetSendToSourceTV(bool type) {}
|
||||||
private:
|
private:
|
||||||
KeyValues *m_pKv;
|
KeyValues *m_pKv;
|
||||||
unsigned int m_NextPos;
|
unsigned int m_NextPos;
|
||||||
|
|||||||
@ -1308,6 +1308,8 @@ static cell_t SendPanelToClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPanelHandler *handler = g_MenuHelpers.GetPanelHandler(pFunction);
|
CPanelHandler *handler = g_MenuHelpers.GetPanelHandler(pFunction);
|
||||||
|
panel->SetSendToSourceTV((params[0] >= 5) ? params[5] : false);
|
||||||
|
|
||||||
if (!panel->SendDisplay(params[2], handler, params[4]))
|
if (!panel->SendDisplay(params[2], handler, params[4]))
|
||||||
{
|
{
|
||||||
g_MenuHelpers.FreePanelHandler(handler);
|
g_MenuHelpers.FreePanelHandler(handler);
|
||||||
|
|||||||
@ -1061,10 +1061,11 @@ native bool SetPanelKeys(Handle panel, int keys);
|
|||||||
* @param client A client to draw to.
|
* @param client A client to draw to.
|
||||||
* @param handler The MenuHandler function to catch actions with.
|
* @param handler The MenuHandler function to catch actions with.
|
||||||
* @param time Time to hold the menu for.
|
* @param time Time to hold the menu for.
|
||||||
|
* @param sendToSTV Allow this menu to be sent to SourceTV
|
||||||
* @return True on success, false on failure.
|
* @return True on success, false on failure.
|
||||||
* @error Invalid Handle.
|
* @error Invalid Handle.
|
||||||
*/
|
*/
|
||||||
native bool SendPanelToClient(Handle panel, int client, MenuHandler handler, int time);
|
native bool SendPanelToClient(Handle panel, int client, MenuHandler handler, int time, bool sendToSTV = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the amount of text the menu can still hold. If this is
|
* @brief Returns the amount of text the menu can still hold. If this is
|
||||||
|
|||||||
@ -341,6 +341,18 @@ namespace SourceMod
|
|||||||
* @return True if supported, otherwise false.
|
* @return True if supported, otherwise false.
|
||||||
*/
|
*/
|
||||||
virtual bool DirectSet(const char *str) =0;
|
virtual bool DirectSet(const char *str) =0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enabled or disabled sending menus to SourceTV
|
||||||
|
*
|
||||||
|
* @return True if enabled, otherwise false.
|
||||||
|
*/
|
||||||
|
virtual bool IsAllowSendToSourceTV() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable or disable sending menus to SourceTV
|
||||||
|
*/
|
||||||
|
virtual void SetSendToSourceTV(bool type) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user