示例#1
0
 public static string TTR(this string text)
 {
     using godot_string textIn = Marshaling.ConvertStringToNative(text);
     Internal.godot_icall_Globals_TTR(textIn, out godot_string dest);
     using (dest)
         return(Marshaling.ConvertStringToManaged(dest));
 }
示例#2
0
 public EditorProgress(string task, string label, int amount, bool canCancel = false)
 {
     Task = task;
     using godot_string taskIn  = Marshaling.ConvertStringToNative(task);
     using godot_string labelIn = Marshaling.ConvertStringToNative(label);
     Internal.godot_icall_EditorProgress_Create(taskIn, labelIn, amount, canCancel);
 }
示例#3
0
 public static object EditorShortcut(string setting)
 {
     using godot_string settingIn = Marshaling.ConvertStringToNative(setting);
     Internal.godot_icall_Globals_EditorShortcut(settingIn, out godot_variant result);
     using (result)
         return(Marshaling.ConvertVariantToManagedObject(result));
 }
示例#4
0
 public static string[] CodeCompletionRequest(CodeCompletionRequest.CompletionKind kind,
                                              string scriptFile)
 {
     using godot_string scriptFileIn = Marshaling.ConvertStringToNative(scriptFile);
     godot_icall_Internal_CodeCompletionRequest((int)kind, scriptFileIn, out godot_packed_string_array res);
     using (res)
         return(Marshaling.ConvertNativePackedStringArrayToSystemArray(res));
 }
示例#5
0
 public static unsafe object EditorDef(string setting, object defaultValue, bool restartIfChanged = false)
 {
     using godot_string settingIn       = Marshaling.ConvertStringToNative(setting);
     using godot_variant defaultValueIn = Marshaling.ConvertManagedObjectToVariant(defaultValue);
     Internal.godot_icall_Globals_EditorDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result);
     using (result)
         return(Marshaling.ConvertVariantToManagedObject(result));
 }
示例#6
0
        private static void SendToScriptDebugger(Exception e)
        {
            var globalFrames = new List <StackInfoTuple>();

            var excMsg = new StringBuilder();

            CollectExceptionInfo(e, globalFrames, excMsg);

            string file     = globalFrames.Count > 0 ? globalFrames[0].File ?? "" : "";
            string func     = globalFrames.Count > 0 ? globalFrames[0].Func : "";
            int    line     = globalFrames.Count > 0 ? globalFrames[0].Line : 0;
            string errorMsg = "Exception";

            using godot_string nFile     = Marshaling.ConvertStringToNative(file);
            using godot_string nFunc     = Marshaling.ConvertStringToNative(func);
            using godot_string nErrorMsg = Marshaling.ConvertStringToNative(errorMsg);
            using godot_string nExcMsg   = Marshaling.ConvertStringToNative(excMsg.ToString());

            using DebuggingUtils.godot_stack_info_vector stackInfoVector = default;

            stackInfoVector.Resize(globalFrames.Count);

            unsafe
            {
                for (int i = 0; i < globalFrames.Count; i++)
                {
                    DebuggingUtils.godot_stack_info *stackInfo = &stackInfoVector.Elements[i];

                    var globalFrame = globalFrames[i];

                    // Assign directly to element in Vector. This way we don't need to worry
                    // about disposal if an exception is thrown. The Vector takes care of it.
                    stackInfo->File = Marshaling.ConvertStringToNative(globalFrame.File);
                    stackInfo->Func = Marshaling.ConvertStringToNative(globalFrame.Func);
                    stackInfo->Line = globalFrame.Line;
                }

                NativeFuncs.godotsharp_internal_script_debugger_send_error(nFunc, nFile, line,
                                                                           nErrorMsg, nExcMsg, p_warning: godot_bool.False, stackInfoVector);
            }
        }
示例#7
0
 public bool TryStep(string state, int step = -1, bool forceRefresh = true)
 {
     using godot_string taskIn  = Marshaling.ConvertStringToNative(Task);
     using godot_string stateIn = Marshaling.ConvertStringToNative(state);
     return(Internal.godot_icall_EditorProgress_Step(taskIn, stateIn, step, forceRefresh));
 }
示例#8
0
 public void Dispose()
 {
     using godot_string taskIn = Marshaling.ConvertStringToNative(Task);
     Internal.godot_icall_EditorProgress_Dispose(taskIn);
     GC.SuppressFinalize(this);
 }
示例#9
0
        /*
         * IMPORTANT:
         * The order of the methods defined in NativeFuncs must match the order
         * in the array defined at the bottom of 'editor/editor_internal_calls.cpp'.
         */

        public static partial void godot_icall_GodotSharpDirs_ResMetadataDir(out godot_string r_dest);
示例#10
0
 public static bool IsMacOSAppBundleInstalled(string bundleId)
 {
     using godot_string bundleIdIn = Marshaling.ConvertStringToNative(bundleId);
     return(godot_icall_Internal_IsMacOSAppBundleInstalled(bundleIdIn));
 }
示例#11
0
 public static partial void godot_icall_GodotSharpDirs_DataEditorToolsDir(out godot_string r_dest);
示例#12
0
 public static partial void godot_icall_GodotSharpDirs_BuildLogsDirs(out godot_string r_dest);
示例#13
0
 public static partial void godot_icall_GodotSharpDirs_MonoUserDir(out godot_string r_dest);
示例#14
0
 public static Object EngineGetSingleton(string name)
 {
     using godot_string src = Marshaling.ConvertStringToNative(name);
     return(UnmanagedGetManaged(NativeFuncs.godotsharp_engine_get_singleton(src)));
 }
示例#15
0
 public static godot_variant CreateFromStringTakingOwnershipOfDisposableValue(godot_string from)
 => new()