Core.Object | +--UWindow.UWindowBase | +--UWindow.UWindowWindow | +--UWindow.UWindowClientWindow | +--UWindow.UWindowDialogClientWindow | +--UMenu.UMenuDialogClientWindow | +--UMenu.UMenuPlayerMeshClient
FaceText,
BodyText
UWindowButton
CenterButton
UWindowSmallButton
FaceButton
MeshActor
LeftButton,
RightButton
CenterRotator,
ViewRotator
bRotate,
bTween
void
AnimEnd(MeshActor MyMesh)
BeforePaint(Canvas C, float X, float Y)
ClearSkins()
Close(optional bool)
Created()
FacePressed()
LeftPressed()
Notify(UWindowDialogControl C, byte E)
Paint(Canvas C, float X, float Y)
Resized()
RightPressed()
SetMesh(mesh NewMesh)
SetMeshString(string NewMesh)
SetNoAnimMesh(mesh NewMesh)
SetNoAnimMeshString(string NewMesh)
SetSkin(Texture NewSkin)
Tick(float Delta)
00001 class UMenuPlayerMeshClient extends UMenuDialogClientWindow; 00002 00003 var UWindowSmallButton FaceButton; 00004 var localized string FaceText, BodyText; 00005 00006 var UWindowButton CenterButton; 00007 00008 var UWindowButton LeftButton, RightButton; 00009 00010 var MeshActor MeshActor; 00011 00012 var rotator CenterRotator, ViewRotator; 00013 00014 var bool bFace, bRotate, bTween; 00015 00016 function Created() 00017 { 00018 Super.Created(); 00019 00020 MeshActor = GetEntryLevel().Spawn(class'MeshActor', GetEntryLevel()); 00021 MeshActor.Mesh = GetPlayerOwner().Mesh; 00022 MeshActor.Skin = GetPlayerOwner().Skin; 00023 MeshActor.NotifyClient = Self; 00024 00025 //if(MeshActor.Mesh != None) 00026 // MeshActor.PlayAnim('Breath3', 0.4); 00027 00028 CenterButton = UWindowButton(CreateControl(class'UWindowButton', WinWidth/3, 0, WinWidth/3, WinHeight)); 00029 CenterButton.bIgnoreLDoubleclick = True; 00030 ViewRotator = rot(0, 32768, 0); 00031 00032 LeftButton = UWindowButton(CreateControl(class'UWindowButton', 0, 0, WinWidth/3, WinHeight)); 00033 LeftButton.bIgnoreLDoubleclick = True; 00034 00035 RightButton = UWindowButton(CreateControl(class'UWindowButton', (WinWidth/3)*2, 0, WinWidth/3, WinHeight)); 00036 RightButton.bIgnoreLDoubleclick = True; 00037 00038 FaceButton = UWindowSmallButton(CreateControl(class'UWindowSmallButton', 0, WinHeight - 16, 48, 16)); 00039 FaceButton.Text = FaceText; 00040 FaceButton.bAlwaysOnTop = True; 00041 FaceButton.bIgnoreLDoubleclick = True; 00042 } 00043 00044 function Resized() 00045 { 00046 Super.Resized(); 00047 00048 CenterButton.SetSize(WinWidth/3, WinHeight); 00049 CenterButton.WinLeft = WinWidth/3; 00050 00051 LeftButton.SetSize(WinWidth/3, WinHeight); 00052 LeftButton.WinLeft = 0; 00053 00054 RightButton.SetSize(WinWidth/3, WinHeight); 00055 RightButton.WinLeft = (WinWidth/3)*2; 00056 00057 FaceButton.WinLeft = 0; 00058 FaceButton.WinTop = WinHeight - 16; 00059 } 00060 00061 function BeforePaint(Canvas C, float X, float Y) 00062 { 00063 FaceButton.AutoWidth(C); 00064 if (LeftButton.bMouseDown) { 00065 ViewRotator.Yaw += 512; 00066 } else if (RightButton.bMouseDown) { 00067 ViewRotator.Yaw -= 512; 00068 } 00069 } 00070 00071 function Paint(Canvas C, float X, float Y) 00072 { 00073 local float OldFov; 00074 00075 C.Style = GetPlayerOwner().ERenderStyle.STY_Modulated; 00076 DrawStretchedTexture(C, 0, 0, WinWidth, WinHeight, Texture'BlackTexture'); 00077 C.Style = GetPlayerOwner().ERenderStyle.STY_Normal; 00078 00079 if (MeshActor != None) 00080 { 00081 OldFov = GetPlayerOwner().FOVAngle; 00082 GetPlayerOwner().SetFOVAngle(30); 00083 if (bFace) 00084 DrawClippedActor( C, WinWidth/2, WinHeight/2, MeshActor, False, ViewRotator, vect(-10, 0, -3) ); 00085 else 00086 DrawClippedActor( C, WinWidth/2, WinHeight/2, MeshActor, False, ViewRotator, vect(0, 0, 0) ); 00087 GetPlayerOwner().SetFOVAngle(OldFov); 00088 } 00089 } 00090 00091 function Tick(float Delta) 00092 { 00093 if (bRotate) 00094 ViewRotator.Yaw += 128; 00095 } 00096 00097 function ClearSkins() 00098 { 00099 local int i; 00100 00101 MeshActor.Skin = None; 00102 for(i=0;i<4;i++) 00103 MeshActor.MultiSkins[i] = None; 00104 } 00105 00106 function SetSkin(texture NewSkin) 00107 { 00108 ClearSkins(); 00109 MeshActor.Skin = NewSkin; 00110 } 00111 00112 function SetMesh(mesh NewMesh) 00113 { 00114 MeshActor.bMeshEnviroMap = False; 00115 MeshActor.DrawScale = MeshActor.Default.DrawScale; 00116 MeshActor.Mesh = NewMesh; 00117 if(MeshActor.Mesh != None) 00118 MeshActor.PlayAnim('Breath3', 0.5); 00119 } 00120 00121 function SetNoAnimMesh(mesh NewMesh) 00122 { 00123 MeshActor.bMeshEnviroMap = False; 00124 MeshActor.DrawScale = MeshActor.Default.DrawScale; 00125 MeshActor.Mesh = NewMesh; 00126 } 00127 00128 function SetMeshString(string NewMesh) 00129 { 00130 SetMesh(mesh(DynamicLoadObject(NewMesh, Class'Mesh'))); 00131 } 00132 00133 function SetNoAnimMeshString(string NewMesh) 00134 { 00135 SetNoAnimMesh(mesh(DynamicLoadObject(NewMesh, Class'Mesh'))); 00136 } 00137 00138 function Close(optional bool bByParent) 00139 { 00140 Log("Mesh client closed!"); 00141 Super.Close(bByParent); 00142 if(MeshActor != None) 00143 { 00144 MeshActor.Destroy(); 00145 MeshActor = None; 00146 } 00147 } 00148 00149 function Notify(UWindowDialogControl C, byte E) 00150 { 00151 switch (E) 00152 { 00153 case DE_Click: 00154 switch (C) 00155 { 00156 case FaceButton: 00157 FacePressed(); 00158 break; 00159 //case LeftButton: 00160 // LeftPressed(); 00161 // break; 00162 //case RightButton: 00163 // RightPressed(); 00164 // break; 00165 case CenterButton: 00166 ViewRotator = rot(0, 32768, 0) + CenterRotator; 00167 break; 00168 } 00169 break; 00170 } 00171 } 00172 00173 function FacePressed() 00174 { 00175 bFace = !bFace; 00176 if (bFace) 00177 FaceButton.Text = BodyText; 00178 else 00179 FaceButton.Text = FaceText; 00180 } 00181 00182 function LeftPressed() 00183 { 00184 ViewRotator.Yaw += 128; 00185 } 00186 00187 function RightPressed() 00188 { 00189 ViewRotator.Yaw -= 128; 00190 } 00191 00192 function AnimEnd(MeshActor MyMesh) 00193 { 00194 if ( MyMesh.AnimSequence == 'Breath3' ) 00195 MyMesh.TweenAnim('All', 0.4); 00196 else 00197 MyMesh.PlayAnim('Breath3', 0.4); 00198 } 00199 00200 defaultproperties 00201 { 00202 FaceText="Face" 00203 BodyText="Body" 00204 }