コード例 #1
0
 protected override void Awake()
 {
     base.Awake();
     if (Dynamically)
     {
         mToggls = new List <Toggle>();
     }
     mPool = new ObjPool <Toggle>(onGetDelegate, onRecoverDelegate, onDisposeDelegate);
 }
コード例 #2
0
 protected override void Awake()
 {
     base.Awake();
     if (null == Content)
     {
         // LogFile.Error("Selector Content is null");
         return;
     }
     mItemPool = new ObjPool <ScrollItem>(OnGetItemDelegate, OnItemRecoverDelegate, OnItemDisposeDelegate);
     mCurItems = new List <ScrollItem>();
     //Debug.Log(Content.anchoredPosition);
 }
コード例 #3
0
 protected override void Awake()
 {
     base.Awake();
     mItemPool         = new ObjPool <ScrollItem>(onPoolGetDelegate, onPoolRecoverDelegate, onPoolDisposeDelegate);
     mCurItems         = new List <ScrollItem>();
     mItemSelectStatus = ObjPools.GetListBool();
     //// 开启回弹
     //movementType = MovementType.Elastic;
     //elasticity = 0.05f;
     //// 关闭移动结束后回弹惯性
     //inertia = false;
 }
コード例 #4
0
ファイル: SoundMgr.cs プロジェクト: dekiven/GameFramework
        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>();
        }
コード例 #5
0
 protected override void OnDestroy()
 {
     if (null != mOnItemSelectedLua)
     {
         mOnItemSelectedLua.Dispose();
         mOnItemSelectedLua = null;
     }
     if (null != mData)
     {
         for (int i = 0; i < mData.Count; i++)
         {
             mData[i].Dispose();
         }
         mData.Clear();
     }
     if (null != mItemPool)
     {
         mItemPool.Dispose();
         mItemPool = null;
     }
     base.OnDestroy();
 }
コード例 #6
0
        public static void Init()
        {
            //sDict = new Dictionary<string, System.Object>();
            sPoolLS = new ObjPool <List <string> >(
                delegate(ref List <string> l)
            {
                if (null == l)
                {
                    l = new List <string>();
                }
                else
                {
                    l.Clear();
                }
                return(true);
            }
                , delegate(List <string> l) {
                l.Clear();
                return(true);
            }
                );
            //sDict[listStr.GetType().ToString()] = listStr;

            sPoolLI = new ObjPool <List <int> >(
                delegate(ref List <int> l)
            {
                if (null == l)
                {
                    l = new List <int>();
                }
                else
                {
                    l.Clear();
                }
                return(true);
            }
                , delegate(List <int> l) {
                l.Clear();
                return(true);
            }
                );
            //sDict[listInt.GetType().ToString()] = listInt;

            sPoolLF = new ObjPool <List <float> >(
                delegate(ref List <float> l)
            {
                if (null == l)
                {
                    l = new List <float>();
                }
                else
                {
                    l.Clear();
                }
                return(true);
            }
                , delegate(List <float> l) {
                l.Clear();
                return(true);
            }
                );
            //sDict[listFloat.GetType().ToString()] = listFloat;

            sPoolLB = new ObjPool <List <bool> >(
                delegate(ref List <bool> l)
            {
                if (null == l)
                {
                    l = new List <bool>();
                }
                else
                {
                    l.Clear();
                }
                return(true);
            }
                , delegate(List <bool> l) {
                l.Clear();
                return(true);
            }
                );

            sPoolAsbInfo = new ObjPool <AsbInfo>(
                delegate(ref AsbInfo info) {
                if (null == info)
                {
                    info = new AsbInfo();
                }
                return(true);
            }
                , null
                );
            //sDict[asbInfo.GetType().ToString()] = asbInfo;
        }