本文整理汇总了C#中NavGraph.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# NavGraph.GetType方法的具体用法?C# NavGraph.GetType怎么用?C# NavGraph.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NavGraph
的用法示例。
在下文中一共展示了NavGraph.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawGraph
public bool DrawGraph (NavGraph graph, GraphEditor graphEditor) {
Color tmp1 = GUI.color;
GUILayoutx.BeginFadeArea (graph.open,"","graph_"+graph.guid,graphBoxStyle);
Color tmp2 = GUI.color;
GUI.color = tmp1;
GUILayout.BeginHorizontal ();
string graphNameControl = "graph_"+graph.guid+"_name";
if (graph.name == null) graph.name = graphEditorTypes[graph.GetType ().Name].displayName;
GUI.SetNextControlName (graphNameControl);
graph.name = GUILayout.TextField (graph.name, EditorGUILayoutx.defaultLabelStyle, GUILayout.ExpandWidth(false),GUILayout.ExpandHeight(false));
if (graph.name == "" && Event.current.type == EventType.Repaint && GUI.GetNameOfFocusedControl() != graphNameControl) {
graph.name = graphEditorTypes[graph.GetType ().Name].displayName;
}
if (GUILayout.Button ("",EditorGUILayoutx.defaultLabelStyle)) {
graph.open = !graph.open;
if (!graph.open) {
graph.infoScreenOpen = false;
}
RepaintSceneView ();
return true;
}
if (script.prioritizeGraphs) {
if (GUILayout.Button (new GUIContent ("Up","Increase the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
//Find the next non null graph
int next = index-1;
for (;next >= 0;next--) if (script.graphs[next] != null) break;
if (next >= 0) {
NavGraph tmp = script.graphs[next];
script.graphs[next] = graph;
script.graphs[index] = tmp;
GraphEditor tmpEditor = graphEditors[next];
graphEditors[next] = graphEditors[index];
graphEditors[index] = tmpEditor;
}
CheckGraphEditors ();
Repaint ();
}
if (GUILayout.Button (new GUIContent ("Down","Decrease the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
//Find the next non null graph
int next = index+1;
for (;next<script.graphs.Length;next++) if (script.graphs[next] != null) break;
if (next < script.graphs.Length) {
NavGraph tmp = script.graphs[next];
script.graphs[next] = graph;
script.graphs[index] = tmp;
GraphEditor tmpEditor = graphEditors[next];
graphEditors[next] = graphEditors[index];
graphEditors[index] = tmpEditor;
}
CheckGraphEditors ();
Repaint ();
}
}
bool drawGizmos = GUILayout.Toggle (graph.drawGizmos,"Draw Gizmos",graphGizmoButtonStyle);
if (drawGizmos != graph.drawGizmos) {
graph.drawGizmos = drawGizmos;
RepaintSceneView ();
}
if (GUILayout.Toggle (graph.infoScreenOpen,"Info",graphInfoButtonStyle)) {
if (!graph.infoScreenOpen) {
graph.infoScreenOpen = true;
graph.open = true;
}
} else {
graph.infoScreenOpen = false;
}
if (GUILayout.Button ("Delete",graphDeleteButtonStyle)) {
RemoveGraph (graph);
return true;
}
GUILayout.EndHorizontal ();
//if (graph.infoScreenOpen) {
EditorGUILayoutx.FadeArea fadeArea = GUILayoutx.BeginFadeArea (graph.infoScreenOpen,"graph_info_"+graph.guid,0);
if (fadeArea.Show ()) {
EditorGUILayout.LabelField ("Nodes",graph.nodes == null ? "null" : graph.nodes.Length.ToString ());
int numWalkable = 0;
if (Event.current.type == EventType.Repaint) {
if (graph.nodes != null) {
for (int i=0;i<graph.nodes.Length;i++) {
//.........这里部分代码省略.........
示例2: DrawGraph
public bool DrawGraph (NavGraph graph, GraphEditor graphEditor) {
Color tmp1 = GUI.color;
EditorGUILayoutx.FadeArea topFadeArea = GUILayoutx.BeginFadeArea (graph.open,"","graph_"+graph.guid,graphBoxStyle);
Color tmp2 = GUI.color;
GUI.color = tmp1;
GUILayout.BeginHorizontal ();
string graphNameControl = "graph_"+graph.guid+"_name";
if (graph.name == null) graph.name = graphEditorTypes[graph.GetType ().Name].displayName;
GUI.SetNextControlName (graphNameControl);
graph.name = GUILayout.TextField (graph.name, EditorGUILayoutx.defaultLabelStyle, GUILayout.ExpandWidth(false),GUILayout.ExpandHeight(false));
if (graph.name == "" && Event.current.type == EventType.Repaint && GUI.GetNameOfFocusedControl() != graphNameControl) {
graph.name = graphEditorTypes[graph.GetType ().Name].displayName;
}
if (GUILayout.Button ("",EditorGUILayoutx.defaultLabelStyle)) {
graph.open = !graph.open;
if (!graph.open) {
graph.infoScreenOpen = false;
}
RepaintSceneView ();
return true;
}
if (script.prioritizeGraphs) {
if (GUILayout.Button (new GUIContent ("Up","Increase the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
//Find the next non null graph
int next = index-1;
for (;next >= 0;next--) if (script.graphs[next] != null) break;
if (next >= 0) {
NavGraph tmp = script.graphs[next];
script.graphs[next] = graph;
script.graphs[index] = tmp;
GraphEditor tmpEditor = graphEditors[next];
graphEditors[next] = graphEditors[index];
graphEditors[index] = tmpEditor;
}
CheckGraphEditors ();
Repaint ();
}
if (GUILayout.Button (new GUIContent ("Down","Decrease the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
//Find the next non null graph
int next = index+1;
for (;next<script.graphs.Length;next++) if (script.graphs[next] != null) break;
if (next < script.graphs.Length) {
NavGraph tmp = script.graphs[next];
script.graphs[next] = graph;
script.graphs[index] = tmp;
GraphEditor tmpEditor = graphEditors[next];
graphEditors[next] = graphEditors[index];
graphEditors[index] = tmpEditor;
}
CheckGraphEditors ();
Repaint ();
}
}
bool drawGizmos = GUILayout.Toggle (graph.drawGizmos,"Draw Gizmos",graphGizmoButtonStyle);
if (drawGizmos != graph.drawGizmos) {
graph.drawGizmos = drawGizmos;
RepaintSceneView ();
}
if (GUILayout.Toggle (graph.infoScreenOpen,"Info",graphInfoButtonStyle)) {
if (!graph.infoScreenOpen) {
graph.infoScreenOpen = true;
graph.open = true;
}
} else {
graph.infoScreenOpen = false;
}
if (GUILayout.Button ("Delete",graphDeleteButtonStyle)) {
RemoveGraph (graph);
return true;
}
GUILayout.EndHorizontal ();
if (topFadeArea.Show () ) {
EditorGUILayoutx.FadeArea fadeArea = GUILayoutx.BeginFadeArea (graph.infoScreenOpen,"graph_info_"+graph.guid,0);
if (fadeArea.Show ()) {
bool nodenull = false;
int total = 0;
int numWalkable = 0;
//.........这里部分代码省略.........
示例3: DrawGraph
public bool DrawGraph(NavGraph graph, GraphEditor graphEditor)
{
//GUILayout.Label (graph.guid.ToString ());
//GUILayoutx.BeginFadeArea (graph.open,"","graph_"+graph.guid,graphBoxStyle);
/*Rect r = EditorGUILayout.BeginVertical (graphBoxStyle);
GUI.Box (r,"",graphBoxStyle);*/
Color tmp1 = GUI.color;
GUILayoutx.BeginFadeArea (graph.open,"","graph_"+graph.guid,graphBoxStyle);
Color tmp2 = GUI.color;
GUI.color = tmp1;
GUILayout.BeginHorizontal ();
if (GUILayout.Button (graphEditorTypes[graph.GetType ().Name].displayName,EditorGUILayoutx.defaultLabelStyle)) {
graph.open = !graph.open;
if (!graph.open) {
graph.infoScreenOpen = false;
}
Repaint ();
}
if (script.prioritizeGraphs) {
if (GUILayout.Button (new GUIContent ("Up","Increase the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
if (index > 0) {
NavGraph tmp = script.graphs[index-1];
script.graphs[index-1] = graph;
script.graphs[index] = tmp;
}
Repaint ();
}
if (GUILayout.Button (new GUIContent ("Down","Decrease the graph priority"),GUILayout.Width (40))) {
int index = script.astarData.GetGraphIndex (graph);
if (index < script.graphs.Length-1) {
NavGraph tmp = script.graphs[index+1];
script.graphs[index+1] = graph;
script.graphs[index] = tmp;
}
Repaint ();
}
}
if (GUILayout.Toggle (graph.infoScreenOpen,"Info",graphInfoButtonStyle)) {
if (!graph.infoScreenOpen) {
graph.infoScreenOpen = true;
graph.open = true;
}
} else {
graph.infoScreenOpen = false;
}
//GUILayout.FlexibleSpace ();
if (GUILayout.Button ("Delete",graphDeleteButtonStyle)) {
RemoveGraph (graph);
return true;
}
GUILayout.EndHorizontal ();
//if (graph.infoScreenOpen) {
EditorGUILayoutx.FadeArea fadeArea = GUILayoutx.BeginFadeArea (graph.infoScreenOpen,"graph_info_"+graph.guid,0);
if (fadeArea.Show ()) {
EditorGUILayout.LabelField ("Nodes",graph.nodes == null ? "null" : graph.nodes.Length.ToString ());
int numWalkable = 0;
if (Event.current.type == EventType.Repaint) {
if (graph.nodes != null) {
for (int i=0;i<graph.nodes.Length;i++) {
if (graph.nodes[i].walkable) numWalkable++;
}
}
}
EditorGUI.indentLevel++;
EditorGUILayout.LabelField ("Walkable",graph.nodes != null ? numWalkable.ToString () : "undefined");
EditorGUILayout.LabelField ("Unwalkable",graph.nodes != null ? (graph.nodes.Length-numWalkable).ToString () : "undefined");
EditorGUI.indentLevel--;
}
GUILayoutx.EndFadeArea ();
//}
GUI.color = tmp2;
//if (GUILayoutx.DrawID ("graph_"+graph.guid)) {
/*if (graph.sourceModifier == null) {
graph.sourceModifier = new ModifierHolder ();
}
graph.sourceModifier.activeModifier = EditorGUILayout.IntField("Modifier",graph.sourceModifier.activeModifier);*/
//graphEditor.HandleUndo (graph);
graphEditor.OnInspectorGUI (graph);
//}
GUILayoutx.EndFadeArea ();
return false;
}