/// <summary> /// Finish the typewriter operation and show all the text right away. /// </summary> public void Finish() { if (mActive) { mActive = false; if (!mReset) { if (mFullText != null) { mCurrentOffset = mFullText.Length; } mFade.Clear(); mLabel.text = mFullText; } if (keepFullDimensions && scrollView != null) { scrollView.UpdatePosition(); } current = this; //EventDelegate.Execute(onFinished); current = null; } }
/// <summary> /// Finish the typewriter operation and show all the text right away. /// </summary> public void Finish() { if (mActive) { mActive = false; if (!mReset) { mCurrentOffset = mFullText.Length; mFade.Clear(); mLabel.text = mFullText; } if (keepFullDimensions && scrollView != null) { scrollView.UpdatePosition(); } current = this; if (onFinished != null) { onFinished(gameObject); } current = null; } }
private void updateScrollBar() { scrollView.UpdatePosition(); scrollView.UpdateScrollbars(true); if (scrollView.panel.GetViewSize().y > grid.transform.localScale.y) { scrollBar.value = 0; } else { scrollBar.value = 1; } }
protected virtual void DrawLegacyFields() { UIProgressBar sb = target as UIProgressBar; float val = EditorGUILayout.Slider("Value", sb.value, 0f, 1f); float alpha = EditorGUILayout.Slider("Alpha", sb.alpha, 0f, 1f); if (sb.value != val || sb.alpha != alpha) { NGUIEditorTools.RegisterUndo("Progress Bar Change", sb); sb.value = val; sb.alpha = alpha; UnityEditor.EditorUtility.SetDirty(sb); for (int i = 0; i < UIScrollView.list.size; ++i) { UIScrollView sv = UIScrollView.list[i]; if (sv.horizontalScrollBar == sb || sv.verticalScrollBar == sb) { NGUIEditorTools.RegisterUndo("Progress Bar Change", sv); sv.UpdatePosition(); } } } }
//BAR處理 void BARSelect() { //Bar初始化 if (DelayTimerBool) { if (DelayTimer < 0.5f) { DelayTimer += Time.deltaTime; BusinessListScrollBar.value = 0; PlayerDataTable.repositionNow = true; BarScrollView.UpdatePosition(); BarScrollView.UpdateScrollbars(); } else { DelayTimer = 0; DelayTimerBool = false; } } if (BarBoolStart) { BusinessListScrollBar.value = 0; BarBoolStart = false; } }
protected override void DrawLegacyFields() { UIScrollBar sb = target as UIScrollBar; float val = EditorGUILayout.Slider("Value", sb.value, 0f, 1f); float size = EditorGUILayout.Slider("Size", sb.barSize, 0f, 1f); float alpha = EditorGUILayout.Slider("Alpha", sb.alpha, 0f, 1f); if (sb.value != val || sb.barSize != size || sb.alpha != alpha) { NGUIEditorTools.RegisterUndo("Scroll Bar Change", sb); sb.value = val; sb.barSize = size; sb.alpha = alpha; NGUITools.SetDirty(sb); for (int i = 0; i < UIScrollView.list.size; ++i) { UIScrollView sv = UIScrollView.list[i]; if (sv.horizontalScrollBar == sb || sv.verticalScrollBar == sb) { NGUIEditorTools.RegisterUndo("Scroll Bar Change", sv); sv.UpdatePosition(); } } } }
/// <summary> /// 必须手动Reposition /// </summary> /// <param name="startRow"></param> public virtual void Reposition(int startRow = 1) { //fix 预加载没有执行Awake?此_Transform是null _Transform = transform; int row = startRow; int col = 1; for (int i = 0; i < _Transform.childCount; i++) { var trans = _Transform.GetChild(i); trans.localPosition = new Vector3((col - 1) * CellWidth, -(row - 1) * CellHeight); col++; if (col > ColumnCount) { row++; col = 1; } } if (_scrollView != null) { _scrollView.UpdatePosition(); _scrollView.ResetPosition(); } }
static int UpdatePosition(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); UIScrollView obj = (UIScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIScrollView"); obj.UpdatePosition(); return(0); }
public void scrollBarChange() { //scrollView.UpdateScrollbars(); scrollView.UpdatePosition(); if (scrollBar.value != 0) { if (scrollBar.barSize > 0.98) { scrollBar.value = 0; } } }
static public int UpdatePosition(IntPtr l) { try { UIScrollView self = (UIScrollView)checkSelf(l); self.UpdatePosition(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
void Update() { if (mReset) { mOffset = 0; mReset = false; mLabel = GetComponent <UILabel>(); mText = mLabel.processedText; } if (mOffset < mText.Length && mNextChar <= RealTime.time) { charsPerSecond = Mathf.Max(1, charsPerSecond); // Periods and end-of-line characters should pause for a longer time. float delay = 1f / charsPerSecond; char c = mText[mOffset]; if (c == '.') { if (mOffset + 2 < mText.Length && mText[mOffset + 1] == '.' && mText[mOffset + 2] == '.') { delay += delayOnPeriod * 3f; mOffset += 2; } else { delay += delayOnPeriod; } } else if (c == '!' || c == '?') { delay += delayOnPeriod; } else if (c == '\n') { delay += delayOnNewLine; } // Automatically skip all symbols NGUIText.ParseSymbol(mText, ref mOffset); mNextChar = RealTime.time + delay; mLabel.text = mText.Substring(0, ++mOffset); // If a scroll view was specified, update its position if (scrollView != null) { scrollView.UpdatePosition(); } } }
public static void UpdateScrollBar(UIScrollView scroll) { var backgroundWidget = scroll.verticalScrollBar.backgroundWidget; var foregroundWidget = scroll.verticalScrollBar.foregroundWidget; if (backgroundWidget) { foregroundWidget.height = backgroundWidget.height; } scroll.UpdateScrollbars(true); scroll.UpdatePosition(); }
static int UpdatePosition(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UIScrollView obj = (UIScrollView)ToLua.CheckObject <UIScrollView>(L, 1); obj.UpdatePosition(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SimulateBattle() { isSimulatingBattle = true; battleLogs.text = ""; battleLogs.text += "Army 1 is: " + army1Type.ToString() + " and Army 2 is: " + army2Type.ToString() + "\n\n"; int counter = 0; while (army1Units > 0 && army2Units > 0) { if (army1Type == ARMY_TYPE.DEFENSIVE && army2Type == ARMY_TYPE.DEFENSIVE) { battleLogs.text += "both armies are on defensive, battle cannot happen under these circumstances"; isSimulatingBattle = false; return; } else { //Army 1 is attacking totalArmy1HP -= totalArmy2ATK; totalArmy2HP -= totalArmy1ATK; army1Units = (int)Math.Ceiling((double)(totalArmy1HP / army1HPPerUnit)); army2Units = (int)Math.Ceiling((double)(totalArmy2HP / army2HPPerUnit)); counter++; battleLogs.text += "Army 1 has " + army1Units.ToString() + " remaining units. \n\n"; battleLogs.text += "Army 2 has " + army2Units.ToString() + " remaining units. \n\n"; } } if (army1Units <= 0 && army2Units <= 0) { battleLogs.text += "Both armies were wiped out."; } else if (army1Units > army2Units) { battleLogs.text += "Army 1 Won with remaining " + army1Units.ToString() + " units. It took " + counter + " rounds."; } else { battleLogs.text += "Army 2 Won with remaining " + army2Units.ToString() + " units. It took " + counter + " rounds."; } scrollViewBar.value = 1f; logsScrollView.UpdatePosition(); isSimulatingBattle = false; }
private static int UpdatePosition(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); UIScrollView uIScrollView = (UIScrollView)ToLua.CheckObject(L, 1, typeof(UIScrollView)); uIScrollView.UpdatePosition(); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public static int UpdatePosition(IntPtr l) { int result; try { UIScrollView uIScrollView = (UIScrollView)LuaObject.checkSelf(l); uIScrollView.UpdatePosition(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
private void Update() { if (mReset) { mOffset = 0; mReset = false; mLabel = GetComponent <UILabel>(); mText = mLabel.processedText; } if (mOffset >= mText.Length || !(mNextChar <= RealTime.time)) { return; } charsPerSecond = Mathf.Max(1, charsPerSecond); float num = 1f / (float)charsPerSecond; char c = mText[mOffset]; if (c == '.') { if (mOffset + 2 < mText.Length && mText[mOffset + 1] == '.' && mText[mOffset + 2] == '.') { num += delayOnPeriod * 3f; mOffset += 2; } else { num += delayOnPeriod; } } else if (c == '!' || c == '?') { num += delayOnPeriod; } else if (c == '\n') { num += delayOnNewLine; } NGUIText.ParseSymbol(mText, ref mOffset); mNextChar = RealTime.time + num; mLabel.text = mText.Substring(0, ++mOffset); if (scrollView != null) { scrollView.UpdatePosition(); } }
static int _m_UpdatePosition(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIScrollView gen_to_be_invoked = (UIScrollView)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.UpdatePosition( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
void Awake() { if (itemPrefab == null || scrollView == null || itemParent == null) { if (Debug.developerConsoleVisible) { Debug.LogError("LoopScrollView.Awake() 有属性没有在inspector中赋值"); } } // 设置scrollview的movement if (arrangeDirection == ArrangeDirection.Up_to_Down || arrangeDirection == ArrangeDirection.Down_to_Up) { scrollView.movement = UIScrollView.Movement.Vertical; } else { scrollView.movement = UIScrollView.Movement.Horizontal; } scrollView.onDragStarted += () => { startDragPos = scrollView.transform.localPosition; }; scrollView.onDragFinished += () => { endDragPos = scrollView.transform.localPosition; }; scrollView.onStoppedMoving += () => { scrollView.UpdatePosition(); }; //这是一个偷懒的方式,防止从零开始时由上到下翻页的时候将需要显示的数据隐藏掉 //数据隐藏掉会导致scrollView的Center改变(变小),导致springPanel-MomentumAndSpring回弹到变小之后的Center上 if (arrangeDirection == ArrangeDirection.Up_to_Down) { InvisibleCache = MaxShowCount; } }
private void Reposition() { Bounds bs = NGUIMath.CalculateRelativeWidgetBounds(previewTable.transform); //Vector2 panelSize = mPanel.GetViewSize(); float width = bs.size.x; //float height = Mathf.Max(bs.size.y, panelSize.y); float height = bs.size.y; var pos = placeholder.transform.localPosition; placeholder.SetRect(0, 0, width, height); placeholder.transform.localPosition = pos; //pos.x = 0; //pos.y = panelSize.y / 2 + mPanel.baseClipRegion.y; scrollView.InvalidateBounds(); if (scrollView.canMoveVertically) { float target = 0.0f; if (height > 1314f) { target = 1.0f; } if (Mathf.Abs(target - scrollView.verticalScrollBar.value) < 0.01f) { scrollView.SetDragAmount(1f, target, false); } else { scrollView.SetDragAmount(1f, target, false); scrollView.SetDragAmount(1f, target, true); } scrollView.UpdatePosition(); } }
public void RefreshBanker(ISFSObject responseData) { var gdata = App.GetGameData <BrnnGameData>(); foreach (GameObject i in CommonObject.CurrentBankerList) { if (i == null) { continue; } i.SetActive(false); Destroy(i); } CommonObject.CurrentBankerList.Clear(); ISFSArray banbers = responseData.GetSFSArray("bankers"); int b = responseData.GetInt("banker"); bool isHaveMe = false; if (banbers == null || banbers.Size() == 0) { ApplyCtrl.Instance.SetStutus(gdata.GetPlayerInfo().CoinA >= gdata.MiniApplyBanker ? 1 : 2); gdata.CurrentBanker.Info = new YxBaseUserInfo { NickM = "系统庄", CoinA = long.MaxValue }; return; } for (int i = 0; i < banbers.Size(); i++) { var banber = banbers.GetSFSObject(i); var brnnUser = new YxBaseUserInfo { Seat = banber.GetInt("seat"), CoinA = banber.GetLong("ttgold"), NickM = banber.GetUtfString("name") }; //同步本地玩家数据 var player = gdata.GetPlayerInfo(brnnUser.Seat, true); if (player != null) { player.CoinA = brnnUser.CoinA; } //刷新庄家数据 if (brnnUser.Seat == b) { var bankerInfo = gdata.GetPlayerInfo(b, true); if (bankerInfo != null) { bankerInfo.CoinA = brnnUser.CoinA; bankerInfo.NickM = brnnUser.NickM; bankerInfo.Seat = brnnUser.Seat; gdata.CurrentBanker.Info = bankerInfo; } GameObject temp = CloneUser(ModelList, GridBankers.gameObject); temp.name = "0"; temp.GetComponent <UserListModel>().SetInfo(brnnUser, true, i + 1); CommonObject.CurrentBankerList.Add(temp); } else { GameObject temp = CloneUser(ModelList, GridBankers.gameObject); temp.name = (9999999999 - brnnUser.CoinA).ToString(CultureInfo.InvariantCulture); temp.GetComponent <UserListModel>().SetInfo(brnnUser, false, i + 1); CommonObject.CurrentBankerList.Add(temp); } if (gdata.GetPlayerInfo().Seat == brnnUser.Seat) { isHaveMe = true; } } if (isHaveMe) { ApplyCtrl.Instance.SetStutus(0); } else { ApplyCtrl.Instance.SetStutus(App.GameData.GetPlayerInfo().CoinA >= App.GetGameData <BrnnGameData>().MiniApplyBanker ? 1 : 2); } GridBankers.repositionNow = true; GridBankers.Reposition(); ScrollView.UpdatePosition(); }
// Update is called once per frame void Update() { if (!Competition.RaceGame_Bool) { EasyObject.SetActive(false); NormalObject.SetActive(false); Ranking1[0].enabled = false; Ranking1[1].enabled = false; Ranking2[0].enabled = false; Ranking2[1].enabled = false; Ranking3[0].enabled = false; Ranking3[1].enabled = false; } else { EasyObject.SetActive(true); if (RaceEnd_Bool && MainGame_Control.StopModeState == GameEnum.ENUM_STOPMODE_STATE.EndShow && !EndWindow_Control.EndWindowOpenBool) { EndObject.SetActive(true); NormalObject.SetActive(true); RaceRankingOpen = false; // EndWindow_Control.EndWindowOpenBool = false; } else { EndObject.SetActive(false); if (!RaceRankingOpen) { NormalObject.SetActive(false); } else { NormalObject.SetActive(true); } } if (RaceRankingList.Count < 6) { RankingBar.barSize = 1; RankingBar.value = 0; } MyRankDataLabel[0].text = TotalPeople.ToString(); MyRankDataLabel[2].text = MainConnet.m_PlayerData.m_strNickName; Money.text = GetMoney.ToString(); Diamond.text = GetDiamond.ToString(); if (RaceRankingCheck && (MainGame_Control.StopModeState == GameEnum.ENUM_STOPMODE_STATE.WaitStop || MainGame_Control.StopModeState == GameEnum.ENUM_STOPMODE_STATE.EndShow)) { MyRankDataLabel[1].text = NowPlayerRanking.ToString(); MyRankDataLabel[3].text = NowPlayerScore.ToString(); DataCheck_void(); ObjcetAdd_void(); RaceRankingCheck = false; } } if (ScrollBarCheckBool) { if (DelayTime < 1f) { DelayTime += Time.deltaTime; RacnkingTable.repositionNow = true; RankingBar.value = 0; m_ScrollView.UpdatePosition(); m_ScrollView.UpdateScrollbars(); } else { DelayTime = 0; ScrollBarCheckBool = false; } } }
// Update is called once per frame void Update() { if (VersionDef.InternationalLanguageSystem) { Name1 = "(" + Font_Control.Instance.m_dicMsgStr[2008025] + ")"; Name2 = "(" + Font_Control.Instance.m_dicMsgStr[2008026] + ")"; } else { Name1 = "(" + "報名中" + ")"; Name2 = "(" + "比賽中" + ")"; } if (SaveRacePlayerData.Count != 0 /*&& !DataChange_Bool && !LockObject_Bool*/) { lock (CompetitionLockObject) { foreach (var item in SaveRacePlayerData) { CompetitionData[item.Key].m_uiNowPlayerCnt = item.Value.m_uiPlayerCnt; if (CompetitionData[item.Key].m_oSwitchState.m_enumState == ENUM_RACE_STATE.End) { item.Value.m_uiPlayerCnt = 0; CompetitionData[item.Key].m_uiNowPlayerCnt = 0; } if (CompetitionData[item.Key].m_bSigned) { ListObject[item.Key].GetComponent <RaceData>().Signed_Bool = true; } else { ListObject[item.Key].GetComponent <RaceData>().Signed_Bool = false; } ListObject[item.Key].GetComponent <RaceData>().People_Label.text = CompetitionData[item.Key].m_uiNowPlayerCnt + "人 / " + CompetitionData[item.Key].m_uiMaxPlayerCnt + "人"; } SaveRacePlayerData.Clear(); //if (MainConnet.m_Scence == MainConnet.SecnceType.Baccarat_Lobby) // DataChange_Bool = true; } } //if (!DataChange_Bool && LockObject_Bool) if (SaveCompetition.Count != 0) { lock (CompetitionLockObject) { foreach (var item in SaveCompetition) { CompetitionData[item.Key].m_oSwitchState.m_timeNext = item.Value.m_timeNext; CompetitionData[item.Key].m_oSwitchState.m_enumState = item.Value.m_enumState; if (item.Value.m_enumState == ENUM_RACE_STATE.Sign) { CompetitionData[item.Key].m_bSigned = false; } else if (item.Value.m_enumState == ENUM_RACE_STATE.End) { CompetitionData[item.Key].m_uiNowPlayerCnt = 0; } DataChange_Bool = true; } SaveCompetition.Clear(); DataChange_Bool = true; LockObject_Bool = false; } } if (CompetitionBoxOpen_Bool) { Competition_Object.SetActive(true); } else { Competition_Object.SetActive(false); } if (BeforeRankingBoxOpen_Bool) { BeforeRanking_Object.SetActive(true); } else { BeforeRanking_Object.SetActive(false); } if (DataChange_Bool && MainConnet.m_Scence == MainConnet.SecnceType.Baccarat_Lobby) { lock (CompetitionLockObject) { SequenceData_Void(); Debug.Log("賽事更新成功"); DataChange_Bool = false; } } if (BarCheck_Bool) { Bar_Void(); } if (!FirstClick && !BarCheck_Bool && FirstClick2) { if (DelayTime2 < 1) { DelayTime2 += Time.deltaTime; m_Scrollview.UpdatePosition(); m_Scrollview.UpdateScrollbars(); BoxBar.value = 0; } else { FirstClick = true; } } if (SequenceData.Count < 3) { BoxBar.barSize = 1; BoxBar.value = 0; } }
private void SwitchItem(int id) { indexStar = id; //Debug.Log("indexStar : " + indexStar.ToString()); if (movement == UIScrollView.Movement.Horizontal) { //Debug.Log("indexStar : " + indexStar.ToString()); //Debug.Log("stop : " + (indexMax - defaultMaxLine).ToString()); if (indexStar > 0) { indexStar = 0; return; } if (indexStar < -(indexMax - defaultMaxLine)) { indexStar = indexMax - defaultMaxLine; return; } indexStar = Mathf.Abs(indexStar); } else if (movement == UIScrollView.Movement.Vertical) { /** star */ if (indexStar < 0) { indexStar = 0; return; } /**end*/ if (indexStar > indexMax - defaultMaxLine) { indexStar = indexMax - defaultMaxLine; return; } } if (lastIndex != indexStar) { if (lastIndex < indexStar) { Transform t = itemTrans[0]; for (int i = 0; i < itemTrans.Length - 1; i++) { itemTrans[i] = itemTrans[i + 1]; } float fy = 0; Vector3 v3 = t.localPosition; if (movement == UIScrollView.Movement.Horizontal) { fy = itemTrans[itemTrans.Length - 2].localPosition.x + size.x + space; v3.x = fy; } else if (movement == UIScrollView.Movement.Vertical) { fy = itemTrans[itemTrans.Length - 2].localPosition.y - size.y - space; v3.y = fy; } t.localPosition = v3; itemTrans[itemTrans.Length - 1] = t; } else { Transform t = itemTrans[itemTrans.Length - 1]; for (int i = itemTrans.Length - 1; i > 0; i--) { itemTrans[i] = itemTrans[i - 1]; } float fy = 0; Vector3 v3 = t.localPosition; if (movement == UIScrollView.Movement.Horizontal) { fy = itemTrans[1].localPosition.x - size.x - space; v3.x = fy; } else if (movement == UIScrollView.Movement.Vertical) { fy = itemTrans[1].localPosition.y + size.y + space; v3.y = fy; } t.localPosition = v3; itemTrans[0] = t; } lastIndex = indexStar; if (scrollGridSetItem != null) { scrollGridSetItem(itemTrans, indexStar, indexEnd); } sView.UpdatePosition(); } }
private IEnumerator InitItems() { yield return(null); int have_num = LTWelfareDataManager.Instance.SignInData.Num; int monthDay = EB.Time.LocalDaysInMonth; SetPlaceHolder(monthDay); int curNum = LTWelfareDataManager.Instance.SignInData.Num; int activeCount = (int)(m_ScrollView.GetComponent <UIPanel>().baseClipRegion.w / SignItemGrid.cellHeight); float value = (float)(((curNum + SignItemGrid.maxPerLine - 1) / SignItemGrid.maxPerLine) - activeCount) / (float)(((monthDay + SignItemGrid.maxPerLine - 1) / SignItemGrid.maxPerLine) - activeCount); float scrollValue = curNum > activeCount ? value : 0f; m_ScrollView.UpdatePosition(); m_ScrollView.UpdateScrollbars(); m_ScrollView.verticalScrollBar.value = scrollValue; if (!m_HaveCreate) { for (int i = 0; i < SignItemList.Count; i++) { GameObject.Destroy(SignItemList[i].mDMono.gameObject); } SignItemList.Clear(); List <SigninAward> monthAwards = WelfareTemplateManager.Instance.GetTemplate(EB.Time.LocalMonth); for (int i = 0; i < monthDay; i++) { if (SignItem == null) { break; } GameObject obj = GameObject.Instantiate(SignItem); obj.SetActive(true); obj.transform.SetParent(SignItemGrid.transform); obj.transform.localScale = Vector3.one; obj.transform.localPosition = new Vector3(1000, 0, 0); LTWelfareSignInItem Ctrl = obj.GetMonoILRComponent <LTWelfareSignInItem>(); Ctrl.InitData(monthAwards[i], i + 1); if (i < have_num) { Ctrl.UpdateReceiveState(eReceiveState.have); } else if (i > have_num && i <= have_num + Mathf.Min(ResidueRealResigninDays - 1, LTWelfareDataManager.Instance.SignInData.IsSigned ? 0 : 1)) { Ctrl.UpdateReceiveState(eReceiveState.can, true); } SignItemList.Add(Ctrl); if ((i + 1) % SignItemGrid.maxPerLine == 0 || i == monthDay - 1) { SignItemGrid.Reposition(); yield return(new WaitForSeconds(0.2f)); } } m_HaveCreate = true; EB.Debug.Log("Create SignItem Finished!!!!!!!"); } if (LTWelfareDataManager.Instance.GetIsHaveSigninAward() && SignItem != null) { LTWelfareSignInItem curItem = GetCurrent(); if (curItem != null) { curItem.UpdateReceiveState(eReceiveState.can); //这里设置可签到特效 } } }
void Update() { if (mReset) { mCurrentOffset = 0; mReset = false; mLabel = GetComponent <UILabel>(); mFullText = mLabel.processedText; mFade.Clear(); if (keepFullDimensions && scrollView != null) { scrollView.UpdatePosition(); } } if (mCurrentOffset < mFullText.Length && mNextChar <= RealTime.time) { int lastOffset = mCurrentOffset; charsPerSecond = Mathf.Max(1, charsPerSecond); // Automatically skip all symbols while (NGUIText.ParseSymbol(mFullText, ref mCurrentOffset)) { } ++mCurrentOffset; // Periods and end-of-line characters should pause for a longer time. float delay = 1f / charsPerSecond; char c = (lastOffset < mFullText.Length) ? mFullText[lastOffset] : '\n'; if (c == '\n') { delay += delayOnNewLine; } else if (lastOffset + 1 == mFullText.Length || mFullText[lastOffset + 1] <= ' ') { if (c == '.') { if (lastOffset + 2 < mFullText.Length && mFullText[lastOffset + 1] == '.' && mFullText[lastOffset + 2] == '.') { delay += delayOnPeriod * 3f; lastOffset += 2; } else { delay += delayOnPeriod; } } else if (c == '!' || c == '?') { delay += delayOnPeriod; } } mNextChar = RealTime.time + delay; if (fadeInTime != 0f) { // There is smooth fading involved FadeEntry fe = new FadeEntry(); fe.index = lastOffset; fe.alpha = 0f; fe.text = mFullText.Substring(lastOffset, mCurrentOffset - lastOffset); mFade.Add(fe); } else { // No smooth fading necessary mLabel.text = keepFullDimensions ? mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset) : mFullText.Substring(0, mCurrentOffset); // If a scroll view was specified, update its position if (!keepFullDimensions && scrollView != null) { scrollView.UpdatePosition(); } } } // Alpha-based fading if (mFade.size != 0) { for (int i = 0; i < mFade.size;) { FadeEntry fe = mFade[i]; fe.alpha += RealTime.deltaTime / fadeInTime; if (fe.alpha < 1f) { mFade[i] = fe; ++i; } else { mFade.RemoveAt(i); } } if (mFade.size == 0) { if (keepFullDimensions) { mLabel.text = mFullText.Substring(0, mCurrentOffset) + "[00]" + mFullText.Substring(mCurrentOffset); } else { mLabel.text = mFullText.Substring(0, mCurrentOffset); } } else { StringBuilder sb = new StringBuilder(); for (int i = 0; i < mFade.size; ++i) { FadeEntry fe = mFade[i]; if (i == 0) { sb.Append(mFullText.Substring(0, fe.index)); } sb.Append('['); sb.Append(NGUIText.EncodeAlpha(fe.alpha)); sb.Append(']'); sb.Append(fe.text); } if (keepFullDimensions) { sb.Append("[00]"); sb.Append(mFullText.Substring(mCurrentOffset)); } mLabel.text = sb.ToString(); } } }
private void ChangeWorldMapOffset() { scrollBar.value = scrollBarValue; scrollView.UpdatePosition(); }