예제 #1
0
    public void OnLocationClick(MapLocationPointer mlp)
    {
        Player   p           = MainGameController.instance.player;
        Location curLocation = MainGameController.instance.databaseController.connection.Table <Location>().Where(x => x.id == p.CurrentLocation).First();
        int      destId      = mlp.GetLocation().id;

        SQLite4Unity3d.TableQuery <Route> routes = MainGameController.instance.databaseController.connection.Table <Route>().Where(x =>
                                                                                                                                   (x.to == destId && x.from == curLocation.id) || (x.from == destId && x.to == curLocation.id));
        if (routes.Count() == 1)
        {
            Route route = routes.First();
            _routeText.text = curLocation.Name + " " + MainGameController.instance.localizationManager.GetLocalizedValue("to_text") + " " + mlp.GetLocation().Name;
            _worldMap.GetComponent <WorldMapController>().ShowRoute(route);
            _selectedRoute = route;

            if (MainGameController.instance.player.GetActiveBoat() == null)
            {
                _noBoatPanel.SetActive(true);
                _chooseRouteButton.interactable = false;
            }
            else if (MainGameController.instance.player.GetActiveBoat().GetSailsBought().Count == 0)
            {
                _noSailPanel.SetActive(true);
                _chooseRouteButton.interactable = false;
            }
        }
    }
예제 #2
0
    public void OnCityClick(MapLocationPointer mlp)
    {
        _worldMapController.ScrollToPosition(new Vector2(mlp.GetLocation().lat, mlp.GetLocation().lon));

        _popupTextPanel.transform.localPosition = mlp.transform.localPosition - new Vector3(0, 255, 0);
        _popupText.text = mlp.GetLocation().Name;
        _popupTextPanel.SetActive(true);
    }