本文整理汇总了C#中UISlider类的典型用法代码示例。如果您正苦于以下问题:C# UISlider类的具体用法?C# UISlider怎么用?C# UISlider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UISlider类属于命名空间,在下文中一共展示了UISlider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomSliderControl
UIControl CustomSliderControl()
{
var cslider = new UISlider (new RectangleF (174f, 12f, 120f, 7f)){
BackgroundColor = UIColor.Clear,
MinValue = 0f,
MaxValue = 100f,
Continuous = true,
Value = 50f,
Tag = kViewTag
};
var left = UIImage.FromFile ("images/orangeslide.png");
left = left.StretchableImage (10, 0);
var right = UIImage.FromFile ("images/yellowslide.png");
right = right.StretchableImage (10, 0);
cslider.SetThumbImage (UIImage.FromFile ("images/slider_ball.png"), UIControlState.Normal);
cslider.SetMinTrackImage (left, UIControlState.Normal);
cslider.SetMaxTrackImage (right, UIControlState.Normal);
cslider.ValueChanged += delegate {
Console.WriteLine ("New value {0}", cslider.Value);
};
return cslider;
}
示例2: Awake
void Awake()
{
uiSlider = GetComponentInChildren<UISlider>();
uiSlider.value = 0;
Bonus = new STowerBonus ();
}
示例3: ValidatePivot
void ValidatePivot (Transform fg, string name, UISlider.Direction dir)
{
if (fg != null)
{
UISprite sprite = fg.GetComponent<UISprite>();
if (sprite != null && sprite.type != UISprite.Type.Filled)
{
if (dir == UISlider.Direction.Horizontal)
{
if (sprite.pivot != UIWidget.Pivot.Left &&
sprite.pivot != UIWidget.Pivot.TopLeft &&
sprite.pivot != UIWidget.Pivot.BottomLeft)
{
GUI.color = new Color(1f, 0.7f, 0f);
GUILayout.Label(name + " should use a Left pivot");
GUI.color = Color.white;
}
}
else if (sprite.pivot != UIWidget.Pivot.BottomLeft &&
sprite.pivot != UIWidget.Pivot.Bottom &&
sprite.pivot != UIWidget.Pivot.BottomRight)
{
GUI.color = new Color(1f, 0.7f, 0f);
GUILayout.Label(name + " should use a Bottom pivot");
GUI.color = Color.white;
}
}
}
}
示例4: Start
protected override void Start()
{
base.Start();
HPMax = level * addHP + baseHP;
ATK = level * addATK + baseATK;
DEF = level * addDEF + baseDEF;
HP = HPMax;
if (HP == 0)
{
HP = level * 100;
}
positionStart = new Vector3(transform.position.x, transform.position.y, transform.position.z);
if (nowState != ActionState.locked)
{
nowState = ActionState.notFoundPlayer;
}
timer = 0f;
moveForward = new Vector2(transform.forward.x, transform.forward.z);
//HPbar
hpBarManagerUI = UIHpBarManager._instance;
hpBar = hpBarManagerUI.CreateHpBar(transform.Find("HpBarPoint").gameObject);
hpSlider = hpBar.transform.GetComponentInChildren<UISlider>();
charaController = this.GetComponent<CharacterController>();
}
示例5: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
normalButton = GetButton (new CGRect (10, 120, 295, 48),
FoodyTheme.SharedTheme.ButtonImage,
"Standard Button");
View.AddSubview (normalButton);
pressedButton = GetButton (new CGRect (10, 190, 295, 48),
FoodyTheme.SharedTheme.PressedButtonImage,
"Button Pressed");
View.AddSubview (pressedButton);
label = new UILabel (new CGRect (15, 40, 400, 30));
FoodyTheme.Apply (label);
label.Text = "Label";
View.AddSubview (label);
var paddingView = new UIView (new CGRect (0, 0, 5, 20));
TextField.LeftView = paddingView;
TextField.LeftViewMode = UITextFieldViewMode.Always;
TextField.ShouldReturn = TextFieldShouldReturn;
TextField.Background = FoodyTheme.SharedTheme.TextFieldBackground;
progress = new UIProgressView (new CGRect (13, 300, 292, 10));
progress.Progress = 0.5f;
View.AddSubview (progress);
slider = new UISlider (new CGRect (10, 330, 298, 10));
slider.Value = 0.5f;
slider.ValueChanged += HandleValueChanged;
View.AddSubview (slider);
FoodyTheme.Apply (View);
}
示例6: OnCreate
public override void OnCreate()
{
base.OnCreate();
for (int i = 0; i < 3; ++i )
{
m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1)); //查找sprite
}
m_progressSprite = GetChildComponent<UISprite>("Progress"); //查找sprite
stageBoard = GetChildComponent<UISprite>("StageBoard");
m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");
m_timeBar = GetChildComponent<UISprite>("TimeBar");
m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");
m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");
}
示例7: CustomRecCell
public CustomRecCell(NSString cellId)
: base(UITableViewCellStyle.Default, cellId)
{
SelectionStyle = UITableViewCellSelectionStyle.Gray;
fileNameLabel = new UILabel () {
Font = UIFont.FromName("AmericanTypewriter", 15f),
BackgroundColor = UIColor.Clear
};
playerPlayButton = new UIButton ();
playerPlayButton.SetTitle("Play", UIControlState.Normal);
playerPlayButton.SetTitle("Playing", UIControlState.Selected);
playerPlayButton.Font = UIFont.FromName ("AmericanTypewriter", 15f);
playerPlayButton.TouchUpInside += playerPlayButtonTouchUpInside_Event;
playerStopButton = new UIButton ();
playerStopButton.SetTitle("Stop", UIControlState.Normal);
playerStopButton.Font = UIFont.FromName ("AmericanTypewriter", 15f);
playerStopButton.TouchUpInside += playerStopButtonTouchUpInside_Event;
progressBar = new UISlider ();
progressBar.Enabled = false;
progressBar.SetThumbImage (UIImage.FromBundle("Images/slider_thumb"), UIControlState.Normal);
ContentView.Add (fileNameLabel);
ContentView.Add (playerPlayButton);
ContentView.Add (playerStopButton);
ContentView.Add (progressBar);
}
示例8: Include
public void Include (UISlider slider)
{
slider.Value = slider.Value + 1;
slider.ValueChanged += (sender, args) => {
slider.Value = 1;
};
}
示例9: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
Title = "Color Controls";
View.BackgroundColor = UIColor.White;
resetButton = UIButton.FromType (UIButtonType.RoundedRect);
resetButton.Frame = new CGRect(110, 60, 90, 40);
resetButton.SetTitle ("Reset", UIControlState.Normal);
resetButton.TouchUpInside += (sender, e) => {
sliderSaturation.Value = 1;
sliderBrightness.Value = 0;
sliderContrast.Value = 1;
HandleValueChanged (sender, e);
};
View.Add (resetButton);
labelC = new UILabel(new CGRect(10, 110, 90, 20));
labelS = new UILabel(new CGRect(10, 160, 90, 20));
labelB = new UILabel(new CGRect(10, 210, 90, 20));
labelC.Text = "Contrast";
labelS.Text = "Saturation";
labelB.Text = "Brightness";
View.Add (labelC);
View.Add (labelS);
View.Add (labelB);
sliderBrightness = new UISlider(new CGRect(100, 110, 210, 20));
sliderSaturation = new UISlider(new CGRect(100, 160, 210, 20));
sliderContrast = new UISlider(new CGRect(100, 210, 210, 20));
// http://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIColorControls
// set min/max values on slider to match CIColorControls filter
sliderSaturation.MinValue = 0;
sliderSaturation.MaxValue = 2;
sliderBrightness.MinValue = -1;
sliderBrightness.MaxValue = 1;
sliderContrast.MinValue = 0;
sliderContrast.MaxValue = 4;
// set default values
sliderSaturation.Value = 1;
sliderBrightness.Value = 0;
sliderContrast.Value = 1;
sliderContrast.TouchUpInside += HandleValueChanged;
sliderSaturation.TouchUpInside += HandleValueChanged;
sliderBrightness.TouchUpInside += HandleValueChanged;
View.Add (sliderContrast);
View.Add (sliderSaturation);
View.Add (sliderBrightness);
imageView = new UIImageView(new CGRect(10, 240, 300, 200));
sourceImage = UIImage.FromFile ("clouds.jpg");
imageView.Image = sourceImage;
View.Add (imageView);
}
示例10: AppearanceViewController
public AppearanceViewController () {
// Set the default appearance values
UIButton.Appearance.TintColor = UIColor.LightGray;
UIButton.Appearance.SetTitleColor(UIColor.FromRGB(0,127,14), UIControlState.Normal);
UISlider.Appearance.ThumbTintColor = UIColor.Red;
UISlider.Appearance.MinimumTrackTintColor = UIColor.Orange;
UISlider.Appearance.MaximumTrackTintColor = UIColor.Yellow;
UIProgressView.Appearance.ProgressTintColor = UIColor.Yellow;
UIProgressView.Appearance.TrackTintColor = UIColor.Orange;
btnBlack = UIButton.FromType(UIButtonType.System);
btnBlue = UIButton.FromType(UIButtonType.System);
slider = new UISlider(new CGRect(10,110,300, 30));
slider2 = new UISlider(new CGRect(10,260,300, 30));
// Wire up the buttons to the SampleCode class methods
btnBlack.TouchUpInside += (sender, e) => {
NavigationController.PushViewController (new BlackViewController(), true);
};
btnBlue.TouchUpInside += (sender, e) => {
NavigationController.PushViewController (new BlueViewController(), true);
};
}
示例11: Start
// Use this for initialization
void Start()
{
factoryWindowMenuObject = GameObject.FindGameObjectWithTag("MenuFactory");
taskWindowObject = factoryWindowMenuObject.transform.FindChild("TaskListWindow").gameObject;
storageWindowData = GetComponent<StorageWindow>();
drillMasterData = GetComponent<DrillMaster>();
scanMasterData = GetComponent<ScanMaster>();
taskWaitListWindowData = GetComponent<TaskWaitListWindow>();
drillDictionary = drillMasterData.drillDictionary;
scanDictionary = scanMasterData.scanDictionary;
progressSlider = factoryWindowMenuObject.transform.FindChild("ProgressBarBuild").gameObject.GetComponent<UISlider>();
GameObject drillDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("DrillData").gameObject;
drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
drillLabelValue = drillDataObject.transform.FindChild("LabelDrillValue").gameObject.GetComponent<UILabel>();
GameObject scanDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("ScanData").gameObject;
scanLabelType = scanDataObject.transform.FindChild("LabelScanType").gameObject.GetComponent<UILabel>();
scanLabelValue = scanDataObject.transform.FindChild("LabelScanValue").gameObject.GetComponent<UILabel>();
GameObject pipesDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("PipesData").gameObject;
//drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
pipesValue = pipesDataObject.transform.FindChild("LabelPipesValue").gameObject.GetComponent<UILabel>();
GameObject kostenDataObject = transform.FindChild("FactoryWindowData").gameObject.transform.FindChild("LabelKosten").gameObject;
//drillLabelType = drillDataObject.transform.FindChild("LabelDrillType").gameObject.GetComponent<UILabel>();
costsValue = kostenDataObject.transform.FindChild("LabelKostenValue").gameObject.GetComponent<UILabel>();
FactoryShow();
FactoryWindowReload();
} // END Start
示例12: Awake
void Awake()
{
globals = Globals.GetInstance();
XPBarSlider = XPBarSliderGO.GetComponent<UISlider>();
maxWidth = XPBarSlider.foreground.localScale.x;
if(XPBarSlider == null)
{
Debug.LogError("Couldn't get the UISlider component in XPBar Script.");
}
XPMaximum = globals.XPMaximum;
if(XPMaximum == 0)
{
globals.XPPoints = 0;
PlayerPrefs.SetInt("XP", 0);
XPMaximum = 100;
globals.XPMaximum = 100;
PlayerPrefs.SetInt("XPMaximum", 100);
Debug.Log("This is the first time XP bar is used.");
}
//XPBar.pixelInset.width = globals.XPPoints / (globals.XPMaximum / 100);
XPPoints = globals.XPPoints;
UpdateDisplay((XPPoints / XPMaximum));
player = GameObject.FindWithTag("Player");
}
示例13: OnCreate
public override void OnCreate()
{
base.OnCreate();
for (int i = 0; i < 3; ++i )
{
m_starsSprites[i] = GetChildComponent<UISprite>("Star" + (i + 1)); //查找sprite
}
m_progressSprite = GetChildComponent<UISprite>("Progress"); //查找sprite
stageBoard = GetChildComponent<UISprite>("StageBoard");
m_speedSlider = GetChildComponent<UISlider>("SpeedSlider");
m_speedLabel = GetChildComponent<UILabel>("SpeedLabel");
m_timeBar = GetChildComponent<UISprite>("TimeBar");
m_scoreDrawer = GetChildComponent<NumberDrawer>("ScoreDrawer");
m_stepDrawer = GetChildComponent<NumberDrawer>("StepDrawer");
m_timeNumber = UIToolkits.FindChild(mUIObject.transform, "TimeNumber").gameObject;
m_minNumber = GetChildComponent<NumberDrawer>("MinNumber");
m_secNumber = GetChildComponent<NumberDrawer>("SecNumber");
m_stepChangeAnim = m_stepDrawer.GetComponent<Animation>();
m_scoreChangeAnim = m_scoreDrawer.GetComponent<Animation>();
m_hurryStepParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryStep").gameObject;
m_hurryStepParticle.SetActive(false);
m_hurryTimeParticle = UIToolkits.FindChild(mUIObject.transform, "Effect_HurryTime").gameObject;
m_hurryTimeParticle.SetActive(false);
}
示例14: ViewDidAppear
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear (animated);
this.View.BackgroundColor = UIColor.LightGray;
txtSpeak = new UITextView (new RectangleF (20, 50, this.View.Bounds.Width - 40, 100));
txtSpeak.Text = "Xamarin rocks!";
this.View.AddSubview (txtSpeak);
segAccent = new UISegmentedControl (new string[] {"US", "UK", "AUS" });
segAccent.Frame = new RectangleF(20,160,this.View.Bounds.Width - 40, 50);
segAccent.SelectedSegment = 0;
this.View.AddSubview (segAccent);
lblRate = new UILabel (new RectangleF (20, 230, 200, 20));
lblRate.Text = "Rate";
this.View.AddSubview (lblRate);
sldRate = new UISlider(new RectangleF(20,250,this.View.Bounds.Width - 40, 50));
sldRate.MinValue = 0;
sldRate.MaxValue = 100;
sldRate.Value = 75;
this.View.AddSubview (sldRate);
lblPitch = new UILabel (new RectangleF (20, 305, 200, 20));
lblPitch.Text = "Pitch";
this.View.AddSubview (lblPitch);
sldPitch = new UISlider(new RectangleF(20,325,this.View.Bounds.Width - 40, 50));
sldPitch.MinValue = 0;
sldPitch.MaxValue = 100;
sldPitch.Value = 75;
this.View.AddSubview (sldPitch);
btnSpeak = new UIButton (UIButtonType.RoundedRect);
btnSpeak.Frame = new RectangleF (100, 375, this.View.Bounds.Width - 200, 30);
btnSpeak.SetTitle ("Speak", UIControlState.Normal);
btnSpeak.TouchDown += (object sender, EventArgs e) => {
var speechSynthesizer = new AVSpeechSynthesizer ();
var speechUtterance =
new AVSpeechUtterance (txtSpeak.Text);
string lang = "en-US";
if (segAccent.SelectedSegment == 1) lang = "en-GB";
if (segAccent.SelectedSegment == 2) lang = "en-AU";
speechUtterance.Voice = AVSpeechSynthesisVoice.FromLanguage (lang);
speechUtterance.Rate = AVSpeechUtterance.MaximumSpeechRate * (sldRate.Value / 100);
speechUtterance.PitchMultiplier = 2.0f * (sldPitch.Value / 100);
speechSynthesizer.SpeakUtterance (speechUtterance);
};
this.View.AddSubview (btnSpeak);
}
示例15: Start
// ###########################
// Use this for initialization
void Start () {
researchMasterData = this.GetComponent<ResearchMaster>();
researchTypeCount = researchMasterData.researchDictionary.Count;
playerAttributeControlData = GameObject.Find("01_Player").GetComponent<PlayerAttributeControl>();
researchWindowMenuObject = GameObject.FindGameObjectWithTag("MenuResearch");
GameObject childHolder = gameObject.transform.FindChild("ResearchWindowData").gameObject;
researchTimeLabel = childHolder.transform.FindChild("ResearchTime").gameObject.GetComponent<UILabel>();
buttonSpeedLabel = childHolder.transform.FindChild("ButtonSpeed").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
buttonAmountLabel = childHolder.transform.FindChild("ButtonAmount").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
buttonDrillLabel = childHolder.transform.FindChild("ButtonDrill").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
buttonBuildCostsLabel = childHolder.transform.FindChild("ButtonBuildCosts").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
buttonDrillPlattformLabel = childHolder.transform.FindChild("ButtonDrillPlattform").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
buttonScan = childHolder.transform.FindChild("ButtonScan").gameObject.transform.FindChild("Label").gameObject.GetComponent<UILabel>();
progressbarSlider = gameObject.transform.FindChild("ResearchWindowData").gameObject.transform.FindChild("ProgressBarResearch").gameObject.transform.FindChild("Control - Colored Progress Bar").gameObject.GetComponent<UISlider>();
ResearchShow();
} // END Start