From: <sv...@ww...> - 2007-08-13 21:14:32
|
Author: nsmoooose Date: 2007-08-13 14:14:20 -0700 (Mon, 13 Aug 2007) New Revision: 2170 Added: branches/first_tutorial/csp/data/ui/tutorials/ branches/first_tutorial/csp/data/ui/tutorials/__init__.py branches/first_tutorial/csp/data/ui/tutorials/index.xml branches/first_tutorial/csp/data/ui/tutorials/takeoff/ branches/first_tutorial/csp/data/ui/tutorials/takeoff/__init__.py branches/first_tutorial/csp/data/ui/tutorials/takeoff/help.xml branches/first_tutorial/csp/data/ui/tutorials/takeoff/mission.xml branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff.py branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff_speed.png Log: Added takeoff tutorial mission Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2170 Added: branches/first_tutorial/csp/data/ui/tutorials/__init__.py =================================================================== Added: branches/first_tutorial/csp/data/ui/tutorials/index.xml =================================================================== --- branches/first_tutorial/csp/data/ui/tutorials/index.xml (rev 0) +++ branches/first_tutorial/csp/data/ui/tutorials/index.xml 2007-08-13 21:14:20 UTC (rev 2170) @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<WindowDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='../window_document.xsd'> + <Includes> + <!-- This include will set the default behaviour on all controls. --> + <StyleInclude>styles.xml</StyleInclude> + <StringTableInclude>global.xml</StringTableInclude> + </Includes> + <Window LocationZ="10" CssClass="help" SizeWidth="900" SizeHeight="650"> + <Control> + <MultiControlContainer> + <Controls> + <Button Id="close" CssClass="close_button" SizeHeight="32" SizeWidth="32" /> + <Label LocationX="10" LocationY="2" SizeWidth="569" SizeHeight="30" Text="${tutorials}" /> + <Label CssClass="stripe" LocationX="0" LocationY="35" SizeWidth="889" SizeHeight="10" /> + <ListBox Id="missions" LocationX="10" LocationY="55" SizeWidth="150" SizeHeight="585" /> + <Label LocationX="170" LocationY="55" SizeWidth="709" SizeHeight="40" Text="${tutorials}" CssClass="heading" /> + <Label LocationX="170" LocationY="95" SizeWidth="709" SizeHeight="505" CssClass="multiline"> + <Text> + Select a tutorial from the list to the left. + </Text> + </Label> + <Button Id="start" Text="${start_simulation}" + LocationX="760" LocationY="600" SizeWidth="120" + SizeHeight="40" Enabled="false" /> + </Controls> + </MultiControlContainer> + </Control> + </Window> +</WindowDocument> Added: branches/first_tutorial/csp/data/ui/tutorials/takeoff/__init__.py =================================================================== Added: branches/first_tutorial/csp/data/ui/tutorials/takeoff/help.xml =================================================================== --- branches/first_tutorial/csp/data/ui/tutorials/takeoff/help.xml (rev 0) +++ branches/first_tutorial/csp/data/ui/tutorials/takeoff/help.xml 2007-08-13 21:14:20 UTC (rev 2170) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<WindowDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='../../window_document.xsd'> + <Includes> + <!-- This include will set the default behaviour on all controls. --> + <StyleInclude>styles.xml</StyleInclude> + <StringTableInclude>global.xml</StringTableInclude> + </Includes> + <Window CssClass="help" LocationZ="-10" SizeWidth="300" SizeHeight="700"> + <Style> + <HorizontalAlign>right</HorizontalAlign> + </Style> + <Control> + <MultiControlContainer> + <Controls> + <Image SizeHeight="151" SizeWidth="151"> + <Style> + <BackgroundColor>ffffffff</BackgroundColor> + <BackgroundImage>tutorials/takeoff/takeoff_speed.png</BackgroundImage> + </Style> + </Image> + <Label Text="Increase throttle to.." /> + </Controls> + </MultiControlContainer> + </Control> + </Window> +</WindowDocument> Added: branches/first_tutorial/csp/data/ui/tutorials/takeoff/mission.xml =================================================================== --- branches/first_tutorial/csp/data/ui/tutorials/takeoff/mission.xml (rev 0) +++ branches/first_tutorial/csp/data/ui/tutorials/takeoff/mission.xml 2007-08-13 21:14:20 UTC (rev 2170) @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<WindowDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='../window_document.xsd'> + <Includes> + <!-- This include will set the default behaviour on all controls. --> + <StyleInclude>styles.xml</StyleInclude> + <StringTableInclude>global.xml</StringTableInclude> + </Includes> + <Window LocationZ="10" CssClass="help" SizeWidth="900" SizeHeight="650"> + <Control> + <MultiControlContainer> + <Controls> + <Button Id="close" CssClass="close_button" SizeHeight="32" SizeWidth="32" /> + <Label LocationX="10" LocationY="2" SizeWidth="569" SizeHeight="30" Text="${tutorials}" /> + <Label CssClass="stripe" LocationX="0" LocationY="35" SizeWidth="889" SizeHeight="10" /> + <ListBox Id="missions" LocationX="10" LocationY="55" SizeWidth="150" SizeHeight="585" /> + <Label LocationX="170" LocationY="55" SizeWidth="709" SizeHeight="40" CssClass="heading" Text="${tutorials_takeoff}" /> + <Label LocationX="170" LocationY="95" SizeWidth="709" SizeHeight="505" CssClass="multiline"> + <Text> + The first flying lesson with a F16. You will learn some basic skills of this simulator and to take off. + </Text> + </Label> + <Button Id="start" Text="${start_simulation}" + LocationX="760" LocationY="600" SizeWidth="120" + SizeHeight="40" /> + </Controls> + </MultiControlContainer> + </Control> + </Window> +</WindowDocument> Added: branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff.py =================================================================== --- branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff.py (rev 0) +++ branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff.py 2007-08-13 21:14:20 UTC (rev 2170) @@ -0,0 +1,90 @@ +#!/usr/bin/python + +# Combat Simulator Project +# Copyright (C) 2002-2005 The Combat Simulator Project +# http://csp.sourceforge.net +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" +Combat Simulator Project : Take off script +""" + +import csp.cspsim +from csp.data.ui.scripts.gamescreenmanager import GameScreenManager +from csp.data.ui.scripts.utils import SlotManager + +class Mission: + def __init__(self, cspsim): + self.cspsim = cspsim + + def name(self): + # Provides a name to the mission. + return "No name set" + + def theatre(self): + # Informs about what theatre to load. + return "No theatre set" + + def startMission(self): + currentScreen = self.cspsim.getCurrentScreen() + windowManager = currentScreen.getWindowManager() + windowManager.closeAll() + self.cspsim.displayLogoScreen() + self.cspsim.loadSimulation() + + self.modifyTheatreForMission() + gameScreenManager = GameScreenManager(self.cspsim) + + self.onStart() + + def modifyTheatreForMission(self): + return + + def onStart(self): + return + + +class TakeOff(Mission): + def __init__(self, cspsim): + Mission.__init__(self, cspsim) + + def startMission(self): + Mission.startMission(self) + + def modifyTheatreForMission(self): + # We add a single aircraft at the airport. + vec = csp.csplib.Vector3 + f16dj = "sim:vehicles.aircraft.f16dj" + self.cspsim.createVehicle(f16dj, vec(-29495, -10530, 91.3), vec(0, 0, 0), vec(0.0, 0.0, 180.0)) + + # Set the date and time. We want daylight for the first mission. + date = csp.csplib.SimDate(2007,6,12,10,0,0) + self.cspsim.setCurrentTime(date) + + def onStart(self): + currentScreen = self.cspsim.getCurrentScreen() + windowManager = currentScreen.getWindowManager() + + print('Hej') + window = csp.cspsim.Window() + print('Hej') + serializer = csp.cspsim.Serialization() + print('Hej') + serializer.load(window, 'tutorials/takeoff/help.xml') + print('Hej') + windowManager.show(window) + print('Hej') + \ No newline at end of file Added: branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff_speed.png =================================================================== (Binary files differ) Property changes on: branches/first_tutorial/csp/data/ui/tutorials/takeoff/takeoff_speed.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |