Ejemplo n.º 1
0
 public void Set(string value, EConsoleVariableFlags setBy = EConsoleVariableFlags.SetByCode)
 {
     using (FStringUnsafe valueUnsafe = new FStringUnsafe(value))
     {
         Native_IConsoleVariable.SetString(Address, ref valueUnsafe.Array, setBy);
     }
 }
Ejemplo n.º 2
0
 public IConsoleCommand RegisterConsoleCommandExec(string name, string help, EConsoleVariableFlags flags = EConsoleVariableFlags.Default)
 {
     using (FStringUnsafe nameUnsafe = new FStringUnsafe(name))
         using (FStringUnsafe helpUnsafe = new FStringUnsafe(help))
         {
             IntPtr address = Native_IConsoleManager.RegisterConsoleCommandExec(
                 Address, ref nameUnsafe.Array, ref helpUnsafe.Array, flags);
             return(address == IntPtr.Zero ? null : new IConsoleCommand(address));
         }
 }
Ejemplo n.º 3
0
 public void Set(float value, EConsoleVariableFlags setBy = EConsoleVariableFlags.SetByCode)
 {
     Native_IConsoleVariable.SetFloat(Address, value, setBy);
 }
Ejemplo n.º 4
0
 public bool TestFlags(EConsoleVariableFlags flags)
 {
     return Native_IConsoleObject.TestFlags(Address, flags);
 }
Ejemplo n.º 5
0
 public void ClearFlags(EConsoleVariableFlags flags)
 {
     Native_IConsoleObject.ClearFlags(Address, flags);
 }
Ejemplo n.º 6
0
        private IConsoleCommand RegisterConsoleCommand(string name, string help, Delegate command, CommandDelegateType type, EConsoleVariableFlags flags)
        {
            ManagedCommand managedCommand = new ManagedCommand(command, type);

            if (managedCommand.Command != null && managedCommand.NativeCallback != null)
            {
                using (FStringUnsafe nameUnsafe = new FStringUnsafe(name))
                    using (FStringUnsafe helpUnsafe = new FStringUnsafe(help))
                    {
                        IntPtr address = IntPtr.Zero;
                        switch (type)
                        {
                        case CommandDelegateType.Default:
                            address = Native_IConsoleManager.RegisterConsoleCommandDefault(
                                Address, ref nameUnsafe.Array, ref helpUnsafe.Array, managedCommand.NativeCallback, flags);
                            break;

                        case CommandDelegateType.WithArgs:
                            address = Native_IConsoleManager.RegisterConsoleCommandWithArgs(
                                Address, ref nameUnsafe.Array, ref helpUnsafe.Array, managedCommand.NativeCallback, flags);
                            break;

                        case CommandDelegateType.WithWorld:
                            address = Native_IConsoleManager.RegisterConsoleCommandWithWorld(
                                Address, ref nameUnsafe.Array, ref helpUnsafe.Array, managedCommand.NativeCallback, flags);
                            break;

                        case CommandDelegateType.WithWorldAndArgs:
                            address = Native_IConsoleManager.RegisterConsoleCommandWithWorldAndArgs(
                                Address, ref nameUnsafe.Array, ref helpUnsafe.Array, managedCommand.NativeCallback, flags);
                            break;

                        case CommandDelegateType.WithOutputDevice:
                            address = Native_IConsoleManager.RegisterConsoleCommandWithOutputDevice(
                                Address, ref nameUnsafe.Array, ref helpUnsafe.Array, managedCommand.NativeCallback, flags);
                            break;
                        }
                        if (address != IntPtr.Zero)
                        {
                            managedCommand.NativeCommand = new IConsoleCommand(address);
                            managedCommands[address]     = managedCommand;
                            return(managedCommand.NativeCommand);
                        }
                    }
            }
            return(null);
        }
Ejemplo n.º 7
0
 public IConsoleCommand RegisterConsoleCommand(string name, string help, FConsoleCommandWithOutputDeviceDelegate command, EConsoleVariableFlags flags = EConsoleVariableFlags.Default)
 {
     return(RegisterConsoleCommand(name, help, command, CommandDelegateType.WithOutputDevice, flags));
 }