Inheritance: MonoBehaviour
Exemple #1
0
        public void RenderLocationButtons(Queue <Entity> locations, Gamedata.Gamedata gamedata)
        {
            this.SuspendLayout();

            tableLayoutPanelMain.RowCount = locations.Count;
            tableLayoutPanelMain.RowStyles.Clear();
            tableLayoutPanelMain.Controls.Clear();

            locationButtons = new LocationButton[locations.Count];
            int i = 0;

            foreach (Entity entity in locations)
            {
                LocationButton lb = new LocationButton(gamedata.GetValue <String>(entity.ID, "Caption", entity.ID));
                tableLayoutPanelMain.Controls.Add(lb, 0, i);
                locationButtons[i] = lb;
                i++;

                lb.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);

                this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
            }

            this.ResumeLayout();
        }
Exemple #2
0
        public FormTest()
        {
            InitializeComponent();

            lb1 = new LocationButton();
            lb2 = new LocationButton();
            lb3 = new LocationButton();

            tableLayoutPanel2.Controls.Add(lb1, 0, 0);
            tableLayoutPanel2.Controls.Add(lb2, 0, 1);
            tableLayoutPanel2.Controls.Add(lb3, 0, 2);

            tableLayoutPanel2.RowCount = 3;
            tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
            tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));
            tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33F));



            this.lb1.AutoSize = true;
            this.lb1.Dock     = System.Windows.Forms.DockStyle.Fill;

            this.lb2.AutoSize = true;
            this.lb2.Dock     = System.Windows.Forms.DockStyle.Fill;

            this.lb3.AutoSize = true;
            this.lb3.Dock     = System.Windows.Forms.DockStyle.Fill;
        }
        private void SetLocations(IEnumerable <LocationConnection> locationConnections)
        {
            Locations.Children.Clear();

            foreach (LocationConnection locationConnection in locationConnections)
            {
                LocationButton locationButton = new LocationButton(locationConnection);
                Locations.Children.Add(locationButton);
            }
        }
Exemple #4
0
        void ReleaseDesignerOutlets()
        {
            if (LocationButton != null)
            {
                LocationButton.Dispose();
                LocationButton = null;
            }

            if (MapView != null)
            {
                MapView.Dispose();
                MapView = null;
            }
        }
Exemple #5
0
    public void ShowAllLocation()
    {
        List <Location> resultLocations = new List <Location>(locations);

        emptyLocation.SetActive(false);

        for (int i = 0; i < locationButtons.Count; i++)
        {
            Destroy(locationButtons[i]);
        }
        locationButtons.Clear();

        for (int i = 0; i < locationProvinces.Count; i++)
        {
            GameObject     newLocationButton    = Instantiate(locationButton, contentParent);
            LocationButton locationButtonScript = newLocationButton.GetComponent <LocationButton>();
            locationButtonScript.SetLocation(locationProvinces[i]);
            locationButtons.Add(newLocationButton);
        }
    }
Exemple #6
0
    public void SearchLocation()
    {
        string keyword = searchTextField.text.Trim();
        List <LocationProvince> resultLocations = new List <LocationProvince>();

        if (keyword != "")
        {
            for (int i = 0; i < locationProvinces.Count; i++)
            {
                if (locationProvinces[i].location.placeNameThai.Contains(keyword) || locationProvinces[i].location.placeNameEng.Contains(keyword) || locationProvinces[i].provinceNameThai.Contains(keyword) || locationProvinces[i].provinceNameEng.Contains(keyword))
                {
                    resultLocations.Add(locationProvinces[i]);
                }
            }
        }

        for (int i = 0; i < locationButtons.Count; i++)
        {
            Destroy(locationButtons[i]);
        }

        if (resultLocations.Count > 0)
        {
            emptyLocation.SetActive(false);
            for (int i = 0; i < resultLocations.Count; i++)
            {
                GameObject     newLocationButton    = Instantiate(locationButton, contentParent);
                LocationButton locationButtonScript = newLocationButton.GetComponent <LocationButton>();
                locationButtonScript.SetLocation(resultLocations[i]);
                locationButtons.Add(newLocationButton);
            }
        }
        else
        {
            emptyLocation.SetActive(true);
        }
    }
 private void OnLocationPick(LocationButton button)
 {
     this.PickedLocation        = button.Location;
     button.Button.Interactable = false;
 }
 private void Start()
 {
     button = GetComponent <LocationButton>();
 }