Core.Object | +--UWindow.UWindowBase | +--UWindow.UWindowWindow | +--UWindow.UWindowClientWindow | +--UWindow.UWindowDialogClientWindow | +--UMenu.UMenuDialogClientWindow | +--UTMenu.ngWorldSecretClient
UWindowMessageBox
ConfirmChange
string
EmptyText
EmptyTitle
UWindowSmallButton
OKButton
OKText
QuitHelp
QuitText
QuitTitle
UWindowComboControl
SecretCombo
SecretDesc
UMenuLabelControl
SecretLabel
SecretText
void
Close(optional bool)
Created()
MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result)
Notify(UWindowDialogControl C, byte E)
OKPressed()
Paint(Canvas C, float X, float Y)
Resized()
00001 class ngWorldSecretClient extends UMenuDialogClientWindow; 00002 00003 // Description Labels 00004 var UMenuLabelControl SecretLabel; 00005 var localized string SecretDesc; 00006 00007 // Secret Combo 00008 var UWindowComboControl SecretCombo; 00009 var localized string SecretText; 00010 00011 var UWindowSmallButton OKButton; 00012 var localized string OKText; 00013 00014 var UWindowMessageBox ConfirmChange; 00015 var localized string QuitHelp; 00016 var localized string QuitTitle; 00017 var localized string QuitText; 00018 var localized string EmptyTitle; 00019 var localized string EmptyText; 00020 00021 function Created() 00022 { 00023 local int XOffset, Num; 00024 local int CenterWidth, CenterPos; 00025 00026 CenterWidth = (WinWidth/4)*3; 00027 CenterPos = (WinWidth - CenterWidth)/2; 00028 00029 // Description 00030 XOffset = 20; 00031 SecretLabel = UMenuLabelControl(CreateWindow(class'UMenuLabelControl', CenterPos - 10, XOffset, CenterWidth + 20, 1)); 00032 SecretLabel.SetText(SecretDesc); 00033 00034 // Secret 00035 SecretCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', CenterPos, XOffset + 20, CenterWidth, 1)); 00036 SecretCombo.SetText(SecretText); 00037 //SecretCombo.SetHelpText(SecretHelp); 00038 SecretCombo.SetFont(F_Normal); 00039 SecretCombo.SetEditable(True); 00040 SecretCombo.AddItem(GetPlayerOwner().GetNGSecret()); 00041 SecretCombo.SetSelectedIndex(0); 00042 00043 OKButton = UWindowSmallButton(CreateControl(class'UWindowSmallButton', WinWidth-56, WinHeight-24, 48, 16)); 00044 OKButton.SetText(OKText); 00045 00046 Super.Created(); 00047 } 00048 00049 function Resized() 00050 { 00051 local int CenterWidth, CenterPos; 00052 00053 CenterWidth = (WinWidth/4)*3; 00054 CenterPos = (WinWidth - CenterWidth)/2; 00055 00056 SecretLabel.SetSize(CenterWidth + 60, 1); 00057 SecretLabel.WinLeft = CenterPos - 30; 00058 00059 SecretCombo.SetSize(CenterWidth, 1); 00060 SecretCombo.WinLeft = CenterPos; 00061 SecretCombo.EditBoxWidth = 110; 00062 00063 OKButton.WinLeft = WinWidth-52; 00064 OKButton.WinTop = WinHeight-20; 00065 } 00066 00067 function Paint(Canvas C, float X, float Y) 00068 { 00069 local Texture T; 00070 00071 Super.Paint(C, X, Y); 00072 00073 T = GetLookAndFeelTexture(); 00074 00075 DrawUpBevel( C, 0, WinHeight-22, WinWidth, 22, T); 00076 } 00077 00078 function Notify(UWindowDialogControl C, byte E) 00079 { 00080 Super.Notify(C, E); 00081 00082 switch(E) 00083 { 00084 case DE_Click: 00085 switch (C) 00086 { 00087 case OKButton: 00088 OKPressed(); 00089 break; 00090 } 00091 } 00092 } 00093 00094 function Close(optional bool bByParent) 00095 { 00096 // Store the new secret. 00097 GetPlayerOwner().SetNGSecret(SecretCombo.GetValue()); 00098 GetPlayerOwner().ngSecretSet = True; 00099 GetPlayerOwner().SaveConfig(); 00100 00101 Super.Close(bByParent); 00102 } 00103 00104 function OKPressed() 00105 { 00106 if (SecretCombo.GetValue() == GetPlayerOwner().GetNGSecret()) 00107 Close(); 00108 else if (SecretCombo.GetValue() == "") 00109 ConfirmChange = MessageBox(QuitTitle, EmptyText, MB_YesNo, MR_Yes, MR_No); 00110 else 00111 ConfirmChange = MessageBox(QuitTitle, QuitText, MB_YesNo, MR_Yes, MR_No); 00112 } 00113 00114 function MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result) 00115 { 00116 if(W == ConfirmChange) 00117 { 00118 switch(Result) 00119 { 00120 case MR_Yes: 00121 Close(); 00122 break; 00123 case MR_No: 00124 SecretCombo.SetValue(GetPlayerOwner().GetNGSecret()); 00125 break; 00126 } 00127 } 00128 } 00129 00130 defaultproperties 00131 { 00132 SecretDesc="Pick your own password to keep your online ngWorldStats unique." 00133 SecretText="ngWorldStats Password:" 00134 OKText="OK" 00135 QuitHelp="Select [Yes] to save your new password." 00136 QuitTitle="Confirm Password Change" 00137 QuitText="Warning! If you play with this new password, a new ngWorldStats account will be created for you the next time you join a ngWorldStats game server. Are you sure you want to do this?" 00138 EmptyTitle="Confirm Password Removal" 00139 EmptyText="Note: You have chosen not to have an ngWorldStats password. Your online game statistics will not be accumulated. Are you sure this is what you want?" 00140 }