Example #1
0
    public void setRLocation(LocationConnection locationConnection)
    {
        GameData gameData = GameManager.Instance.GameData;

        this.locationConnection = locationConnection;

        if (!String.IsNullOrEmpty(locationConnection.Label))
        {
            Text.text = locationConnection.Label;
        }
        else
        {
            Text.text = locationConnection.TargetLocation.Label.Text(gameData);
        }

        RawImage.texture = locationConnection.Texture;

        Button.onClick.RemoveAllListeners();

        if (locationConnection.TargetLocation.isOpen())
        {
            Button.onClick.AddListener(() => locationConnection.execute());
        }
        else
        {
            Button.interactable = false;
        }
    }
        public string UpdateEvent(int eventId, string name, DateTime eventdate, string addressStreetName,
           string addressStreetNumber, string addressPostalCode, string location, string phone,
           string email, string city, string countryCode, Boolean official)
        {
            string sql = "";
            DataSet drA = null;
            DataSet drL = null;

            LocationConnection locationConnection = new LocationConnection();
            sql = "select location_id from events where id = '" + eventId + "'; ";

            drL = this.Query(sql);
            int locationId = int.Parse(drL.Tables[0].Rows[0][0].ToString());
            // getting the location_address id
            sql = "select address_id from locations where id = '" + locationId + "'; ";

            drA = this.Query(sql);
            int addressId = int.Parse(drA.Tables[0].Rows[0][0].ToString());

            this._UpdateEvent(eventId, name, eventdate, official, locationId);

            locationConnection.UpdateLocation(locationId, location, phone, email, addressId);
            AddressConnection addConn = new AddressConnection();
            addConn.UpdateAddress(addressId, addressStreetName, addressStreetNumber, city, addressPostalCode, countryCode);

            return "";
        }
 public LocationButton(LocationConnection locationConnection) : this()
 {
     Image.Source = locationConnection.Texture;
     TextDestinationLabel.Text = locationConnection.Label;
     TextDuration.Text         = locationConnection.Duration.ToString();
     Button.IsEnabled          = locationConnection.IsEnabled();
     Button.Click += delegate { locationConnection.execute(); GameManager.Instance.Update(); };
 }
    public static CommandsCollection GotoCommandsList(LocationConnection locationConnection)
    {
        var result = new CommandsCollection();

        if (locationConnection.interruptible)
        {
            result.Add(new CommandInterrupt(locationConnection.Type));
        }
        result.Add(new CommandTimePass(locationConnection.Duration.GetValueOrDefault(0)));
        result.Add(new CommandGotoLocation(locationConnection.TargetLocation));


        return(result);
    }
        public string InsertNewEvent(string name, DateTime eventdate, string addressStreetName,
           string addressStreetNumber, string addressPostalCode, string location, string phone,
           string email, string city , string countryCode, Boolean official)
        {
            AddressConnection addConn = new AddressConnection();
            string addressId = addConn.InsertNewAddress(addressStreetName, addressStreetNumber, city, addressPostalCode, countryCode);

            LocationConnection locationConnection = new LocationConnection();
            string locationId = locationConnection.InsertNewLocation(location, phone, email, "" + addressId);

            string eventId = this._InsertEvent(name, eventdate, official , locationId);

            return eventId;
        }
Example #6
0
        private static List <LocationConnection> LocationConnections(GameLocation from)
        {
            var connections = new List <LocationConnection>();

            foreach (Warp warp in from.warps)
            {
                GameLocation targetLoc = Game1.getLocationFromName(warp.TargetName);
                if (targetLoc != null)
                {
                    var lc = new LocationConnection(warp.TargetName, warp.X, warp.Y, false, targetLoc.IsOutdoors);
                    connections.Add(lc);
                }
            }
            foreach (var doorDict in from.doors)
            {
                foreach (var door in doorDict)
                {
                    Point        point     = door.Key;
                    string       locName   = door.Value;
                    GameLocation targetLoc = Game1.getLocationFromName(locName);
                    if (targetLoc != null)
                    {
                        var lc = new LocationConnection(locName, point.X, point.Y, true, targetLoc.IsOutdoors);
                        connections.Add(lc);
                    }
                }
            }
            if (from is StardewValley.Locations.BuildableGameLocation)
            {
                StardewValley.Locations.BuildableGameLocation bl = from as StardewValley.Locations.BuildableGameLocation;
                foreach (var b in bl.buildings)
                {
                    if (b.indoors.Value != null)
                    {
                        var point   = b.humanDoor.Value;
                        var locName = b.indoors.Value.NameOrUniqueName;
                        var lc      = new LocationConnection(locName, point.X + b.tileX.Value, point.Y + b.tileY.Value, true, false);
                        connections.Add(lc);
                    }
                    ;
                }
            }
            return(connections);
        }
Example #7
0
        private void eSuggestionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int country_position = 0;
            int city_position    = 0;
            int index;
            int location_id;
            int address_id;

            addressConnection  = new AddressConnection();
            locationConnection = new LocationConnection();
            DataSet dsA;
            DataSet dsL;

            if (eSuggestionList.ItemsSource != null)
            {
                eSuggestionList.Visibility = System.Windows.Visibility.Collapsed;
                eventName.TextChanged     -= new TextChangedEventHandler(eventName_TextChanged);

                index = eSuggestionList.SelectedIndex;

                if (eSuggestionList.SelectedIndex != -1)
                {
                    ListData item = (ListData)eSuggestionList.SelectedItem;
                    _eventId    = item.id;
                    location_id = int.Parse(filteredEvents.Tables[0].Rows[index][4].ToString());

                    this.eventName.Text          = filteredEvents.Tables[0].Rows[index][1].ToString();
                    this.eventDate.SelectedDate  = (DateTime)filteredEvents.Tables[0].Rows[index][2];
                    this.eventOfficial.IsChecked = (Boolean)filteredEvents.Tables[0].Rows[index][3];

                    dsL = locationConnection.getLocation(location_id);

                    this.eventLocation.Text = dsL.Tables[0].Rows[0][1].ToString();
                    this.eventPhone.Text    = dsL.Tables[0].Rows[0][2].ToString();
                    this.eventEmail.Text    = dsL.Tables[0].Rows[0][3].ToString();
                    address_id = int.Parse(dsL.Tables[0].Rows[0][4].ToString());

                    dsA = addressConnection.getAddress(address_id);

                    this.eventAddress.Text    = dsA.Tables[0].Rows[0][1].ToString();
                    this.eventAddressNum.Text = dsA.Tables[0].Rows[0][2].ToString();
                    this.eventTK.Text         = dsA.Tables[0].Rows[0][4].ToString();

                    string eventCity    = dsA.Tables[0].Rows[0][3].ToString();
                    int    ix           = dsA.Tables[0].Columns.Count;
                    string eventCountry = dsA.Tables[0].Rows[0][5].ToString();


                    //
                    //the fix for the country selection error
                    //
                    CountryConnection countryconn = new CountryConnection();
                    DataSet           countriname = countryconn.getCountryNameByCode(eventCountry);
                    eventCountry = countriname.Tables[0].Rows[0][0].ToString();



                    for (int i = 0; i < this.cmbECountryChooses.Items.Count; i++)
                    {
                        if (eventCountry.Equals(cmbECountryChooses.Items[i].ToString()))
                        {
                            country_position = i;
                            break;
                        }
                    }


                    this.cmbECountryChooses.SelectedIndex = country_position;


                    CityConnection cityConnection = new CityConnection();
                    DataSet        cityNa         = cityConnection.GetCityNameByCityId(int.Parse(eventCity));
                    eventCity = cityNa.Tables[0].Rows[0][0].ToString();

                    for (int i = 0; i < this.cmbECityChooses.Items.Count; i++)
                    {
                        if (eventCity.Equals(cmbECityChooses.Items[i].ToString()))
                        {
                            city_position = i;
                            break;
                        }
                    }
                    this.cmbECityChooses.SelectedIndex = city_position;
                }
                eventName.TextChanged += new TextChangedEventHandler(eventName_TextChanged);
            }
        }
Example #8
0
        private void initialize()
        {
            addressConnection  = new AddressConnection();
            locationConnection = new LocationConnection();
            //cities kai countries
            cityConnection    = new CityConnection();
            countryConnection = new CountryConnection();
            this.countries    = countryConnection.GetCountries();

            foreach (DataRow dr in countries.Tables[0].Rows)
            {
                cmbECountryChooses.Items.Add(dr[1].ToString());
            }
            cmbECountryChooses.SelectedIndex = 0;

            this.eventUpdateCities("CY");


            //events
            eventConnection = new EventConnection();
            this.events     = eventConnection.getEvents();
            cmbTEventChooser.Items.Add("Select Event");

            foreach (DataRow dr in events.Tables[0].Rows)
            {
                cmbTEventChooser.Items.Add(dr[1].ToString());
            }
            cmbTEventChooser.SelectedIndex = 0;

            //ages
            cmbTAgeFrom.Items.Add("From");
            cmbTAgeTo.Items.Add("To");
            for (int i = 5; i <= 60; i++)
            {
                cmbTAgeFrom.Items.Add(i.ToString());
                cmbTAgeTo.Items.Add(i.ToString());
            }
            cmbTAgeFrom.SelectedIndex = 0;
            cmbTAgeTo.SelectedIndex   = 0;

            //levels
            cmbTLevelFrom.Items.Add("From");
            cmbTLevelFrom.Items.Add("A");
            cmbTLevelFrom.Items.Add("B");
            cmbTLevelFrom.Items.Add("C");
            cmbTLevelFrom.Items.Add("D");

            cmbTLevelTo.Items.Add("To");
            cmbTLevelTo.Items.Add("A");
            cmbTLevelTo.Items.Add("B");
            cmbTLevelTo.Items.Add("C");
            cmbTLevelTo.Items.Add("D");

            cmbTLevelFrom.SelectedIndex = 0;
            cmbTLevelTo.SelectedIndex   = 0;


            //games
            cmbTGame.Items.Add("Select game type");
            cmbTGame.Items.Add("Game A");
            cmbTGame.Items.Add("Game B");
            cmbTGame.Items.Add("Game C");
            cmbTGame.Items.Add("Game D");
            cmbTGame.Items.Add("Game E");

            cmbTGame.SelectedIndex = 0;
        }