Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDpk3062 <dpk3062@rit.edu>2009-07-06 03:44:05 (GMT)
committer Dpk3062 <dpk3062@rit.edu>2009-07-06 03:44:05 (GMT)
commitbe5f99eca2a2d42552605a1e9fb34063734903ba (patch)
tree8e4b27badc4b117fe9be3a1858ec799b85e60b70 /src
parenteeabb679006b687b62b54eae0ff18969cb3e3984 (diff)
* Shortened some XML tags
* Renamed profile.xml to profile.mpro * Added /muthris/config/last/profile
Diffstat (limited to 'src')
-rw-r--r--src/actions/__init__.py0
-rw-r--r--src/actions/action.py35
-rw-r--r--src/setup/__init__.py0
-rw-r--r--src/setup/level.py31
-rw-r--r--src/setup/main.py61
5 files changed, 127 insertions, 0 deletions
diff --git a/src/actions/__init__.py b/src/actions/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/actions/__init__.py
diff --git a/src/actions/action.py b/src/actions/action.py
new file mode 100644
index 0000000..38ae9a0
--- /dev/null
+++ b/src/actions/action.py
@@ -0,0 +1,35 @@
+'''
+
+'''
+
+class Actions(object):
+ '''Actions are created by the player or the system and are sent around as messages between different components'''
+
+ def pack(self, action):
+ '''Packages the given object for transmission over a network'''
+ #TODO
+ pass
+
+ def unpack(self, package):
+ '''Unpackages the given network package into its original Action'''
+ #TODO
+ pass
+
+
+class UserActions(Actions):
+ '''UserActions are Actions performed by the player'''
+
+ def isLegal(self, model):
+ '''Returns true if this action is able to perform itself on the given game board data'''
+ #TODO
+ pass
+
+ def apply(self, model):
+ '''Causes this UserAction to perform itself on the given game board data'''
+ #TODO
+ pass
+
+
+class SystemActions(Actions):
+ '''SystemActions are Actions created only by different components of the game'''
+ pass
diff --git a/src/setup/__init__.py b/src/setup/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/setup/__init__.py
diff --git a/src/setup/level.py b/src/setup/level.py
new file mode 100644
index 0000000..907d8bd
--- /dev/null
+++ b/src/setup/level.py
@@ -0,0 +1,31 @@
+'''
+
+'''
+from lxml import etree
+from utils import utils
+
+class LevelInfo(object):
+ '''
+ '''
+
+ def __init__(self, path):
+ '''
+ Constructor
+ '''
+
+ #open up the mlvl file and read in its basic properties
+ root = utils.getXMLRoot(path)
+ self.name = root.xpath('//level-info/@name')[0]
+ self.description = root.xpath('//level-info/@description')[0]
+ pass
+
+ def getName(self):
+ '''Gets the name of this level'''
+ return self.name
+
+ def getDescription(self):
+ '''Gets the description of this level'''
+ return self.description
+
+
+ \ No newline at end of file
diff --git a/src/setup/main.py b/src/setup/main.py
new file mode 100644
index 0000000..1f05f10
--- /dev/null
+++ b/src/setup/main.py
@@ -0,0 +1,61 @@
+'''
+
+'''
+
+if __name__ == '__main__':
+ pass
+
+import os
+
+# using lxml for XML processing
+from lxml import etree
+from level import LevelInfo
+from utils import utils
+
+# constants
+ConfigFile = '/home/doug/workspace/Muthris/docs/examples/config.xml'
+LevelExt = '.mlvl'
+
+# load the configuration file
+config = utils.getXMLRoot(ConfigFile)
+
+#for each level folder, scan for and process any Muthris level files (.mlvl)
+levels = []
+folders = config.xpath('//level-folders/folder/@location')
+for folder in folders:
+ #search for files in the level folder
+ list = os.listdir(folder)
+ print(list)
+ for path in list:
+ #make sure path is not just the filename, as isfile() would fail if it was
+ path = folder + '/' + path
+
+ #only want level files
+ if not os.path.isfile(path):
+ continue
+ if not path.endswith(LevelExt):
+ continue
+
+ #create a level object for this level file
+ level = LevelInfo( path )
+ levels.append( level )
+
+print( config )
+print( folders )
+
+
+
+# find all the level folders
+
+# load all the level folders
+
+# start the menus
+
+print( 'done' )
+
+
+def processLevelFile( file ):
+ ''' '''
+ pass
+
+