public void OpenNewButton(int stageNum) { m_newStageNumber = stageNum; m_newStageMoveTime = HeadMoveTime; if (m_newStageNumber == 2) { GlobalVars.InMapFTUE = true; m_heartUI.HideWindow(); //进入FTUE状态 UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow <UIFTUE>(); if (ftue == null) { ftue = UIWindowManager.Singleton.CreateWindow <UIFTUE>(); } ftue.ResetFTUEStep(); System.Collections.Generic.List <FTUEData> ftueData = new System.Collections.Generic.List <FTUEData>(); FTUEData data = new FTUEData(); data.dialog = Localization.instance.Get("FTUEStep0"); data.headImage = "Speicher"; data.from = new Position(); data.from.MakeItUnAvailable(); ftueData.Add(data); //第1句话 data = new FTUEData(); data.dialog = Localization.instance.Get("FTUEStep1"); data.headImage = "Speicher"; data.pointToGameObject = "Stage1"; data.from = new Position(); data.from.MakeItUnAvailable(); ftueData.Add(data); //第2句话 data = new FTUEData(); data.dialog = Localization.instance.Get("FTUEStep2"); data.headImage = "Speicher"; data.from = new Position(); data.from.MakeItUnAvailable(); ftueData.Add(data); //第3句话 ftue.ShowFTUE(0, ftueData); } }
public override void OnUpdate() { base.OnUpdate(); if (uiWindowState != UIWindowStateEnum.Show) { return; } GlobalVars.RefreshHeart(); //显示心数和时间//////////////////////////////////////////////////////////////////////// if (!m_heartUI.Visible) { if (!GlobalVars.InMapFTUE) { m_heartUI.ShowWindow(); } } else { UISprite heartNum = m_heartUI.GetChildComponent <UISprite>("HeartNum"); heartNum.spriteName = "Large_" + GlobalVars.HeartCount; m_coinNumber.SetNumber((int)Unibiller.GetCurrencyBalance("gold")); if (GlobalVars.HeartCount < 5) //若心没满,要显示时间 { if (!m_timeNumber.activeSelf) { m_timeNumber.SetActive(true); } int ticks = (int)((System.DateTime.Now.Ticks - GlobalVars.GetHeartTime.Ticks) / 10000); int ticksToGetHeart = CapsConfig.Instance.GetHeartInterval * 1000 - ticks; int min = ticksToGetHeart / 1000 / 60; int second = ticksToGetHeart / 1000 % 60; m_minNumber.SetNumberRapid(min); m_secNumber.SetNumberRapid(second); } else { if (m_timeNumber.activeSelf) { m_timeNumber.SetActive(false); } } } if (GlobalVars.InMapFTUE) { return; } //处理头像在地图上移动 if (m_newStageNumber > -1) //若正在移动 { m_newStageMoveTime -= Time.deltaTime; if (m_newStageMoveTime < 0) //若移动到了 { RefreshButtonStar(m_newStageNumber); AddStagePartile(m_newStageNumber); m_headSprite.gameObject.transform.localPosition = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z); ////移到目标点 GlobalVars.HeadStagePos = GlobalVars.AvailabeStageCount; //记录头像移动 PlayerPrefs.SetInt("HeadStagePos", GlobalVars.HeadStagePos); //记录 RefreshButton(m_newStageNumber - 1); if (m_newStageNumber >= 2) { RefreshButton(m_newStageNumber - 2); } if (m_newStageNumber == 2) //需要出FTUE的情况 { GlobalVars.InMapFTUE = true; m_heartUI.HideWindow(); //进入FTUE状态 UIFTUE ftue = UIWindowManager.Singleton.GetUIWindow <UIFTUE>(); if (ftue == null) { ftue = UIWindowManager.Singleton.CreateWindow <UIFTUE>(); } ftue.ResetFTUEStep(); System.Collections.Generic.List <FTUEData> ftueData = new System.Collections.Generic.List <FTUEData>(); FTUEData data = new FTUEData(); data.dialog = Localization.instance.Get("FTUEStep3"); data.headImage = "Speicher"; data.pointToGameObject = "Stage2"; data.from = new Position(); data.from.MakeItUnAvailable(); ftueData.Add(data); //第4句话 data = new FTUEData(); ftue.ShowFTUE(0, ftueData); } else //不需要出FTUE,自动点关卡按钮 { int tempNum = m_newStageNumber; Timer.AddDelayFunc(1.0f, delegate() { UIButton.current = m_stageBtns[tempNum - 1].GetComponent <UIButton>(); OnStageClicked(); }); } m_newStageNumber = -1; m_inputBlocker.SetActive(false); } else { if (!m_inputBlocker.activeInHierarchy) { m_inputBlocker.SetActive(true); } Vector3 target = new Vector3(m_stageBtns[m_newStageNumber - 1].localPosition.x, m_stageBtns[m_newStageNumber - 1].localPosition.y + HeadYOffset, m_stageBtns[m_newStageNumber - 1].localPosition.z); Vector3 fromPos = m_stageBtns[m_newStageNumber - 2].localPosition; fromPos.y += HeadYOffset; m_headSprite.gameObject.transform.localPosition = Vector3.Lerp(fromPos, target, (1 - m_newStageMoveTime / HeadMoveTime)); } } //5105 - 2045 = 3060 //处理云的移动 //float y = (mUIObject.transform.localPosition.y - (454.0f)) * 3054 / 3964.0f; //m_cloudSprite.transform.LocalPositionY(-y); m_cloudSprite.LocalPositionY((m_mapObj.transform.localPosition.y * 2) % 1135); if (m_cloudSprite.transform.localPosition.y > 0) { m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y - 1135); } else { m_cloud2Sprite.transform.LocalPositionY(m_cloudSprite.transform.localPosition.y + 1135); } if (m_stageUI.Visible) { m_lastClickStageTime = Timer.GetRealTimeSinceStartUp(); //更新关卡点击时间 } //else if (Timer.GetRealTimeSinceStartUp() - m_lastClickStageTime > 5.0f) //5秒没有有效操作 else { SetStageHelp(true); } if (m_stageUI.Visible) //若关卡UI显示了 { if (!m_blurSprites[0].activeInHierarchy) //若模糊层没显示 { for (int i = 0; i < 3; ++i) { m_blurSprites[i].SetActive(true); m_blurSprites[i].GetComponent <TweenAlpha>().Play(true); } EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, null); } } else { if (m_blurSprites[0].activeInHierarchy) { for (int i = 0; i < 3; ++i) { m_blurSprites[i].GetComponent <TweenAlpha>().Play(false); } EventDelegate.Set(m_blurSprites[0].GetComponent <TweenAlpha>().onFinished, delegate() { for (int i = 0; i < 3; ++i) { m_blurSprites[i].SetActive(false); } }); } } }