Esempio n. 1
0
        public static List <Location> getLocations(Location.LocationType type)
        {
            List <Location> p       = new List <Location>();
            SQLiteCommand   command = new SQLiteCommand(
                "SELECT name, ID, ParentID FROM " + type.ToString(),
                dbConnection);
            SQLiteDataReader reader = command.ExecuteReader();

            System.Console.Out.WriteLine(command.ToString());
            while (reader.Read())
            {
                p.Add(new Location(reader.GetString(0), type, reader.GetInt32(1), reader.GetInt32(2)));
            }
            return(p);
        }
Esempio n. 2
0
        public static List <Location> getLocationsInLocation(Location.LocationType type, int parentID)
        {
            List <Location> p       = new List <Location>();
            SQLiteCommand   command = new SQLiteCommand(
                "SELECT name, ID, ParentID FROM " + type.ToString() + " " +
                " WHERE ParentID = @ParentID",
                dbConnection);

            command.Parameters.AddWithValue("ParentID", parentID);
            SQLiteDataReader reader = command.ExecuteReader();

            System.Console.Out.WriteLine(command.ToString());
            while (reader.Read())
            {
                p.Add(new Location(reader.GetString(0), type, reader.GetInt32(1), reader.GetInt32(2)));
            }
            return(p);
        }
Esempio n. 3
0
    public void CreateLocations(World activeWorld)
    {
        // Loop through each data entry of the LocationImports file, then draw the Location's information from this entry called locdata.
        foreach (LocationImportsData locdata in locationImports.dataArray)
        {
            if (locdata.Name != "")
            {
                if (locdata.Locationtype != "")
                {
                    locType = (Location.LocationType)System.Enum.Parse(typeof(Location.LocationType), locdata.Locationtype);
                }
                else
                {
                    Debug.Log("Trying to create a location: " + locdata.Name + " that has no locationtype: " + locdata.Locationtype);
                }

                if (locdata.Locationsubtype != "")
                {
                    locSubType = (Location.LocationSubType)System.Enum.Parse(typeof(Location.LocationSubType), locdata.Locationsubtype);
                }
                else
                {
                    locSubType = Location.LocationSubType.Unassigned;
                }

                if (locSubType == Location.LocationSubType.City)
                {
                    City createdLoc = new City(locType, locSubType, locdata.Name);
                    AssignLocationVariables(locdata, createdLoc);
                    activeWorld.locationList.Add(createdLoc);
                }

                else
                {
                    Location createdLoc = new Location(locType, locSubType, locdata.Name);
                    AssignLocationVariables(locdata, createdLoc);
                    activeWorld.locationList.Add(createdLoc);
                }
            }
        }
    }
Esempio n. 4
0
        public Question(string name, Game.Language language, Location loc)
        {
            m_name = name;
            m_type = loc.LocationTypeValue;



            m_answer = new Answer(name, loc);
            

            string firstPart, secondPart, thirdPart;
            switch (m_type)
            {
                case(Location.LocationType.City):
                    switch (language)
                    {
                        case(Game.Language.Norwegian):
                            secondPart = "byen";
                            break;
                        case(Game.Language.English):
                            secondPart = "the city";
                            break;
                        default:
                            secondPart = "the city";
                            break;
                    }
                    break;
                case(Location.LocationType.Region):
                    switch (language)
                    {
                        case(Game.Language.Norwegian):
                            secondPart = "området";
                            break;
                        case(Game.Language.English):
                            secondPart = "the region";
                            break;
                        default:
                            secondPart = "the region";
                            break;
                    }
                    break;
                default :
                    secondPart = "the city";
                    break;
            }

            switch (language)
            {
                case(Game.Language.Norwegian):
                    thirdPart = "";
                    break;
                case(Game.Language.English):
                    thirdPart = "located";
                    break;
                default:
                    thirdPart = "located";
                    break;
            }

            switch (language)
            {
                case (Game.Language.Norwegian):
                    firstPart = "Hvor er";
                    break;
                case (Game.Language.English):
                    firstPart = "Where is";
                    break;
                default:
                    firstPart = "Where is";
                    break;
            }

            m_question = string.Format("{0} {1} {2} {3}", firstPart, secondPart, m_name, thirdPart);
        }