|  |  |  | 
|---|
|  |  |  | protected int currentProgress = 0; | 
|---|
|  |  |  | protected int targetProgress = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Text titleText; | 
|---|
|  |  |  | protected Text tipsText; | 
|---|
|  |  |  | protected Image progressBar; | 
|---|
|  |  |  | protected Text progressText; | 
|---|
|  |  |  | // [SerializeField] UIAlphaTween m_AlphaTween; | 
|---|
|  |  |  | [SerializeField] Image m_BackGround; | 
|---|
|  |  |  | [SerializeField] RectTransform m_AndroidProgressContainer; | 
|---|
|  |  |  | [SerializeField] RectTransform m_NetworkContainer; | 
|---|
|  |  |  | [SerializeField] SmoothSlider m_PartProgressSlider; | 
|---|
|  |  |  | [SerializeField] SmoothSlider m_TotalProgressSlider; | 
|---|
|  |  |  | [SerializeField] Text m_StageDescription; | 
|---|
|  |  |  | [SerializeField] Text m_BuildTime; | 
|---|
|  |  |  | [SerializeField] Text m_Version; | 
|---|
|  |  |  | // [SerializeField] Button m_UserHelp; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected List<Sprite> backGrounds = new List<Sprite>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected float backGroundTimer = 0f; | 
|---|
|  |  |  | protected int backGroundIndex = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void InitComponent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.InitComponent(); | 
|---|
|  |  |  | titleText = transform.Find("Text_Loading").GetComponent<Text>(); | 
|---|
|  |  |  | tipsText = transform.Find("Text_Tips").GetComponent<Text>(); | 
|---|
|  |  |  | progressBar = transform.Find("Img_Progress/Img_Foreground").GetComponent<Image>(); | 
|---|
|  |  |  | progressText = transform.Find("Text_Progress").GetComponent<Text>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Application.isEditor) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (m_BackGround.overrideSprite == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var sprite = BuiltInLoader.LoadSprite("Launch_1"); | 
|---|
|  |  |  | m_BackGround.overrideSprite = sprite; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (backGrounds.Count <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (var i = 0; i < 3; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var sprite = BuiltInLoader.LoadSprite(StringUtility.Contact("Launch_", i + 1)); | 
|---|
|  |  |  | if (sprite != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | backGrounds.Add(sprite); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_BackGround.overrideSprite = backGrounds[0]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (directly) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | currentProgress = targetProgress = (int)(value * 100); | 
|---|
|  |  |  | currentProgress = targetProgress = Mathf.Min((int)(value * 100), 100); | 
|---|
|  |  |  | UpdateProgress(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | currentProgress = (int)(value * 100); | 
|---|
|  |  |  | targetProgress = Mathf.Min((int)(value * 100), 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void UpdateProgress() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | progressText.text = currentProgress + "%"; | 
|---|
|  |  |  | progressBar.fillAmount = currentProgress / 100f; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void Update() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // Debug.LogErrorFormat("cur : {0}  /  target {1}", currentProgress, targetProgress); | 
|---|
|  |  |  | if (currentProgress < targetProgress) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | currentProgress = (int)Mathf.Lerp(currentProgress, targetProgress, 0.1f); | 
|---|
|  |  |  | UpdateProgress(); | 
|---|
|  |  |  | m_TotalProgressSlider.value = currentProgress / 100f; | 
|---|
|  |  |  | m_PartProgressSlider.value = currentProgress / 100f; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | m_TotalProgressSlider.value = currentProgress / 100f; | 
|---|
|  |  |  | m_PartProgressSlider.value = currentProgress / 100f; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | CopiedLogic_UpdateProgress(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void CopiedLogic_UpdateProgress() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //  暂留接口 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //  好像都不应该在这里写东西了 | 
|---|
|  |  |  | //  m_TotalProgressSlider跟m_PartProgressSlider都有自己新的逻辑 | 
|---|
|  |  |  | //  m_StageDescription有固定的文字 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //  iOS如果不是download那也都是隐藏的 这里肯定不会有download的 所以就不搬了 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void LateUpdate() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UpdateProgress(); | 
|---|
|  |  |  | CopiedLogic_LateUpdate(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void CopiedLogic_LateUpdate() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | backGroundTimer += Time.deltaTime; | 
|---|
|  |  |  | if (backGroundTimer >= 3f) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | backGroundTimer -= 3f; | 
|---|
|  |  |  | if (backGrounds.Count > 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //  考虑在这里做这个描述的切换 或者根据图片来做提示词 | 
|---|
|  |  |  | // m_StageDescription.text = ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SetData(LaunchWinData _launchWinData) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | backGroundTimer = _launchWinData.backGroundTimer; | 
|---|
|  |  |  | backGroundIndex = _launchWinData.backGroundIndex; | 
|---|
|  |  |  | m_BackGround.overrideSprite = _launchWinData.sprite; | 
|---|
|  |  |  | backGrounds = _launchWinData.sprites; | 
|---|
|  |  |  | m_StageDescription.text = Language.GetFromLocal(44);//最后Completed一定是这个 考虑要不要塞入LaunchWinData.. | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|