Skip to content

Conversation

@stavrosfa
Copy link
Contributor

  1. Added unit thumbnail in the lower right info box
  2. Now it also displays the unit's rank, and also if the unit is in a city, the name of the city instead of the underlying terrain info
  3. Clicking on it will center on the currently active unit
  4. Clicking on it at the end of the turn will end the turn

To be honest this one felt a bit "hacky", for lack of a better word. If you have any suggestions as to how to improve it, let me know.

2. Clicking will center on the currently active unit
3. Clicking at the end of the turn will end the turn
@esbudylin esbudylin self-requested a review November 11, 2025 15:44
@TomWerner
Copy link
Contributor

Very cool! Sorry for the slow review, missed the email.

My one comment is that I'd rather not duplicate the "get the first frame of the animation" logic that we already have in the city screen:

// Get the flic data for the unit we're producing.
string path = new AnimationManager(null).getUnitFlicFilepath(up, MapUnit.AnimatedAction.DEFAULT);
ConvertCiv3Media.Flic flic = Util.LoadFlic(path);
// Set up a shader we can use to color the "tint" portion of the
// animation frame below.
ShaderMaterial material = new();
material.Shader = GD.Load<Shader>("res://UnitTint.gdshader");
Color civColor = TextureLoader.LoadColor(city.owner.colorIndex);
material.SetShaderParameter("tintColor", new Vector3(civColor.R, civColor.G, civColor.B));
// See flicRowToAnimationDirection for the mapping, row 2 is facing
// southeast, and we're just grabbing frame 0.
byte[] frame = flic.Images[2, 0];
// Each frame is split in two parts, the base image, and the "tint"
// of the image, which is the part of the unit that has civ-specific
// colors.
(ImageTexture baseImage, ImageTexture imageTint) = Util.LoadTextureFromFlicData(frame, flic.Palette, flic.Width, flic.Height);
// Add the base sprite.
Sprite2D baseImageSprite = new();
baseImageSprite.Texture = baseImage;
baseImageSprite.Position = new Vector2(productionButton.TextureNormal.GetWidth() / 2, 35);
productionButton.AddChild(baseImageSprite);
// Add the tint sprite, hooking up the shader.
Sprite2D imageTintSprite = new Sprite2D();
imageTintSprite.Texture = imageTint;
imageTintSprite.Material = material;
imageTintSprite.Position = baseImageSprite.Position;

Could you share that code for the lower right hand box?

@stavrosfa
Copy link
Contributor Author

No worries, I though we were in some kind of freeze before the release.

Regarding what you said, you are absolutely right, but I think instead of using the city screen logic in the lower right hand box, the city screen method should call the method in the AnimantionManager.
Maybe that's what you meant all along, because calling the cityScreen from the LowerRightInfoBox doesn't make sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants