using Godot; using System.Collections.Generic; using System.IO; namespace Rokojori; [Tool] [GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Action.svg")] [RokojoriActionCoreExport] public partial class GDScriptExportTest : NetworkNode { public static void OtherTest() { var lockable = new object(); lock ( lockable ) { if ( lockable != null ) { GD.Print(); } else { throw new System.Exception( "Some Error" ); } } var path = ""; var data = ""; try { StreamWriter streamWriter = File.CreateText( path ); streamWriter.Write( data ); streamWriter.Dispose(); } catch ( System.Exception e ) { RJLog.Log( "Could not save text: ", path, "exception", e ); } } public static void SwitchTest() { var value = 4; switch ( value ) { case 1: return; case 2: case 3: { RJLog.Log( "Should not be 3" ); } break; case 7: { RJLog.Log( "Should not be 7" ); break; } default: { RJLog.Log( "This is the default!" ); break; } } } public static void CrazyLoopTest() { var someVar = true; var xx = 0; while ( someVar ) { xx += 2; if ( xx > 100 ) { someVar = false; } if ( xx < 100) { break; } } for ( int startX = 0, startY = -1, x = 4; x < 10; x++ ) { if ( x == 7 ) { continue; } if ( startX - x > startY ) { continue; } for ( int startZ = -5, startW = -1, y = 4; y < 10; y++,x+=2 ) { if ( startZ < 0 ) { for ( int zz = 77; zz > 0; zz-- ) { if ( startZ == startW - zz ) { continue; } } } } } } }