blob: b3136b4cd161b29568378bd64a61849a95b12fd6 (
plain)
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
70
71
72
73
74
75
|
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
namespace AmplifyShaderEditor
{
public class ToolsMenuButtonParent
{
protected AmplifyShaderEditorWindow m_parentWindow = null;
private float m_buttonSpacing = 10;
private int m_currentState = 0;
private bool m_isInitialized = false;
protected GUIContent m_content;
public ToolsMenuButtonParent( AmplifyShaderEditorWindow parentWindow, string text, string tooltip, float buttonSpacing )
{
m_parentWindow = parentWindow;
m_content = new GUIContent( text, tooltip );
if ( buttonSpacing > 0 )
m_buttonSpacing = buttonSpacing;
}
public virtual void Draw()
{
if ( !m_isInitialized )
{
Init();
}
//GUILayout.Space( m_buttonSpacing );
}
public virtual void Draw( Vector2 pos )
{
Draw( pos.x, pos.y );
}
public virtual void Draw( float x ,float y )
{
if ( !m_isInitialized )
{
Init();
}
}
protected virtual void Init()
{
m_isInitialized = false;
}
public virtual void SetStateOnButton( int state, string tooltip )
{
m_currentState = state;
m_content.tooltip = tooltip;
}
public virtual void SetStateOnButton( int state )
{
m_currentState = state;
}
public virtual void Destroy() { }
public float ButtonSpacing
{
get { return m_buttonSpacing; }
}
public int CurrentState
{
get { return m_currentState; }
}
}
}
|