public void find() { if(!bar){ var ggg=GameObject.Find(uiProgressBar); if(ggg)bar=ggg.GetComponent<UIProgressBar>(); } }
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"); }
// 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(); } }
// 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> (); }
void Awake() { if(m_CreditsView != null) { m_CreditsViewScroll = m_CreditsView.verticalScrollBar; m_CreditsViewScroll.value = 0.0f; UICamera.selectedObject = m_CreditsViewScroll.gameObject; } }
// Use this for initialization void Start () { NormalAttackManager = this; slider = GetComponent<UISlider> (); slider.fillDirection = UIProgressBar.FillDirection.BottomToTop; CooltimeMax = 1.0f; Cooltime = CooltimeMax; }
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(); }
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; }
// 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); } }
// Use this for initialization void Start () { hpbar = RoleBarUIManager._instance.createHp(); GameObject hpBarpt = new GameObject(fightrole.name + "hpBar"); hpBarpt.transform.parent = fightrole.roleModel.transform; hpBarpt.transform.localPosition = new Vector3(0, fightrole.roleHeight, 0); hpbarpos = hpBarpt.transform; hpbar.transform.localScale = Vector3.one * 1.5f; }
static int get_cachedTransform(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIProgressBar obj = (UIProgressBar)o; UnityEngine.Transform ret = obj.cachedTransform; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index cachedTransform on a nil value")); } }
static int get_onChange(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIProgressBar obj = (UIProgressBar)o; System.Collections.Generic.List <EventDelegate> ret = obj.onChange; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onChange on a nil value")); } }
static int get_numberOfSteps(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIProgressBar obj = (UIProgressBar)o; int ret = obj.numberOfSteps; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index numberOfSteps on a nil value")); } }
static int get_onDragFinished(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIProgressBar obj = (UIProgressBar)o; UIProgressBar.OnDragFinished ret = obj.onDragFinished; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index onDragFinished on a nil value")); } }
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(); }
/// <summary> /// Helper function used in UpdateScrollbars(float) function above. /// </summary> protected void UpdateScrollbars(UIProgressBar slider, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted) { if (slider == null) { return; } mIgnoreCallbacks = true; { float contentPadding; if (viewSize < contentSize) { contentMin = Mathf.Clamp01(contentMin / contentSize); contentMax = Mathf.Clamp01(contentMax / contentSize); contentPadding = contentMin + contentMax; slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) : ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f); } else { contentMin = Mathf.Clamp01(-contentMin / contentSize); contentMax = Mathf.Clamp01(-contentMax / contentSize); contentPadding = contentMin + contentMax; slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) : ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f); if (contentSize > 0) { contentMin = Mathf.Clamp01(contentMin / contentSize); contentMax = Mathf.Clamp01(contentMax / contentSize); contentPadding = contentMin + contentMax; } } UIScrollBar sb = slider as UIScrollBar; if (sb != null) { sb.barSize = 1f - contentPadding; } } mIgnoreCallbacks = false; }
protected override void OnInit(object userdata) { base.OnInit(userdata); Head = transform.Find("headFrame/texHead").GetComponent <UITexture>(); sliderHp = transform.Find("headFrame/sliderHp").GetComponent <UIProgressBar>(); sliderMp = transform.Find("headFrame/sliderMp").GetComponent <UIProgressBar>(); labName = transform.Find("headFrame/labName").GetComponent <UILabel>(); labHp = transform.Find("headFrame/sliderHp/labHp").GetComponent <UILabel>(); labMp = transform.Find("headFrame/sliderMp/labMp").GetComponent <UILabel>(); labGold = transform.Find("gold/num").GetComponent <UILabel>(); labFood = transform.Find("food/num").GetComponent <UILabel>(); spExp = transform.Find("headFrame/spExp").GetComponent <UISprite>(); lblLevel = transform.Find("headFrame/spExp/lblLevel").GetComponent <UILabel>(); lblMapName = transform.Find("mapName").GetComponent <UILabel>(); lblMapLayerName = transform.Find("mapLayerName").GetComponent <UILabel>(); Messenger.AddListener(MessageId.MAP_UPDATE_PLAYER_INFO, UpdatePlayerInfoPanel); Messenger.AddListener(MessageId.MAP_GET_MAP_LAYER_DATA, UpdateMapInfo); }
public override void Awake() { base.Awake(); var t = mDMono.transform; _uiProgressBar = t.GetComponent <UIProgressBar>(); _labName = t.GetComponent <UILabel>("Lab_Name"); _labProgress = t.GetComponent <UILabel>("Lab_Progress"); _labUnlock = t.GetComponent <UILabel>("Lab_Unlock"); _progrerssBarForeground = t.GetComponent <UISprite>("Foreground"); _labIncrement = t.GetComponent <UILabel>("Lab_Increment"); _goUp = t.FindEx("Lab_Increment/Up").gameObject; _goDown = t.FindEx("Lab_Increment/Down").gameObject; fxprg = t.FindEx("prgfx").gameObject; fxprg.GetComponent <Transform>().localScale = new Vector3(2.2f, 1, 1); Reset(); }
public void OnUIProgressBarValueChange(UIProgressBar component) { try { LuaFunction func = LuaRoot.Instance.Lua.GetFunction("OnUIEvent"); func.BeginPCall(); func.Push("OnUIProgressBarValueChange"); func.Push(ScriptName); func.Push(component); func.PCall(); func.EndPCall(); } catch (System.Exception e) { LogSystem.Instance.Error("UIScript Call OnUIProgressBarValueChange Error:" + ScriptName + component.name + e.ToString()); } }
public void Awake() { instance = this; WarningScreen = transform.Find("WarningScreen").gameObject; QualityControlLabel = WarningScreen.GetComponent <UILabel>("QualityControlLabel"); SplashScreen = transform.Find("SplashScreen").gameObject; SplashLabel = SplashScreen.transform.Find("SplashLabel").GetComponent <UILabel>(); VersionLabel = SplashScreen.transform.Find("DistributeAnchor/Layout/FullVersion").GetComponent <UILabel>(); SplashProgressBar = SplashScreen.transform.Find("ProgressBar").GetComponent <UIProgressBar>(); DownloadDialogue = transform.Find("DialogueScreen").GetComponent <LTDownloadDialogueController>(); SplashProgressBar.value = 0; _uiTexture = SplashScreen.GetComponent <UITexture>("Panel/Texture"); _fxComponent = SplashScreen.FindEx("Panel/Texture/FX"); _uiAtlas = WarningScreen.GetComponent <UISprite>().atlas; }
private IEnumerator ChangeValueProcessBar(float value, float max, UIProgressBar bar) { float curBarValue = bar.value; float destValue = value / max; float lerpValue = 0; float timer = Time.time; while (lerpValue != destValue) { lerpValue = Mathf.Lerp(curBarValue, destValue, (Time.time - timer) * 3); bar.value = lerpValue; yield return(new WaitForSeconds(Time.deltaTime)); } if (lerpValue <= 0.05f) { bar.value = 0.05f; } }
public LoginProgressDialog(UIScreen Screen, Vector2 Pos) : base(Screen, Pos, false, true, false) { m_Font = m_Screen.Font11px; //cityselprotocolstrings.cst m_Cst = StringManager.StrTable(210); Vector2 RelativePosition = new Vector2(60, 0); m_LblTitle = new UILabel(m_Cst[1], 1, Pos + RelativePosition, m_Font.MeasureString(m_Cst[1]), m_Screen.StandardTxtColor, 11, m_Screen, UIParser.Nodes.TextAlignment.Center_Center); RelativePosition = new Vector2(20, 85); m_ProgressBar = new UIProgressBar(m_Screen, Pos + RelativePosition, 250); SetSize((int)((m_Font.MeasureString(m_Cst[1]).X + 40) * Resolution.getVirtualAspectRatio()), (int)(175 * Resolution.getVirtualAspectRatio())); }
public override void Awake() { base.Awake(); var t = controller.transform; ButtonGrid = t.GetComponent <UIGrid>("Content/ScrollView/Placeholder/ButtonList"); TitleTemplate = t.GetMonoILRComponent <LTActivityTitleItem>("Content/ScrollView/Placeholder/ButtonList/template"); InsPartnerTransform = t.FindEx("Content/ViewList"); Template3 = t.GetMonoILRComponent <LTActivityBodyItem_Gift>("Content/ViewList/template3"); Template4 = t.GetMonoILRComponent <LTActivityBodyItem>("Content/ViewList/template4"); Template5 = t.GetMonoILRComponent <LTActivityBodyItem_ScoreRepeat>("Content/ViewList/template5"); Template6 = t.GetMonoILRComponent <LTActivityBodyItem_ScoreOnce>("Content/ViewList/template6"); Template7 = t.GetMonoILRComponent <LTActivityBodyItem_SevenDay>("Content/ViewList/template7"); Template8 = t.GetMonoILRComponent <LTActivityBodyItem_Draw>("Content/ViewList/template8"); Template9 = t.GetMonoILRComponent <LTActivityBodyItem_Turntable>("Content/ViewList/template9"); Template10 = t.GetMonoILRComponent <LTActivityBodyItem_LuckyCat>("Content/ViewList/template10"); Template11 = t.GetMonoILRComponent <LTActivityBodyItem_URPartner>("Content/ViewList/template11"); Template12 = t.GetMonoILRComponent <LTActivityBodyItem_EquipmentWish>("Content/ViewList/template12"); Template13 = t.GetMonoILRComponent <LTActivityBodyItem_BossChallenge>("Content/ViewList/template13"); Template14 = t.GetMonoILRComponent <LTActivityBodyItem_SSRWish>("Content/ViewList/template14"); Template15 = t.GetMonoILRComponent <LTActivityBodyItem_Monopoly>("Content/ViewList/template15"); Template16 = t.GetMonoILRComponent <LTActivityBodyItem_Racing>("Content/ViewList/template16"); controller.backButton = t.GetComponent <UIButton>("UINormalFrameBG/CancelBtn"); progresBar = t.GetComponent <UIProgressBar>("Content/ScrollView/UIScrollBar"); ArrowObj = t.FindEx("Content/Arrow").gameObject; progresBar.onChange.Add(new EventDelegate(OnChange)); TitleTemplate.mDMono.gameObject.CustomSetActive(false); Template3.mDMono.gameObject.CustomSetActive(false); Template4.mDMono.gameObject.CustomSetActive(false); Template5.mDMono.gameObject.CustomSetActive(false); Template6.mDMono.gameObject.CustomSetActive(false); Template7.mDMono.gameObject.CustomSetActive(false); Template8.mDMono.gameObject.CustomSetActive(false); Template9.mDMono.gameObject.CustomSetActive(false); Template10.mDMono.gameObject.CustomSetActive(false); Template11.mDMono.gameObject.CustomSetActive(false); Template12.mDMono.gameObject.CustomSetActive(false); Template13.mDMono.gameObject.CustomSetActive(false); Template14.mDMono.gameObject.CustomSetActive(false); Template15.mDMono.gameObject.CustomSetActive(false); Template16.mDMono.gameObject.CustomSetActive(false); }
/// <summary> /// Register the event listeners. /// </summary> public void Start() { if (mStarted) { return; } mStarted = true; Upgrade(); if (Application.isPlaying) { if (mBG != null) { mBG.autoResizeBoxCollider = true; } OnStart(); #if UNITY_ANDROID //[PK DEBUG 2/1/2018] //if (PlayerPrefs.GetInt(OptionPopup.LiveStreaming_) == 1) //{ // //do nothing //} //else //{ // if (current == null && onChange != null) // { // current = this; // EventDelegate.Execute(onChange); // current = null; // } //} #elif UNITY_STANDALONE if (current == null && onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } #else #endif } ForceUpdate(); }
void TweenSpriteAlpha(GameObject father) { GameObject goBack = null; UIProgressBar progressBar = null; if (null != father) { progressBar = father.GetComponent <UIProgressBar>(); Transform trans = father.transform.Find("white"); if (trans != null) { goBack = trans.gameObject; } } if (goBack == null) { return; } UISprite spBack = null; if (null != goBack) { spBack = goBack.GetComponent <UISprite>(); } if (null != spBack && null != progressBar) { if (spBack.fillAmount <= progressBar.value) { spBack.fillAmount = progressBar.value; SetCastFlag(true); } else { TweenAlpha tween = goBack.GetComponent <TweenAlpha>(); if (null == tween) { return; } tween.enabled = true; tween.ResetToBeginning(); tween.PlayForward(); } } }
protected void DistanceCheck(AgentPrivate agent, UIProgressBar bar, int index = -1) { ObjectPrivate op; Vector startingPosition; try { op = ScenePrivate.FindObject(agent.AgentInfo.ObjectId); if (op == null || !op.IsValid) { return; } startingPosition = op.Position; } catch (Exception) { return; } while (true) { try { if (!agent.IsValid || !op.IsValid || !bar.IsValid) { return; } if ((op.Position - startingPosition).LengthSquared() > CancelDistanceSquared) { bar.Cancel(); } Wait(0.2f); } catch (Exception) { return; } } }
public virtual void Init(BattleUnit bu) { m_BattleUnit = bu; RegEvent(); string res; if (bu.IsPlayerSide) { res = ConfigMng.Instance.GetConfig <ClientHeroCfg> ().HeroClientData [bu.OrgData.unit_id].res_path; } else { res = ConfigMng.Instance.GetConfig <ClientHeroCfg> ().MonsterClientData [bu.OrgData.unit_id].res_path; } m_ModelObj = CommonUtil.ResourceMng.Instance.GetResource(res, CommonUtil.ResourceType.Model) as GameObject; if (m_ModelObj == null) { CommonLogger.LogError("Model Can't loaded: " + res); return; } m_AniCtrl = m_ModelObj.GetComponent <Animator> (); StandPos p = GameHelper.Game.FindEmptyPos(bu.IsPlayerSide ? StandType.Player : StandType.Enemy); if (p != null) { m_ModelObj.transform.position = p.transform.position; m_ModelObj.transform.localRotation = p.transform.localRotation; GameHelper.Game.OccupyStandPos(p, bu.OrgData.unit_id); m_StandPos = p; m_StandPos.SetTapHero(this); } InitTaps(); m_BloodBar = (UIManager.Instance.AddUI("UI/BloodBar") as GameObject).GetComponent <BloodBar>(); m_StateProgress = (UIManager.Instance.AddUI("UI/StateProgressBar") as GameObject).GetComponent <UIProgressBar>(); m_EmpowerProgress = (UIManager.Instance.AddUI("UI/EmpowerProgressBar") as GameObject).GetComponent <UIProgressBar>(); CheckStateProgressBarShow(); UpdateBloodBarPos(); }
private static int get_foregroundWidget(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; UIWidget foregroundWidget = uIProgressBar.foregroundWidget; ToLua.Push(L, foregroundWidget); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index foregroundWidget on a nil value"); } return(result); }
private static int set_onChange(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; List <EventDelegate> onChange = (List <EventDelegate>)ToLua.CheckObject(L, 2, typeof(List <EventDelegate>)); uIProgressBar.onChange = onChange; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onChange on a nil value"); } return(result); }
private static int get_fillDirection(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; UIProgressBar.FillDirection fillDirection = uIProgressBar.fillDirection; ToLua.Push(L, fillDirection); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index fillDirection on a nil value"); } return(result); }
private static int get_onDragFinished(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; UIProgressBar.OnDragFinished onDragFinished = uIProgressBar.onDragFinished; ToLua.Push(L, onDragFinished); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onDragFinished on a nil value"); } return(result); }
private static int set_alpha(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; float alpha = (float)LuaDLL.luaL_checknumber(L, 2); uIProgressBar.alpha = alpha; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index alpha on a nil value"); } return(result); }
private static int set_fillDirection(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; UIProgressBar.FillDirection fillDirection = (UIProgressBar.FillDirection)((int)ToLua.CheckObject(L, 2, typeof(UIProgressBar.FillDirection))); uIProgressBar.fillDirection = fillDirection; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index fillDirection on a nil value"); } return(result); }
private static int set_backgroundWidget(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; UIWidget backgroundWidget = (UIWidget)ToLua.CheckUnityObject(L, 2, typeof(UIWidget)); uIProgressBar.backgroundWidget = backgroundWidget; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index backgroundWidget on a nil value"); } return(result); }
private static int set_thumb(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; Transform thumb = (Transform)ToLua.CheckUnityObject(L, 2, typeof(Transform)); uIProgressBar.thumb = thumb; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index thumb on a nil value"); } return(result); }
private static int set_numberOfSteps(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; int numberOfSteps = (int)LuaDLL.luaL_checknumber(L, 2); uIProgressBar.numberOfSteps = numberOfSteps; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index numberOfSteps on a nil value"); } return(result); }
///////////////////////////////////////// protected override void OnRenderProgressBar(UIProgressBar control, CanvasRenderer renderer) { var rect = control.GetScreenRectangle(); renderer.AddQuad(rect, new ColorValue(0.05, 0.05, 0.3)); if (control.Maximum.Value != 0) { double progress = control.Value.Value / control.Maximum.Value; if (progress > 0) { var rect2 = rect; rect2.Expand(-control.GetScreenOffsetByValue(new UIMeasureValueVector2(UIMeasure.Units, 4, 4))); rect2.Right = MathEx.Lerp(rect2.Left, rect2.Right, progress); renderer.AddQuad(rect2, new ColorValue(1, 1, 1)); } } }
private void Init() { this._publicTransportVehicleWorldInfoPanel = GameObject.Find("(Library) PublicTransportVehicleWorldInfoPanel").GetComponent <PublicTransportVehicleWorldInfoPanel>(); if (!((UnityEngine.Object) this._publicTransportVehicleWorldInfoPanel != (UnityEngine.Object)null)) { return; } this._status = this._publicTransportVehicleWorldInfoPanel.Find <UILabel>("Status"); this._target = this._publicTransportVehicleWorldInfoPanel.Find <UIButton>("Target"); this._target.eventClick += new MouseEventHandler(this.OnTargetClick); this._distance = this._publicTransportVehicleWorldInfoPanel.Find <UILabel>("Distance"); this._distanceTraveled = Utils.GetPrivate <UIProgressBar>((object)this._publicTransportVehicleWorldInfoPanel, "m_DistanceTraveled"); this._distanceProgress = Utils.GetPrivate <UILabel>((object)this._publicTransportVehicleWorldInfoPanel, "m_DistanceProgress"); this._cachedCurrentProgress = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedCurrentProgress", BindingFlags.Instance | BindingFlags.NonPublic); this._cachedTotalProgress = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedTotalProgress", BindingFlags.Instance | BindingFlags.NonPublic); this._cachedProgressVehicle = this._publicTransportVehicleWorldInfoPanel.GetType().GetField("m_cachedProgressVehicle", BindingFlags.Instance | BindingFlags.NonPublic); this.AddPanelControls(); this._initialized = true; }
private static int get_alpha(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); UIProgressBar uIProgressBar = (UIProgressBar)obj; float alpha = uIProgressBar.alpha; LuaDLL.lua_pushnumber(L, (double)alpha); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index alpha on a nil value"); } return(result); }
protected void Start() { this.Upgrade(); if (Application.isPlaying) { if (this.mBG != null) { this.mBG.autoResizeBoxCollider = true; } this.OnStart(); if (UIProgressBar.current == null && this.onChange != null) { UIProgressBar.current = this; EventDelegate.Execute(this.onChange); UIProgressBar.current = null; } } this.ForceUpdate(); }
protected void Start() { Upgrade(); if (Application.isPlaying) { if (mBG != null) { mBG.autoResizeBoxCollider = true; } OnStart(); if (current == null && onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } } ForceUpdate(); }
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; } }
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"); }
/// <summary> /// Register the event listeners. /// </summary> protected void Start () { Upgrade(); #if UNITY_EDITOR if (!Application.isPlaying) return; #endif if (mFG != null) { mSprite = mFG as UISprite; mFG.pivot = UIWidget.Pivot.Center; mStartingSize = new Vector2(mFG.width, mFG.height); mStartingPos = mFG.cachedTransform.localPosition; } else { Debug.LogWarning("Progress bar needs a foreground widget to work with", this); enabled = false; return; } GameObject bg = (mBG != null && mBG.collider != null) ? mBG.gameObject : gameObject; UIEventListener bgl = UIEventListener.Get(bg); bgl.onPress += OnPressBackground; bgl.onDrag += OnDragBackground; if (mBG != null) mBG.autoResizeBoxCollider = true; OnStart(); if (onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } ForceUpdate(); }
/// <summary> /// Register the event listeners. /// </summary> protected void Start () { Upgrade(); if (Application.isPlaying) { if (mFG == null) { Debug.LogWarning("Progress bar needs a foreground widget to work with", this); enabled = false; return; } if (mBG != null) mBG.autoResizeBoxCollider = true; OnStart(); if (onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } } ForceUpdate(); }
void Start () { mBar = GetComponent<UIProgressBar>(); mSprite = GetComponent<UIBasicSprite>(); Update(); }
void Awake() { cannon = GameObject.FindGameObjectWithTag (Tags.cannon).GetComponent<Cannon> (); bar = GetComponent<UIProgressBar> (); sprite = GetComponent<UISprite> (); }
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); } } }
public static void LerpBarColor(float _Value, UIProgressBar _Bar) { _Bar.backgroundWidget.color = LerpColor(_Value) * 0.8f; _Bar.foregroundWidget.color = LerpColor(_Value); }
private void SetBar(UIProgressBar bar) { bar.backgroundSprite = "LevelBarBackground"; bar.progressSprite = "LevelBarForeground"; bar.progressColor = Color.green; bar.size = new Vector2(barWidth - 120, 16); bar.minValue = 0f; bar.maxValue = 1f; }
/// <summary> /// Helper function used in UpdateScrollbars(float) function above. /// </summary> protected void UpdateScrollbars (UIProgressBar slider, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted) { if (slider == null) return; mIgnoreCallbacks = true; { float contentPadding; if (viewSize < contentSize) { contentMin = Mathf.Clamp01(contentMin / contentSize); contentMax = Mathf.Clamp01(contentMax / contentSize); contentPadding = contentMin + contentMax; slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) : ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f); } else { contentMin = Mathf.Clamp01(-contentMin / contentSize); contentMax = Mathf.Clamp01(-contentMax / contentSize); contentPadding = contentMin + contentMax; slider.value = inverted ? ((contentPadding > 0.001f) ? 1f - contentMin / contentPadding : 0f) : ((contentPadding > 0.001f) ? contentMin / contentPadding : 1f); if (contentSize > 0) { contentMin = Mathf.Clamp01(contentMin / contentSize); contentMax = Mathf.Clamp01(contentMax / contentSize); contentPadding = contentMin + contentMax; } } UIScrollBar sb = slider as UIScrollBar; if (sb != null) sb.barSize = 1f - contentPadding; } mIgnoreCallbacks = false; }
protected void Start() { this.Upgrade(); if (Application.isPlaying) { if (this.mBG != null) { this.mBG.autoResizeBoxCollider = true; } this.OnStart(); if (UIProgressBar.current == null && this.onChange != null) { UIProgressBar.current = this; EventDelegate.Execute(this.onChange); UIProgressBar.current = null; } } this.ForceUpdate(); }
void Start () { progressBar = GetComponent<UIProgressBar>(); progressBar.Value = 0f; }
void Start () { mBar = GetComponent<UIProgressBar>(); Update(); }
/// <summary> /// Cache the components and register a listener callback. /// </summary> void Awake () { mList = GetComponent<UIPopupList>(); mCheck = GetComponent<UIToggle>(); mSlider = GetComponent<UIProgressBar>(); }
protected void Start() { this.Upgrade(); if (this.mFG != null) { this.mSprite = this.mFG as UISprite; this.mFG.pivot = UIWidget.Pivot.Center; this.mStartingSize = new Vector2((float) this.mFG.width, (float) this.mFG.height); this.mStartingPos = this.mFG.cachedTransform.localPosition; } else { Debug.LogWarning("Progress bar needs a foreground widget to work with", this); base.enabled = false; return; } GameObject go = ((this.mBG == null) || (this.mBG.collider == null)) ? base.gameObject : this.mBG.gameObject; UIEventListener listener = UIEventListener.Get(go); listener.onPress = (UIEventListener.BoolDelegate) Delegate.Combine(listener.onPress, new UIEventListener.BoolDelegate(this.OnPressBackground)); listener.onDrag = (UIEventListener.VectorDelegate) Delegate.Combine(listener.onDrag, new UIEventListener.VectorDelegate(this.OnDragBackground)); if (this.mBG != null) { this.mBG.autoResizeBoxCollider = true; } this.OnStart(); if (this.onChange != null) { current = this; EventDelegate.Execute(this.onChange); current = null; } this.ForceUpdate(); }
// Use this for initialization void Awake() { progressBar = GetComponent<UIProgressBar>(); coolLabel = transform.FindChild("CoolDownLabel").GetComponent<UILabel>(); }
/// <summary> /// Register the event listeners. /// </summary> protected void Start () { Upgrade(); if (Application.isPlaying) { if (mBG != null) mBG.autoResizeBoxCollider = true; OnStart(); if (current == null && onChange != null) { current = this; EventDelegate.Execute(onChange); current = null; } } ForceUpdate(); }
private void SetProgress(UIProgressBar serviceBar, float val, float start, float target, int raw = -1, int max = -1) { var extraTip = ""; if (target == int.MaxValue) { extraTip = "Max!"; } else if (raw != -1) { extraTip = raw.ToString("F0") + "/" + max.ToString("F0"); } else if (start == 0) { extraTip = val.ToString("F0") + "/" + target.ToString("F0"); } else { extraTip = start.ToString("F0") + "/" + val.ToString("F0") + "/" + target.ToString("F0"); } var lastIndex = serviceBar.tooltip.LastIndexOf(' '); if (lastIndex > 0) { serviceBar.tooltip = serviceBar.tooltip.Substring(0, lastIndex) + " " + extraTip; } else { serviceBar.tooltip = extraTip; } if (target == int.MaxValue) { target = start; start -= 20; } serviceBar.value = Mathf.Clamp((val - start) / (float)(target - start), 0f, 1f); }
private void SetPos(UILabel title, UIProgressBar bar, float x, float y, bool visible) { bar.relativePosition = new Vector3(x + 120, y - 3); title.relativePosition = new Vector3(x, y); if (visible) { bar.Show(); title.Show(); } else { bar.Hide(); title.Hide(); } }