コード例 #1
0
ファイル: ShareValue.cs プロジェクト: zyb2013/GameProject3
        public void   DrawGUI(string label)
        {
            GUI.color = Color.white;
            GUILayout.Label(string.Format("<color=#0FE3FF>[ShareObject]</color> {0}", label), BTHelper.BVTSkin.label, GUILayout.MaxWidth(200));
            GUILayout.BeginHorizontal();
            if (!Application.isPlaying)
            {
                GUI.color           = Color.white;
                GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f, 1f);
                string k = UnityEditor.EditorGUILayout.TextField(key, GUILayout.MaxWidth(100), GUILayout.ExpandWidth(true));
                this.SetKey(k);
            }
            else
            {
                GUI.backgroundColor = new Color(0.7f, 0.7f, 0.7f);
                GUI.color           = new Color(0.8f, 0.8f, 1f);
                GUILayout.Label(key, GUILayout.MaxWidth(100), GUILayout.ExpandWidth(true));
            }
            GUI.color           = Color.white;
            GUI.backgroundColor = Color.white;

            if (data == null)
            {
                UnityEditor.EditorGUILayout.ObjectField("", data, typeof(FValue), true, GUILayout.MaxWidth(100), GUILayout.ExpandWidth(true));
            }
            else
            {
                data.DrawField();
                if (data.K != key)
                {
                    this.key = data.K;
                }
                if (data.GetValue() != GetValue())
                {
                    this.SetValue(data.GetValue(), false);
                }
            }
            GUILayout.EndHorizontal();
        }
コード例 #2
0
ファイル: ShareValue.cs プロジェクト: zyb2013/GameProject3
        public void   SetKey <T>(string key) where T : FValue
        {
            if (this.key == key)
            {
                return;
            }
            this.key = key;
            T f = board.GetData <T>(key);

            data = (T)f;
            if (data != null)
            {
                data.SetKey(key);
                this.SetValue(data.GetValue(), false);
            }
        }