Пример #1
0
        private string GetDevelopmentText()
        {
            var cryptoKey = GetCryptoKey();

            if (string.IsNullOrEmpty(developmentText))
            {
                return(string.Empty);
            }

            var text = string.Empty;

            try
            {
                text = developmentText.Decrypt(cryptoKey);
            }
            catch
            {
                using (new DisableStackTraceScope())
                {
                    var hierarchyPath = UnityUtility.GetHierarchyPath(gameObject);

                    Debug.LogErrorFormat("DevelopmentText decrypt failed.\n{0}", hierarchyPath);

                    developmentText = null;
                }

                EditorUtility.SetDirty(this);
            }

            return(string.IsNullOrEmpty(text) ? null : string.Format("{0}{1}", DevelopmentMark, text));
        }
Пример #2
0
        private Texture GetMainTexture()
        {
            Texture texture = null;

            if (material != null)
            {
                texture = material.mainTexture;
            }

            if (texture == null)
            {
                var animModule = textureSheetAnimation;

                if (animModule.enabled && textureSheetAnimationCurrentFrame.HasValue)
                {
                    var index = textureSheetAnimationCurrentFrame.Value;

                    if (animModule.spriteCount < index)
                    {
                        index = animModule.spriteCount;
                    }

                    var sprite = animModule.GetSprite(index);

                    if (sprite != null)
                    {
                        texture = sprite.texture;
                    }
                    else
                    {
                        var hierarchyPath = UnityUtility.GetHierarchyPath(gameObject);

                        Debug.LogErrorFormat("TextureSheetAnimation sprite index not found.\n\nindex : {0}\nhierarchy : {1}\n", index, hierarchyPath);
                    }
                }
            }

            if (texture == null)
            {
                texture = Texture2D.whiteTexture;
            }

            return(texture);
        }
Пример #3
0
        private void SetDevelopmentText(string text)
        {
            var cryptoKey = GetCryptoKey();

            try
            {
                developmentText = string.IsNullOrEmpty(text) ? string.Empty : text.Encrypt(cryptoKey);
            }
            catch
            {
                using (new DisableStackTraceScope())
                {
                    var hierarchyPath = UnityUtility.GetHierarchyPath(gameObject);

                    Debug.LogErrorFormat("DevelopmentText encrypt failed.\n{0}", hierarchyPath);

                    developmentText = null;
                }
            }

            ImportText();
        }