Ejemplo n.º 1
0
        public Dialogue(int dialogueRef, SQLiteConnection conn)
        {
            SQLiteDataReader reader = new SQLiteCommand("Select * From Dialogue WHERE id = " + dialogueRef + ";", conn).ExecuteReader();

            DataTable dialogueTable = new DataTable();
            dialogueTable.Load(reader);

            DataView dialogueView = new DataView(dialogueTable);

            if (dialogueView.Count > 0)
            {
                mText = dialogueView[0]["text"].ToString();
                mActor = new Actor(Convert.ToInt32(dialogueView[0]["actorId"]), conn);

                reader = new SQLiteCommand("Select * From Options WHERE dialogueId = " + dialogueRef + ";", conn).ExecuteReader();
                DataTable optionTable = new DataTable();
                optionTable.Load(reader);

                DataView optionView = new DataView(optionTable);

                mChoices = new Option[optionView.Count];

                for(int i = 0; i < optionView.Count; i++)
                {
                    string optionText = optionView[i]["actualtext"].ToString();
                    string optionDisplay = optionView[i]["displayText"].ToString();
                    int outcomeType = Convert.ToInt32(optionView[i]["outcomeType"]);
                    int outcomeId = Convert.ToInt32(optionView[i]["outcomeId"]);
                    mChoices[i] = new Option(optionText, optionDisplay, outcomeType, outcomeId);
                }
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }