choose build palette on select production building
This commit is contained in:
@@ -1191,5 +1191,13 @@ namespace OpenRa
|
||||
renderer.DrawText(sp.Info.LongDesc.Replace("\\n", "\n"), pos, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrentTab(string produces)
|
||||
{
|
||||
if (!paletteOpen)
|
||||
paletteAnimating = true;
|
||||
paletteOpen = true;
|
||||
currentTab = produces;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
<Compile Include="Support\OpenAlInterop.cs" />
|
||||
<Compile Include="Support\PerfHistory.cs" />
|
||||
<Compile Include="Sync.cs" />
|
||||
<Compile Include="Traits\ChoosePaletteOnSelect.cs" />
|
||||
<Compile Include="Traits\CrateSpawner.cs" />
|
||||
<Compile Include="Traits\OreGrowth.cs" />
|
||||
<Compile Include="Traits\OreRefinery.cs" />
|
||||
|
||||
27
OpenRa.Game/Traits/ChoosePaletteOnSelect.cs
Normal file
27
OpenRa.Game/Traits/ChoosePaletteOnSelect.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class ChoosePaletteOnSelectInfo : StatelessTraitInfo<ChoosePaletteOnSelect> { }
|
||||
|
||||
class ChoosePaletteOnSelect : INotifySelection
|
||||
{
|
||||
public void SelectionChanged()
|
||||
{
|
||||
var firstItem = Game.controller.selection.Actors.FirstOrDefault(
|
||||
a => a.World.LocalPlayer == a.Owner && a.traits.Contains<Production>());
|
||||
|
||||
if (firstItem == null)
|
||||
return;
|
||||
|
||||
var produces = firstItem.Info.Traits.Get<ProductionInfo>().Produces.FirstOrDefault();
|
||||
if (produces == null)
|
||||
return;
|
||||
|
||||
Game.chrome.SetCurrentTab(produces);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ World:
|
||||
LightPaletteRotator:
|
||||
BuildingInfluence:
|
||||
UnitInfluence:
|
||||
ChoosePaletteOnSelect:
|
||||
PaletteFromFile@terrain_temperat:
|
||||
Name: terrain
|
||||
Filename: temperat.pal
|
||||
|
||||
Reference in New Issue
Block a user