示例#1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        AudioButtonClickComponent component = (AudioButtonClickComponent)target;

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

            return;
        }

        ResourcesConfigManager.Initialize();
        if (!ResourcesConfigManager.GetIsExitRes(component.audioName))
        {
            EditorGUILayout.HelpBox("没有资源!!!", MessageType.Error);
            return;
        }
        if (GUILayout.Button("Play", GUILayout.Height(60)))
        {
            AudioClip clip = ResourceManager.Load <AudioClip>(component.audioName);
            AudioEditorUtils.PlayClip(clip);
        }
    }
示例#2
0
        public void BundleConfigExistTest()
        {
            //只要初始化成功则通过
            ResourcesConfigManager.Initialize();

            Assert.AreEqual(true, true);
        }
        public void BundleConfigExistTest()
        {
            ResourcesConfigManager.Initialize();

            bool isExist = ConfigManager.GetIsExistConfig(ResourcesConfigManager.c_ManifestFileName);

            Assert.AreEqual(isExist, true);
        }
示例#4
0
    void OnEnable()
    {
        ResourcesConfigManager.Initialize();
        EditorGUIStyleData.Init();
        m_currentSchemeData  = SDKManager.LoadGameSchemeConfig();
        m_currentSelectIndex = GetCurrentSelectIndex();

        CreateReadMe();
    }
        public void SingleComponentValueRollbackTest()
        {
            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);

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

            TestSingleComponent tc = world.GetSingletonComp <TestSingleComponent>();

            Assert.AreEqual(0, tc.testValue);

            TestCommandComponent cmd = new TestCommandComponent();

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

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

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(1, tc.testValue);

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

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(1, tc.testValue);

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

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

            tc = world.GetSingletonComp <TestSingleComponent>();
            Assert.AreEqual(2, tc.testValue);
        }
示例#6
0
    //static List<ResourcesConfig> s_deleteList = new List<ResourcesConfig>();

    static IEnumerator StartDownLoad()
    {
        Debug.Log("下载服务器文件到本地");

        UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(0)));

        RecordTable hotupdateData = RecordManager.GetData(c_HotUpdateRecordName);

        for (int i = 0; i < s_downLoadList.Count; i++)
        {
            string md5Tmp = hotupdateData.GetRecord(s_downLoadList[i].name, "null");

            if (md5Tmp == s_downLoadList[i].md5)
            {
                //该文件已更新完毕
                UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i)));
            }
            else
            {
                string downloadPath = s_resourcesFileDownLoadPath + s_downLoadList[i].path + "." + AssetsBundleManager.c_AssetsBundlesExpandName;

                WWW www = new WWW(downloadPath);
                yield return(www);

                if (www.error != null && www.error != "")
                {
                    Debug.LogError("下载出错! " + downloadPath + " " + www.error);
                    UpdateDateCallBack(HotUpdateStatusEnum.UpdateFail, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i)));

                    yield break;
                }
                else
                {
                    Debug.Log("下载成功! " + downloadPath);

                    ResourceIOTool.CreateFile(Application.persistentDataPath + "/" + s_downLoadList[i].path + "." + AssetsBundleManager.c_AssetsBundlesExpandName, www.bytes);
                    RecordManager.SaveRecord(c_HotUpdateRecordName, s_downLoadList[i].name, s_downLoadList[i].md5);

                    UpdateDateCallBack(HotUpdateStatusEnum.Updating, GetHotUpdateProgress(true, true, GetDownLoadFileProgress(i)));
                }
            }
        }

        //保存版本信息
        //保存文件信息
        ResourceIOTool.WriteStringByFile(PathTool.GetAbsolutePath(ResLoadLocation.Persistent, HotUpdateManager.c_versionFileName + "." + ConfigManager.c_expandName), m_versionFileCatch);
        ResourceIOTool.WriteStringByFile(PathTool.GetAbsolutePath(ResLoadLocation.Persistent, ResourcesConfigManager.c_ManifestFileName + "." + ConfigManager.c_expandName), m_Md5FileCatch);

        //从stream读取配置
        RecordManager.SaveRecord(c_HotUpdateRecordName, c_useHotUpdateRecordKey, true);

        UpdateDateCallBack(HotUpdateStatusEnum.UpdateSuccess, 1);

        //重新生成资源配置
        ResourcesConfigManager.Initialize();
    }
示例#7
0
        public void UIManagerLoadTest()
        {
            ResourcesConfigManager.Initialize();

            GameObject manager = GameObjectManager.CreateGameObject("UIManager");

            Assert.AreNotEqual(manager.GetComponent <UILayerManager>(), null);
            Assert.AreNotEqual(manager.GetComponent <UIAnimManager>(), null);
            Assert.AreNotEqual(manager.GetComponentInChildren <Camera>(), null);
        }
示例#8
0
        public void ValueRollbackTest()
        {
            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();
            RealPlayerComponent rp = new RealPlayerComponent();
            EntityBase          c1 = world.CreateEntityImmediately("Test", sc, rp);

            LockStepInputSystem.commandCache.moveDir.x = FixedMath.Create(1000);

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

            LockStepInputSystem.commandCache.moveDir.x = FixedMath.Create(0000);

            MoveComponent mc = c1.GetComp <MoveComponent>();

            //Debug.Log("mc.pos.x " + mc.pos.x + " frame " + world.FrameCount);

            Assert.AreEqual(399, mc.pos.x.ToInt());

            CommandComponent cmd = new CommandComponent();

            cmd.frame = 1;
            cmd.id    = c1.ID;
            GlobalEvent.DispatchTypeEvent(cmd);

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

            mc = c1.GetComp <MoveComponent>();
            //Debug.Log("mc.pos.x " + mc.pos.x + " frame " + world.FrameCount);

            for (int i = 0; i < 10; i++)
            {
                world.CallRecalc();
                world.FixedLoop(WorldManager.IntervalTime);
                mc = c1.GetComp <MoveComponent>();
                //Debug.Log("mc.pos.x " + mc.pos.x + " frame " + world.FrameCount);
            }

            Assert.AreEqual(0, mc.pos.x.ToInt());
        }
    void OnEnable()
    {
        ResourcesConfigManager.Initialize();

        m_currentSelectIndex = 0;
        EditorGUIStyleData.Init();

        FindAllDataName();
        LoadEditorConfig();
        LoadConfig();
    }
示例#10
0
    void OnEnable()
    {
        m_filePath = Application.dataPath + "/SDKPath";

        ResourcesConfigManager.Initialize();
        EditorGUIStyleData.Init();

        LoadSchemeConfig();

        CreateSDKFile();
    }
示例#11
0
    private object DrawTextureGUI(string text, object value)
    {
        if (editTextureValue != null)
        {
            value            = editTextureValue;
            editTextureValue = null;
        }

        GUILayout.BeginHorizontal();
        value = EditorDrawGUIUtil.DrawBaseValue(text, value);
        if (GUILayout.Button("o", GUILayout.Width(20)))
        {
            ObjectSelectorWindow.Show(GeneralDataModificationWindow.GetInstance(), value.ToString(),
                                      new string[] { "Assets/Resources" },
                                      typeof(GameObject),
                                      (assetName, obj) =>
            {
                editTextureValue = assetName;
            }
                                      );
        }
        GUILayout.EndHorizontal();
        string content = value.ToString();
        bool   isHave  = false;

        try
        {
            ResourcesConfigManager.Initialize();
            if (ResourcesConfigManager.GetIsExitRes(content))
            {
                Texture2D obj = ResourceManager.Load <Texture2D>(content);
                if (obj)
                {
                    if (obj != previewTex)
                    {
                        previewEditor1 = Editor.CreateEditor(obj);
                        previewTex     = obj;
                    }

                    previewEditor1.OnPreviewGUI(GUILayoutUtility.GetRect(300, 300), EditorStyles.helpBox);
                    isHave = true;
                }
            }
        }
        catch { }

        if (!isHave)
        {
            EditorGUILayout.HelpBox("没有图片 [" + value + "] !!", MessageType.Error);
        }

        return(value);
    }
    void OnEnable()
    {
        ResourcesConfigManager.Initialize();

        m_currentSelectIndex = 0;
        EditorGUIStyleData.Init();

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

        configFileNames.Clear();
        string m_directoryPath = Application.dataPath + "/Resources/" + DataManager.c_directoryName;

        configFileNames.AddRange(PathUtils.GetDirectoryFileNames(m_directoryPath, new string[] { ".txt" }, false, false));
    }
示例#13
0
    /// <summary>
    /// 程序启动
    /// </summary>
    public void AppLaunch()
    {
        DontDestroyOnLoad(gameObject);
        SetResourceLoadType();               //设置资源加载类型
        ResourcesConfigManager.Initialize(); //资源路径管理器启动

        MemoryManager.Init();                //内存管理初始化
        Timer.Init();                        //计时器启动
        InputManager.Init();                 //输入管理器启动

#if !UNITY_WEBGL
        UIManager.Init();                    //UIManager启动
#else
        UIManager.InitAsync();               //异步加载UIManager
#endif

        ApplicationStatusManager.Init();     //游戏流程状态机初始化
        GlobalLogicManager.Init();           //初始化全局逻辑

        if (AppMode != AppMode.Release)
        {
            GUIConsole.Init(); //运行时Console

            DevelopReplayManager.OnLunchCallBack += () =>
            {
#if USE_LUA
                LuaManager.Init();
#endif
                InitGlobalLogic();                                 //全局逻辑
                ApplicationStatusManager.EnterTestModel(m_Status); //可以从此处进入测试流程
            };

            DevelopReplayManager.Init(m_quickLunch);   //开发者复盘管理器
        }
        else
        {
            Log.Init(false); //关闭 Debug

#if USE_LUA
            LuaManager.Init();
#endif
            InitGlobalLogic();                              //全局逻辑
            ApplicationStatusManager.EnterStatus(m_Status); //游戏流程状态机,开始第一个状态
        }
    }
示例#14
0
    /// <summary>
    /// 程序启动
    /// </summary>
    public void AppLaunch()
    {
        DontDestroyOnLoad(gameObject);
        SetResourceLoadType();               //设置资源加载类型
        ResourcesConfigManager.Initialize(); //资源路径管理器启动

        MemoryManager.Init();                //内存管理初始化
        HeapObjectPool.Init();
        Timer.Init();                        //计时器启动
        InputManager.Init();                 //输入管理器启动
        UIManager.Init();                    //UIManager启动

        ApplicationStatusManager.Init();     //游戏流程状态机初始化
        GlobalLogicManager.Init();           //初始化全局逻辑

        if (m_AppMode != AppMode.Release)
        {
            GUIConsole.Init(); //运行时Console

            DevelopReplayManager.OnLunchCallBack += () =>
            {
                if (m_useLua)
                {
                    LuaManager.Init();
                }

                InitGlobalLogic();                                 //全局逻辑
                ApplicationStatusManager.EnterTestModel(m_Status); //可以从此处进入测试流程
            };

            DevelopReplayManager.Init(m_quickLunch);   //开发者复盘管理器
        }
        else
        {
            Log.Init(false); //关闭 Debug

            if (m_useLua)
            {
                LuaManager.Init();
            }

            InitGlobalLogic();                              //全局逻辑
            ApplicationStatusManager.EnterStatus(m_Status); //游戏流程状态机,开始第一个状态
        }
    }
示例#15
0
    /// <summary>
    /// 程序启动
    /// </summary>
    public void AppLaunch()
    {
        DontDestroyOnLoad(this);
        SetResourceLoadType();               //设置资源加载类型
        ResourcesConfigManager.Initialize(); //资源路径管理器启动

        InputManager.Init();                 //输入管理器启动
        UIManager.Init();                    //UIManager启动

        ApplicationStatusManager.Init();     //游戏流程状态机初始化

        //初始化全局逻辑
        GlobalLogicManager.Init();

        if (m_AppMode != AppMode.Release)
        {
            GUIConsole.Init(); //运行时Console

            DevelopReplayManager.OnLunchCallBack += () =>
            {
                LuaManager.Init();
                InitGlobalLogic();                                 //全局逻辑
                ApplicationStatusManager.EnterTestModel(m_Status); //可以从此处进入测试流程
            };

            DevelopReplayManager.Init(m_quickLunch);   //开发者复盘管理器
        }
        else
        {
            Log.Init(false); //关闭 Debug

            LuaManager.Init();
            //全局逻辑
            InitGlobalLogic();
            //游戏流程状态机,开始第一个状态
            ApplicationStatusManager.EnterStatus(m_Status);
        }
    }
    private void Init()
    {
        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;
    }
示例#17
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;
        }
    }
        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);
        }
        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 override void OnEnterStatus()
 {
     ResourcesConfigManager.Initialize();
     UIManager.Init();
 }
        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); //不派发
        }