This repository has been archived by the owner on Mar 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpncgame.xsd
113 lines (108 loc) · 4.58 KB
/
pncgame.xsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0" encoding="UTF-8"?>
<!--
(CC BY-NC-SA 4.0) David J. Kalbfleisch 2015
https://creativecommons.org/licenses/by-nc-sa/4.0/
https://github.com/kalbfled/pncgame
Please read LICENSE, on Github, for more information.
This schema defines a valid PncGame for use with pncgame.js.
Schema version 1.0
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="PncGame">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string" default="pncgame.js (CC BY-NC-SA 4.0) David J. Kalbfleisch 2015"/>
<xs:element name="PlayerInventory" type="inventorytype" minOccurs="0"/>
<xs:element name="Location" type="locationtype" maxOccurs="unbounded"/>
<xs:element name="PlayerStart" type="idtype" default="1"/>
<!-- TODO - LOCATION INDEPENDENT EVENTS -->
</xs:sequence>
<!-- The version of this XSD the PncGame targets -->
<xs:attribute name="version" type="xs:string"/>
</xs:complexType>
</xs:element>
<!-- Complex types -->
<xs:complexType name="locationtype">
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Image" type="xs:string"/>
<xs:element name="Item" type="itemtype" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Event" type="eventtype" minOccurs="0" maxOccurs="unbounded"/>
<!-- TODO - LOCATION BASED AUDIO -->
</xs:sequence>
<xs:attribute name="id" type="idtype" use="required"/>
</xs:complexType>
<xs:complexType name="inventorytype">
<xs:sequence>
<xs:element name="Item" type="itemtype" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="itemtype">
<xs:sequence>
<xs:element name="Description" type="xs:string"/>
<xs:element name="Image" type="xs:string"/>
<xs:element name="Interaction" type="idtype" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="idtype" use="required"/>
<!--
These attributes are parameters to the HTML5 canvas context drawImage method. Most are
not required because an item might never be drawn on the canvas.
http://www.w3schools.com/tags/canvas_drawimage.asp
-->
<xs:attribute name="sx" type="nonNegativeInteger" use="required"/>
<xs:attribute name="sy" type="nonNegativeInteger" use="required"/>
<xs:attribute name="swidth" type="nonNegativeInteger"/>
<xs:attribute name="sheight" type="nonNegativeInteger"/>
<xs:attribute name="x" type="nonNegativeInteger"/>
<xs:attribute name="y" type="nonNegativeInteger"/>
<xs:attribute name="width" type="nonNegativeInteger"/>
<xs:attribute name="height" type="nonNegativeInteger"/>
</xs:complexType>
<xs:complexType name="eventtype">
<xs:sequence>
<xs:element name="Description" type="xs:string"/>
<xs:element name="Prerequisite" type="prerequisitetype" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Consequence" type="consequencetype" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="shape" type="shapetype" use="required"/>
<!-- TODO - I could make the type for coords more restrictive with a regex. -->
<xs:attribute name="coords" type="xs:string"/>
</xs:complexType>
<xs:complexType name="prerequisitetype">
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="type" type="prerequisitetypetype" use="required"/>
<xs:attribute name="itemid" type="idtype" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="consequencetype">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="consequencetypetype" use="required"/>
<xs:attribute name="itemid" type="idtype"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- Simple types -->
<xs:simpleType name="idtype">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="prerequisitetypetype">
<xs:restriction base="xs:string">
<xs:pattern value="item|noitem"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="consequencetypetype">
<xs:restriction base="xs:string">
<xs:pattern value="audio|custom|item|location|message"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="shapetype">
<xs:restriction base="xs:string">
<xs:pattern value="circle|default|poly|rect"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>