| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 | 
							- using FairyGUI;
 
- using UI.Launcher;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public class LauncherView
 
-     {
 
-         private static LauncherView m_Instance = null;
 
-         /// <summary>
 
-         /// 单例
 
-         /// </summary>
 
-         public static LauncherView Instance
 
-         {
 
-             get
 
-             {
 
-                 if (m_Instance == null)
 
-                 {
 
-                     m_Instance = new LauncherView();
 
-                 }
 
-                 return m_Instance;
 
-             }
 
-         }
 
-         private UI_LauncherUI _ui;
 
-         private GameObject _gameObject;
 
-         private GoWrapper _wrapper;
 
-         /// <summary>
 
-         /// 每1%耗时,单位秒
 
-         /// </summary>
 
-         private const float SPEED = 0.01f;
 
-         /// <summary>
 
-         /// 界面是否打开状态
 
-         /// </summary>
 
-         private bool isOpen = false;
 
-         /// <summary>
 
-         /// FairyGUI包名
 
-         /// </summary>
 
-         private string _packageName;
 
-         #region private
 
-         private void Dispose()
 
-         {
 
-             UIPackage.RemovePackage("UI/" + _packageName);
 
-             _ui.Dispose(true);
 
-             _ui = null;
 
-             if (_gameObject != null)
 
-             {
 
-                 GameObject.Destroy(_gameObject);
 
-             }
 
-         }
 
-         #endregion
 
-         public LauncherView()
 
-         {
 
-             _packageName = UI_LauncherUI.PACKAGE_NAME;
 
-             UIPackage.AddPackage("UI/" + _packageName + "/" + _packageName);
 
-             _ui = UI_LauncherUI.Create();
 
-             _ui.target.MakeFullScreen();
 
-             _ui.target.AddRelation(GRoot.inst, RelationType.Size);
 
-             _ui.m_txtVersion.text = Application.version;
 
-             string resPath = "Effect/ui_dljm/ui_dljm_jdt_tw";
 
-             var prefab = Resources.Load<GameObject>(resPath);
 
-             _gameObject = GameObject.Instantiate(prefab);
 
-             var assetDisposer = _gameObject.AddComponent<AssetReleaser>();
 
-             assetDisposer.resPath = resPath;
 
-             _gameObject.transform.localScale = new Vector3(100, 100, 100);
 
-             _wrapper = new GoWrapper(_gameObject);
 
-             _ui.m_holder.SetNativeObject(_wrapper);
 
-         }
 
-         /// <summary>
 
-         /// 设置版本号文字
 
-         /// </summary>
 
-         /// <param name="version"></param>
 
-         public void SetVersion(string version)
 
-         {
 
-             if (!isOpen)
 
-             {
 
-                 return;
 
-             }
 
-             _ui.m_txtVersion.text = version;
 
-         }
 
-         /// <summary>
 
-         /// 设置描述文字
 
-         /// </summary>
 
-         /// <param name="desc"></param>
 
-         public void SetDesc(string desc, string descRight = "")
 
-         {
 
-             if (!isOpen)
 
-             {
 
-                 return;
 
-             }
 
-             string str = string.Format("{0}{1}", desc, descRight);//  + descRight;
 
-             _ui.m_txtDescLeft.text = str;
 
-             // _ui.m_txtDescLeft.text = desc ?? "";
 
-             // _ui.m_txtDescRight.text = descRight ?? "";
 
-         }
 
-         /// <summary>
 
-         /// 设置进度0-100
 
-         /// </summary>
 
-         /// <param name="progress"></param>
 
-         /// <param name="callback"></param>
 
-         public void SetProgress(long progress, GTweenCallback callback = null)
 
-         {
 
-             if (!isOpen)
 
-             {
 
-                 return;
 
-             }
 
-             GTweener twener = GTween.GetTween(_ui.m_progressBar1, TweenPropType.Progress);
 
-             if (twener != null)
 
-             {
 
-                 twener.Kill(true);
 
-             }
 
-             if (progress < _ui.m_progressBar1.value)
 
-             {
 
-                 _ui.m_progressBar1.value = progress;
 
-                 _ui.m_imgAni.x = _ui.m_progressBar1.width * (progress / 100) - 120;
 
-                 callback?.Invoke();
 
-             }
 
-             else
 
-             {
 
-                 float duration = (float)(progress - _ui.m_progressBar1.value) * SPEED;
 
-                 GTweener gtweener = _ui.m_progressBar1.TweenValue(progress, duration).OnUpdate((GTweener t) =>
 
-                 {
 
-                     _ui.m_imgAni.x = _ui.m_progressBar1.width * (t.value.x / 100) - 120;
 
-                 });
 
-                 if (callback != null)
 
-                 {
 
-                     gtweener.OnComplete(callback);
 
-                 }
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 打开界面
 
-         /// </summary>
 
-         public void Open()
 
-         {
 
-             if (isOpen)
 
-             {
 
-                 return;
 
-             }
 
- #if (UNITY_5 || UNITY_5_3_OR_NEWER)
 
-             //Use the font names directly
 
-             UIConfig.defaultFont = "Microsoft YaHei";
 
- #else
 
-         //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
 
-         // UIExcelConfig.defaultFont = "afont";
 
- #endif
 
-             _ui.m_progressBar1.value = 0;
 
-             _ui.m_txtDescLeft.text = "";
 
-             _ui.m_txtDescRight.text = "";
 
-             GRoot.inst.AddChild(_ui.target);
 
-             isOpen = true;
 
-             _ui.m_imgLogo.visible = LauncherConfig.netType != LauncherConfig.EnumNetType.TEMP;
 
-         }
 
-         /// <summary>
 
-         /// 关闭界面
 
-         /// </summary>
 
-         /// <param name="toDestroy"></param>
 
-         public void Close(bool toDestroy = false)
 
-         {
 
-             if (!isOpen)
 
-             {
 
-                 return;
 
-             }
 
-             isOpen = false;
 
-             _ui.target.RemoveFromParent();
 
-             if (toDestroy)
 
-             {
 
-                 Dispose();
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |