swwmgz_m/zscript/swwm_menu.zsc

66 lines
2 KiB
Text

// internal "knowledge base" and more
Class SWWMKnowledgeBaseMenu : GenericMenu
{
// TODO everything, just have it be a blank menu for now
TextureID MainWindow, TabSeparator, WindowSeparator;
Font TewiFont;
int curtab;
// for scrolling
int sel0, sel1, sel2;
// inventory lists
Array<Inventory> invlist;
// lore stuff
SWWMLoreLibrary lorelib;
// store prompt
Array<Class<Inventory> > storelist;
bool buying;
int buyitem;
int buyamount;
// trading
SWWMTradeHistory tradelib;
// temporary bottom messages, such as "not enough money"
String tmsg;
int tmsgtic;
override void Init( Menu parent )
{
Super.Init(parent);
if ( gamestate != GS_LEVEL )
{
// can't open this menu outside of the game
Close();
return;
}
TewiFont = Font.GetFont('TewiShaded');
MainWindow = TexMan.CheckForTexture("graphics/KBase/MainWindow.png",TexMan.Type_Any);
TabSeparator = TexMan.CheckForTexture("graphics/KBase/TabSeparator.png",TexMan.Type_Any);
WindowSeparator = TexMan.CheckForTexture("graphics/KBase/WindowSeparator.png",TexMan.Type_Any);
curtab = CVar.GetCVar('swwm_lasttab',players[consoleplayer]).GetInt();
if ( (curtab < 0) || (curtab > 7) ) curtab = 0;
}
override bool MenuEvent( int mkey, bool fromcontroller )
{
switch( mkey )
{
case MKEY_ENTER:
case MKEY_BACK:
MenuSound(GetCurrentMenu()?"menu/backup":"menu/clear");
Close();
return true;
}
return false;
}
override void Drawer()
{
Super.Drawer();
String str;
double hs = max(min(floor(Screen.GetWidth()/640.),floor(Screen.GetHeight()/400.)),1.);
Vector2 ss = (Screen.GetWidth(),Screen.GetHeight())/hs;
Vector2 origin = (ss.x-640,ss.y-400)/2.;
Screen.DrawTexture(MainWindow,false,origin.x,origin.y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
str = StringTable.Localize("$SWWM_COMINGSOON");
Screen.DrawText(TewiFont,Font.CR_FIRE,(ss.x-TewiFont.StringWidth(str))/2.,(ss.y-TewiFont.GetHeight())/2.,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
}