Beispiel #1
0
        /// <summary>
        /// Start
        /// </summary>
        // -----------------------------------------------------------------------------
        void Start()
        {
#if UNITY_EDITOR
            if (!this.m_refText)
            {
                Debug.LogWarning("(#if UNITY_EDITOR) : m_refText == null : " + Funcs.CreateHierarchyPath(this.transform));
            }

            if (this.m_sendEvent.GetPersistentEventCount() <= 0)
            {
                Debug.LogWarning("(#if UNITY_EDITOR) : m_sendEvent.GetPersistentEventCount() <= 0 : " + Funcs.CreateHierarchyPath(this.transform));
            }
#endif
        }
 /// <summary>
 /// Encrypt binary data
 /// </summary>
 /// <param name="data">data to encrypt</param>
 /// <returns>encrypted data</returns>
 // -----------------------------------------------------------------------------------------------
 protected virtual byte[] encryptBinaryData(byte[] data)
 {
     return(Funcs.EncryptBinaryData(data, this.m_encryptionInfo.password));
 }
Beispiel #3
0
        /// <summary>
        /// Called in Awake
        /// </summary>
        // -------------------------------------------------------------------------------------------------------
        protected override void initOnAwake()
        {
#if UNITY_EDITOR
            if (!this.m_languageCsvForSystemText)
            {
                Debug.LogWarning("(#if UNITY_EDITOR) : m_languageCsvForSystemText is null : " + Funcs.CreateHierarchyPath(this.transform));
            }

            // m_languageAndFontList
            {
                foreach (var val in this.m_languageAndFontList)
                {
                    if (!this.isSupportedLanguageEditorOnly(val.systemLanguage))
                    {
                        Debug.LogWarning("(#if UNITY_EDITOR) : Not supported language : " + val.systemLanguage.ToString() + " : " + Funcs.CreateHierarchyPath(this.transform));
                    }

                    if (!val.font)
                    {
                        Debug.LogWarning("(#if UNITY_EDITOR) : font is null : " + val.systemLanguage.ToString() + " : " + Funcs.CreateHierarchyPath(this.transform));
                    }
                }
            }
#endif

            // initCsvForSystemText
            {
                this.initCsvForSystemText();
            }

            // m_currentFont
            {
                var temp = this.m_languageAndFontList.Find(val => val.systemLanguage == this.m_currentSystemLanguage);
                this.m_currentFont = (temp != null) ? temp.font : null;
            }
        }
        /// <summary>
        /// Build AssetBundles by params
        /// </summary>
        // -----------------------------------------------------------------------------------------------
        protected void build()
        {
            // crypto check
            {
                if (this.m_encryptionInfo.useEncryption && Funcs.IsCryptoVersionDeprecated(this.m_encryptionInfo.cryptoVersion))
                {
                    if (!EditorUtility.DisplayDialog(
                            "Confirmation",
                            "Selected [Crypto Version] is deprecated. Do you want to continue?",
                            "Yes",
                            "Cancel"
                            ))
                    {
                        return;
                    }
                }
            }

            // ----------------------

            string buildPath = EditorUtility.OpenFolderPanel("Build AssetBundles", this.m_buildPath, "");

            if (string.IsNullOrEmpty(buildPath))
            {
                return;
            }

            // m_buildPath
            {
                this.m_buildPath = buildPath;
            }

            if (!this.ready())
            {
                return;
            }

            // -------------------------------

            bool ok = true;

            Dictionary <string, LabelAndVariant> fakes = null;

            if (this.m_otherInfo.useFakeAssetBundleNames)
            {
                fakes = this.setFakeAssetBundleInfos();
            }

            if (this.m_encryptionInfo.useEncryption)
            {
                ok = this.buildAssetBundles(this.m_encryptionInfo.tempAssetBundlesFolderPath, false);

                if (ok)
                {
                    ok = this.createEncryptedFiles();

                    if (ok)
                    {
                        this.buildAssetBundles(buildPath, true);
                    }
                }
            }

            else
            {
                ok = this.buildAssetBundles(buildPath, false);
            }

            if (this.m_otherInfo.useFakeAssetBundleNames)
            {
                this.revertAssetBundleInfos(fakes);
            }

            // savePrefs
            {
                this.savePrefs();
            }

            // ForceUpdate
            {
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }

            //EditorUtility.DisplayDialog("Build AssetBundles", ok ? "Success\n\nDon't forget to clear editor's cache if you needed." : "Failed", "OK");
            EditorUtility.DisplayDialog("Build AssetBundles", ok ? "Success" : "Failed", "OK");
        }
        /// <summary>
        /// Start
        /// </summary>
        // ---------------------------------------------------------------------------------------
        private void Start()
        {
            // m_refImage
            {
                this.m_refImage = this.GetComponent <Image>();
            }

            // addLanguageSignalReceiver
            {
                SimpleReduxManager.Instance.addLanguageSignalReceiver(this.onLanguageSignal);
            }

            // changeSpriteByLanguage
            {
                this.changeSpriteByLanguage();
            }

#if UNITY_EDITOR
            // checkDuplicatesEditorOnly
            {
                Funcs.checkDuplicatesEditorOnly(this.m_languageAndSpriteList, val => val.systemLanguage, this.transform);
            }

            // empty sprite
            {
                var temp = this.m_languageAndSpriteList.FindAll(val => val.sprite == null);

                if (temp.Count > 0)
                {
                    Debug.LogWarningFormat("(#if UNITY_EDITOR) : {0} Empty sprites : {1}", temp.Count, Funcs.CreateHierarchyPath(this.transform));
                }
            }

            // supportedLanguagesEditorOnly
            {
                if (LanguageManager.isAvailable())
                {
                    // count
                    {
                        if (LanguageManager.Instance.supportedLanguagesEditorOnly.Count != this.m_languageAndSpriteList.Count)
                        {
                            Debug.LogWarning("(#if UNITY_EDITOR) : Different size in language setting : " + Funcs.CreateHierarchyPath(this.transform));
                        }
                    }

                    // isSupportedLanguageEditorOnly
                    {
                        foreach (var val in this.m_languageAndSpriteList)
                        {
                            if (!LanguageManager.Instance.isSupportedLanguageEditorOnly(val.systemLanguage))
                            {
                                Debug.LogWarningFormat(
                                    "(#if UNITY_EDITOR) : Not supported language : {0} : {1}",
                                    val.systemLanguage,
                                    Funcs.CreateHierarchyPath(this.transform)
                                    );
                            }
                        }
                    }
                }
            }
#endif
        }