Modular Screens

by astog·v1.0·Updated 2018-10-01

Modular Screens Screen modularity

About this mod Machine translation

Modular Screens Screen modularity

Allows modders to safely add launchbar buttons, partial links, etc.

Overview

Version history

discuss

What's this?

In short, this is a mod that allows other mods to add buttons to the launch bar (top left corner), screen hooks (top right corner) without overwriting the base game UI files. It also adds a dropdown to add extra buttons if the modder requires it.

Why use this?

Since this allows modders to not overwrite the same base UI files, more mods will be compatible with each other and allow them to add screens to the game in a more sane way.

How to use it?

For mod users, this requires the same installation as other mods. If you are a modder and want to add buttons, read the information below for the three main places where you can add buttons.

Start Bar Extras List

I added lists for menus that don't need icons. I replaced the world builder's show/hide with list toggles. This is probably the easiest place to add buttons. Here is an example:

code:

LuaEvents.LaunchBar_AddExtra(“Button1”,extraButton);

The first parameter is the key (to prevent duplicate buttons) and the second parameter is the table:

code:

local extraButton:table = {

Text = "Test1"; - the text to be displayed in the button

callback=open; - function called when the button is clicked

Tooltip = "test1"; - if nil, disable tooltip}

launch bar

These are the icons above the world planner, including Tech, Civic tree buttons, etc. To add an icon, call:

code:

LuaEvents.LaunchBar_AddIcon(buttonInfo);

An example of buttonInfo that adds the samurai button below:

code:

textureOffsetX,textureOffsetY,textureSheet = IconManager:FindIconAtlas(“ICON_UNIT_JAPANESE_SAMURAI”,38);

local button2Info = {

-Icon texture

IconTexture = {

OffsetX = textureOffsetX;

OffsetY = textureOffsetY + 3;

Sheet = textureSheet;

Color = UI.GetColorValue(“COLOR_PLAYER_BARBARIAN_PRIMARY”);

};

  • Base texture (think of it as a button texture)

BaseTexture = {

OffsetX = 0;

Offset Y = 147;

Sheet =“LaunchBar_Hook_GreatPeopleButton”;

  • Color = UI.GetColorValue(“COLOR_BLUE”);

HoverOffsetX = 0;

HoverOffsetY = 0;

};

-Button information

Callback = function() print("ATTACK!") end;

  • tooltip = "Barb...";

}

Part of the screen hooks These are the screens

in the upper right corner, including a transaction overview, world scores, and more. The method of adding to these is similar to the Launch Bar button.

code:

LuaEvents.PartialScreenHooks_AddHook(hookInfo1);

The table structure is the same as that used in the launch bar.

code:

local hookInfo1: table = {

-Icon texture

IconTexture = {

OffsetX = 0;

Offset Y = 0;

Sheet =“MapPins24.dds”;

Color = UI.GetColorValue(“COLOR_PLAYER_GOLDENROD”)

};

  • Button texture

BaseTexture = {

OffsetX = 0;

Offset Y = 0;

Sheet =“LaunchBar_Hook_ButtonSmall”;

  • Offset on hover

HoverOffsetX = 0;

HoverOffsetY = 40;

};

Callback = function() print("Damascus steel!") end;

Tooltip =“ATTACK!”;

};

Instructions for use

All LuaEvents should not be called in init() as this would make it load order dependent. Instead call it in this event:

code:

Events.LoadScreenClose

Additional usage examples can be seen at the bottom of launchbar.lua and partialscreenhooks.lua.

What is this?

In short, this is a mod that allows other modders to add buttons to launchbar (top left), screen hooks (top right), without needing to overwrite the base game UI files. It also adds a pull down to add extra buttons if the modder wants.

Why use this?

Since this allows modders to not overwrite the same base UI files, more mods will be compatible with each other, and allow them add screens to the game in a more sane way.

How to use this?

For a mod user, this requires the same installation as other mods. If you are a modder, and want to add buttons read the info below for the three main places where you can add buttons.

Launch Bar Extras List

I added lis …

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. There is no universal mod manager for this game: some mods replace game files directly, some go into a game-specific Mods folder, and some need a game-specific community loader or tool first — follow the bundled readme.
  3. Place the files exactly as the readme says; mods with listed dependencies need those installed too.
  4. Launch the game to confirm it loaded; some games require enabling mods in settings or an in-game mod menu.

Install locations vary a lot between games and mods — the bundled readme is the most reliable guide.

File & checksum

Filename
Modular Screens 屏幕模块化
File size
20.6 KiB