Advertisement
nikich340

W3 popup test

Sep 1st, 2020
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. // ----------------------------------------------------------------------------
  2. class CMyModPopupCallback extends IModUiConfirmPopupCallback {
  3.     public function OnConfirmed(action: String) {
  4.         switch (action) {
  5.             case "quit":
  6.                 theGame.GetGuiManager().ShowNotification("Confirmed!");
  7.                 break;
  8.         }
  9.     }
  10. }
  11. // ----------------------------------------------------------------------------
  12. class MyClass {
  13.     private var confirmPopup: CModUiActionConfirmation;
  14.     private var quitConfirmCallback: CMyModPopupCallback;
  15.    
  16.     public function popupRequest() {
  17.         var msgTitle: String;
  18.         var msgText: String;
  19.  
  20.         //SetIgnoreInput(true);
  21.         if (confirmPopup) { delete confirmPopup; }
  22.  
  23.         confirmPopup = new CModUiActionConfirmation in this;
  24.         msgTitle = "Popup title";
  25.         msgText = "Popup text";
  26.  
  27.         /* public function open(caller: IModUiConfirmPopupCallback, title: String, msg: String, action: String) */
  28.        
  29.         confirmPopup.open(quitConfirmCallback, msgTitle, msgText, "quit");
  30.        
  31.         theGame.GetGuiManager().ShowNotification("opened!");
  32.     }
  33. }
  34. // ----------------------------------------------------------------------------
  35. exec function test_mypopup() {
  36.     var myClassObj : MyClass;
  37.     myClassObj = new MyClass in thePlayer;
  38.    
  39.     theGame.GetGuiManager().ShowNotification("created!");
  40.     myClassObj.popupRequest();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement