Esempio n. 1
0
        public AssetBundleButton(CompanionResource resource, AssetBundleResource bundle, RuntimePlatform platform,
                                 UnityObject asset, IUsesCloudStorage storageUser)
        {
            clicked += OnClicked;

            if (asset == null)
            {
                SetEnabled(false);
            }

            m_Resource    = resource;
            m_Platform    = platform;
            m_Bundle      = bundle;
            m_Asset       = asset;
            m_StorageUser = storageUser;

            name = $"{resource.name} - {platform} bundle button";

            var state = State.NotUploaded;

            if (m_Bundle != null)
            {
                if (m_Bundle.Timestamp >= m_Resource.timestamp)
                {
                    state = State.Uploaded;
                }
                else
                {
                    state = CompanionResourceUI.IsPlatformInstalled(m_Platform) ? State.Update : State.Warn;
                }
            }

            SetState(state);
        }
        public void AddOrUpdateBundle(string platform, string bundleKey, long fileSize)
        {
            if (m_BundleDictionary.TryGetValue(platform, out var bundle))
            {
                bundle.Update(bundleKey, fileSize);
                return;
            }

            bundle = new AssetBundleResource(platform, bundleKey, fileSize);
            m_BundleDictionary[platform] = bundle;
        }
 public bool TryGetBundleResource(string platform, out AssetBundleResource resource)
 {
     return(m_BundleDictionary.TryGetValue(platform, out resource));
 }