Пример #1
0
        private IEnumerator CoSyncTableSheets()
        {
            yield return(null);

            var request =
                Resources.LoadAsync <AddressableAssetsContainer>(AddressableAssetsContainerPath);

            yield return(request);

            if (!(request.asset is AddressableAssetsContainer addressableAssetsContainer))
            {
                throw new FailedToLoadResourceException <AddressableAssetsContainer>(
                          AddressableAssetsContainerPath);
            }

            List <TextAsset> csvAssets = addressableAssetsContainer.tableCsvAssets;
            var csv = new Dictionary <string, string>();

            foreach (var asset in csvAssets)
            {
                if (Agent.GetState(Addresses.TableSheet.Derive(asset.name)) is Text tableCsv)
                {
                    var table = tableCsv.ToDotnetString();
                    csv[asset.name] = table;
                }

                yield return(null);
            }
            TableSheets = new TableSheets(csv);
        }
Пример #2
0
        private IEnumerator CoInitializeTableSheets()
        {
            yield return(null);

            var request =
                Resources.LoadAsync <AddressableAssetsContainer>(AddressableAssetsContainerPath);

            yield return(request);

            if (!(request.asset is AddressableAssetsContainer addressableAssetsContainer))
            {
                throw new FailedToLoadResourceException <AddressableAssetsContainer>(
                          AddressableAssetsContainerPath);
            }

            List <TextAsset> csvAssets = addressableAssetsContainer.tableCsvAssets;
            var csv = new Dictionary <string, string>();

            foreach (var asset in csvAssets)
            {
                csv[asset.name] = asset.text;
            }
            TableSheets = new TableSheets(csv);
        }