// 重写Inspector检视面板 public override void OnInspectorGUI() { np.StartInit = EditorGUILayout.Toggle("运行显示", np.StartInit); np.StartDataConfig = EditorGUILayout.Toggle("启用数据", np.StartDataConfig); if (!string.IsNullOrEmpty(np.mDataConfig)) { if (GUILayout.Button("删除数据文件")) { np.mDataConfig = null; } } //数据序列化 if (np.StartDataConfig) { if (!string.IsNullOrEmpty(np.mDataConfig)) { GUILayout.Label("---------------------------------------------------"); GUILayout.Label("数据解析:" + np.mDataConfig); GUILayout.Label("---------------------------------------------------"); } if (np.mUnitObject != null) { MyEdior.DrawConverter.DrawObject(np.mUnitObject, null); if (GUILayout.Button("保存数据")) { np.mDataConfig = StringSerialize.Serialize(np.mUnitObject); } } } string tempName = np.StartConfig ? "保存配置" : "Delete"; mSelectPrefab.InitGUI(); np.nTypeKey = mSelectPrefab.getSelectKey(); if (mCurSelectName != np.nTypeKey) { mCurSelectName = np.nTypeKey; } if (np.mUnitObject == null) { GUILayout.Space(10); if (GUILayout.Button("Create")) { np.SetActive(true); } } else { GUILayout.Space(10); if (GUILayout.Button(tempName)) { GameObject.DestroyImmediate(np.mUnitObject.gameObject); } } MyEdior.KeepScene(); }
// 重写Inspector检视面板 public override void OnInspectorGUI() { KeyStr = np.mKey; EditorGUILayout.LabelField("带有 " + KeyStr + " 的物体将会自动保存"); nChangeKey = EditorGUILayout.Toggle("打开Key修改按钮", nChangeKey); if (nChangeKey) { GUILayout.Label("输入要保存的Key:"); np.mKey = GUILayout.TextField(np.mKey); if (np.mKey == null || np.mKey == "") { np.mKey = "F_"; } } nOpenCreate = EditorGUILayout.Toggle("打开创建按钮", nOpenCreate); if (nOpenCreate) { mSelectPrefab.InitGUI(); GUILayout.Space(10); if (GUILayout.Button("Create")) { SceneManager.instance.Create(mSelectPrefab.getSelectKey(), np.gameObject); } } else { GUILayout.Space(10); if (isUpdateShow) { EditorGUILayout.LabelField("有更新,请点击Apply进行更新"); } if (GUILayout.Button("Apply")) { applyData(); } } MyEdior.KeepScene(); }