Esempio n. 1
0
        void Awake()
        {
            mViewListeners          = new Dictionary <string, LuaTable>();
            mPrefabs                = new GameResHandler <GameObject>("common");
            mPrefabs.OnLoadCallbcak = _onLoadPrefab;
            mPrefabs.Suffix         = ".prefab";

            //mCanvas = new Canvas[Enum.GetValues(typeof(RenderMode)).Length];
            mCanvas          = new Canvas[3];
            mStackViews      = new Stack <UIBase>();
            mStaticViews     = new List <UIBase>();
            mStaticViewInfos = new List <AsbInfo>();

            //foreach (RenderMode r in Enum.GetValues(typeof(RenderMode)))
            {
                GetCanvasByMode(RenderMode.WorldSpace);
                //TODO:暂时不使用ScreenSpaceCamera模式,没有需求
                GetCanvasByMode(RenderMode.ScreenSpaceCamera);
                GetCanvasByMode(RenderMode.ScreenSpaceOverlay);
            }

            //给UI管理器添加EventSyetem
            GameObject eventObj = new GameObject();

            eventObj.transform.SetParent(transform);
            eventObj.name = "EventSystem";
            mEventSystem  = eventObj.AddComponent <EventSystem>();
            Debug.Log(mEventSystem.enabled);
            eventObj.AddComponent <StandaloneInputModule>();
        }
Esempio n. 2
0
 /// <summary>
 /// 请勿直接调用构造函数,请使用 Instance 方法获取单例
 /// </summary>
 public SpriteAtlasMgr()
 {
     mSpriteDict                   = new GameResHandler <SpriteAtlas>("common");
     mSpriteDict.Suffix            = ".spriteatlas";
     mSpriteDict.OnReleaseCallback = (ref SpriteAtlas s) =>
     {
         Resources.UnloadAsset(s);
         s = null;
     };
 }
Esempio n. 3
0
 /// <summary>
 /// 请勿直接调用构造函数,请使用 Instance 方法获取单例
 /// </summary>
 public GameResManager()
 {
     mObjDict = new GameResHandler <UObj>("common");
     //mObjDict.Suffix = ".spriteatlas";
     mObjDict.OnReleaseCallback = (ref UObj s) =>
     {
         Resources.UnloadAsset(s);
         s = null;
     };
     mObjDict.OnLoadCallbcak = (UObj obj, AsbInfo info) =>
     {
         //TODO:EventManager 通知
     };
 }
Esempio n. 4
0
        /// <summary>
        /// 请勿直接调用构造函数,请使用 Instance 方法获取单例
        /// </summary>
        public PrefabMgr()
        {
            mObjDict                   = new GameResHandler <GameObject>("common");
            mObjDict.Suffix            = ".prefab";
            mObjDict.OnReleaseCallback = (ref GameObject s) =>
            {
                //Resources.UnloadAsset(s);
                //TODO:是否是直接 destroy 待验证
                UObj.Destroy(s);
                s = null;
            };

            mObjDict.OnLoadCallbcak = (GameObject obj, AsbInfo info) =>
            {
                //TODO:EventManager 通知
            };
        }
Esempio n. 5
0
        void Start()
        {
            //从GameConfig初始化音乐相关的配置
            mPlayBgm     = GameConfig.IsPlayBgm;
            mPlaySound   = GameConfig.IsPlaySound;
            mBgmVolume   = GameConfig.BGMVolume;
            mSoundVolume = GameConfig.SoundVolume;

            mAudios = new GameResHandler <AudioClip>("common");
            mAudios.OnReleaseCallback = delegate(ref AudioClip audioClip)
            {
                audioClip.UnloadAudioData();
            };
            mPlayingSources        = new List <AudioSource>();
            mAudios.OnLoadCallbcak = _onAudioClipLoad;
            mSourcePool            = new ObjPool <AudioSource>(HandleOnGetDelegate, HandleOnRecoverDelegate, HandleOnDisposeDelegate);

            mBgmSource = gameObject.AddComponent <AudioSource>();
        }