Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 |
// // Displays the heirachy of quick chat menus // class HUDQuickChatMenu extends HUDContainer; enum EOpeningState { STATE_Opening, STATE_Open, STATE_Closing, STATE_Closed }; var() config float GutterX; var() config float GutterY; var() config int numRows; var() config int numColumns; var() config float animateTime; var HUDQuickChatMenu activeChildMenu; var HUDQuickChatMenu parentMenu; var float animatePosX; var float animatePosY; var EOpeningState menuState; var float animateStartTime; var float animateProgress; var QuickChatMenu menu; function InitMenu(QuickChatMenu menuObject, HUDQuickChatMenu parent, HUDContainer parentContainer) { local int i; local HUDQuickChatMenuItem nextItem; menu = menuObject; parentMenu = parent; menuState = STATE_Closed; for(i = 0; i < menu.subMenu.Length; ++i) { nextItem = HUDQuickChatMenuItem(AddClonedElement("TribesGUI.HUDQuickChatMenuItem", "default_QuickChatMenuItem")); nextItem.InitMenu(menu.subMenu[i], self, parentContainer); } } function OpenMenu(optional HUDQuickChatMenuItem trigger) { if(menuState == STATE_Opening || menuState == STATE_Open || activeChildMenu != None) return; animatePosX = 0; animatePosY = 0; if(trigger != None) { animatePosX = trigger.PosX; animatePosY = trigger.PosY; } bVisible = true; menuState = STATE_Opening; animateStartTime = timeSeconds; animateProgress = 0.0; SetNeedsLayout(); } function CloseMenu(optional HUDQuickChatMenuItem trigger) { if(menuState == STATE_Closing || menuState == STATE_Closed) return; animatePosX = 0; animatePosY = 0; if(trigger != None) { animatePosX = trigger.PosX; animatePosY = trigger.PosY; } menuState = STATE_Closing; animateStartTime = timeSeconds; animateProgress = 0.0; SetNeedsLayout(); } function DoLayout(Canvas c) { local int i, row, col; local float CurX, CurY, MaxHeight; local HUDQuickChatMenuItem nextItem; super.DoLayout(c); if(menuState == STATE_Opening || menuState == STATE_Closing) { animateProgress += ((timeSeconds - animateStartTime) / animateTime); if(animateProgress >= 1.0) { animateProgress = 1.0; if(menuState == STATE_Opening) { menuState = STATE_Open; bVisible = true; } else if(menuState == STATE_Closing) { menuState = STATE_Closed; bVisible = false; } } if(menuState == STATE_Opening) SetAlpha(animateProgress); else if(menuState == STATE_Closing) SetAlpha(1.0 - animateProgress); } for(row = 0; row < numRows; ++row) { for(col = 0; col < numColumns; ++col) { if(i < children.Length) { nextItem = HUDQuickChatMenuItem(children[i]); if(nextItem != None) { nextItem.PosX = CurX; nextItem.PosY = CurY; // force the change in values CurX += GutterX + nextItem.Width; MaxHeight = Max(MaxHeight, nextItem.Height); } } ++i; } CurX = 0; CurY += GutterY + MaxHeight; } if(menuState == STATE_Opening || menuState == STATE_Closing) { for(i = 0; i < children.Length; ++i) { if(menuState == STATE_Opening) { children[i].PosX = animatePosX + animateProgress * (children[i].PosX - animatePosX); children[i].PosY = animatePosY + animateProgress * (children[i].PosY - animatePosY); } else { children[i].PosX = children[i].PosX - animateProgress * (children[i].PosX - animatePosX); children[i].PosY = children[i].PosY - animateProgress * (children[i].PosY - animatePosY); } } SetNeedsLayout(); } } function HUDQuickChatMenu GetRootMenu() { if(parentMenu != None) return parentMenu.GetRootMenu(); return self; } function CancelAll() { bVisible = false; menuState = STATE_Closed; if(activeChildMenu != None) { activeChildMenu.CancelAll(); activeChildMenu = None; } } function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta, HUDAction Response ) { local int i; if(menu.bDummyItem) return false; if(activeChildMenu != None && menu.IsCategoryMenu()) return activeChildMenu.KeyEvent(Key, Action, Delta, Response); else if(menuState == STATE_Opening || menuState == STATE_Open) { for(i = 0; i < children.Length; i++) { if(children[i].KeyEvent(Key, Action, Delta, Response)) return true; } } return false; } defaultproperties { animateTime=0.7 bVisible = false GutterX = 10 GutterY = 10 numRows = 3 numColumns = 3 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |