Ejemplo n.º 1
0
        private void LoadMessages()
        {
            _log?.LogInformation("Loading message assets...");
            var json = _resourceLoader.LoadAsset("messages.json");

            _messages = JsonConvert.DeserializeObject <Dictionary <int, Message> >(json);
        }
Ejemplo n.º 2
0
        public object LoadAsset(string assetPath, LoadMode mode)
        {
            if (string.IsNullOrEmpty(assetPath))
            {
                throw new ArgumentNullException("invalid path");
            }
            string absolutePath      = GetAbsolutePath(assetPath, mode);
            string assetName         = Path.GetFileNameWithoutExtension(absolutePath);
            string internalAssetName = GetInternalAssetName(absolutePath, assetName);

            while (true)
            {
                LoadAssetInfo info = GetLoadingAssetInfo(absolutePath, assetName);
                if (info == null)
                {
                    break;
                }
            }

            if (m_Holder.HasAsset(internalAssetName))
            {
                return(m_Holder.GetAsset(internalAssetName));
            }

            object asset = m_Loader.LoadAsset(absolutePath, mode);

            m_Holder.AddAsset(internalAssetName, asset);
            return(asset);
        }
Ejemplo n.º 3
0
        public override void OnInitialize(IResourceLoader loader, params object[] pars)
        {
            m_ResLoader = loader;
            m_RootGo    = GameObject.Instantiate(loader.LoadAsset("Prefabs/UI/", "UIRoot")) as GameObject;
            m_RootTrans = m_RootGo.transform;
            m_Camera    = m_RootGo.GetComponentInChildren <Camera>();
            m_Canvas    = m_RootGo.GetComponentInChildren <Canvas>();

            m_GroupUIs  = new List <IUserInterface>();
            m_SingleUIs = new List <IUserInterface>();
            m_HUDs      = new List <IUserInterface>();

            //注册监听按钮事件
            InputSystem.Instance.AddInputEvent(HandleInput, InputConst.INPUT_PRIORITY_UI);
        }
Ejemplo n.º 4
0
 public AssetGetter LoadAsset(string assetPath)
 {
     return(resLoader.LoadAsset(assetPath));
 }
Ejemplo n.º 5
0
        private void LoadFromJsonFile()
        {
            var json = _resourceLoader.LoadAsset("items.json");

            _items = JsonConvert.DeserializeObject <List <Item> >(json);
        }
Ejemplo n.º 6
0
        private void LoadFromJsonFile()
        {
            var json = _resourceLoader.LoadAsset("locations.json");

            _locations = JsonConvert.DeserializeObject <Dictionary <int, Location> >(json);
        }