コード例 #1
0
        public void OnGUI()
        {
            GUILayout.Space(10);

            string assetPath = Path.GetDirectoryName(this.tilesetRecord.AssetPath) + "/";

            ExtraEditorGUI.AbovePrefixLabel(TileLang.ParticularText("Property", "Asset Path:"), RotorzEditorStyles.Instance.BoldLabel);
            EditorGUILayout.SelectableLabel(assetPath, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
            string buttonTextShowInOS = TileLang.OpensWindow(
                Application.platform == RuntimePlatform.OSXEditor
                    ? TileLang.ParticularText("Action", "Show In Finder")
                    : TileLang.ParticularText("Action", "Show In Explorer"));

            if (GUILayout.Button(buttonTextShowInOS, RotorzEditorStyles.Instance.ButtonWide))
            {
                EditorUtility.OpenWithDefaultApp(assetPath);
                GUIUtility.ExitGUI();
            }

            var atlasTexture = this.tileset.AtlasTexture;

            if (atlasTexture == null)
            {
                GUILayout.Space(10);
                GUILayout.Label(TileLang.Text("Atlas texture is missing."));
                return;
            }

            if (atlasTexture.width != atlasTexture.height || !Mathf.IsPowerOfTwo(atlasTexture.width))
            {
                GUILayout.Space(3);
                EditorGUILayout.HelpBox(TileLang.Text("Atlas texture is not square and/or not a power of two size. This can lead to poor quality results."), MessageType.Warning, true);
                GUILayout.Space(3);
            }
            else
            {
                GUILayout.Space(5);
            }

            this.DrawAtlasTexture();
        }
コード例 #2
0
        private static string TemplateTextMatcher(Match match)
        {
            string text;

            string textFunctionName = match.Groups[3].Value;

            switch (textFunctionName)
            {
            case "Text":
                text = TileLang.Text(match.Groups[4].Value);
                break;

            case "ParticularText":
                text = TileLang.ParticularText(match.Groups[4].Value, match.Groups[6].Value);
                break;

            default:
                throw new KeyNotFoundException(string.Format("Unexpected text function '{0}'.", textFunctionName));
            }

            if (match.Groups[2].Value == "OpensWindow")
            {
                text = TileLang.OpensWindow(text);
            }

            text = "\"" + text + "\"";

            if (!match.Groups[2].Success)
            {
                // No wrapping function was added, so any trailing parenthesis does not
                // belong to that, simply copy to output.
                text = text + match.Groups[7].Value;
            }

            return(text);
        }