コード例 #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);
        }
コード例 #2
0
 protected override void OnDestroy()
 {
     RefObjectManager.UF_GetInstance().UF_ReleaseRef(this.texture);
     this.texture         = null;
     m_OnWebTextureLoaded = null;
     base.OnDestroy();
 }
コード例 #3
0
 public void UF_OnStart()
 {
     //加载资源包
     m_PerformPkg = RefObjectManager.UF_GetInstance().UF_LoadRefObject <AssetPerformAction>("obj_perform_action", true) as AssetPerformAction;
     if (m_PerformPkg == null)
     {
         Debugger.UF_Error(string.Format("Can not load perform package"));
     }
 }
コード例 #4
0
        private Texture2D UF_SerializeImageFormBytes(byte[] bytes, string texName)
        {
            Texture2D t2d = new Texture2D(512, 512, TextureFormat.RGB24, false);

            t2d.name = texName;
            t2d.LoadImage(bytes);
            t2d.filterMode = FilterMode.Point;
            //添加引用管理
            RefObjectManager.UF_GetInstance().UF_RetainRef(t2d);
            return(t2d);
        }
コード例 #5
0
ファイル: GameMain.cs プロジェクト: moto2002/FrameLock
        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);
            }
        }
コード例 #6
0
        private void UF_SetRawTexture(Texture2D texture2d)
        {
            if (this.texture == texture2d)
            {
                return;
            }
            if (this.texture != null)
            {
                RefObjectManager.UF_GetInstance().UF_ReleaseRef(this.texture);
            }

            this.texture = texture2d;

            if (texture2d != null)
            {
                RefObjectManager.UF_GetInstance().UF_RetainRef(this.texture);
                if (autoNativeSize)
                {
                    SetNativeSize();
                }
            }
        }
コード例 #7
0
        //载入布局
        public void UF_LoadSceneElementLayout(string dataName)
        {
            UF_ClearSceneElement();
            //var layoutData =  AssetSystem.UF_GetInstance().LoadObjectImageComponent<SecenElementLayout>(dataName);
            AssetSceneLayout layoutData = RefObjectManager.UF_GetInstance().UF_LoadRefObject <AssetSceneLayout>(dataName, false) as AssetSceneLayout;

            if (layoutData != null)
            {
                foreach (var item in layoutData.Data)
                {
                    if (!string.IsNullOrEmpty(item.block))
                    {
                        var element = CEntitySystem.UF_GetInstance().UF_Create <SceneElement>(item.block);
                        if (element != null)
                        {
                            this.UF_AddSceneElement(element, item.x, item.y);
                            //寻路相关值设置
                            UF_SetASGridBlockStateArea(element, item.x, item.y);
                        }
                    }
                }
            }
        }
コード例 #8
0
 public Texture2D UF_LoadTexture(string textureName)
 {
     return(RefObjectManager.UF_GetInstance().UF_LoadRefObject <Texture2D>(textureName, false) as Texture2D);
 }
コード例 #9
0
        public int UF_LoadTextureFromCacheOrDownload(string url, DelegateTexture methodCallback)
        {
            //解析出名字
            string fileName  = Path.GetFileNameWithoutExtension(url);
            string localfile = GlobalPath.TexturePath + fileName;
            //指定的url图片名字转化为本地图片名字
            bool isWebToLocal = false;

            if (string.IsNullOrEmpty(fileName))
            {
                return(0);
            }

            if (methodCallback == null)
            {
                Debug.LogWarning("LoadTextureFromCacheOrDownload with Not Callback, Invoke Method Failed");
                return(0);
            }

            if (m_DicMapWebTextureToLocal.ContainsKey(fileName))
            {
                fileName     = m_DicMapWebTextureToLocal [fileName];
                isWebToLocal = true;
            }

            var tex = RefObjectManager.UF_GetInstance().UF_LoadRefObject <Texture2D>(fileName, false) as Texture2D;

            if (tex != null)
            {
                if (methodCallback != null)
                {
                    methodCallback(tex);
                }
                return(0);
            }

            if (isWebToLocal)
            {
                Texture2D image = UF_LoadTexture(fileName);
                if (image == null)
                {
                    image = UF_LoadTextureLocal(GlobalPath.TexturePath + fileName);
                }
                if (methodCallback != null)
                {
                    methodCallback(image);
                }
                return(0);
            }

            //检查本地是否存在缓存图片
            if (File.Exists(localfile))
            {
                //				Debug.Log ("load form Cache:" + localfile);
                Texture2D t2d = UF_LoadTextureLocal(localfile);
                if (methodCallback != null)
                {
                    methodCallback(t2d);
                }
                return(0);
            }
            else
            {
                //				Debug.Log ("load form Web:" + url);
                if (!m_DicWebTextureRequeset.ContainsKey(fileName))
                {
                    m_DicWebTextureRequeset.Add(fileName, methodCallback);
                }
                else
                {
                    m_DicWebTextureRequeset[fileName] += methodCallback;
                }
                return(FrameHandle.UF_AddCoroutine(UF_ILoadTextureFormWeb(url)));
            }
        }
コード例 #10
0
ファイル: DVBoardAsset.cs プロジェクト: moto2002/FrameLock
        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));
            }
        }