KF2-Server-Extension/ServerExt/Classes/ExtWebAdmin_UI.uc

65 lines
1.4 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
// Webadmin playinfo config variables.
// Just an information holder.
Class ExtWebAdmin_UI extends Object
transient;
/* List of PropTypes:
0 = Integer
1 = Boolean
2 = string
3 = multiline text field
*/
struct FWebAdminConfigInfo
{
var byte PropType;
var name PropName;
var string UIName,UIDesc;
var int NumElements;
structdefaultproperties
{
NumElements=1
}
};
struct FPropGroup
{
var string PageName;
var class<Object> ObjClass;
var array<FWebAdminConfigInfo> Configs;
var delegate<OnGetValue> GetValue;
var delegate<OnSetValue> SetValue;
var int Dupes;
};
var array<FPropGroup> ConfigList;
// Value accessors.
2020-11-28 20:04:55 +00:00
Delegate string OnGetValue(name PropName, int ElementIndex);
Delegate OnSetValue(name PropName, int ElementIndex, string Value);
2017-10-20 02:00:49 +00:00
final function Cleanup()
{
ConfigList.Length = 0;
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
final function AddSettingsPage(string PageName, class<Object> Obj, const out array<FWebAdminConfigInfo> Configs, delegate<OnGetValue> GetFunc, delegate<OnSetValue> SetFunc)
2017-10-20 02:00:49 +00:00
{
local int i;
i = ConfigList.Find('PageName',PageName);
2020-11-28 20:12:58 +00:00
if (i>=0) // Make sure no dupe pages.
2017-10-20 02:00:49 +00:00
PageName $= "_"$(ConfigList[i].Dupes++);
i = ConfigList.Length;
ConfigList.Length = i+1;
ConfigList[i].PageName = PageName;
ConfigList[i].ObjClass = Obj;
ConfigList[i].Configs = Configs;
ConfigList[i].GetValue = GetFunc;
ConfigList[i].SetValue = SetFunc;
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:12:58 +00:00
final function bool HasConfigfor (class<Object> Obj)
2017-10-20 02:00:49 +00:00
{
return (ConfigList.Find('ObjClass',Obj)>=0);
}