本文整理汇总了C#中Library.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# Library.Generate方法的具体用法?C# Library.Generate怎么用?C# Library.Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library.Generate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetShipGenerator
public void SetShipGenerator(Library.ShipGenerator gen, int layout = 0)
{
if (lstSystems != null)
{
foreach (var system in lstSystems)
system.Remove();
lstSystems.Clear();
lstSystems = null;
}
// Set current ship
currentShipGen = gen;
currentShip = gen.Generate(layout);
// Update ship renderer
shipRenderer.Ship = currentShip;
// Update layout buttons
btnLayoutA.Enabled = (currentShipGen.NumberOfLayouts >= 1);
btnLayoutA.Toggled = (layout == 0);
btnLayoutA.UpdateImage();
btnLayoutB.Enabled = (currentShipGen.NumberOfLayouts >= 2);
btnLayoutB.Toggled = (layout == 1);
btnLayoutB.UpdateImage();
// Create new UI
tbShipName.Text = currentShip.Name;
lstSystems = new List<ImageButton>();
var systems = currentShip.Systems;
for (int i = 0; i < systems.Count; i++)
{
var system = systems[i];
var btnSystem = new ImageButton();
btnSystem.Image = Root.Singleton.Material("img/customizeUI/box_system_on.png");
btnSystem.HoveredImage = Root.Singleton.Material("img/customizeUI/box_system_select2.png");
btnSystem.DisabledImage = Root.Singleton.Material("img/customizeUI/box_system_off.png");
btnSystem.Enabled = true;
//btnSystem.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
Util.LayoutControl(btnSystem, 370 + (i * 38), 380, 38, 96, rctScreen);
btnSystem.Parent = Root.Singleton.Canvas;
btnSystem.Init();
var systembox = new SystemBox();
systembox.SystemIcon = Root.Singleton.Material(system.IconGraphics["green"]);
systembox.PowerLevel = system.MinPower;
systembox.Width = btnSystem.Width - 2;
systembox.Height = btnSystem.Height - 2;
systembox.Parent = btnSystem;
systembox.Init();
lstSystems.Add(btnSystem);
}
}