Exemplo n.º 1
0
        public int UF_LoadTextureAsync(string textureName, DelegateTexture callback)
        {
            var tex = RefObjectManager.UF_GetInstance().UF_GetRefObject <Texture2D>(textureName, false) as Texture2D;

            if (tex != null)
            {
                if (callback != null)
                {
                    callback(tex);
                }
            }
            else
            {
                DelegateObject _loadfinish = delegate(UnityEngine.Object image) {
                    Texture2D texture = image as Texture2D;
                    if (texture != null)
                    {
                        RefObjectManager.UF_GetInstance().UF_RetainRef(texture);
                    }
                    if (callback != null)
                    {
                        callback(texture);
                    }
                };
                return(AssetSystem.UF_GetInstance().UF_AsyncLoadObjectImage(textureName, _loadfinish));
            }
            return(0);
        }
Exemplo n.º 2
0
        IEnumerator UF_CoGameStart()
        {
            Debugger.UF_Log("GameMain Start Begain");
            MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_MAIN_PRE_START);
            //获取native 配置
            yield return(StartCoroutine(GlobalSettings.UF_InitExternInfo()));

            //初始化全局配置表
            yield return(StartCoroutine(GlobalSettings.UF_InitGameConfigs()));

            //检查版本更新
            yield return(StartCoroutine(UpgradeSystem.UF_GetInstance().UF_CheckUpgrade()));

            //资源系统初始化
            yield return(StartCoroutine(AssetSystem.UF_GetInstance().UF_InitAssetSystem()));

            //LuaFramework 初始化
            //yield return StartCoroutine(LuaFramework.UF_GetInstance().UF_InitFramework());
            FrameHandle.UF_OnStart();
            MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_MAIN_START);
            Debugger.UF_Log("GameMain Start Over");

            MessageSystem.UF_GetInstance().UF_AddListener(DefineEvent.E_START_BATTLE, OnAllReady);
            MessageSystem.UF_GetInstance().UF_AddListener(DefineEvent.E_CLIENT_MSG, OnClientMsg);
            MessageSystem.UF_GetInstance().UF_AddListener(DefineEvent.E_StartFrameSync, OnStartFrameSync);
            MessageSystem.UF_GetInstance().UF_AddListener(DefineEvent.E_StopFrameSync, OnStopFrameSync);

            com.unity.mgobe.src.Util.RandomUtil.Init(int.Parse(GetTimeStamp()));

            //AllUI.Instance.Show("PanelLogin");
            UIManager.UF_GetInstance().UF_ShowView("UI System", "ui_panellogin", null);
            yield break;
        }
Exemplo n.º 3
0
 private void UF_DrawTagGC()
 {
     GUILayout.Space(4);
     if (GUILayout.Button("GC UnusedRes", GUILayout.Height(40), GUILayout.Width(120)))
     {
         Resources.UnloadUnusedAssets();
     }
     GUILayout.Space(4);
     if (GUILayout.Button("GC AssetBundle", GUILayout.Height(40), GUILayout.Width(120)))
     {
         AssetSystem.UF_GetInstance().UF_ClearAll(false);
         Resources.UnloadUnusedAssets();
     }
     GUILayout.Space(4);
     if (GUILayout.Button("GC Mono", GUILayout.Height(40), GUILayout.Width(120)))
     {
         System.GC.Collect();
     }
     GUILayout.Space(4);
     if (GUILayout.Button("GC Lua", GUILayout.Height(40), GUILayout.Width(120)))
     {
         GLuaState lua = GLuaState.Get(System.IntPtr.Zero);
         lua.LuaGC(LuaGCOptions.LUA_GCCOLLECT);
     }
 }
Exemplo n.º 4
0
 private bool UF_UpdatePoolEntity(IEntityHnadle entity)
 {
     if (entity != null)
     {
         //是否需要销毁
         if ((GTime.Time - entity.timeStamp) >= DisposeTime)
         {
             if (entity is IOnDestroyed)
             {
                 (entity as IOnDestroyed).UF_OnDestroyed();
             }
             AssetSystem.UF_GetInstance().UF_DestroyObject(entity as Object);
             return(false);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         Debugger.UF_Error("UpdateActiveEntity: Get Null Node<IEntityHnadle> in Update,IEntityHnadle has benn Destroyed out of EntityManager");
         return(false);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 异步创建实体
        /// </summary>
        public int UF_AsyncCreate(string name, DelegateObject callback)
        {
            IEntityHnadle val = m_PoolEntitys.UF_Pop(name);

            if (val != null)
            {
                UF_ActiveEntity(val);
                if (callback != null)
                {
                    callback(val as Object);
                }
                return(0);
            }

            //异步加载
            return(AssetSystem.UF_GetInstance().UF_AsyncLoadObject(name,
                                                                   (param) => {
                if (param == null)
                {
                    Debugger.UF_Error(string.Format("Create Entity[{0}] Failed,Entity Asset Not Exist!", name));
                    if (callback != null)
                    {
                        callback(null);
                    }
                    return;
                }
                GameObject entityGo = param as GameObject;
                if (entityGo == null)
                {
                    Debugger.UF_Error(string.Format("Create Entity[{0}] Failed,Asset Entity Is Not GameObject Type!", name));
                    if (callback != null)
                    {
                        callback(null);
                    }
                    return;
                }
                IEntityHnadle entity = entityGo.GetComponent <IEntityHnadle>();
                if (entity == null)
                {
                    Debugger.UF_Error(string.Format("Create Entity[{0}] Failed,GameObject Count Not Find IEntityHnadle Component!", name));
                    if (callback != null)
                    {
                        callback(null);
                    }
                    return;
                }
                if (entity is IOnAwake)
                {
                    (entity as IOnAwake).UF_OnAwake();
                }
                UF_ActiveEntity(entity);
                if (callback != null)
                {
                    callback(entity as Object);
                }
            }
                                                                   ));
        }
Exemplo n.º 6
0
 public void UF_RemoveAtla(string atlaName)
 {
     if (m_DicAtlaSets.ContainsKey(atlaName))
     {
         AssetUIAtlas atlas = m_DicAtlaSets [atlaName];
         m_DicAtlaSets.Remove(atlaName);
         UnityEngine.Object.Destroy(atlas);
         //释放AB引用
         AssetSystem.UF_GetInstance().UF_RelaseRef(atlaName);
     }
 }
Exemplo n.º 7
0
 //清除全部实体对象
 public void UF_ClearAll()
 {
     m_ListActive.UF_NForeach((entity) => {
         AssetSystem.UF_GetInstance().UF_DestroyObject(entity as Object);
         return(false);
     });
     m_PoolEntitys.UF_NForeach((entity) => {
         AssetSystem.UF_GetInstance().UF_DestroyObject(entity as Object);
         return(false);
     });
 }
Exemplo n.º 8
0
        //清除全部图集
        public void UF_ClearAtla()
        {
            List <AssetUIAtlas> listTmp = new List <AssetUIAtlas>(m_DicAtlaSets.Values);

            m_DicAtlaSets.Clear();
            for (int k = 0; k < listTmp.Count; k++)
            {
                listTmp[k].Dispose();
                //释放AB引用
                AssetSystem.UF_GetInstance().UF_RelaseRef(listTmp[k].name);
            }
        }
Exemplo n.º 9
0
        public Object UF_LoadRefObject <T>(string objName, bool retain)
        {
            var retVal = UF_GetRefObject(objName, retain);

            if (retVal == null)
            {
                retVal = AssetSystem.UF_GetInstance().UF_LoadObjectImage(objName);
                if (retVal != null && retVal is T)
                {
                    if (retain)
                    {
                        UF_RetainRef(retVal);
                    }
                }
            }
            return(retVal);
        }
Exemplo n.º 10
0
        void Awake()
        {
            try{
                DontDestroyOnLoad(this);
                s_GameMaim = this;
                s_Root     = this.gameObject;

                FrameHandle.UF_AddHandle(Debugger.UF_GetInstance());
                //System
                FrameHandle.UF_AddHandle(MessageSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(UpgradeSystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(NetworkSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(AssetSystem.UF_GetInstance());
                FrameHandle.UF_AddHandle(CEntitySystem.UF_GetInstance());
                //FrameHandle.UF_AddHandle(LuaFramework.UF_GetInstance());
                //manager
                FrameHandle.UF_AddHandle(PDataManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(ShaderManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(AudioManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(UIManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(FXManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(NavigateManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(MotionManager.UF_GetInstance());
                //FrameHandle.UF_AddHandle(PerformActionManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RaycastManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(VoiceManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RenderPreviewManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(RefObjectManager.UF_GetInstance());
                FrameHandle.UF_AddHandle(CheckPointManager.UF_GetInstance());

                FrameHandle.UF_AddHandle(SimulationManager.Instance);

                //setting
                GTime.FrameRate     = 60;
                GTime.FixedTimeRate = 0.016f;
                GTime.RunDeltaTime  = 0.016f;

                Screen.sleepTimeout = SleepTimeout.NeverSleep;
                VendorSDK.UF_Init();

                //VestBinder.Bind();
            }
            catch (System.Exception e) {
                Debugger.UF_Exception(e);
            }
        }
Exemplo n.º 11
0
        IEnumerator UF_CoGameReboot()
        {
            Debugger.UF_Log("GameMain Reboot Begain");
            yield return(null);

            FrameHandle.UF_OnReset();
            yield return(null);

            CEntitySystem.UF_GetInstance().UF_ClearAll();
            yield return(null);

            AssetSystem.UF_GetInstance().UF_ClearAll(true);
            Debugger.UF_Log("GameMain Reboot Over");
            yield return(null);

            System.GC.Collect();
            yield return(null);

            UF_GameStart();
        }
Exemplo n.º 12
0
 internal AssetUIAtlas UF_GetAtlas(string atlaName)
 {
     atlaName = atlaName.ToLower();
     if (m_DicAtlaSets.ContainsKey(atlaName))
     {
         return(m_DicAtlaSets [atlaName]);
     }
     else
     {
         AssetUIAtlas atlas = AssetSystem.UF_GetInstance().UF_LoadObjectImage(atlaName) as AssetUIAtlas;
         //设置AB引用
         AssetSystem.UF_GetInstance().UF_RetainRef(atlaName);
         if (atlas == null)
         {
             Debugger.UF_Warn(string.Format("This UIAlta[ {0} ] you want to load is Null", atlaName));
         }
         else
         {
             m_DicAtlaSets.Add(atlaName, atlas);
         }
         return(atlas);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 同步创建实体
        /// </summary>
        public IEntityHnadle UF_Create(string name)
        {
            //再回收池中查找
            IEntityHnadle entity = m_PoolEntitys.UF_Pop(name);

            if (entity != null)
            {
                UF_ActiveEntity(entity);
                return(entity);
            }

            //加载创建新的实例
            entity = AssetSystem.UF_GetInstance().UF_LoadObjectComponent <IEntityHnadle> (name);
            if (entity != null)
            {
                if (entity is IOnAwake)
                {
                    (entity as IOnAwake).UF_OnAwake();
                }
                UF_ActiveEntity(entity);
            }

            return(entity);
        }
Exemplo n.º 14
0
        public void UF_DrawInfo(Rect rect)
        {
            if (m_CurrentTag == TAG_INFO_ENTITY)
            {
                GUILayout.BeginHorizontal();
                var sb = StrBuilderCache.Acquire();
                sb.AppendLine(string.Format("== Active Count: {0} ==", CEntitySystem.UF_GetInstance().ActiveCount));
                sb.AppendLine();
                sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetActiveEntityInfo());
                GUI.color = Color.green;
                GUILayout.Box(sb.ToString());

                sb.Clear();
                sb.AppendLine(string.Format("== Pool Count: {0} ==", CEntitySystem.UF_GetInstance().PoolCount));
                sb.AppendLine();
                sb.AppendLine(CEntitySystem.UF_GetInstance().UF_GetPoolEntityInfo());
                GUI.color = Color.white;
                GUILayout.Box(sb.ToString());
                StrBuilderCache.Release(sb);
                GUILayout.EndHorizontal();
            }
            else if (m_CurrentTag == TAG_INFO_AB)
            {
                GUILayout.Label("Total Count: " + AssetSystem.UF_GetInstance().count);
                GUILayout.Box(AssetSystem.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_LOAD_TRACK)
            {
                if (Debugger.UF_GetInstance().MsgTrackers.ContainsKey(Debugger.TRACK_RES_LOAD))
                {
                    MsgTracker tracker = Debugger.UF_GetInstance().MsgTrackers[Debugger.TRACK_RES_LOAD];
                    GUILayout.Box(tracker.UF_ForeachToString(UF_TrackMsgForeach));
                }
            }
            else if (m_CurrentTag == TAG_UI)
            {
                var lastAlignment = GUI.skin.box.alignment;
                GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                GUILayout.Box(UIManager.UF_GetInstance().ToString());
                GUI.skin.box.alignment = lastAlignment;
            }
            else if (m_CurrentTag == TAG_RefObject)
            {
                GUILayout.Box(RefObjectManager.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_AUDIO)
            {
                GUILayout.Box(AudioManager.UF_GetInstance().ToString());
            }
            else if (m_CurrentTag == TAG_SHADER)
            {
                GUILayout.Box(ShaderManager.UF_GetInstance().UF_GetShadersInfo());
            }
            else if (m_CurrentTag == TAG_ASSETDB)
            {
                int countBundle   = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Bundle);
                int countRebundle = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Rebundle);
                int countRuntimes = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.Runtimes);
                int countNone     = AssetDataBases.UF_GetAssetInfoCount(AssetDataBases.AssetFileType.None);

                GUILayout.Box(string.Format("Bundle-> {0}", countBundle));
                GUILayout.Box(string.Format("Runtime-> {0}", countRuntimes));
                GUILayout.Box(string.Format("Rebundle-> {0}", countRebundle));
                GUILayout.Box(string.Format("None-> {0}", countNone));
            }
        }