SpatialFear.SFYesNoBox

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
//=============================================================================
// Spatial Fear
// Class: SFYesNoBox
// Descritption: A client widow, that brings up a Yes/No selection box used,
//					by the quicksave action, to ask, before overwriting the
//					last quicksave game. Test window only!!!
//
// Author: Markus Nuebel
//=============================================================================
class SFYesNoBox expands UWindowDialogClientWindow;

var UWindowMessageBox	m_wndQuestionBox;
var	SFPlayer			m_oPlayer;
/*
#exec Texture Import File=textures\base.pcx Name=TC_Base Group=TeamChange Mips=Off Flags=2
#exec Texture Import File=textures\Blue0.pcx Name=TC_Blue0 Group=TeamChange Mips=Off Flags=2
#exec Texture Import File=textures\Blue1.pcx Name=TC_Blue1 Group=TeamChange Mips=Off Flags=2
#exec Texture Import File=textures\Red0.pcx Name=TC_Red0 Group=TeamChange Mips=Off Flags=2
#exec Texture Import File=textures\Red1.pcx Name=TC_Red1 Group=TeamChange Mips=Off Flags=2
#exec AUDIO IMPORT FILE="Sounds\Pick.wav" NAME="TC_PickSnd" GROUP="TeamChange"
#exec AUDIO IMPORT FILE="Sounds\Over.wav" NAME="TC_OverSnd" GROUP="TeamChange"

var UWindowButton JoinRed;		
var UWindowButton JoinBlue;

// AddButton - This function is a little custom job that allows you to neatly
// setup a graphical button.  It's parameters are location and size of the button
// (relative to the window) and the 3 textures used for N (Normal or Up state),
// O (Over state) and P (Pressed state).  You could expand this to handle a disabled
// state but it's not relevant here.

function UWindowButton AddButton(int x, int y, int w, int h, texture N, texture O, texture P)
{

	local UWindowButton b;
	
	b = UWindowButton(CreateControl(class'UWindowButton',x,y,w,h));
	b.UpTexture = N;
	b.DownTexture = P;
	b.OverTexture = O;
	b.DisabledTexture = N;
	
	b.ToolTipString = "";
	b.OverSound = sound 'TC_OverSnd';
	b.DownSound = sound 'TC_PickSnd';

	// Add sound effects here


	return b;

}

// SetColor - Another helper function that just converts and R/G/B tripplet
// in to a Color variable.

function Color SetColor(int r, int g, int b)
{
	local color c;
	C.R = r;
	C.G = g;
	C.B = b;
	return c;
}

// Created - It's in the created function that we build the actual
// controls that are on the window.

function Created()
{
	local int i;

	Super.Created();
	
	// Set the initial position of the window.

	WinLeft = (Root.WinWidth - WinWidth) / 2;
	WinTop = (Root.WinHeight - WinHeight) / 2;
	JoinRed =  AddButton(35,85,69,68,  texture 'TC_Red0',  texture 'TC_Red1',  texture 'TC_Red1');
	JoinBlue =  AddButton(154,85,69,68,  texture 'TC_Blue0',  texture 'TC_Blue1',  texture 'TC_Blue1');

}
// Paint - Called once per tick.  Since this window uses a 
// custom graphic, we have to draw it here each tick.

function Paint(Canvas C, float X, float Y)
{

	// Since there really isn't a frame for this window, we 
	// have to paint our custom frame each render cycle.

	C.Style = 2;  // STY_Masked
	C.SetPos(0,0);
//	C.DrawIcon(texture 'TC_Base',1);
	C.Style = 1; // STY_Normal

}
// Notify - This function handles mouse clicks and key
// presses.  
function Notify(UWindowDialogControl C, byte E)
{
	Super.Notify(C,E);

	if(E == DE_Click)
	{

		switch(C)
		{
		case JoinRed:
		QuestionBox = MessageBox("Quicksave?", "Do you want to save your game now?", MB_YesNo, MR_No, MR_Yes);
//		QuestionBox.bAcceptsFocus = true;
//		QuestionBox.bAlwaysOnTop  = true;
		QuestionBox.bLeaveOnscreen  = true;
		
				break;
			case JoinBlue:
		QuestionBox = MessageBox("Restart?", "Do you want to restart now?", MB_YesNo, MR_No, MR_Yes);
				break;
		}
	}
}
*/


// Brings up the window
function ShowWindow()
{
	// Call to base class
	Super.ShowWindow();
	// Create the question box
	m_wndQuestionBox = MessageBox("Quicksave?", "Do you want to save your game now?", MB_YesNo, MR_No, MR_Yes);
	m_wndQuestionBox.bLeaveOnscreen  = true;
}

// Handles the message box selection
function MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result)
{
	if ((W == m_wndQuestionBox) && (Result == MR_Yes))
		// the reboot stuff here.
		Close();
	if ((W == m_wndQuestionBox) && (Result == MR_No))
		Close();
}

defaultproperties
{
}

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:46 PM
Created with UnCodeX