void LoadButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { string path = EditorUtility.OpenFilePanel( "Load Behavior Layout", Application.dataPath, "xml" ); if ( !string.IsNullOrEmpty( path ) ) { LoadXML( path ); } }
void SaveButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { BehaviorNodeControl root = m_editor.GetRootControl(); if ( root != null ) { string path = EditorUtility.SaveFilePanelInProject( "Save Behavior Layout", string.Format("Layout{0}",m_tools.TreeIdField.Value),"xml",""); if ( !string.IsNullOrEmpty( path ) ) { SaveXML( path, root ); } } }
void GenerateButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { BehaviorNodeControl root = m_editor.GetRootControl(); if ( root != null ) { SaveXML( Application.persistentDataPath + "/" + TEMP_FILENAME, root ); EditorPrefs.SetBool( TEMP_FILE_KEY, true ); string safeHandle = m_tools.TreeIdField.Value.Replace( " ", "" ); BehaviorTreeGenerator generator = new BehaviorTreeGenerator(); string output = generator.Generate( m_tools.TreeIdField.Value, safeHandle, root ); SaveSourceFile( safeHandle, output ); } }
void NewButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { bool confirm = EditorUtility.DisplayDialog( "Confirm New Behavior", "Are you sure you would like to create a new behavior? Current layout will be discarded!", "Ok", "Cancel" ); if (confirm ) { m_editor.ClearAll(); } }
void m_duplicate_Clicked(UForms.Events.IClickable sender, UForms.Events.ClickEventArgs args, Event nativeEvent) { Duplicate(m_original.Value as GameObject, m_count.Value, m_transform.Translate, m_transform.Rotate, m_transform.Scale, (Space)m_space.Value); }
void OnOutputClicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { if ( sender is Button ) { Button b = sender as Button; int index = m_outputButtons.IndexOf( b ); if ( index >= 0 ) { if ( OutputClicked != null ) { OutputClicked( this, index, args.button ); } } } }