열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-22 3fc9f79ca436203b0b5ba39b6a079ee086227c11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Magic Mirror Lite (c) 2015 Digital Ruby, LLC
// http://www.digitalruby.com
//
 
using System;
 
using UnityEngine;
using UnityEditor;
 
namespace DigitalRuby.RainMaker
{
    public class MagicMirrorEditor : Editor
    {
        private Texture2D logo;
 
        public override void OnInspectorGUI()
        {
            if (logo == null)
            {
                string[] guids = AssetDatabase.FindAssets("MagicMirrorLogo");
                foreach (string guid in guids)
                {
                    string path = AssetDatabase.GUIDToAssetPath(guid);
                    logo = AssetDatabase.LoadMainAssetAtPath(path) as Texture2D;
                    if (logo != null)
                    {
                        break;
                    }
                }
            }
            if (logo != null)
            {
                const float maxLogoWidth = 450.0f;
                EditorGUILayout.Separator();
                float w = EditorGUIUtility.currentViewWidth;
                Rect r = new Rect();
                r.width = Math.Min(w - 40.0f, maxLogoWidth);
                r.height = r.width / 2.7f;
                Rect r2 = GUILayoutUtility.GetRect(r.width, r.height);
                r.x = ((EditorGUIUtility.currentViewWidth - r.width) * 0.5f) - 4.0f;
                r.y = r2.y;
                GUI.DrawTexture(r, logo, ScaleMode.StretchToFill);
                if (GUI.Button(r, "", new GUIStyle()))
                {
                    Application.OpenURL("https://www.assetstore.unity3d.com/en/#!/content/103687?aid=1011lGnL");
                }
                EditorGUILayout.Separator();
            }
 
            DrawDefaultInspector();
        }
    }
 
    [CustomEditor(typeof(MirrorCameraScript))]
    public class MirrorCameraScriptEditor : MagicMirrorEditor
    {
    }
 
    [CustomEditor(typeof(MirrorReflectionScript))]
    public class MirrorReflectionScriptEditor : MagicMirrorEditor
    {
    }
 
    [CustomEditor(typeof(MirrorScript))]
    public class MirrorScriptEditor : MagicMirrorEditor
    {
    }
}