Esempio n. 1
0
        // Signal all sheets in our component list to refresh their data.  Intelligently use the cache ID
        // to only refresh sheets with unique IDs.
        public static void RefreshAll(RefreshAllCompleteDelegate del)
        {
            instance.m_RefreshAllDel = del;
            List <string> refreshedCacheIds = new List <string>();

            var sheets = instance.GetComponentsInChildren <BaseCloudDataSheet>();

            foreach (var sheet in sheets)
            {
                if (sheet.isRefreshing)
                {
                    continue;
                }

                string cacheId = sheet.cacheId;
                if (refreshedCacheIds.Contains(cacheId))
                {
                    sheet.ReloadFromCache();
                }
                else
                {
                    instance.m_RefreshingCount++;
                    sheet.onRefreshCacheComplete += instance.OnSheetRefreshComplete;
                    sheet.RefreshCache();
                    refreshedCacheIds.Add(cacheId);
                }
            }
        }
Esempio n. 2
0
        void OnSheetRefreshComplete(BaseCloudDataSheet sheet)
        {
            m_RefreshingCount--;
            sheet.onRefreshCacheComplete -= OnSheetRefreshComplete;

            if (m_RefreshingCount == 0 && m_RefreshAllDel != null)
            {
                m_RefreshAllDel();
            }

            m_RefreshAllDel = null;
        }