Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.31 KB | None | 0 0
  1. //================================================================================
  2. // AuctionWnd.
  3. //================================================================================
  4.  
  5. class AuctionWnd extends UICommonAPI;
  6.  
  7. var WindowHandle Me;
  8. var TextBoxHandle txtRemainStr;
  9. var TextBoxHandle txtTimeHour;
  10. var TextBoxHandle txtTimeMin;
  11. var TextBoxHandle txtTimeSec;
  12. var TextBoxHandle txtHighBid;
  13. var TextBoxHandle txtMyAdenaStr;
  14. var TextBoxHandle txtMyAdena;
  15. var TextBoxHandle txtItemInfoStr;
  16. var ButtonHandle BtnBid1;
  17. var ButtonHandle BtnBid2;
  18. var ButtonHandle BtnBid3;
  19. var ButtonHandle BtnBid4;
  20. var ButtonHandle BtnBidInput;
  21. var TextBoxHandle txtHighBidStr;
  22. var TextureHandle txtRemainTimeBg;
  23. var TextureHandle ItemInfoBg;
  24. var TextureHandle txtHighBidBg;
  25. var TextureHandle txtMyAdenaBg;
  26. var ButtonHandle BtnClose;
  27. var ButtonHandle BtnNext;
  28. var ItemWindowHandle AuctionItem;
  29. var TextBoxHandle txtItemDesc;
  30. var TextBoxHandle txtItemName;
  31. var WindowHandle areaScroll;
  32. var WindowHandle NextAuctionWnd;
  33. var INT64 m_myLastBidPrice;
  34. var INT64 m_myBidPrice;
  35. var INT64 m_currentPrice;
  36. var int m_auctionID;
  37. var ItemInfo m_auctionItem;
  38. var int bShowUI;
  39. var int iAuctionID;
  40. var INT64 iCurrentPrice;
  41. var int iRemainSecond;
  42. const ADENA_OVER_FLOW= "100000000000";
  43. const DIALOG_CONFIRM_PRICE= 432;
  44. const DIALOG_ASK_AUCTION_PRICE= 321;
  45. const TIMER_DELAY=1000;
  46. const TIMER_ID=777;
  47.  
  48. function OnRegisterEvent ()
  49. {
  50.   RegisterEvent(3050);
  51.   RegisterEvent(1710);
  52. }
  53.  
  54. function OnLoad ()
  55. {
  56.   Initialize();
  57.   Load();
  58. }
  59.  
  60. function Initialize ()
  61. {
  62.   if ( 1 == 0 )
  63.   {
  64.     OnRegisterEvent();
  65.   }
  66.   if ( 1 == 0 )
  67.   {
  68.     Me = GetHandle("AuctionWnd");
  69.     txtRemainStr = TextBoxHandle(GetHandle("AuctionWnd.txtRemainStr"));
  70.     txtTimeHour = TextBoxHandle(GetHandle("AuctionWnd.txtTimeHour"));
  71.     txtTimeMin = TextBoxHandle(GetHandle("AuctionWnd.txtTimeMin"));
  72.     txtTimeSec = TextBoxHandle(GetHandle("AuctionWnd.txtTimeSec"));
  73.     txtHighBid = TextBoxHandle(GetHandle("AuctionWnd.txtHighBid"));
  74.     txtMyAdenaStr = TextBoxHandle(GetHandle("AuctionWnd.txtMyAdenaStr"));
  75.     txtMyAdena = TextBoxHandle(GetHandle("AuctionWnd.txtMyAdena"));
  76.     txtItemInfoStr = TextBoxHandle(GetHandle("AuctionWnd.txtItemInfoStr"));
  77.     BtnBid1 = ButtonHandle(GetHandle("AuctionWnd.BtnBid1"));
  78.     BtnBid2 = ButtonHandle(GetHandle("AuctionWnd.BtnBid2"));
  79.     BtnBid3 = ButtonHandle(GetHandle("AuctionWnd.BtnBid3"));
  80.     BtnBid4 = ButtonHandle(GetHandle("AuctionWnd.BtnBid4"));
  81.     BtnBidInput = ButtonHandle(GetHandle("AuctionWnd.BtnBidInput"));
  82.     txtHighBidStr = TextBoxHandle(GetHandle("AuctionWnd.txtHighBidStr"));
  83.     txtRemainTimeBg = TextureHandle(GetHandle("AuctionWnd.txtRemainTimeBg"));
  84.     ItemInfoBg = TextureHandle(GetHandle("AuctionWnd.ItemInfoBg"));
  85.     txtHighBidBg = TextureHandle(GetHandle("AuctionWnd.txtHighBidBg"));
  86.     txtMyAdenaBg = TextureHandle(GetHandle("AuctionWnd.txtMyAdenaBg"));
  87.     BtnClose = ButtonHandle(GetHandle("AuctionWnd.BtnClose"));
  88.     AuctionItem = ItemWindowHandle(GetHandle("AuctionWnd.AuctionItem"));
  89.     txtItemDesc = TextBoxHandle(GetHandle("AuctionWnd.scrollDesc.txtItemDesc"));
  90.     txtItemName = TextBoxHandle(GetHandle("AuctionWnd.txtItemName"));
  91.     areaScroll = GetHandle("AuctionWnd.scrollDesc");
  92.     NextAuctionWnd = GetHandle("NextAuctionDrawerWnd");
  93.   } else {
  94.     Me = GetWindowHandle("AuctionWnd");
  95.     txtRemainStr = GetTextBoxHandle("AuctionWnd.txtRemainStr");
  96.     txtTimeHour = GetTextBoxHandle("AuctionWnd.txtTimeHour");
  97.     txtTimeMin = GetTextBoxHandle("AuctionWnd.txtTimeMin");
  98.     txtTimeSec = GetTextBoxHandle("AuctionWnd.txtTimeSec");
  99.     txtHighBid = GetTextBoxHandle("AuctionWnd.txtHighBid");
  100.     txtMyAdenaStr = GetTextBoxHandle("AuctionWnd.txtMyAdenaStr");
  101.     txtMyAdena = GetTextBoxHandle("AuctionWnd.txtMyAdena");
  102.     txtItemInfoStr = GetTextBoxHandle("AuctionWnd.txtItemInfoStr");
  103.     BtnBid1 = GetButtonHandle("AuctionWnd.BtnBid1");
  104.     BtnBid2 = GetButtonHandle("AuctionWnd.BtnBid2");
  105.     BtnBid3 = GetButtonHandle("AuctionWnd.BtnBid3");
  106.     BtnBid4 = GetButtonHandle("AuctionWnd.BtnBid4");
  107.     BtnBidInput = GetButtonHandle("AuctionWnd.BtnBidInput");
  108.     txtHighBidStr = GetTextBoxHandle("AuctionWnd.txtHighBidStr");
  109.     txtRemainTimeBg = GetTextureHandle("AuctionWnd.txtRemainTimeBg");
  110.     ItemInfoBg = GetTextureHandle("AuctionWnd.ItemInfoBg");
  111.     txtHighBidBg = GetTextureHandle("AuctionWnd.txtHighBidBg");
  112.     txtMyAdenaBg = GetTextureHandle("AuctionWnd.txtMyAdenaBg");
  113.     BtnClose = GetButtonHandle("AuctionWnd.BtnClose");
  114.     AuctionItem = GetItemWindowHandle("AuctionWnd.AuctionItem");
  115.     txtItemDesc = GetTextBoxHandle("AuctionWnd.scrollDesc.txtItemDesc");
  116.     txtItemName = GetTextBoxHandle("AuctionWnd.txtItemName");
  117.     areaScroll = GetWindowHandle("AuctionWnd.scrollDesc");
  118.     BtnNext = GetButtonHandle("AuctionWnd.BtnNextAuction");
  119.     NextAuctionWnd = GetWindowHandle("NextAuctionDrawerWnd");
  120.   }
  121. }
  122.  
  123. function Load ()
  124. {
  125. }
  126.  
  127. function OnEvent (int Event_ID, string param)
  128. {
  129.   local ItemInfo Info;
  130.  
  131.   switch (Event_ID)
  132.   {
  133.     case 3050:
  134.     ParseInt(param,"ShowUI",bShowUI);
  135.     ParseInt(param,"AuctionID",iAuctionID);
  136.     ParseINT64(param,"CurrentPrice",iCurrentPrice);
  137.     ParseInt(param,"RemainSecond",iRemainSecond);
  138.     ParamToItemInfo(param,Info);
  139.     m_currentPrice = iCurrentPrice;
  140.     m_auctionID = iAuctionID;
  141.     m_auctionItem = Info;
  142.     if ( bShowUI == 1 )
  143.     {
  144.       InsertAuctionItem();
  145.       m_hOwnerWnd.SetTimer(777,1000);
  146.       Me.ShowWindow();
  147.       Me.SetFocus();
  148.     }
  149.     UpdateAuctionWnd();
  150.     break;
  151.     case 1710:
  152.     HandleDialogOK();
  153.     break;
  154.     default:
  155.   }
  156. }
  157.  
  158. function OnTimer (int TimerID)
  159. {
  160.   if ( TimerID == 777 )
  161.   {
  162.     Class'AuctionAPI'.RequestInfoItemAuction(m_auctionID);
  163.   }
  164. }
  165.  
  166. function InsertAuctionItem ()
  167. {
  168.   AuctionItem.Clear();
  169.   AuctionItem.AddItem(m_auctionItem);
  170.   AuctionItem.SetTooltipType("Inventory");
  171.   txtItemName.SetText(m_auctionItem.Name);
  172.   ComputeScrollHeight(m_auctionItem.Description);
  173.   txtItemDesc.SetText(m_auctionItem.Description);
  174. }
  175.  
  176. function ComputeScrollHeight (string tempStr)
  177. {
  178.   local int nHeight;
  179.   local int nWidth;
  180.   local Rect rectWnd;
  181.  
  182.   rectWnd = txtItemDesc.GetRect();
  183.   GetTextSizeDefault(tempStr,nWidth,nHeight);
  184.   areaScroll.SetScrollHeight((nHeight + 1) * (nWidth / rectWnd.nWidth + 1));
  185.   areaScroll.SetScrollPosition(0);
  186. }
  187.  
  188. function OnShow ()
  189. {
  190.   BtnNext.EnableWindow();
  191.   BtnBid1.EnableWindow();
  192.   BtnBid2.EnableWindow();
  193.   BtnBid3.EnableWindow();
  194.   BtnBid4.EnableWindow();
  195.   BtnBidInput.EnableWindow();
  196. }
  197.  
  198. function OnHide ()
  199. {
  200.   Class'UIAPI_WINDOW'.KillUITimer("AuctionWnd",777);
  201.   Class'UIAPI_ITEMWINDOW'.Clear("AuctionWnd.AuctionItem");
  202.   NextAuctionWnd.HideWindow();
  203. }
  204.  
  205. function OnClickButton (string Name)
  206. {
  207.   m_myBidPrice = -1;
  208.   switch (Name)
  209.   {
  210.     case "BtnBid1":
  211.     m_myBidPrice = UnknownFunction401(m_currentPrice,2);
  212. }
  213.  
  214. function UpdateAuctionWnd ()
  215. {
  216.   local int temp1;
  217.   local int m_timeHour;
  218.   local int m_timeMin;
  219.   local int m_timeSec;
  220.   local string tempStr;
  221.   local INT64 tempPrice;
  222.  
  223. }
  224.  
  225. function OnBtnBidInputClick ()
  226. {
  227.   DialogSetID(321);
  228.   DialogSetEditType("number");
  229.   DialogSetParamInt64(-1);
  230.   DialogSetDefaultOK();
  231.   DialogShow(1,6,GetSystemMessage(2138));
  232. }
  233.  
  234. function HandleDialogOK ()
  235. {
  236.   local int Id;
  237.  
  238.   if ( DialogIsMine() )
  239.   {
  240.     Id = DialogGetID();
  241.     if ( Id == 321 )
  242.     {
  243. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement