Created
October 28, 2014 09:58
-
-
Save anonymous/18604c986c22362c4d7a to your computer and use it in GitHub Desktop.
Civ BE - Trade route sorting v2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- =========================================================================== | |
-- Trade Route Popup | |
-- =========================================================================== | |
include( "IconSupport" ); | |
include( "InstanceManager" ); | |
include( "CommonBehaviors" ); | |
include( "TradeRouteHelpers" ); | |
-- =========================================================================== | |
-- VARIABLES | |
-- =========================================================================== | |
local g_ItemManagers = { | |
InstanceManager:new( "ItemInstance", "Button", Controls.YourCitiesStack ), | |
InstanceManager:new( "ItemInstance", "Button", Controls.YourOutpostsStack ), | |
InstanceManager:new( "ItemInstance", "Button", Controls.OtherCivsStack ), | |
InstanceManager:new( "ItemInstance", "Button", Controls.StationsStack ), | |
} | |
local g_iUnitIndex = -1; | |
local g_iPlayer = -1; | |
local g_invalidPlotMiasmaStyle = "InvalidPlotMiasma"; | |
local g_invalidPlotMiasmaColor = Vector4(1, 0, 0, 0.5); | |
local m_bHidden = true; | |
local g_PopupInfo = nil; | |
-- =========================================================================== | |
-- FUNCTIONS | |
-- =========================================================================== | |
-- =========================================================================== | |
function Initialize() | |
local m_screenSizeX, m_screenSizeY = UIManager:GetScreenSizeVal() | |
local spHeight = Controls.ItemScrollPanel:GetSizeY(); | |
local bpHeight = Controls.BottomPanel:GetSizeY(); | |
local ART_BUFFER = 5; | |
Controls.BottomPanel:SetSizeY( m_screenSizeY - ART_BUFFER ); | |
Controls.BottomPanel:ReprocessAnchoring(); | |
local ART_BUFFER_SCROLLAREA = 211; | |
Controls.ItemScrollPanel:SetSizeY( Controls.BottomPanel:GetSizeY() - ART_BUFFER_SCROLLAREA ); | |
Controls.ItemScrollPanel:CalculateInternalSize(); | |
Controls.ItemScrollPanel:ReprocessAnchoring(); | |
end | |
------------------------------------------------- | |
------------------------------------------------- | |
function OnPopupMessage(popupInfo) | |
local popupType = popupInfo.Type; | |
if popupType ~= ButtonPopupTypes.BUTTONPOPUP_CHOOSE_INTERNATIONAL_TRADE_ROUTE then | |
return; | |
end | |
g_PopupInfo = popupInfo; | |
g_iUnitIndex = popupInfo.Data2; | |
UIManager:QueuePopup( ContextPtr, PopupPriority.SocialPolicy ); | |
UI.SetTradeRouteVisibleMode(true ); | |
end | |
Events.SerialEventGameMessagePopup.Add( OnPopupMessage ); | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
function InputHandler( uiMsg, wParam, lParam ) | |
---------------------------------------------------------------- | |
-- Key Down Processing | |
---------------------------------------------------------------- | |
if uiMsg == KeyEvents.KeyDown then | |
if (wParam == Keys.VK_ESCAPE) then | |
if(not Controls.ChooseConfirm:IsHidden()) then | |
Controls.ChooseConfirm:SetHide(true); | |
else | |
OnClose(); | |
end | |
return true; | |
end | |
end | |
end | |
ContextPtr:SetInputHandler( InputHandler ); | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
function TradeOverview() | |
local popupInfo = { | |
Type = ButtonPopupTypes.BUTTONPOPUP_TRADE_ROUTE_OVERVIEW, | |
} | |
Events.SerialEventGameMessagePopup(popupInfo); | |
end | |
Controls.TradeOverviewButton:RegisterCallback( Mouse.eLClick, TradeOverview ); | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
function OnClose() | |
Events.ClearHexHighlightStyle(g_invalidPlotMiasmaStyle); | |
UIManager:DequeuePopup(ContextPtr); | |
UI.SetTradeRouteVisibleMode(OptionsManager.GetShowTradeOn()); | |
end | |
Controls.CloseButton:RegisterCallback( Mouse.eLClick, OnClose ); | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
function RefreshData() | |
local iActivePlayer = Game.GetActivePlayer(); | |
local pPlayer = Players[iActivePlayer]; | |
local pUnit = pPlayer:GetUnitByID(g_iUnitIndex); | |
if (pUnit == nil) then | |
return; | |
end | |
local pOriginPlot = pUnit:GetPlot(); | |
local pOriginCity = pOriginPlot:GetPlotCity(); | |
local eDomain = pUnit:GetDomainType(); | |
local unitType = pUnit:GetUnitType(); | |
local unitInfo = GameInfo.Units[unitType]; | |
local portraitOffset, portraitAtlas = UI.GetUnitPortraitIcon(unitType, pPlayer:GetID()); | |
IconHookup(portraitOffset, 64, portraitAtlas, Controls.TradeUnitIcon); | |
Controls.StartingCity:LocalizeAndSetText("TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_STARTING_CITY", pOriginCity:GetName()); | |
Controls.UnitInfo:LocalizeAndSetText("TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_TRADE_UNIT", pUnit:GetName()); | |
local sortByPulldown = Controls.SortByPullDown; | |
sortByPulldown:ClearEntries(); | |
for i, v in ipairs(g_SortOptions) do | |
local controlTable = {}; | |
sortByPulldown:BuildEntry( "InstanceOne", controlTable ); | |
controlTable.Button:LocalizeAndSetText(v[1]); | |
controlTable.Button:RegisterCallback(Mouse.eLClick, function() | |
sortByPulldown:GetButton():LocalizeAndSetText(v[1]); | |
g_CurrentSortOption = i; | |
SortData(); | |
DisplayData(); | |
end); | |
end | |
sortByPulldown:CalculateInternals(); | |
sortByPulldown:GetButton():LocalizeAndSetText(g_SortOptions[g_CurrentSortOption][1]); | |
local map = Map; | |
g_Model = {}; | |
g_Unit = pUnit; | |
local potentialTradeSpots = pPlayer:GetUnitAvailableTradeRoutes(pUnit); | |
for i,v in ipairs(potentialTradeSpots) do | |
local tradeRoute = { | |
PlotX = v.DestX, | |
PlotY = v.DestY, | |
TradeConnectionType = v.TradeConnectionType | |
}; | |
-- Site Plot | |
local pTargetPlot = map.GetPlot(v.DestX, v.DestY); | |
-- Site Owner ID | |
local iTargetOwner = v.DestPlayerID; | |
-- Site Name | |
tradeRoute.SiteName = v.DestSiteName; | |
-- Site Player | |
local pTargetPlayer = Players[iTargetOwner]; | |
-- Site Civ Name | |
if (v.TradeConnectionType == TradeConnectionTypes.TRADE_CONNECTION_STATION) then | |
tradeRoute.CivName = Locale.Lookup("TXT_KEY_TRADE_ROUTE_DEFAULT_STATION_CIV_NAME"); | |
else | |
tradeRoute.CivName = pTargetPlayer:GetCivilizationDescription(); | |
end | |
if(iTargetOwner == iActivePlayer) then | |
if (pTargetPlot:IsCity()) then | |
tradeRoute.Category = 1; -- Your Cities | |
elseif (pTargetPlot:IsOutpost()) then | |
tradeRoute.Category = 2; -- Your Outposts | |
end | |
elseif (iTargetOwner < GameDefines.MAX_MAJOR_CIVS) then | |
tradeRoute.Category = 3; -- Other Civ Cities | |
elseif (pTargetPlot:IsStation()) then | |
tradeRoute.Category = 4; -- Station | |
end | |
local myBonuses = {}; | |
local theirBonuses = {}; | |
if (v.TradeConnectionType == TradeConnectionTypes.TRADE_CONNECTION_INTERNATIONAL or | |
v.TradeConnectionType == TradeConnectionTypes.TRADE_CONNECTION_INTERNAL_CITY or | |
v.TradeConnectionType == TradeConnectionTypes.TRADE_CONNECTION_STATION) then | |
if (v.Yields ~= nil) then | |
print("Trade Effect: Yield"); | |
for j,u in ipairs(v.Yields) do | |
local iYield = j - 1; | |
local entry = GetYieldBonusTip(iYield); | |
local iMyYield = math.floor(u.Mine / 100); | |
local iTheirYield = math.floor(u.Theirs / 100); | |
if(iYield == YieldTypes.YIELD_ENERGY) then | |
tradeRoute.Energy = u.Mine; | |
tradeRoute.EnergyDelta = u.Mine - u.Theirs; | |
elseif (iYield == YieldTypes.YIELD_SCIENCE) then | |
tradeRoute.Science = u.Mine; | |
tradeRoute.ScienceDelta = u.Mine - u.Theirs; | |
elseif(iYield == YieldTypes.YIELD_FOOD) then | |
tradeRoute.FoodInc = u.Mine; | |
tradeRoute.FoodOut = u.Theirs; | |
tradeRoute.FoodTot = u.Mine + u.Theirs; | |
elseif (iYield == YieldTypes.YIELD_PRODUCTION) then | |
tradeRoute.ProductionInc = u.Mine; | |
tradeRoute.ProductionOut = u.Theirs; | |
tradeRoute.ProductionTot = u.Mine + u.Theirs; | |
end | |
if(iMyYield ~= 0) then | |
table.insert(myBonuses, "[ICON_ARROW_LEFT] " .. Locale.Lookup(entry, iMyYield)); | |
end | |
if(iTheirYield ~= 0) then | |
table.insert(theirBonuses, "[ICON_ARROW_RIGHT] " .. Locale.Lookup(entry, iTheirYield)); | |
end | |
end | |
end | |
-- Stations may have other effects to display | |
local station = pTargetPlot:GetPlotStation(); | |
if (station ~= nil) then | |
local extraEffectSummary = station:GetTradePopupSummary(); | |
if (extraEffectSummary ~= "") then | |
table.insert(myBonuses, extraEffectSummary); | |
end | |
end | |
elseif (v.TradeConnectionType == TradeConnectionTypes.TRADE_CONNECTION_OUTPOST) then | |
print("Trade Effect: Outpost Growth"); | |
table.insert(myBonuses, Locale.Lookup("TXT_KEY_OUTPOST_TRADE_ROUTE_PERCENT_GROWTH", v.OutpostGrowthMod)); | |
end | |
local strOutput; | |
if(#myBonuses > 0) then | |
strOutput = table.concat(myBonuses, "[NEWLINE]") .. "[NEWLINE]" .. table.concat(theirBonuses, "[NEWLINE]"); | |
else | |
strOutput = table.concat(theirBonuses, "[NEWLINE]"); | |
end | |
tradeRoute.Bonuses = strOutput; | |
tradeRoute.TargetPlayerId = pTargetPlayer:GetID(); | |
tradeRoute.eDomain = eDomain; | |
if (v.OldTradeRoute) then | |
tradeRoute.PrevRoute = Locale.Lookup("TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_PREV_ROUTE"); | |
else | |
tradeRoute.PrevRoute = ""; | |
end | |
table.insert(g_Model, tradeRoute); | |
end | |
-- Highlight invalid trade plots | |
local bHighlightMiasma : boolean = pPlayer:GetGeneralUnitMiasmaHealthDelta() < 0; | |
for iPlotLoop = 0, Map.GetNumPlots()-1, 1 do | |
local pPlot = Map.GetPlotByIndex(iPlotLoop); | |
local hexID = ToHexFromGrid(Vector2(pPlot:GetX(), pPlot:GetY())); | |
if pPlot:IsVisible(pPlayer:GetTeam(), false) then | |
if (bHighlightMiasma and pPlot:HasMiasma()) then | |
Events.SerialEventHexHighlight(hexID, true, g_invalidPlotMiasmaColor, g_invalidPlotMiasmaStyle); | |
end | |
end | |
end | |
end | |
function SortBySiteName(a, b) | |
return Locale.Compare(a.SiteName, b.SiteName) == -1; | |
end | |
function SortByCivName(a, b) | |
local result = Locale.Compare(a.CivName, b.CivName); | |
if(result == 0) then | |
return SortBySiteName(a,b); | |
else | |
return result == -1; | |
end | |
end | |
function SortByNearest(a, b) | |
if g_Unit == nil then | |
return; | |
end | |
local pPlot = g_Unit:GetPlot(); | |
local distA = Map.PlotDistance(pPlot:GetX(), pPlot:GetY(), a.PlotX, a.PlotY); | |
local distB = Map.PlotDistance(pPlot:GetX(), pPlot:GetY(), b.PlotX, b.PlotY); | |
return distA < distB; | |
end | |
function SortByMaxScience(a, b) | |
return a.Science > b.Science; | |
end | |
function SortByScienceDelta(a, b) | |
return a.ScienceDelta > b.ScienceDelta; | |
end | |
function SortByMaxEnergy(a, b) | |
return a.Energy > b.Energy; | |
end | |
function SortByEnergyDelta(a, b) | |
return a.EnergyDelta > b.EnergyDelta; | |
end | |
function SortByFoodInc(a, b) | |
return a.FoodInc > b.FoodInc; | |
end | |
function SortByFoodOut(a, b) | |
return a.FoodOut > b.FoodOut; | |
end | |
function SortByFoodTot(a, b) | |
return a.FoodTot > b.FoodTot; | |
end | |
function SortByProductionInc(a, b) | |
return a.ProductionInc > b.ProductionInc; | |
end | |
function SortByProductionOut(a, b) | |
return a.ProductionOut > b.ProductionOut; | |
end | |
function SortByProductionTot(a, b) | |
return a.ProductionTot > b.ProductionTot; | |
end | |
g_SortOptions = { | |
{"TXT_KEY_PEDIA_CIVILIZATION_NAME", SortByCivName}, | |
{"TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_SORT_CITYNAME", SortBySiteName}, | |
{"TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_SORT_NEAREST", SortByNearest}, | |
{"Science", SortByMaxScience}, | |
{"Science Delta", SortByScienceDelta}, | |
{"Energy", SortByMaxEnergy}, | |
{"Energy Delta", SortByEnergyDelta}, | |
{"Food Inc", SortByFoodInc}, | |
{"Food Out", SortByFoodOut}, | |
{"Food Tot", SortByFoodTot}, | |
{"Production Inc", SortByProductionInc}, | |
{"Production Out", SortByProductionOut}, | |
{"Production Tot", SortByProductionTot}, | |
} | |
g_CurrentSortOption = 1; | |
function SortData() | |
table.sort(g_Model, g_SortOptions[g_CurrentSortOption][2]); | |
end | |
function DisplayData() | |
for _, itemManager in ipairs(g_ItemManagers) do | |
itemManager:ResetInstances(); | |
end | |
for _, tradeRoute in ipairs(g_Model) do | |
local itemInstance = g_ItemManagers[tradeRoute.Category]:GetInstance(); | |
itemInstance.SiteName:SetText(tradeRoute.SiteName); | |
itemInstance.Bonuses:SetText(tradeRoute.Bonuses); | |
itemInstance.PrevRoute:SetText(tradeRoute.PrevRoute); | |
SimpleCivIconHookup(tradeRoute.TargetPlayerId, 64, itemInstance.CivIcon); | |
itemInstance.Button:RegisterCallback(Mouse.eLClick, function() SelectTradeDestinationChoice(tradeRoute.PlotX, tradeRoute.PlotY, tradeRoute.TradeConnectionType); end); | |
itemInstance.Button:SetToolTipString(tradeRoute.ToolTip); | |
local buttonWidth, buttonHeight = itemInstance.Button:GetSizeVal(); | |
--local descWidth, descHeight = itemInstance.Bonuses:GetSizeVal(); | |
itemInstance.DetailsStack:ReprocessAnchoring(); | |
itemInstance.DetailsStack:CalculateSize(); | |
local descWidth, descHeight = itemInstance.DetailsStack:GetSizeVal(); | |
local newHeight = math.max(80, descHeight + 20); | |
itemInstance.Button:SetSizeVal(buttonWidth, newHeight); | |
--itemInstance.Box:SetSizeVal(buttonWidth, newHeight); | |
itemInstance.GoToCity:RegisterCallback(Mouse.eLClick, function() | |
local plot = Map.GetPlot(tradeRoute.PlotX, tradeRoute.PlotY); | |
UI.LookAt(plot, 0); | |
end); | |
itemInstance.Button:RegisterCallback(Mouse.eMouseEnter, function() Game.SelectedUnit_SpeculativePopupTradeRoute_Display(tradeRoute.PlotX, tradeRoute.PlotY, tradeRoute.TradeConnectionType, tradeRoute.eDomain); end); | |
itemInstance.Button:RegisterCallback(Mouse.eMouseExit, function() Game.SelectedUnit_SpeculativePopupTradeRoute_Hide(tradeRoute.PlotX, tradeRoute.PlotY, tradeRoute.TradeConnectionType); end); | |
end | |
Controls.YourCitiesStack:CalculateSize(); | |
Controls.YourCitiesStack:ReprocessAnchoring(); | |
Controls.YourOutpostsStack:CalculateSize(); | |
Controls.YourOutpostsStack:ReprocessAnchoring(); | |
Controls.OtherCivsStack:CalculateSize(); | |
Controls.OtherCivsStack:ReprocessAnchoring(); | |
Controls.StationsStack:CalculateSize(); | |
Controls.StationsStack:ReprocessAnchoring(); | |
Controls.ItemStack:CalculateSize(); | |
Controls.ItemStack:ReprocessAnchoring(); | |
Controls.ItemScrollPanel:CalculateInternalSize(); | |
end | |
function SelectTradeDestinationChoice(iPlotX, iPlotY, iTradeConnectionType) | |
g_selectedPlotX = iPlotX; | |
g_selectedPlotY = iPlotY; | |
g_selectedTradeType = iTradeConnectionType; | |
Controls.ChooseConfirm:SetHide(false); | |
end | |
function OnConfirmYes( ) | |
Controls.ChooseConfirm:SetHide(true); | |
local kPlot = Map.GetPlot( g_selectedPlotX, g_selectedPlotY ); | |
Game.SelectionListGameNetMessage(GameMessageTypes.GAMEMESSAGE_PUSH_MISSION, MissionTypes.MISSION_ESTABLISH_TRADE_ROUTE, kPlot:GetPlotIndex(), g_selectedTradeType, 0, false, nil); | |
Events.AudioPlay2DSound("AS2D_INTERFACE_TRADE_ROUTE_CONFIRM"); | |
OnClose(); | |
end | |
Controls.ConfirmYes:RegisterCallback( Mouse.eLClick, OnConfirmYes ); | |
function OnConfirmNo( ) | |
Controls.ChooseConfirm:SetHide(true); | |
end | |
Controls.ConfirmNo:RegisterCallback( Mouse.eLClick, OnConfirmNo ); | |
------------------------------------------------------------------------------- | |
------------------------------------------------------------------------------- | |
function ShowHideHandler( bIsHide, bInitState ) | |
m_bHidden = bIsHide; | |
if( not bInitState ) then | |
if( not bIsHide ) then | |
UI.incTurnTimerSemaphore(); | |
Events.SerialEventGameMessagePopupShown(g_PopupInfo); | |
RefreshData(); | |
SortData(); | |
DisplayData(); | |
local unitPanel = ContextPtr:LookUpControl( "/InGame/WorldView/UnitPanel/Base" ); | |
if( unitPanel ~= nil ) then | |
unitPanel:SetHide( true ); | |
end | |
local infoCorner = ContextPtr:LookUpControl( "/InGame/WorldView/InfoCorner" ); | |
if( infoCorner ~= nil ) then | |
infoCorner:SetHide( true ); | |
end | |
else | |
local unitPanel = ContextPtr:LookUpControl( "/InGame/WorldView/UnitPanel/Base" ); | |
if( unitPanel ~= nil ) then | |
unitPanel:SetHide(false); | |
end | |
local infoCorner = ContextPtr:LookUpControl( "/InGame/WorldView/InfoCorner" ); | |
if( infoCorner ~= nil ) then | |
infoCorner:SetHide(false); | |
end | |
if(g_PopupInfo ~= nil) then | |
Events.SerialEventGameMessagePopupProcessed.CallImmediate(g_PopupInfo.Type, 0); | |
end | |
UI.decTurnTimerSemaphore(); | |
end | |
end | |
end | |
ContextPtr:SetShowHideHandler( ShowHideHandler ); | |
function OnDirty() | |
-- If the user performed any action that changes selection states, just close this UI. | |
if not m_bHidden then | |
OnClose(); | |
end | |
end | |
Events.UnitSelectionChanged.Add( OnDirty ); | |
function OnCollapseExpand() | |
Controls.YourCitiesStack:CalculateSize(); | |
Controls.YourCitiesStack:ReprocessAnchoring(); | |
Controls.YourOutpostsStack:CalculateSize(); | |
Controls.YourOutpostsStack:ReprocessAnchoring(); | |
Controls.OtherCivsStack:CalculateSize(); | |
Controls.OtherCivsStack:ReprocessAnchoring(); | |
Controls.StationsStack:CalculateSize(); | |
Controls.StationsStack:ReprocessAnchoring(); | |
Controls.ItemStack:CalculateSize(); | |
Controls.ItemStack:ReprocessAnchoring(); | |
Controls.ItemScrollPanel:CalculateInternalSize(); | |
end | |
RegisterCollapseBehavior{ | |
Header = Controls.YourCitiesHeader, | |
HeaderLabel = Controls.YourCitiesHeaderLabel, | |
HeaderExpandedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_YOUR_CITIES"), | |
HeaderCollapsedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_YOUR_CITIES_COLLAPSED"), | |
Panel = Controls.YourCitiesStack, | |
Collapsed = false, | |
OnCollapse = OnCollapseExpand, | |
OnExpand = OnCollapseExpand, | |
}; | |
RegisterCollapseBehavior{ | |
Header = Controls.YourOutpostsHeader, | |
HeaderLabel = Controls.YourOutpostsHeaderLabel, | |
HeaderExpandedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_YOUR_OUTPOSTS"), | |
HeaderCollapsedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_YOUR_OUTPOSTS_COLLAPSED"), | |
Panel = Controls.YourOutpostsStack, | |
Collapsed = false, | |
OnCollapse = OnCollapseExpand, | |
OnExpand = OnCollapseExpand, | |
}; | |
RegisterCollapseBehavior{ | |
Header = Controls.OtherCivsHeader, | |
HeaderLabel = Controls.OtherCivsHeaderLabel, | |
HeaderExpandedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_OTHER_CIVS"), | |
HeaderCollapsedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_OTHER_CIVS_COLLAPSED"), | |
Panel = Controls.OtherCivsStack, | |
Collapsed = false, | |
OnCollapse = OnCollapseExpand, | |
OnExpand = OnCollapseExpand, | |
}; | |
RegisterCollapseBehavior{ | |
Header = Controls.StationsHeader, | |
HeaderLabel = Controls.StationsHeaderLabel, | |
HeaderExpandedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_STATIONS"), | |
HeaderCollapsedLabel = Locale.Lookup("TXT_KEY_CHOOSE_TRADE_ROUTE_STATIONS_COLLAPSED"), | |
Panel = Controls.StationsStack, | |
Collapsed = false, | |
OnCollapse = OnCollapseExpand, | |
OnExpand = OnCollapseExpand, | |
}; | |
Initialize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Context ID="ChooseInternationalTradeRoutePopup" ColorSet="Beige_Black_Alpha" Style="FontNormal16" FontStyle="Shadow"> | |
<Instance Name="ItemInstance"> | |
<GridButton Anchor="L,C" Size="370,73" Color="255,255,255,255" Offset="0,0" StateOffsetIncrement="0,0" ID="Button" Style="CivilopediaListItem"> | |
<Image ID="CivIcon" Size="65,65" Offset="2,0" Anchor="L,T" Texture="CivSymbolsColor512.dds"/> | |
<Button Anchor="R,T" ID="GoToCity" Offset="2,2" Size="30,30" StateOffsetIncrement="0,0" Texture="Civilopedia_SearchIcon.dds"/> | |
<Stack StackGrowth="Bottom" Offset="70,5" Padding="4" ID="DetailsStack"> | |
<Label Anchor="L,T" Offset="0,0" Style="GrayGlow" WrapWidth="290" ID="SiteName" /> | |
<Label Anchor="L,T" Offset="0,0" Style="GrayShadow" WrapWidth="290" ID="PrevRoute" String="Previous Route" /> | |
<Label Anchor="L,T" Offset="0,0" LeadingOffset="2" Style="GrayShadow" WrapWidth="290" ID="Bonuses" /> | |
</Stack> | |
</GridButton> | |
</Instance> | |
<!-- Main Panel--> | |
<Grid ID="BottomPanel" Anchor="L,B" Offset="-7,-19" Size="400, 500" Style="GridWindowWithHeader" ConsumeMouse="1" > | |
<Button ID="CloseButton" Anchor="R,T" Offset="7,7" Style="CloseButton"/> | |
<Box Color="0,0,0,0" Size="parent, 40"> | |
<Label Anchor="L,C" Offset="16,10" Style="MenuTitleCaptionSmall" WrapWidth="350" String="{TXT_KEY_CHOOSE_INTERNATIONAL_TRADE_ROUTE_TITLE:upper}"/> | |
</Box> | |
<Grid Style="ProductionListHeaderGrid" Size="parent-7,60" Offset="0,48"> | |
<Image ID="TradeUnitIcon" Size="64,64" Offset="0,-8" Anchor="L,T" Texture="CivSymbolsColor512.dds"/> | |
<Container Size="436,100"> | |
<Label ID="StartingCity" Anchor="L,T" Offset="65,10" Style="GrayGlow" /> | |
<Label ID="UnitInfo" Anchor="L,T" Offset="67,30" Style="GrayShadow" /> | |
<Label ID="UnitRange" Anchor="L,T" Offset="67,48" Style="GrayShadow" /> | |
</Container> | |
</Grid> | |
<Grid Style="GridColumnHeader" Size="parent-7,45" Offset="0,100"> | |
<Box Anchor="C,T" Size="436,40" Color="0,0,0,0"> | |
<PullDown Anchor="C,C" Offset="0,2" Style="GenericPullDown" ScrollThreshold="250" Size="260,27" AutoSizePopUp="1" SpaceForScroll="0" ID="SortByPullDown" /> | |
</Box> | |
</Grid> | |
<Grid Style="SideRight" Color="255,255,255,150" Size="18,parent-90" Anchor="R,T" Offset="5,145"/> | |
<ScrollPanel Anchor="L,T" Size="parent-17,parent-218" Offset="-10,145" Vertical="1" ID="ItemScrollPanel" AutoScrollBar="1"> | |
<!-- Scroll Controls --> | |
<ScrollBar Style="VertSlider" Length="parent" Offset="4,0" Anchor="R,T" AnchorSide="O,I"/> | |
<Stack Anchor="L,T" Offset="18,0" StackGrowth="Bottom" Padding="0" ID="ItemStack"> | |
<GridButton Anchor="L,T" Size="370,27" Offset="0,0" Style="CivilopediaListHeader" ID="YourCitiesHeader"> | |
<Label Anchor="C,C" Offset="0,0" Style="FontNormal20" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_LEAGUE_OVERVIEW_ACTIVE_RESOLUTIONS" ID="YourCitiesHeaderLabel"/> | |
</GridButton> | |
<Stack ID="YourCitiesStack" Anchor="L,T" Offset="0,0" StackGrowth="Bottom" Padding="0" Color="0.0.0.0"/> | |
<GridButton Anchor="L,T" Size="370,27" Offset="0,0" Style="CivilopediaListHeader" ID="YourOutpostsHeader"> | |
<Label Anchor="C,C" Offset="0,0" Style="FontNormal20" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_LEAGUE_OVERVIEW_ACTIVE_RESOLUTIONS" ID="YourOutpostsHeaderLabel"/> | |
</GridButton> | |
<Stack ID="YourOutpostsStack" Anchor="L,T" Offset="0,0" StackGrowth="Bottom" Padding="0" Color="0.0.0.0"/> | |
<GridButton Anchor="L,T" Size="370,27" Offset="0,0" Style="CivilopediaListHeader" ID="OtherCivsHeader"> | |
<Label Anchor="C,C" Offset="0,0" Style="FontNormal20" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_LEAGUE_OVERVIEW_ACTIVE_RESOLUTIONS" ID="OtherCivsHeaderLabel"/> | |
</GridButton> | |
<Stack ID="OtherCivsStack" Anchor="L,T" Offset="0,0" StackGrowth="Bottom" Padding="0" Color="0.0.0.0"/> | |
<GridButton Anchor="L,T" Size="370,27" Offset="0,0" Style="CivilopediaListHeader" ID="StationsHeader"> | |
<Label Anchor="C,C" Offset="0,0" Style="FontNormal20" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_LEAGUE_OVERVIEW_ACTIVE_RESOLUTIONS" ID="StationsHeaderLabel"/> | |
</GridButton> | |
<Stack ID="StationsStack" Anchor="L,T" Offset="0,0" StackGrowth="Bottom" Padding="0" Color="0.0.0.0"/> | |
</Stack> | |
</ScrollPanel> | |
<Grid Style="ProductionListHeaderGrid" Size="parent-14,55" Anchor="C,B" Offset="0,13"> | |
<GridButton Anchor="C,C" Style="BaseButton" Size="Parent-90,35" Offset="0,-4" ID="TradeOverviewButton"> | |
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_CHOOSE_TRADE_ROUTE_TRADE_OVERVIEW" Style="FontNormal20" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/> | |
</GridButton> | |
</Grid> | |
</Grid> | |
<!-- Confirmation Popup --> | |
<Box Color="Black.200" Size="Full.Full" ID="ChooseConfirm" Hidden="1" ConsumeMouse="1"> | |
<Grid Size="350,200" Anchor="C,C" Offset="0,0" Padding="0,20" Style="Grid9DetailFive140" Hidden="0"> | |
<Label Anchor="C,T" ID="ConfirmText" Offset="0,30" WrapWidth="320" Style="FontNormal22" ColorSet="Beige_Black_Alpha" FontStyle="Shadow" String="TXT_KEY_CONFIRM_CHOOSE_TRADE_ROUTE"/> | |
<Stack Anchor="C,B" Offset="0,30" Padding="15" StackGrowth="Bottom" ID="ButtonStack"> | |
<!-- Yes Button --> | |
<GridButton Style="BaseButton" ID="ConfirmYes" Size="200,42" Anchor="C,B" Offset="0,0" Hidden="0"> | |
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_YES_BUTTON" ColorSet="Beige_Black" Style="FontNormal24" FontStyle="Shadow"/> | |
</GridButton> | |
<!-- No Button --> | |
<GridButton Style="BaseButton" ID="ConfirmNo" Size="200,42" Anchor="C,B" Offset="0,0" Hidden="0"> | |
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_NO_BUTTON" ColorSet="Beige_Black" Style="FontNormal24" FontStyle="Shadow"/> | |
</GridButton> | |
</Stack> | |
</Grid> | |
</Box> | |
</Context> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment