forked from ZestyTS/DreamQEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.cs
More file actions
81 lines (64 loc) · 2.28 KB
/
Scene.cs
File metadata and controls
81 lines (64 loc) · 2.28 KB
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SQLite;
namespace DreamQEngine
{
public class Scene
{
//The location that this scene takes place
protected Location mLocation;
//The text intro describing the scene
protected string mSetup;
//The other characters involved in this scene
protected Actor[] mActors;
//The beginning dialogue in this scene
protected Dialogue mStartingDialogue;
public Scene()
{
}
public Scene(int sceneRef, SQLiteConnection conn)
{
SQLiteDataReader reader = new SQLiteCommand("Select * From Scenes WHERE id = "+sceneRef+";", conn).ExecuteReader();
DataTable sceneTable = new DataTable();
sceneTable.Load(reader);
DataView sceneView = new DataView(sceneTable);
if (sceneView.Count > 0)
{
mLocation = new Location(Convert.ToInt32(sceneView[0]["locationId"]), conn);
mStartingDialogue = new Dialogue(Convert.ToInt32(sceneView[0]["initialDialogueId"]), conn);
mSetup = sceneView[0]["setupText"].ToString();
reader = new SQLiteCommand("Select * From Actors_Scenes WHERE sceneId = " + sceneRef + ";", conn).ExecuteReader();
DataTable actorsTable = new DataTable();
actorsTable.Load(reader);
DataView actorsView = new DataView(actorsTable);
mActors = new Actor[actorsView.Count];
for (int i = 0; i < actorsView.Count; i++)
{
mActors[i] = new Actor(Convert.ToInt32(actorsView[i]["actorId"]), conn);
}
}
}
public Location location
{
set { mLocation = value; }
get { return mLocation; }
}
public Dialogue startingDialogue
{
set { mStartingDialogue = value; }
get { return mStartingDialogue; }
}
public Actor[] actors
{
set { mActors = value; }
get { return mActors; }
}
public string setup
{
set { mSetup = value; }
get { return mSetup; }
}
}
}