mirror of
https://github.com/riperiperi/FreeSO.git
synced 2025-01-22 07:32:14 -05:00
Improve city interaction when there's only 1 nhood
This commit is contained in:
parent
d45593bc04
commit
3e9893a1f0
4 changed files with 57 additions and 4 deletions
|
@ -111,6 +111,8 @@ There are a few things you can do in the neighbourhood editor:
|
|||
- Move a neighbourhood's origin point to the mouse position. The neighbourhood visualization will update to show you what area of the city belongs to which neighbourhood.
|
||||
- Hold shift & Click
|
||||
- Create a new neighbourhood at the mouse position.
|
||||
- Hold ctrl & Click
|
||||
- Delete the neighbourhood at the mouse position. Needs to be pretty close.
|
||||
- Press "R"
|
||||
- Rename the neighbourhood closest to the mouse position.
|
||||
- Press "C"
|
||||
|
@ -120,7 +122,7 @@ There are a few things you can do in the neighbourhood editor:
|
|||
- Press Shift + F10
|
||||
- Save the neighbourhood data to `Content/edit_neigh.json`.
|
||||
|
||||
Similar to the City Painter, this tool is currently pretty user unfriendly, so improvements would definitely be welcome. For example, not being able to delete neighbourhoods is a bit silly, but you can always save to JSON, manually delete it with a text editor, then load it again.
|
||||
Similar to the City Painter, this tool is currently pretty user unfriendly, so improvements would definitely be welcome.
|
||||
|
||||
Descriptions for neighbourhoods also can't be edited ingame. Add a `description` field to each object in the JSON to give your neighbourhoods a description that appears in their nhood page. You can also do this in the database after importing.
|
||||
|
||||
|
|
|
@ -22,6 +22,45 @@ namespace FSO.Client.Rendering.City
|
|||
private UILotControlTouchHelper Touch;
|
||||
public CityCameraCenter CenterCam { get; set; }
|
||||
|
||||
// Set a center delta, then tween to 0 to smootly move to a target location.
|
||||
|
||||
public Vector2 CenterDelta;
|
||||
public float TweenDeltaX
|
||||
{
|
||||
get
|
||||
{
|
||||
return CenterDelta.X;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (CenterDelta.X != 0)
|
||||
{
|
||||
CenterTile.X -= value - CenterDelta.X;
|
||||
}
|
||||
|
||||
CenterDelta.X = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float TweenDeltaY
|
||||
{
|
||||
get
|
||||
{
|
||||
return CenterDelta.Y;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (CenterDelta.Y != 0)
|
||||
{
|
||||
CenterTile.Y -= value - CenterDelta.Y;
|
||||
}
|
||||
|
||||
CenterDelta.Y = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float FarUIFade
|
||||
{
|
||||
get { return Math.Max(0, Math.Min(1, 6.5f - Zoom3D)); }
|
||||
|
|
|
@ -80,6 +80,8 @@ namespace FSO.Client.Rendering.City
|
|||
int halfMapSize = mapSize / 2;
|
||||
int margin = 512;
|
||||
|
||||
// These points stop the neighbourhood geometry from going too far out of bounds, which would cause visual issues.
|
||||
|
||||
pts.Add(new Vector2(halfMapSize, -margin));
|
||||
pts.Add(new Vector2(-margin, halfMapSize));
|
||||
|
||||
|
@ -476,7 +478,8 @@ namespace FSO.Client.Rendering.City
|
|||
//find the nhood we're hovering
|
||||
var pos = City.EstTileAtPosWithScroll(state.MouseState.Position.ToVector2() / FSOEnvironment.DPIScaleFactor, null);
|
||||
|
||||
if (City.HandleMouse)
|
||||
// Neighbourhoods are only interactive if there's more than one.
|
||||
if (City.HandleMouse && City.NeighGeom.Cells.Count > 1)
|
||||
{
|
||||
HoverNHood = NhoodNearest(pos);
|
||||
if (HoverNHood > -1 && !HoverPct.ContainsKey(HoverNHood))
|
||||
|
|
|
@ -1102,9 +1102,18 @@ namespace FSO.Client.Rendering.City
|
|||
|
||||
//((CityCamera2D)Camera).m_TargVOffX = (float)(-hb + pt.X * isoScale * 2);
|
||||
//((CityCamera2D)Camera).m_TargVOffY = (float)(vb - pt.Y * isoScale * 2); //zoom into approximate location of mouse cursor if not zoomed already
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentTile != null) ((CityCamera3D)Camera).CenterTile = currentTile.Value;
|
||||
var camera = (CityCamera3D)Camera;
|
||||
if (currentTile != null)
|
||||
{
|
||||
camera.CenterDelta = currentTile.Value - camera.CenterTile;
|
||||
GameFacade.Screens.Tween.To(camera, 0.3f, new Dictionary<string, float>() {
|
||||
{ "TweenDeltaX", 0f },
|
||||
{ "TweenDeltaY", 0f },
|
||||
}, TweenQuad.EaseOut);
|
||||
}
|
||||
((CityCamera3D)Camera).TargetZoom = 1.7f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue