本文整理汇总了C#中Slider类的典型用法代码示例。如果您正苦于以下问题:C# Slider类的具体用法?C# Slider怎么用?C# Slider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Slider类属于命名空间,在下文中一共展示了Slider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addSlider
public void addSlider(Slider resourceSlider)
{
slider = resourceSlider;
if(slider != null)
slider.value = _value / _max;
}
示例2: EnemyAttack
void EnemyAttack()
{
if (tw.ce.enemySummoned) {
if (whoMoves == 1) {
Debug.Log("enemy atck");
txt = damageTakenPlayer.GetComponent<Text>();
dice = Random.Range(1, 9);
if (dice + tw.ce.enemyLUK > tw.tst.dexTotal) {
dice = Random.Range(1, 5);
dmg = dice + tw.ce.enemySTR - ((tw.tst.conTotal / 4) * 3);
sld = playerLife.GetComponent<Slider>();
sld.value -= dmg;
txt.text = dmg.ToString();
lastDamage = dmg;
dmg = 0;
whoMoves = 0;
} else {
txt.text = "MISS";
whoMoves = 0;
}
secondDamage.SetActive(false);
damageTakenEnemy.SetActive(false);
damageTakenPlayer.SetActive(true);
healTaken.SetActive(false);
}
}
turn++;
}
示例3: EnemyAttack
void EnemyAttack()
{
if (tw.ce.enemySummoned) {
if (whoMoves == 1) {
txt = damageTakenPlayer.GetComponent<Text>();
dice = Random.Range(1, 21);
diceDef = Random.Range(1, 5);
if (dice > (tw.tst.dexTotal + diceDef)) {
dice = Random.Range(1, 5);
dmg = dice + tw.ce.enemySTR - (tw.tst.conTotal / 2);
sld = playerLife.GetComponent<Slider>();
sld.value -= dmg;
txt.text = dmg.ToString();
dmg = 0;
whoMoves = 0;
} else {
txt.text = "MISS";
whoMoves = 0;
}
damageTakenEnemy.SetActive(false);
damageTakenPlayer.SetActive(true);
}
}
}
示例4: Start
// Use this for initialization
void Start () {
circles = GetComponentsInChildren<Circle>();
inputField = GameObject.Find("Canvas/InputField").GetComponent<InputField>();
stressBar = GameObject.Find("Canvas/Stress").GetComponent<Slider>();
audios = GetComponents<AudioSource>();
blackBackground = GameObject.Find("Canvas/BlackBackground");
gameOver = GameObject.Find("Canvas/BlackBackground/GameOver");
pressEnter = GameObject.Find("Canvas/BlackBackground/PressEnter");
gameStart = GameObject.Find("Canvas/BlackBackground/GameStart");
healthIndicator = GameObject.Find("Canvas/HealthIndicator").GetComponent<HealthIndicator>();
gameOver.SetActive(false);
isGameOver = true;
healthIndicator.SetTransparency(0f);
currentDay = 0;
taskIndex = 0;
dayTimer = new Timer(30f);
endOfDayTimer = new Timer(4f);
dayTimer.Reset();
taskTimer = new Timer(StepTimeBasedOnDay);
prevRandTask = 0;
daysData = CSVParser.Parse("Data/days");
}
示例5: Awake
protected override void Awake()
{
base.Awake();
slider = GetComponent<Slider>();
slider.value = 1f;
}
示例6: Main
public static void Main()
{
Window controllerWindow =
GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.ControllerWindow));
GlideTouch.Initialize();
Glide.FitToScreen = true;
Glide.MainWindow = controllerWindow;
DirectionSlider = (Slider) controllerWindow.GetChildByName("DirectionSlider");
DirectionSlider.ValueChangedEvent += UpdateRobotDirection;
SpeedSlider = (Slider) controllerWindow.GetChildByName("SpeedSlider");
SpeedSlider.ValueChangedEvent += UpdateRobotSpeed;
var beepButton = (Button) controllerWindow.GetChildByName("BeepButton");
beepButton.TapEvent += Beep;
var stopButton = (Button) controllerWindow.GetChildByName("StopButton");
stopButton.TapEvent += StopRobot;
NrfController.OnDataReceived += HandleObstacleDetection;
NrfController.Initialize("CONTR", "ROBOT");
Thread.Sleep(Timeout.Infinite);
}
示例7: Initialize
public void Initialize()
{
Debug.Log("Initializing ControllerState");
Screen.orientation = ScreenOrientation.LandscapeLeft;
_backBtn = GameObject.Find(BackButton).GetComponent<Button>();
_backBtn.onClick.AddListener(() => OnBackClick(_backBtn));
_leftSlider = GameObject.Find(LeftSlider).GetComponent<Slider>();
_leftSlider.value = 0;
_leftSlider.onValueChanged.AddListener(OnLeftSliderChange);
_rightSlider = GameObject.Find(RightSlider).GetComponent<Slider>();
_rightSlider.value = 0;
_rightSlider.onValueChanged.AddListener(OnRightSliderChange);
_connected = false;
_connecting = false;
_zegg = _manager.GetSelectedZegg();
if (_zegg == null) {
Application.LoadLevel(Scenes.SCANNER);
return;
}
ConnectToZegg(_zegg.Address);
}
示例8: Start
// Use this for initialization
void Start()
{
if (shakeSlider == null)
{
shakeSlider = gameObject.GetComponent<Slider>();
}
}
示例9: Start
// Use this for initialization
void Start()
{
sound = GetComponent<AudioSource>();
mAnimator = GetComponent<Animator>();
// スライダーを取得する
slider = GameObject.Find("Slider").GetComponent<Slider>();
}
示例10: Start
void Start()
{
base.Init ();
healthSlider = HealthBar.GetComponent<Slider> ();
healthSlider.maxValue = maxHealth;
healthSlider.value = maxHealth;
}
示例11: Start
protected override void Start()
{
base.Start();
textElement = GetComponentInChildren<Text>();
layoutElement = GetComponent<LayoutElement>();
slider = GameObject.Find("ButtonTextSlider").GetComponent<Slider>();
}
示例12: Awake
void Awake()
{
ground = GameObject.Find("Ground");
chargeBar = GameObject.Find("Chargebar").GetComponent<Slider>();
energyBar = GameObject.Find("EnergyBar").GetComponent<Slider>();
}
示例13: Start
void Start()
{
if (_slider == null)
_slider = (SliderProxy.FrameworkControl as Slider) ?? (SliderProxy.FrameworkControl as SliderDialog).Slider;
if (_slider != null)
{
// Add slider with a tick for each configuration.
if (Configurations != null)
{
var ticks = new Slider.Tick[Configurations.Length];
for (int i = 0; i < ticks.Length; ++i)
{
ticks[i] = new Slider.Tick();
ticks[i].Value = (float)i / (float)Configurations.Length;
ticks[i].Label = (i + 1).ToString();
}
_slider.Ticks = ticks;
_slider.SnapsToTicks = true;
_slider.InitialValue = (float)InitialValue / ticks.Length;
}
_slider.Moved += OnSliderMoved;
}
}
示例14: Start
void Start()
{
camera = Camera.main.transform;
unit = GetComponentInParent<ClashBattleUnit>();
slider = GetComponentInChildren<Slider>();
var colors = new ColorBlock();
switch (unit.species.type) {
case ClashSpecies.SpeciesType.CARNIVORE:
colors.normalColor = Color.red;
break;
case ClashSpecies.SpeciesType.HERBIVORE:
colors.normalColor = Color.blue;
break;
case ClashSpecies.SpeciesType.OMNIVORE:
colors.normalColor = Color.yellow;
break;
case ClashSpecies.SpeciesType.PLANT:
colors.normalColor = Color.green;
break;
default: break;
}
colors.colorMultiplier = 1.0f;
slider.colors = colors;
}
示例15: Init
internal bool Init()
{
//buttons
Button[] buttons = new Button[ 2 ];
buttons[ 0 ] = new Button( JoystickButtons.Button1, 0 );
buttons[ 1 ] = new Button( JoystickButtons.Button2, 1 );
//axes
Axis[] axes = new Axis[ 1 ];
axes[ 0 ] = new JoystickInputDevice.Axis( JoystickAxes.X, new Range( -1, 1 ), false );
//povs
POV[] povs = new POV[ 0 ];
//povs[ 0 ] = new JoystickInputDevice.POV( JoystickPOVs.POV1 );
//sliders
Slider[] sliders = new Slider[ 0 ];
//sliders[ 0 ] = new Slider( JoystickSliders.Slider1 );
//forceFeedbackController
ForceFeedbackController forceFeedbackController = null;
//initialize data
InitDeviceData( buttons, axes, povs, sliders, forceFeedbackController );
return true;
}