Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.43 KB | None | 0 0
  1. class BR_PathWnd extends UICommonAPI;
  2.  
  3. const N_MAX_WEB_RES_X = 1024;
  4. const N_MAX_WEB_RES_Y = 1024;
  5. const N_BUTTON_HEAD_AREA_BUFFER = 75;
  6.  
  7. var string m_WindowName;
  8.  
  9. var WindowHandle    m_hPathWnd;
  10. var WebBrowserHandle    m_hBrowserViewer;
  11. var EditBoxHandle   ChatEditBox;
  12. var bool m_firstOpen;
  13.  
  14. function OnRegisterEvent()
  15. {
  16.     RegisterEvent(EV_ShowWebPathMainPage);
  17.     RegisterEvent(EV_ShowWebPathListPage);
  18.     RegisterEvent(EV_ShowWebPathAlarm);
  19.     RegisterEvent( EV_ResolutionChanged );
  20. }
  21.  
  22. function OnLoad()
  23. {
  24.     if(CREATE_ON_DEMAND==0)
  25.         OnRegisterEvent();
  26.  
  27.     if(CREATE_ON_DEMAND==0)
  28.     {
  29.         m_hPathWnd=GetHandle(m_WindowName);
  30.         m_hBrowserViewer=WebBrowserHandle(GetHandle(m_WindowName$".WebBrowser"));
  31.     }
  32.     else
  33.     {
  34.         m_hPathWnd=GetWindowHandle(m_WindowName);
  35.         m_hBrowserViewer=GetWebBrowserHandle(m_WindowName$".WebBrowser");
  36.     }
  37.  
  38. //  ChatEditBox = EditBoxHandle( GetHandle( "ChatWnd.ChatEditBox" )); COD-_-
  39. //  ChatEditBox = GetEditBoxHandle( "ChatWnd.ChatEditBox" );
  40.    
  41.     m_firstOpen = false;
  42. }
  43.  
  44. function OnShow()
  45. {
  46.     m_hBrowserViewer.ShowWindow();
  47. }
  48.  
  49. function OnHide()
  50. {
  51.     m_hBrowserViewer.HideWindow();
  52. }
  53.  
  54. function NavigateToPathPage(String additionalURL)
  55. {
  56.     local UserInfo userinfo;
  57.     local int serverNo;
  58.     local string lineage2PathMapURL;
  59.     local int lineage2PetitionID;
  60.  
  61.     // default setting for in game browser petition
  62.     //m_hBrowserViewer.WithWebSession();
  63.  
  64.     // ??·? »???µ??? ??°??? 1:1 ?®?????? ???? URL???­ ?????? ?¤??µ???????.
  65.     // ???¤???? ??·§?????? ?®??????±? ??¶?????.
  66.     m_hBrowserViewer.BeginParam( "UTF-8" );
  67.  
  68. //  lineage2PetitionID = 32; // °??¤µ? °?
  69. //  m_hBrowserViewer.PushParam( "target", string(lineage2PetitionID) );
  70. //
  71. //  serverNo = GetServerNo();
  72. //  m_hBrowserViewer.PushParam( "server_id", string(serverNo) );
  73. //
  74. //  GetPlayerInfo( userinfo );
  75. //  m_hBrowserViewer.PushParam( "char_name", userinfo.Name );
  76.    
  77.     if( additionalURL == "main" )
  78.     {
  79.         if( GetINIString( "URL", "L2InGameBrowserPathMapURL", lineage2PathMapURL, "l2.ini" ) )
  80.         {
  81.             //m_hBrowserViewer.NavigateAsPost( lineage2PathMapURL$"/"$additionalURL );
  82.             m_hBrowserViewer.NavigateAsPost( lineage2PathMapURL );
  83.         }
  84.     }
  85.     else
  86.     {
  87.         m_hBrowserViewer.NavigateAsPost( additionalURL );
  88.     }  
  89. }
  90. function HandleShowWebPathMapMainPage(String param)
  91. {
  92.     local string url;
  93.    
  94.     ParseString(param, "Message", url);
  95.  
  96.     if( url == "" )
  97.     {
  98.         url = "main";
  99.     }
  100.    
  101.     if( m_firstOpen == false )
  102.     {
  103.         m_firstOpen = true;
  104.         CheckResolution();
  105.     }
  106.    
  107.     ChatEditBox.ReleaseFocus();
  108.     m_hPathWnd.ShowWindow();
  109.     m_hPathWnd.SetFocus();
  110.    
  111.     // ???? ??????
  112.     NavigateToPathPage(url);
  113. }
  114.  
  115. function HandleShowWebPathMapListPage()
  116. {
  117.     m_hPathWnd.ShowWindow();
  118.     m_hPathWnd.SetFocus();
  119.    
  120.     // ?®?? ?»?? ??????
  121.     NavigateToPathPage("list");
  122. }
  123.  
  124. function HandleShowWebPathAlarm(String param)
  125. {
  126.     local int PathToAwakeningAlarmType;
  127.     local int PathToAwakeningAlarmValue;
  128.    
  129.     PathToAwakeningAlarmType = 0;
  130.     PathToAwakeningAlarmValue = 0;
  131.    
  132.     m_hPathWnd.ShowWindow();
  133.     m_hPathWnd.SetFocus();
  134.    
  135.     ParseInt(param, "Type", PathToAwakeningAlarmType); // 0 None 1 Level
  136.     ParseInt(param, "Value", PathToAwakeningAlarmValue); // type 0??¶§?? »???????
  137.    
  138.     debug(" ShowWebPathAlarm Type" @ PathToAwakeningAlarmType @ "Value" @ PathToAwakeningAlarmValue ) ;
  139.    
  140.     // ?®?? ?»?? ??????
  141.     NavigateToPathPage("list");
  142. }
  143.  
  144.  
  145. function OnEvent(int Event_ID, String param)
  146. {
  147.     switch(Event_ID)
  148.     {      
  149.     case EV_ShowWebPathMainPage:
  150.         HandleShowWebPathMapMainPage(param);       
  151.         break;
  152.        
  153.     case EV_ShowWebPathListPage:
  154.         HandleShowWebPathMapListPage();
  155.         break;
  156.     case EV_ShowWebPathAlarm:
  157.         HandleShowWebPathAlarm(param);
  158.         break;     
  159.     case EV_ResolutionChanged :
  160.         HandleResolutionChanged(param);
  161.         break;
  162.     }
  163. }
  164.  
  165. function OnClickButton( string Name )
  166. {
  167.     switch( Name )
  168.     {
  169.     case "HomeButton":
  170.         NavigateToPathPage("main");
  171.         break;
  172.     case "PrevButton":
  173.         m_hBrowserViewer.GoToHistoryOffset(-1);
  174.         break;
  175.     case "NextButton":
  176.         m_hBrowserViewer.GoToHistoryOffset(1);
  177.         break;     
  178.     }  
  179. }
  180.  
  181. function HandleResolutionChanged(String aParam)
  182. {
  183.     local int NewWidth;
  184.     local int NewHeight;
  185.     ParseInt(aParam, "NewWidth", NewWidth);
  186.     ParseInt(aParam, "NewHeight", NewHeight);
  187.  
  188.     //branch EP1.0 luciper3 - ?? ?????­ ??¶§ °??? 0?? ????µ? 0?» ????????·??­ °????» ????????°? »?¶???
  189.     if( NewWidth <= 0 || NewHeight <= 0 )
  190.         return;
  191.     //end of branch
  192.  
  193.     ResetWebSize(NewWidth, NewHeight);
  194. }
  195.  
  196. function CheckResolution()
  197. {
  198.     local int CurrentMaxWidth;
  199.     local int CurrentMaxHeight;
  200.  
  201.  
  202.     GetCurrentResolution (CurrentMaxWidth, CurrentMaxHeight);
  203.     ResetWebSize(CurrentMaxWidth, CurrentMaxHeight);
  204. }
  205.  
  206. function ResetWebSize(int CurrentWidth, int CurrentHeight)
  207. {
  208.     local int adjustedwidth;
  209.     local int adjustedheight;
  210.     local int MainMapWidth;
  211.     local int MainMapHeight;
  212.  
  213.     //~ debug("MinimapExpandWnd - ResetMinimapSize");
  214.    
  215.     MainMapWidth = CurrentWidth;
  216.     MainMapHeight = CurrentHeight;
  217.  
  218.     adjustedwidth = CurrentWidth - 19 ;
  219.     adjustedheight = CurrentHeight - N_BUTTON_HEAD_AREA_BUFFER - 5 ;
  220.    
  221.     if (CurrentWidth > N_MAX_WEB_RES_X )
  222.     {
  223.         adjustedwidth = N_MAX_WEB_RES_X - 19;
  224.         MainMapWidth = N_MAX_WEB_RES_X ;
  225.                
  226.        
  227.     }
  228.     if (CurrentHeight > N_MAX_WEB_RES_Y)
  229.     {
  230.         adjustedheight = N_MAX_WEB_RES_Y - N_BUTTON_HEAD_AREA_BUFFER;
  231.         MainMapHeight = N_MAX_WEB_RES_Y;       
  232.     }
  233.    
  234.     m_hPathWnd.SetWindowSize(MainMapWidth+2 , MainMapHeight-2);
  235.     m_hBrowserViewer.SetWindowSize(adjustedwidth+2, adjustedheight-2);     
  236.    
  237. }
  238.  
  239. defaultproperties
  240. {
  241.     m_WindowName="BR_PathWnd"
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement