示例#1
0
        private void Start()
        {
            AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            //if (baseComponent.EditorResourceMode)
            //{
            //    m_LocalizationManager.SetResourceManager(baseComponent.EditorResourceHelper);
            //}
            //else
            {
                m_LocalizationManager.SetResourceManager(AshEntry.GetModule <IResourceManager>());
            }

            LocalizationHelperBase localizationHelper = Helper.CreateHelper(m_LocalizationHelperTypeName, m_CustomLocalizationHelper);

            if (localizationHelper == null)
            {
                Log.Error("Can not create localization helper.");
                return;
            }

            localizationHelper.name = string.Format("Localization Helper");
            Transform transform = localizationHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_LocalizationManager.SetLocalizationHelper(localizationHelper);
            m_LocalizationManager.Language = baseComponent.EditorLanguage;
        }
示例#2
0
        private void Start()
        {
            m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Web Request Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_WebRequestAgentHelperCount; i++)
            {
                AddWebRequestAgentHelper(i);
            }
        }
示例#3
0
        private void Start()
        {
            AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            //if (baseComponent.EditorResourceMode)
            //{
            //    m_UIManager.SetResourceManager(baseComponent.EditorResourceHelper);
            //}
            //else
            {
                m_UIManager.SetResourceManager(AshEntry.GetModule <IResourceManager>());
            }

            m_UIManager.SetObjectPoolManager(AshEntry.GetModule <IObjectPoolManager>());
            m_UIManager.InstanceAutoReleaseInterval = m_InstanceAutoReleaseInterval;
            m_UIManager.InstanceCapacity            = m_InstanceCapacity;
            m_UIManager.InstanceExpireTime          = m_InstanceExpireTime;
            m_UIManager.InstancePriority            = m_InstancePriority;

            UIFormHelperBase uiFormHelper = Helper.CreateHelper(m_UIFormHelperTypeName, m_CustomUIFormHelper);

            if (uiFormHelper == null)
            {
                Log.Error("Can not create UI form helper.");
                return;
            }

            uiFormHelper.name = string.Format("UI Form Helper");
            Transform transform = uiFormHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_UIManager.SetUIFormHelper(uiFormHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("UI Form Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            m_InstanceRoot.gameObject.layer = LayerMask.NameToLayer("UI");

            for (int i = 0; i < m_UIGroups.Length; i++)
            {
                if (!AddUIGroup(m_UIGroups[i].Name, m_UIGroups[i].Depth))
                {
                    Log.Warning("Add UI group '{0}' failure.", m_UIGroups[i].Name);
                    continue;
                }
            }
        }
示例#4
0
        private void Start()
        {
            AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>();

            if (baseComponent == null)
            {
                Log.Fatal("Base component is invalid.");
                return;
            }

            m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>();
            if (m_EventComponent == null)
            {
                Log.Fatal("Event component is invalid.");
                return;
            }

            m_EditorResourceMode = false;
            m_ResourceManager    = AshEntry.GetModule <IResourceManager>();
            if (m_ResourceManager == null)
            {
                Log.Fatal("Resource manager is invalid.");
                return;
            }

            m_ResourceManager.ResourceInitComplete      += OnResourceInitComplete;
            m_ResourceManager.VersionListUpdateSuccess  += OnVersionListUpdateSuccess;
            m_ResourceManager.VersionListUpdateFailure  += OnVersionListUpdateFailure;
            m_ResourceManager.ResourceCheckComplete     += OnResourceCheckComplete;
            m_ResourceManager.ResourceUpdateStart       += OnResourceUpdateStart;
            m_ResourceManager.ResourceUpdateChanged     += OnResourceUpdateChanged;
            m_ResourceManager.ResourceUpdateSuccess     += OnResourceUpdateSuccess;
            m_ResourceManager.ResourceUpdateFailure     += OnResourceUpdateFailure;
            m_ResourceManager.ResourceUpdateAllComplete += OnResourceUpdateAllComplete;

            m_ResourceManager.SetReadOnlyPath(Application.streamingAssetsPath);
            if (m_ReadWritePathType == ReadWritePathType.TemporaryCache)
            {
                m_ResourceManager.SetReadWritePath(Application.temporaryCachePath);
            }
            else
            {
                if (m_ReadWritePathType == ReadWritePathType.Unspecified)
                {
                    m_ReadWritePathType = ReadWritePathType.PersistentData;
                }

                m_ResourceManager.SetReadWritePath(Application.persistentDataPath);
            }

            if (m_EditorResourceMode)
            {
                return;
            }

            SetResourceMode(m_ResourceMode);
            m_ResourceManager.SetDownloadManager(AshEntry.GetModule <IDownloadManager>());
            m_ResourceManager.SetObjectPoolManager(AshEntry.GetModule <IObjectPoolManager>());
            m_ResourceManager.AssetAutoReleaseInterval    = m_AssetAutoReleaseInterval;
            m_ResourceManager.AssetCapacity               = m_AssetCapacity;
            m_ResourceManager.AssetExpireTime             = m_AssetExpireTime;
            m_ResourceManager.AssetPriority               = m_AssetPriority;
            m_ResourceManager.ResourceAutoReleaseInterval = m_ResourceAutoReleaseInterval;
            m_ResourceManager.ResourceCapacity            = m_ResourceCapacity;
            m_ResourceManager.ResourceExpireTime          = m_ResourceExpireTime;
            m_ResourceManager.ResourcePriority            = m_ResourcePriority;
            if (m_ResourceMode == ResourceMode.Updatable)
            {
                m_ResourceManager.UpdatePrefixUri  = m_UpdatePrefixUri;
                m_ResourceManager.UpdateRetryCount = m_UpdateRetryCount;
            }

            m_ResourceHelper = Helper.CreateHelper(m_ResourceHelperTypeName, m_CustomResourceHelper);
            if (m_ResourceHelper == null)
            {
                Log.Error("Can not create resource helper.");
                return;
            }

            m_ResourceHelper.name = string.Format("Resource Helper");
            Transform transform = m_ResourceHelper.transform;

            transform.SetParent(this.transform);
            transform.localScale = Vector3.one;

            m_ResourceManager.SetResourceHelper(m_ResourceHelper);

            if (m_InstanceRoot == null)
            {
                m_InstanceRoot = (new GameObject("Load Resource Agent Instances")).transform;
                m_InstanceRoot.SetParent(gameObject.transform);
                m_InstanceRoot.localScale = Vector3.one;
            }

            for (int i = 0; i < m_LoadResourceAgentHelperCount; i++)
            {
                AddLoadResourceAgentHelper(i);
            }
        }