Ejemplo n.º 1
0
        /// <summary>
        /// We need to check if there are any resources to preload. If we call Load when there is nothing to load an error will be thrown.
        /// </summary>
        /// <returns></returns>
        void BeginPreloading()
        {
            var selectedLocale = LocalizationSettings.SelectedLocale;

            if (selectedLocale == null)
            {
                Debug.LogError("Can not preload when `LocalizationSettings.SelectedLocale` is null.");
                return;
            }

            m_Progress = 0;
            var localeLabel = AddressHelper.FormatAssetLabel(selectedLocale.Identifier);

            m_ResourceKeys.Clear();
            m_ResourceKeys.Add(localeLabel);
            m_ResourceKeys.Add(LocalizationSettings.PreloadLabel);
            m_LoadResourcesOperation = AddressablesInterface.LoadResourceLocationsAsync(m_ResourceKeys, Addressables.MergeMode.Intersection, typeof(TTable));

            if (!m_LoadResourcesOperation.IsDone)
            {
                m_LoadResourcesOperation.Completed += LoadTables;
            }
            else
            {
                LoadTables(m_LoadResourcesOperation);
            }
        }
Ejemplo n.º 2
0
        void FindTableByName(string collectionName)
        {
            m_CollectionName = collectionName;
            var tableAddress = AddressHelper.GetTableAddress(m_CollectionName, m_SelectedLocale.Identifier);

            // Check the table exists
            var tableResourceOp = AddressablesInterface.LoadResourceLocationsAsync(tableAddress, typeof(TTable));

            if (!tableResourceOp.IsDone)
            {
                tableResourceOp.Completed += LoadTableResource;
            }
            else
            {
                LoadTableResource(tableResourceOp);
            }
        }