void OnEnable()
    {
        win = this;
        ResourcesConfigManager.Initialize();

        m_currentSelectIndex = 0;
        EditorGUIStyleData.Init();

        FindAllDataName();
        LoadEditorConfig();
        LoadConfig();

        if (treeViewState == null)
        {
            treeViewState = new TreeViewState();
        }

        treeView = new FolderTreeView(treeViewState);

        treeView.SetData(s_languageFullKeyList);
        treeView.dblclickItemCallBack = ModuleFileDblclickItemCallBack;
        treeView.selectCallBack       = ModuleFileFolderSelectCallBack;
    }
Пример #2
0
    public static void DisposeOne()
    {
        removeItems.Clear();

        foreach (var item in recycleAssets)
        {
            if (ResourcesConfigManager.GetIsExitRes(item.name))
            {
                ResourceManager.UnLoad(item.name);
                removeItems.Add(item);
                break;
            }
            else
            {
                removeItems.Add(item);
            }
        }

        foreach (var item in removeItems)
        {
            recycleAssets.Remove(item);
        }
    }
Пример #3
0
        public void ResourcesFieldTest()
        {
            ResourcesConfigManager.Initialize();

            Type[] types = Assembly.Load("Assembly-CSharp").GetTypes();

            for (int i = 0; i < types.Length; i++)
            {
                //Attribute.GetCustomAttribute(types,typeof(ResourcesFieldAttribute));

                //for (int j = 0; j < types.; j++)
                //{

                //}

                //if (types[i].IsSubclassOf(typeof(IApplicationStatus)))
                //{
                //    listTmp.Add(types[i].Name);
                //}
            }


            //Assert.AreEqual(isExist, true);
        }
Пример #4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        ImageLoadComponent component = (ImageLoadComponent)target;

        if (string.IsNullOrEmpty(component.iconName))
        {
            EditorGUILayout.HelpBox("不能为空!!!", MessageType.Error);

            return;
        }

        //ResourcesConfigManager.Initialize();
        if (!ResourcesConfigManager.GetIsExitRes(component.iconName))
        {
            EditorGUILayout.HelpBox("没有资源!!!", MessageType.Error);
            return;
        }
        //  if (GUI.changed)
        {
            Image image = component.LoadImage();
            image.sprite = null;
        }
    }
Пример #5
0
    public static void LoadAsync(string name, Type resType, CallBack <Object> callBack)
    {
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);

        loadAssetsController.LoadAsync(path, resType, callBack);
    }
Пример #6
0
 public static bool GetResourceIsExist(string name)
 {
     return(ResourcesConfigManager.GetIsExitRes(name));
 }
Пример #7
0
    public static void Release(string name)
    {
        string path = ResourcesConfigManager.GetLoadPath(loadType, name);

        loadAssetsController.Release(path);
    }
Пример #8
0
    /// <summary>
    /// 更新文件
    /// </summary>
    /// <returns></returns>
    static IEnumerator DownLoadFile()
    {
        UpdateDateCallBack(HotUpdateStatusEnum.DownLoadingMd5File, GetHotUpdateProgress(true, false, 0));
        //取得服务器版本文件
        WWW www = new WWW(s_Md5FileDownLoadPath);

        Debug.Log("服务器获取MD5文件 :" + s_Md5FileDownLoadPath);
        //yield return www;

        while (!www.isDone)
        {
            UpdateDateCallBack(HotUpdateStatusEnum.DownLoadingMd5File, GetHotUpdateProgress(true, false, www.progress));
            yield return(new WaitForEndOfFrame());
        }

        if (www.error != null && www.error != "")
        {
            //下载失败
            Debug.LogError("MD5 DownLoad Error " + www.error);

            UpdateDateCallBack(HotUpdateStatusEnum.Md5FileDownLoadFail, GetHotUpdateProgress(true, false, 0));
            yield break;
        }

        m_Md5FileCatch = www.text;

        UpdateDateCallBack(HotUpdateStatusEnum.DownLoadingMd5File, GetHotUpdateProgress(true, false, 1));

        ResourcesConfigStruct serviceFileConfig = ResourcesConfigManager.AnalysisResourcesConfig2Struct(www.text);
        ResourcesConfigStruct localFileConfig   = ResourcesConfigManager.AnalysisResourcesConfig2Struct(ResourcesConfigManager.ReadResourceConfigContent());

        s_downLoadList = new List <ResourcesConfig>();

        CheckBundleList(serviceFileConfig.relyList, localFileConfig.relyList);
        CheckBundleList(serviceFileConfig.bundleList, localFileConfig.bundleList);

        yield return(StartDownLoad());
    }
    void OnGUI()
    {
        titleContent.text = "打包设置编辑器";

        UpdateRelyPackageNames();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("过滤器:");

        RelyMaskFilter = EditorGUILayout.MaskField(RelyMaskFilter, RelyPackageNames);
        bundleQuery    = EditorGUILayout.TextField("", bundleQuery);
        EditorGUILayout.EndHorizontal();

        scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(false));

        isFoldRelyPackages = EditorGUILayout.Foldout(isFoldRelyPackages, "依赖包:");
        if (isFoldRelyPackages)
        {
            //依赖包视图
            RelyPackagesView();

            EditorGUILayout.Space();
        }

        EditorGUI.indentLevel = 0;
        isFoldBundles         = EditorGUILayout.Foldout(isFoldBundles, "AssetsBundle:");
        if (isFoldBundles)
        {
            //bundle包视图
            BundlesView();
        }
        GUILayout.EndScrollView();

        LogsScrollPos = GUILayout.BeginScrollView(LogsScrollPos, GUILayout.ExpandHeight(true));

        EditorGUI.indentLevel = 0;
        isFoldLog             = EditorGUILayout.Foldout(isFoldLog, "提示信息:");
        if (isFoldLog)
        {
            //提示信息视图
            LogView();
        }

        GUILayout.EndScrollView();

        EditorGUI.indentLevel = 0;
        GUILayout.BeginHorizontal();

        checkMaterial = EditorGUILayout.Toggle("检查材质球和贴图", checkMaterial);

        GUILayout.EndHorizontal();

        HotUpdateConfigGUI();

        if (GUILayout.Button("检查依赖关系"))
        {
            CheckPackage();
        }

        if (GUILayout.Button("生成并保存编辑器文件"))
        {
            CreatePackageFile();                //保存编辑器文件
            CheckAndCreatBundelPackageConfig(); //生成资源路径文件
        }

        if (GUILayout.Button("重新生成资源路径文件"))
        {
            ResourcesConfigManager.CreateResourcesConfig();
        }
        if (GUILayout.Button("Create Bundle Names"))
        {
            //自动设置打包信息
            SetAssetsInfo();
        }
        if (GUILayout.Button("5.0 打包"))
        {
            NewPackage();
        }

        GUILayout.BeginHorizontal();

        VersionService.LargeVersion = EditorGUILayout.IntField("large", VersionService.LargeVersion);
        VersionService.SmallVersion = EditorGUILayout.IntField("small", VersionService.SmallVersion);

        if (GUILayout.Button("保存版本文件"))
        {
            VersionService.CreateVersionFile();
        }

        GUILayout.EndHorizontal();

        if (isContent)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(messageContent);

            if (GUILayout.Button("关闭"))
            {
                isContent      = false;
                messageContent = "";
            }

            if (errorCount != 0 || warnCount != 0)
            {
                if (GUILayout.Button("清除"))
                {
                    isContent      = false;
                    messageContent = "";

                    ClearCheckLog();
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        if (isProgress)
        {
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUI.ProgressBar(new Rect(3, position.height - 22, position.width - 6, 18), progress, progressContent);
        }
    }
 //生成游戏中使用的配置文件
 public void CreatBundelPackageConfig()
 {
     ResourcesConfigManager.CreateResourcesConfig();
 }
Пример #11
0
 public static bool GetIsExistData(string DataName)
 {
     return ResourcesConfigManager.GetIsExitRes(DataName);
 }
Пример #12
0
    /// <summary>
    /// 异步加载一个bundle
    /// </summary>
    /// <param name="bundleName">bundle名</param>
    public static void LoadBundleAsync(string bundleName, BundleLoadCallBack callBack)
    {
        ResourcesConfig configTmp = ResourcesConfigManager.GetBundleConfig(bundleName);

        if (configTmp == null)
        {
            Debug.LogError("LoadBundleAsync: " + bundleName + " dont exist!");
            return;
        }

        string path = GetBundlePath(configTmp);

        LoadState state = new LoadState();

        int LoadCount = 0;

        if (configTmp.relyPackages.Length > 0 && configTmp.relyPackages[0] != "")
        {
            //先加载依赖包
            for (int i = 0; i < configTmp.relyPackages.Length; i++)
            {
                if (configTmp.relyPackages[i] != "")
                {
                    LoadRelyBundleAsync(configTmp.relyPackages[i], (LoadState relyLoadState, RelyBundle RelyBundle) =>
                    {
                        if (RelyBundle != null && relyLoadState.isDone)
                        {
                            LoadCount++;
                            state.progress += 1 / ((float)configTmp.relyPackages.Length + 1);
                        }

                        //所有依赖包加载完毕加载资源包
                        if (LoadCount == configTmp.relyPackages.Length)
                        {
                            ResourceIOTool.AssetsBundleLoadAsync(path, (LoadState bundleLoadState, AssetBundle bundle) =>
                            {
                                if (bundleLoadState.isDone)
                                {
                                    callBack(LoadState.CompleteState, AddBundle(bundleName, bundle));
                                }
                                else
                                {
                                    state.progress += bundleLoadState.progress / ((float)configTmp.relyPackages.Length + 1);
                                    callBack(state, null);
                                }
                            });
                        }
                        else
                        {
                            callBack(state, null);
                        }
                    });
                }
            }
        }
        else
        {
            ResourceIOTool.AssetsBundleLoadAsync(path, (LoadState bundleLoadState, AssetBundle bundle) =>
            {
                if (bundleLoadState.isDone)
                {
                    callBack(LoadState.CompleteState, AddBundle(bundleName, bundle));
                }
                else
                {
                    state.progress += bundleLoadState.progress / ((float)configTmp.relyPackages.Length + 1);
                    callBack(state, null);
                }
            });
        }
    }
 public override void OnEnterStatus()
 {
     ResourcesConfigManager.Initialize();
     UIManager.Init();
 }
Пример #14
0
 public static bool GetIsExistConfig(string ConfigName)
 {
     return(ResourcesConfigManager.GetIsExitRes(ConfigName));
 }
        public void SameMsgTest_1()
        {
            ResourcesConfigManager.Initialize();
            WorldManager.IntervalTime = 100;

            LockStepEntityTestWorld world = (LockStepEntityTestWorld)WorldManager.CreateWorld <LockStepEntityTestWorld>();

            world.IsClient = true;
            world.IsStart  = true;
            world.IsLocal  = true;

            ConnectStatusComponent csc = world.GetSingletonComp <ConnectStatusComponent>();

            csc.confirmFrame = 0; //从目标帧之后开始计算

            SelfComponent sc = new SelfComponent();

            EntityBase c1 = world.CreateEntityImmediately("1", sc);

            LockStepInputSystem.commandCache.moveDir.x = 0;

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);
            TestMoveComponent mc = c1.GetComp <TestMoveComponent>();

            Assert.AreEqual(0, mc.pos.x);

            LockStepInputSystem.commandCache.moveDir.x = 1000;

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            mc = c1.GetComp <TestMoveComponent>();

            Assert.AreEqual(1000, mc.pos.x);

            TestCommandComponent cmd = new TestCommandComponent();

            cmd.frame     = 1;
            cmd.id        = 1;
            cmd.moveDir.x = 1000;
            GlobalEvent.DispatchTypeEvent(cmd);

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            mc = c1.GetComp <TestMoveComponent>();

            Assert.AreEqual(1000, mc.pos.x);

            SameCommand sameMsg = new SameCommand();

            sameMsg.id    = 1;
            sameMsg.frame = 2;

            GlobalEvent.DispatchTypeEvent(sameMsg);

            mc = c1.GetComp <TestMoveComponent>();

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);
            mc = c1.GetComp <TestMoveComponent>();


            Assert.AreEqual(0, mc.pos.x);
        }
        public void EnityRollBackTest_4()
        {
            WorldManager.IntervalTime = 100;

            ResourcesConfigManager.Initialize();

            LockStepEntityTestWorld world = (LockStepEntityTestWorld)WorldManager.CreateWorld <LockStepEntityTestWorld>();

            world.IsClient = true;
            world.IsStart  = true;
            world.IsLocal  = true;

            ConnectStatusComponent csc = world.GetSingletonComp <ConnectStatusComponent>();

            csc.confirmFrame = 0; //从目标帧之后开始计算

            PlayerComponent pc = new PlayerComponent();
            SelfComponent   sc = new SelfComponent();

            /*EntityBase c1 = */ world.CreateEntityImmediately("1", pc, sc);

            int createFrame  = -1;
            int destroyFrame = -1;

            string tmp = (1 + "FireObject" + 1);
            int    id  = tmp.ToHash();

            string tmp2 = (2 + "FireObject" + 1);
            int    id2  = tmp2.ToHash();

            world.OnEntityOptimizeCreated += (entity) =>
            {
                //Debug.Log("OnEntityCreate " + entity.ID + " frame " + world.FrameCount);

                if (entity.ID == id2)
                {
                    createFrame = world.FrameCount;
                }
            };

            world.OnEntityOptimizeDestroyed += (entity) =>
            {
                if (entity.ID == id2)
                {
                    destroyFrame = world.FrameCount;
                }
            };

            Assert.AreEqual(false, world.GetEntityIsExist(id));  //没执行前不存在这个对象
            Assert.AreEqual(false, world.GetEntityIsExist(id2)); //没执行前不存在这个对象

            LockStepInputSystem.commandCache.isFire = true;

            world.CallRecalc();
            world.FixedLoop(WorldManager.IntervalTime);

            //id1 存在 id2 不存在
            Assert.AreEqual(true, world.GetEntityIsExist(id));
            Assert.AreEqual(false, world.GetEntityIsExist(id2));

            LockStepInputSystem.commandCache.isFire = false;

            for (int i = 0; i < 10; i++)
            {
                world.CallRecalc();
                world.FixedLoop(WorldManager.IntervalTime);
            }

            TestCommandComponent cmd = new TestCommandComponent();

            cmd.frame  = 1;
            cmd.id     = 1;
            cmd.isFire = false;
            GlobalEvent.DispatchTypeEvent(cmd);

            cmd        = new TestCommandComponent();
            cmd.frame  = 2;
            cmd.id     = 1;
            cmd.isFire = true;
            GlobalEvent.DispatchTypeEvent(cmd);

            world.CallRecalc();

            //id2 不存在 id1 不存在
            Assert.AreEqual(false, world.GetEntityIsExist(id2));
            Assert.AreEqual(false, world.GetEntityIsExist(id));

            Assert.AreEqual(-1, createFrame);  //应该不派发
            Assert.AreEqual(-1, destroyFrame); //不派发
        }