Advertisement
musashi1584

UISL_UIShell_Message_YourMod

Dec 10th, 2017
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class UISL_UIShell_Message_YourMod extends UIScreenListener config(YourMod_Hint_NullConfig);
  2.  
  3. var config bool bDismissed;
  4.  
  5. var localized string strModIsMissing;
  6.  
  7. event OnInit(UIScreen Screen)
  8. {
  9.     if(UIShell(Screen) != none && !bDismissed && !IsDLCInstalled('DEPENDS_ON_MOD_NAME'))
  10.     {
  11.         Screen.SetTimer(3.0f, false, nameof(MakePopup), self);
  12.     }
  13. }
  14.  
  15. simulated function MakePopup()
  16. {
  17.     local TDialogueBoxData kDialogData;
  18.     kDialogData.eType = eDialog_Warning;
  19.     kDialogData.strText = GetText();
  20.     kDialogData.fnCallback = OKClickedCB;
  21.  
  22.     kDialogData.strAccept = class'UIUtilities_Text'.default.m_strGenericAccept;
  23.  
  24.     `PRESBASE.UIRaiseDialog(kDialogData);
  25. }
  26.  
  27. simulated function OKClickedCB(eUIAction eAction)
  28. {
  29.     `PRESBASE.PlayUISound(eSUISound_MenuSelect);
  30.     bDismissed = true;
  31.     self.SaveConfig();
  32. }
  33.  
  34. simulated function string GetText()
  35. {
  36.     return strModIsMissing;
  37. }
  38.  
  39. static function bool IsDLCInstalled(name DLCName)
  40. {
  41.     local XComOnlineEventMgr EventManager;
  42.     local int i;
  43.        
  44.     EventManager = `ONLINEEVENTMGR;
  45.     for(i = 0; i < EventManager.GetNumDLC(); ++i)
  46.     {
  47.         if (DLCName == EventManager.GetDLCNames(i))
  48.         {
  49.             return true;
  50.         }
  51.     }
  52.     return false;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement