本文整理汇总了C#中UIProgressBar类的典型用法代码示例。如果您正苦于以下问题:C# UIProgressBar类的具体用法?C# UIProgressBar怎么用?C# UIProgressBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIProgressBar类属于命名空间,在下文中一共展示了UIProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public static void Init(GameAreaInfoPanel g)
{
m_AreaIndex = g.GetType().GetField("m_AreaIndex", BindingFlags.NonPublic | BindingFlags.Instance);
m_FullscreenContainer = UIView.Find("FullScreenContainer");
m_Title = g.Find<UILabel>("Title");
m_BuildableArea = g.Find<UILabel>("BuildableArea");
m_Price = g.Find<UILabel>("Price");
m_PurchasePanel = g.Find<UIPanel>("PurchasePanel");
m_OilResources = g.Find<UIProgressBar>("ResourceBarOil");
m_OreResources = g.Find<UIProgressBar>("ResourceBarOre");
m_ForestryResources = g.Find<UIProgressBar>("ResourceBarForestry");
m_FertilityResources = g.Find<UIProgressBar>("ResourceBarFarming");
m_OilNoResources = g.Find("ResourceOil").Find<UISprite>("NoNoNo");
m_OreNoResources = g.Find("ResourceOre").Find<UISprite>("NoNoNo");
m_ForestryNoResources = g.Find("ResourceForestry").Find<UISprite>("NoNoNo");
m_FertilityNoResources = g.Find("ResourceFarming").Find<UISprite>("NoNoNo");
m_Water = g.Find<UISprite>("Water");
m_NoWater =m_Water.Find<UISprite>("NoNoNo");
m_Highway = g.Find<UISprite>("Highway");
m_NoHighway =m_Highway.Find<UISprite>("NoNoNo");
m_InHighway =m_Highway.Find<UISprite>("Incoming");
m_OutHighway =m_Highway.Find<UISprite>("Outgoing");
m_Train = g.Find<UISprite>("Train");
m_NoTrain =m_Train.Find<UISprite>("NoNoNo");
m_InTrain =m_Train.Find<UISprite>("Incoming");
m_OutTrain =m_Train.Find<UISprite>("Outgoing");
m_Ship = g.Find<UISprite>("Ship");
m_NoShip =m_Ship.Find<UISprite>("NoNoNo");
m_InShip =m_Ship.Find<UISprite>("Incoming");
m_OutShip =m_Ship.Find<UISprite>("Outgoing");
m_Plane = g.Find<UISprite>("Plane");
m_NoPlane =m_Plane.Find<UISprite>("NoNoNo");
m_InPlane =m_Plane.Find<UISprite>("Incoming");
m_OutPlane = m_Plane.Find<UISprite>("Outgoing");
}
示例2: Update
// Update is called once per frame
void Update () {
#if UNITY_EDITOR
if (host == null)
{
host = GetComponent<UIWidget>();
}
if (processBar == null)
{
processBar = NGUITools.FindInParents<UIProgressBar>(gameObject);
}
#endif
if(host == null)
return;
if (uiCamera == null) uiCamera = NGUITools.FindCameraForLayer(gameObject.layer);
Rect mRect = uiCamera.pixelRect;
Vector3 v = new Vector3(mRect.xMax, 0f, 0f);
v = uiCamera.ScreenToWorldPoint(v);
Vector3 lp = this.transform.InverseTransformPoint(v);
int newWidth = (int)lp.x;
if (newWidth != oldWidth)
{
oldWidth = newWidth;
host.width = (int)lp.x;
if (processBar != null)
processBar.ForceUpdate();
}
}
示例3: Start
// Use this for initialization
void Start ()
{
mCurrentExpLabel = GameObject.Find ("CurrentEXP").GetComponent<UILabel> ();
mNextExpLabel = GameObject.Find ("NextEXP").GetComponent<UILabel> ();
mNameLabel = gameObject.transform.FindChild ("Name").GetComponent<UILabel> ();
mExpProgressBar = gameObject.transform.FindChild ("ProgressBar").GetComponent<UIProgressBar> ();
}
示例4: find
public void find()
{
if(!bar){
var ggg=GameObject.Find(uiProgressBar);
if(ggg)bar=ggg.GetComponent<UIProgressBar>();
}
}
示例5: Start
// Use this for initialization
void Start () {
NormalAttackManager = this;
slider = GetComponent<UISlider> ();
slider.fillDirection = UIProgressBar.FillDirection.BottomToTop;
CooltimeMax = 1.0f;
Cooltime = CooltimeMax;
}
示例6: Awake
public override void Awake()
{
resourceBars = new Dictionary<ImmaterialResourceManager.Resource, UIProgressBar>();
resourceLabels = new Dictionary<ImmaterialResourceManager.Resource, UILabel>();
for (var i = 0; i < 20; i += 1)
{
var res = (ImmaterialResourceManager.Resource)i;
var bar = AddUIComponent<UIProgressBar>();
bar.backgroundSprite = "LevelBarBackground";
bar.progressSprite = "LevelBarForeground";
bar.progressColor = Color.green;
resourceBars.Add(res, bar);
var label = AddUIComponent<UILabel>();
label.text = GetName(res);
label.textScale = 0.5f;
label.size = new Vector2(100, 20);
resourceLabels.Add(res, label);
}
pollutionBar = AddUIComponent<UIProgressBar>();
pollutionBar.backgroundSprite = "LevelBarBackground";
pollutionBar.progressSprite = "LevelBarForeground";
pollutionBar.progressColor = Color.red;
pollutionLabel = AddUIComponent<UILabel>();
pollutionLabel.text = "Pollution";
pollutionLabel.textScale = 0.5f;
pollutionLabel.size = new Vector2(100, 20);
serviceLabel = AddUIComponent<UILabel>();
serviceBar = AddUIComponent<UIProgressBar>();
educationLabel = AddUIComponent<UILabel>();
educationBar = AddUIComponent<UIProgressBar>();
happyLabel = AddUIComponent<UILabel>();
happyBar = AddUIComponent<UIProgressBar>();
wealthLabel = AddUIComponent<UILabel>();
wealthBar = AddUIComponent<UIProgressBar>();
waitLabel = AddUIComponent<UILabel>();
commuteWaitTimeBar = AddUIComponent<UIProgressBar>();
incomeLabel = AddUIComponent<UILabel>();
buildingNames.Clear();
LoadTextFiles();
descriptionLabel = AddUIComponent<UILabel>();
descriptionButton = AddUIComponent<UIButton>();
base.Awake();
}
示例7: create
public static UIProgressBar create( UIToolkit manager, string barFilename, int xPos, int yPos, bool rightToLeft, int depth )
{
var textureInfo = manager.textureInfoForFilename( barFilename );
var frame = new Rect( xPos, yPos, textureInfo.frame.width, textureInfo.frame.height );
if( rightToLeft )
frame.x = xPos + (int)textureInfo.frame.width;
var progressBar = new UIProgressBar( manager, frame, depth, textureInfo.uvRect, rightToLeft );
return progressBar;
}
示例8: initButton
// Use this for initialization
protected override void initButton()
{
progressBar = UIProgressBar.create(toolkitManager, buttonNormalState, 0, 0, rightToLeft, 30);
progressBar.resizeTextureOnChange = true;
mainControl = progressBar;
label = GetComponent<UITKText>() as UITKText;
if (backImageName != null && ! backImageName.Equals(""))
{
progressBack = toolkitManager.addSprite(backImageName, 0, 0, 40);
}
}
示例9: Start
void Start()
{
monsterScrollList = GameObject.Find("MonsterScrollList").GetComponent<UIScrollList>();
statsPanel = GameObject.Find("MonsterInfoPanel").GetComponent<UIPanel>();
magnitudeBar = statsPanel.transform.FindChild("damage").FindChild("damageBar").GetComponent<UIProgressBar>();
attackSpeedBar = statsPanel.transform.FindChild("attackSpeed").FindChild("attackSpeedBar").GetComponent<UIProgressBar>();
attackRangeBar = statsPanel.transform.FindChild("range").FindChild("rangeBar").GetComponent<UIProgressBar>();
movementSpeedBar = statsPanel.transform.FindChild("moveSpeed").FindChild("moveSpeedBar").GetComponent<UIProgressBar>();
healthBar = statsPanel.transform.FindChild("health").FindChild("healthBar").GetComponent<UIProgressBar>();
spawnRate = statsPanel.transform.FindChild("spawnRate").GetComponent<SpriteText>();
monsterName = statsPanel.transform.FindChild("name").GetComponent<SpriteText>();
monsterSprite = statsPanel.transform.FindChild("sprite").GetComponent<tk2dSprite>();
goldCost = statsPanel.transform.FindChild("goldCost").GetComponent<SpriteText>();
confirmButton = statsPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
confirmButtonImage = confirmButton.GetComponent<tk2dSprite>();
monsterSaleConfirmationPanel = GameObject.Find("SellConfirmationPanel").GetComponent<UIPanel>();
monsterSaleConfirmButton = monsterSaleConfirmationPanel.transform.FindChild("okayButton").GetComponent<UIButton>();
monsterSaleCancelButton = monsterSaleConfirmationPanel.transform.FindChild("cancelButton").GetComponent<UIButton>();
monsterSaleConfirmButton.scriptWithMethodToInvoke = this;
monsterSaleCancelButton.scriptWithMethodToInvoke = this;
monsterSaleConfirmButton.methodToInvoke = "MonsterSaleConfirmed";
monsterSaleCancelButton.methodToInvoke = "MonsterSaleCancelled";
scrollListCamera = monsterScrollList.renderCamera;
levelManager = GameObject.Find("LevelManager").GetComponent<LevelManager>();
listPanel = GameObject.Find("MonsterSelectionPanel").GetComponent<UIPanel>();
Transform attackEffectParent = GameObject.Find("attackEffectIcons").transform.FindChild("icons");
actionEffectIcons = attackEffectParent.GetComponentsInChildren<tk2dSprite>();
if (playerStatusManager == null)
playerStatusManager = GameObject.Find("PlayerStatusManager").GetComponent<PlayerStatusManager>();
entityFactory = EntityFactory.GetInstance();
monsterSelectedCallback = null;
LoadMonsterScrollPanel();
}
示例10: animateProgressBar
private IEnumerator animateProgressBar( UIProgressBar progressBar )
{
float value = 0.0f;
while( true )
{
// Make sure the progress doesnt exceed 1
if( value > 1.0f )
{
// Swap the progressBars resizeTextureOnChange property
progressBar.resizeTextureOnChange = !progressBar.resizeTextureOnChange;
value = 0.0f;
}
else
{
value += 0.01f;
}
progressBar.value = value;
yield return 0;
}
}
示例11: Start
private void Start ()
{
progressBar = GetComponent<UIProgressBar>();
progressBar.ChangeValue += ChangeValue;
GameObject obj = GameObject.Find("Controller(Clone)");
if (obj != null)
{
controller = obj.GetComponent<Controller>();
if (id == 0)
progressBar.value = controller.EffectsVolume;
if (id == 1)
progressBar.value = controller.MusicVolume;
if (id == 2)
{
progressBar.value = controller.ScreenBright;
if (dirLight != null)
dirLight.intensity = progressBar.value * 2;
//light.intensity = 2.5f + progressBar.value * 5.5f;
//brightEffect.Bright = progressBar.value;
}
}
else Debug.LogWarning("Controller не создан, необходимо запустить сценгу MtnuMain");
}
示例12: Start
void Start ()
{
mBar = GetComponent<UIProgressBar>();
mSprite = GetComponent<UIBasicSprite>();
Update();
}
示例13: Awake
void Awake()
{
cannon = GameObject.FindGameObjectWithTag (Tags.cannon).GetComponent<Cannon> ();
bar = GetComponent<UIProgressBar> ();
sprite = GetComponent<UISprite> ();
}
示例14: OnEnable
void OnEnable()
{
if (_usage==null || _usage.Length==0)
{
_usage = new int[Enum.GetNames(typeof(NGuiPlayMakerDelegates)).Length];
}
if (targetFSM == null)
{
targetFSM = GetComponent<PlayMakerFSM>();
}
if (targetFSM == null)
{
enabled = false;
Debug.LogWarning("No Fsm Target assigned");
}
// check if we are using on Submit
if (DoesTargetImplementsEvent(targetFSM,NGuiPlayMakerDelegates.OnSubmitEvent))
{
_input = this.GetComponent<UIInput>();
if (_input!=null)
{
EventDelegate _del = new EventDelegate();
_del.target = this;
_del.methodName = "OnSubmitChange";
_input.onSubmit.Add(_del);
}
}
// check if we are using on Slider change
if (DoesTargetImplementsEvent(targetFSM,NGuiPlayMakerDelegates.OnSliderChangeEvent))
{
_pBar = this.GetComponent<UIProgressBar>();
if (_pBar!=null)
{
EventDelegate _del = new EventDelegate();
_del.target = this;
_del.methodName = "OnSliderChange";
_pBar.onChange.Add(_del);
}
}
// check if we are using on Input or toggle change
if (DoesTargetImplementsEvent(targetFSM,NGuiPlayMakerDelegates.OnChangeEvent))
{
_input = this.GetComponent<UIInput>();
if (_input!=null)
{
EventDelegate _del = new EventDelegate();
_del.target = this;
_del.methodName = "OnChange";
_input.onChange.Add(_del);
}
_toggle = this.GetComponent<UIToggle>();
if (_toggle!=null)
{
EventDelegate _del = new EventDelegate();
_del.target = this;
_del.methodName = "OnChange";
_toggle.onChange.Add(_del);
}
}
}
示例15: LerpBarColor
public static void LerpBarColor(float _Value, UIProgressBar _Bar)
{
_Bar.backgroundWidget.color = LerpColor(_Value) * 0.8f;
_Bar.foregroundWidget.color = LerpColor(_Value);
}