本文整理汇总了C#中Slider类的典型用法代码示例。如果您正苦于以下问题:C# Slider类的具体用法?C# Slider怎么用?C# Slider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Slider类属于命名空间,在下文中一共展示了Slider类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: addSlider
public void addSlider(Slider resourceSlider)
{
slider = resourceSlider;
if(slider != null)
slider.value = _value / _max;
}
开发者ID:Desocrit,项目名称:BoDCode,代码行数:7,代码来源:Resource.cs
示例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++;
}
开发者ID:danielkropf,项目名称:The-RPG,代码行数:29,代码来源:Battle.cs
示例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);
}
}
}
开发者ID:danielkropf,项目名称:The-RPG,代码行数:25,代码来源:Battle.cs
示例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");
}
开发者ID:fdu5526,项目名称:CTIN492_FoundText,代码行数:27,代码来源:CirclesManager.cs
示例5: Awake
protected override void Awake()
{
base.Awake();
slider = GetComponent<Slider>();
slider.value = 1f;
}
开发者ID:sigmadruid,项目名称:NewMaze,代码行数:7,代码来源:BarItem.cs
示例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);
}
开发者ID:jsikorski,项目名称:Remote-Controlled-Robot,代码行数:27,代码来源:Program.cs
示例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);
}
开发者ID:jerrytron,项目名称:pfp-zig-zegg,代码行数:26,代码来源:ControllerState.cs
示例8: Start
// Use this for initialization
void Start()
{
if (shakeSlider == null)
{
shakeSlider = gameObject.GetComponent<Slider>();
}
}
开发者ID:ironpencil,项目名称:critomit,代码行数:8,代码来源:ScreenShakeAdjuster.cs
示例9: Start
// Use this for initialization
void Start()
{
sound = GetComponent<AudioSource>();
mAnimator = GetComponent<Animator>();
// スライダーを取得する
slider = GameObject.Find("Slider").GetComponent<Slider>();
}
开发者ID:306-san,项目名称:brave_cat,代码行数:8,代码来源:Player_ito2.cs
示例10: Start
void Start()
{
base.Init ();
healthSlider = HealthBar.GetComponent<Slider> ();
healthSlider.maxValue = maxHealth;
healthSlider.value = maxHealth;
}
开发者ID:Multihuntr,项目名称:random-game,代码行数:7,代码来源:PlayerHealth.cs
示例11: Start
protected override void Start()
{
base.Start();
textElement = GetComponentInChildren<Text>();
layoutElement = GetComponent<LayoutElement>();
slider = GameObject.Find("ButtonTextSlider").GetComponent<Slider>();
}
开发者ID:Archimagus,项目名称:ggj2016,代码行数:7,代码来源:ChoiceButton.cs
示例12: Awake
void Awake()
{
ground = GameObject.Find("Ground");
chargeBar = GameObject.Find("Chargebar").GetComponent<Slider>();
energyBar = GameObject.Find("EnergyBar").GetComponent<Slider>();
}
开发者ID:hossamshuk,项目名称:SandWitch-Hunt,代码行数:7,代码来源:NetworkSphereAttack.cs
示例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;
}
}
开发者ID:jacthoma,项目名称:Project-Elephant,代码行数:27,代码来源:ZSUConfigurationSelector.cs
示例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;
}
开发者ID:hunvil,项目名称:ConvergeGame_Client,代码行数:25,代码来源:ClashHealthBar.cs
示例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;
}
开发者ID:huytd,项目名称:fosproject,代码行数:27,代码来源:ExampleCustomInputDevice.cs
示例16: initUI
private void initUI()
{
//UI Initializations - Grab Canvas with find object, then grab children for efficiency
gameUI = FindObjectOfType<Canvas>();
//get all child sliders
Component[] canvasSliders = gameUI.GetComponentsInChildren<Slider> ();
//get all text sliders
Component[] canvasTexts = gameUI.GetComponentsInChildren<Text> ();
//loop through and find specific slider
foreach (Slider child in canvasSliders) {
if (child.tag.Equals("Enemy HP")) {
enemyHealth = child;
}
}
//loop through and find specific text
foreach (Text child in canvasTexts) {
if (child.tag.Equals("Enemy Ratio")) {
enemyRatio = child;
}
}
//create listener to run delegate function for updating text ratio of enemy
enemyHealth.onValueChanged.AddListener (updateEnemyRatio);
}
开发者ID:Edj3,项目名称:Unity_3PShooter,代码行数:27,代码来源:FireGun.cs
示例17: Start
// Use this for initialization
void Start()
{
slider = GetComponent<Slider> ();
slider.onValueChanged.AddListener ((value) => {
musicManager.SetMusicVolume (value);
});
}
开发者ID:guozanhua,项目名称:fantastic_m2,代码行数:8,代码来源:MusicVolumeChange.cs
示例18: Game_OnStart
private static void Game_OnStart(EventArgs args)
{
if (Player.Instance.Hero != Champion.Shaco && Player.Instance.Hero != Champion.Leblanc)
return;
CloneMenu = MainMenu.AddMenu("Clone control", "yodagodEOQ");
Chat.Print(Player.Instance.ChampionName + " clone controller loaded", Color.White);
Control = CloneMenu.Add("Clone", new CheckBox("Control clone"));
CloneMenu.AddGroupLabel("You can select a target with left click");
Mode = CloneMenu.Add("Mode", new Slider("", 2, 0, 2));
Mode.DisplayName = "If health > 40%:" + Modes[Mode.CurrentValue];
Mode.OnValueChange += delegate
(ValueBase<int> sender, ValueBase<int>.ValueChangeArgs Args)
{
sender.DisplayName = "If health > 40%:" + Modes[Args.NewValue];
};
Mode2 = CloneMenu.Add("Mode2", new Slider("", 0, 0, 2));
Mode2.DisplayName = "If health < 40%:" + Modes[Mode2.CurrentValue];
Mode2.OnValueChange += delegate
(ValueBase<int> sender, ValueBase<int>.ValueChangeArgs Args)
{
sender.DisplayName = "If health < 40%:" + Modes[Args.NewValue];
};
Range = CloneMenu.Add("Range", new Slider("Get targets within {0} range", 2000, 1, 10000));
Game.OnUpdate += ControlClone;
GameObject.OnCreate += CreateClone;
GameObject.OnDelete += DeleteClone;
}
开发者ID:alvothefirst,项目名称:EloBuddy,代码行数:33,代码来源:Program.cs
示例19: Recall
private int recallsWithGold; //TODO repair shop and remove this tempfix
public Recall(LogicSelector currentLogic, Menu parMenu)
{
Menu menu = parMenu.AddSubMenu("Recall settings", "ergtrh");
flatGold=new Slider("Minimum base gold to recall", 560, 0, 4000);
goldPerLevel = new Slider("Minmum gold per level to recall", 70, 0, 300);
menu.Add("mingold", flatGold);
menu.Add("goldper", goldPerLevel);
menu.AddSeparator(100);
menu.AddLabel(
@"
Example: Your champ has lvl 10
Base gold = 560
Gold per level = 70
Minimum gold = 560+70*10 = 1260
AutoBuddy won't recall if you have less gold than needed for next item.
");
current = currentLogic;
foreach (
Obj_SpawnPoint so in
ObjectManager.Get<Obj_SpawnPoint>().Where(so => so.Team == ObjectManager.Player.Team))
{
spawn = so;
}
Core.DelayAction(ShouldRecall, 3000);
if (MainMenu.GetMenu("AB").Get<CheckBox>("debuginfo").CurrentValue)
Drawing.OnDraw += Drawing_OnDraw;
}
开发者ID:EnfermeraSexy,项目名称:EloBuddy,代码行数:31,代码来源:Recall.cs
示例20: EffectSlide
public void EffectSlide(Slider slider)
{
if (OptionManager.getInstance () != null && SoundManager.getInstance () != null) {
OptionManager.getInstance ().setEffectLevel (slider.value);
SoundManager.getInstance ().SetEffectLevel (slider.value);
}
}
开发者ID:Dinendal1er,项目名称:Climb-That-Tower,代码行数:7,代码来源:OptionUIManager.cs
注:本文中的Slider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论