本文整理汇总了C#中Spinner.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Spinner.Select方法的具体用法?C# Spinner.Select怎么用?C# Spinner.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spinner
的用法示例。
在下文中一共展示了Spinner.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupCC
private void SetupCC(Viewport vp)
{
Camera c = manager.UI.Camera;
Rectangle ccArea = new Rectangle(0, 0, (int)(vp.Width * 0.5f), vp.Height / 3);
ControlMat ccSpace = new ControlMat(ccArea, 7, 1, 2, ControlMat.FillOrder.RowsFirst);
cc.Add(new Label("Camera Options", ccSpace.Spaces[0], Label.Fit.AlignCenter));
Spinner<Camera.Mode> mode = new Spinner<Camera.Mode>("Mode", ccSpace.Spaces[1]);
foreach (Camera.Mode cMode in Enum.GetValues(typeof(Camera.Mode)))
mode.Add(cMode);
mode.Use += delegate() { manager.UI.Camera.SetMode(mode.GetSelected()); };
c.Changed += delegate(object src, EventArgs e) { mode.Select(c.CurrentMode); };
cc.Add(mode);
Slider transSpeed = new Slider("TSpeed", ccSpace.Spaces[2], 0.1f, 5.0f);
transSpeed.SetValue(manager.UI.Camera.TranslateSpeed);
transSpeed.Use += delegate(float v) { manager.UI.Camera.TranslateSpeed = v; };
c.Changed += delegate(object src, EventArgs e) { transSpeed.SetValue(c.TranslateSpeed); };
cc.Add(transSpeed);
Slider rotSpeed = new Slider("RSpeed", ccSpace.Spaces[3], 0.02f, 0.1f);
rotSpeed.SetValue(manager.UI.Camera.RotateSpeed);
rotSpeed.Use += delegate(float v) { manager.UI.Camera.RotateSpeed = v; };
c.Changed += delegate(object src, EventArgs e) { rotSpeed.SetValue(c.RotateSpeed); };
cc.Add(rotSpeed);
Label posInfo = new Label("Position: " + manager.UI.Camera.Position, ccSpace.Spaces[4], Label.Fit.AlignCenter);
cc.Add(posInfo);
Label rotInfo = new Label("Rotation: " + manager.UI.Camera.Rotation, ccSpace.Spaces[5], Label.Fit.AlignLeft);
cc.Add(rotInfo);
c.Changed += delegate(object src, EventArgs e)
{
posInfo.SetText("Position: " + c.Position, Label.Fit.AlignLeft);
rotInfo.SetText("Rotation: " + c.Rotation, Label.Fit.AlignLeft);
};
cc.Disable(manager.UI);
}
示例2: SetupTerrainComponents
private void SetupTerrainComponents(Viewport vp, Rectangle settingsPanelArea)
{
int sliderHeight = (int)(0.05f * vp.Height);
ControlMat mat = new ControlMat(settingsPanelArea, 7, 1, 10);
Slider scaleX = new Slider("Length Scale", mat.Spaces[0], 0.1f, 10.0f);
scaleX.SetValue(bs.ScaleX);
scaleX.Use += delegate(float v) { bs.ScaleX = v; };
controls.Add(scaleX);
Slider scaleY = new Slider("Height Scale", mat.Spaces[1], 0.1f, 10.0f);
scaleY.SetValue(bs.ScaleY);
scaleY.Use += delegate(float v) { bs.ScaleY = v; };
controls.Add(scaleY);
Slider scaleZ = new Slider("Width Scale", mat.Spaces[2], 0.1f, 10.0f);
scaleZ.SetValue(bs.ScaleZ);
scaleZ.Use += delegate(float v) { bs.ScaleZ = v; };
controls.Add(scaleZ);
Slider vegetationDensity = new Slider("Vegetation", mat.Spaces[3], 0.0f, 1.0f);
vegetationDensity.SetValue(bs.VegDensity);
vegetationDensity.Use += delegate(float v) { bs.VegDensity = v; };
controls.Add(vegetationDensity);
Slider treeDensity = new Slider("Trees", mat.Spaces[4], 0.0f, 1.0f);
treeDensity.SetValue(bs.TreeDensity);
treeDensity.Use += delegate(float v) { bs.TreeDensity = v; };
controls.Add(treeDensity);
Slider smoothing = new Slider("Smoothing", mat.Spaces[5], 0, 50);
smoothing.SetValue(bs.Smoothing);
smoothing.Use += delegate(float v) { bs.Smoothing = (int)v; };
controls.Add(smoothing);
Spinner<Climate> cSpin = new Spinner<Climate>("Climate", mat.Spaces[6]);
cSpin.Use += delegate() { bs.Climate = cSpin.GetSelected().ToString(); };
foreach (Climate climate in Enum.GetValues(typeof(Climate)))
cSpin.Add(climate);
cSpin.Select((Climate)Enum.Parse(typeof(Climate), bs.Climate));
controls.Add(cSpin);
int y = (int)(vp.Height * 0.05f);
controls.Add(new Label("Setup", new Rectangle(0, y / 2, vp.Width, y * 2), Label.Fit.AlignCenter));
}