BugInTheSYS

Some in-game script (maybe lua?)

Oct 22nd, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.65 KB | None | 0 0
  1. menu_lan_results={
  2.     init_function = function()
  3.         Network:StartSystemLink()
  4.         windows_reset()
  5.         GameFlow.SetGameMode("JOIN")
  6.         StandardUpperBalk()
  7.         StandardLowerBalk()
  8.         --XBoxLiveLowerBalk(LINKRESULTS_JOIN, LINKRESULTS_BACK, LINKRESULTS_REFRESH)
  9.         GUI:LoadBackground("data/menu/bg/game_background.tga")
  10.        
  11.        
  12.         local listboxParams={
  13.         ListBoxTemplate={Name="sessionlist", ShowBorders=FALSE},
  14.         Left=Layout.ListPos[1],
  15.         Top=Layout.ListPos[2],
  16.         LeftPadding=0,
  17.         RightPadding=0,
  18.         TopPadding=0,
  19.         BottomPadding=0,
  20.         RowWidth=Layout.ListWidth,
  21.         RowHeight=Layout.ListRowHeight,
  22.         RowPadding=Layout.ListRowPadding,
  23.         RowTemplate={Font=Layout.ListFont, DrawBackgroundColor=TRUE, TitleCentering=TITLE_CENTER_NONE},
  24.         RowTemplateType="Button",
  25.         RowTemplateCust=function(Row, RowNr)
  26.             Row:SetColor({0, 0, 0, 0})
  27.             Row:SetActiveColor(Layout.ListBackgroundColor)
  28.             Row:SetInactiveColor({0, 0, 0, 0})
  29.         end,
  30.         NumRows=9,
  31.         Coloumns={
  32.                 [1]={
  33.                 Name="matchnr", -- _row# is added
  34.                 ColoumnTemplate={Position=Layout.MatchNrPos, Font=Layout.MatchNrFont, Size=SIZE(Layout.ListRowHeight,Layout.MatchNrWidth), ShowBorders=FALSE},
  35.                 ColoumnTemplateType="StaticText",
  36.                 ColoumnTemplateCust=function(Coloumn, RowNr, ColoumnNr)
  37.                     Coloumn:SetColor(Layout.MatchNrFontColor)
  38.                 end
  39.                 },     
  40.                 [2]={
  41.                 Name="matchname", -- _row# is added
  42.                 ColoumnTemplate={Position=Layout.MatchNamePos, Size=SIZE(Layout.ListRowHeight,Layout.MatchNameWidth), Font=Layout.ListFont, DrawBackgroundColor=FALSE, TitleCentering=TITLE_CENTER_NONE},
  43.                 ColoumnTemplateType="StaticText",
  44.                 ColoumnTemplateCust=function(Coloumn, RowNr, ColoumnNr)
  45.                     Coloumn:SetColor(Layout.ListFontColor)
  46.                 end
  47.                 },     
  48.                 [3]={
  49.                 Name="players", -- _row# is added
  50.                 ColoumnTemplate={Position=Layout.PlayersPos, Size=SIZE(Layout.ListRowHeight,Layout.PlayersWidth), Font=Layout.ListFont, DrawBackgroundColor=FALSE, TitleCentering=TITLE_CENTER_NONE},
  51.                 ColoumnTemplateType="StaticText",
  52.                 ColoumnTemplateCust=function(Coloumn, RowNr, ColoumnNr)
  53.                     Coloumn:SetColor(Layout.ListFontColor)
  54.                 end
  55.                 },
  56.             }
  57.         }
  58.         local list=addparent(CreateMultiColoumnListBox(listboxParams))
  59.         list.onNeedData=function(Self, RowObject, RowNr, ControlRowNr)
  60.             local matchnr=wm.GetWindow(string.format("matchnr_row%i", ControlRowNr))
  61.             local matchname=wm.GetWindow(string.format("matchname_row%i", ControlRowNr))
  62.             local players=wm.GetWindow(string.format("players_row%i", ControlRowNr))
  63.             if RowNr <=SessionList:GetNumSessions() then
  64.                 SessionList:SetSessionNum(RowNr)
  65.                 local sessionInfo=SessionList:GetSessionInfo()
  66.                 --matchnr:SetTitle(ConvertToWString(string.format("%02i", RowNr)))
  67.                 matchname:SetTitle(sessionInfo.SessionName)
  68.                 local playersTitle=string.format("%i/%i", sessionInfo.FilledPublicSlots+sessionInfo.FilledPrivateSlots, sessionInfo.MaxPublicSlots+sessionInfo.MaxPrivateSlots)
  69.                 playersTitle=ConvertToWString(playersTitle)
  70.                 players:SetTitle(playersTitle)
  71.             end
  72.         end
  73.        
  74.         list:SetNumRows(0)
  75.        
  76.         list.onSelectedRowChanged=function(Self, RowNr)
  77.             RefreshGameInfoBox()
  78.         end
  79.        
  80.        
  81.        
  82.         local win=addparent(StaticText{Position=MakeSafePos(Layout.GameTitlePos), Size=Layout.TitleSize, Font=Layout.TitleFont, ShowBorders=FALSE})
  83.         win:SetColor(Layout.TitleFontColor)
  84.         win:SetTitle(LINKRESULTS_GAME)
  85.  
  86.         local win=addparent(StaticText{Position=MakeSafePos(Layout.PlayersTitlePos), Size=Layout.TitleSize, Font=Layout.TitleFont, ShowBorders=FALSE})
  87.         win:SetColor(Layout.TitleFontColor)
  88.         win:SetTitle(LINKRESULTS_PLAYERS)
  89.        
  90.         CreateGameInfoBox(Layout.InfoBoxPos, Layout.InfoBoxSize, true, false, true)
  91.        
  92.         --local handler=addparent(InputHandler{Name="inputhandler"})
  93.         --handler.onKeyPressed=function(Self, Character, VirtualKey, ScanCode)
  94.         --  if VirtualKey==KeyCodes["BUTTON_START"] then
  95.         --      JoinSelectedSession()
  96.         --  elseif VirtualKey==KeyCodes["BUTTON_SELECT"] then
  97.         --      menu_lan_results.options.back_action()
  98.         --  elseif VirtualKey==KeyCodes["BUTTON_X"] and State=="DISPLAYING" then
  99.         --      Network:StopSystemLink()
  100.         --      Network:StartSystemLink()
  101.         --      SessionList:Refresh()
  102.         --      ShowThinkingWindow()
  103.         --      State="SEARCHING"
  104.         --  elseif VirtualKey==KeyCodes["BUTTON_UP"] then
  105.         --      list:MovePrev()
  106.         --  elseif VirtualKey==KeyCodes["BUTTON_DOWN"] then
  107.         --      list:MoveNext()
  108.         --  elseif VirtualKey==KeyCodes["BUTTON_LEFT"] then
  109.         --      PrevInfoPage()
  110.         --  elseif VirtualKey==KeyCodes["BUTTON_RIGHT"] then
  111.         --      NextInfoPage()
  112.         --  end
  113.         --end
  114.         --handler:SetFocus()
  115.            
  116.         activateparents()
  117.         SessionList:Refresh()
  118.         ShowThinkingWindow()
  119.         State="SEARCHING"
  120.     end,
  121.    
  122.     deinit_function = function()
  123.         --deactivateparents()
  124.         windows_reset()
  125.     end,
  126.  
  127.  
Advertisement
Add Comment
Please, Sign In to add comment