コード例 #1
0
ファイル: SoundSetter.cs プロジェクト: msdx321/SoundSetter
        public void MasterVolumeAdjust(string command, string args)
        {
            var chat = this.pluginInterface.Framework.Gui.Chat;

            ParseAdjustArgs(args, out var op, out var volumeTargetStr);

            if (op == OperationKind.Mute)
            {
                this.vc.MasterVolumeMuted.SetValue(true);
                chat.Print("Master volume muted.");
                return;
            }

            if (op == OperationKind.Unmute)
            {
                this.vc.MasterVolumeMuted.SetValue(false);
                chat.Print("Master volume unmuted.");
                return;
            }

            if (!int.TryParse(volumeTargetStr, out var volumeTarget))
            {
                PrintChatError(chat, string.Format(ErrorMessages.AdjustCommand, MasterVolumeAdjustCommand));
                return;
            }

            VolumeControls.AdjustVolume(this.vc.MasterVolume, volumeTarget, op);
            chat.Print($"Master volume set to {this.vc.MasterVolume.GetValue()}.");
        }
コード例 #2
0
ファイル: SoundSetter.cs プロジェクト: msdx321/SoundSetter
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            this.pluginInterface = pluginInterface;

            this.config = (Configuration)this.pluginInterface.GetPluginConfig() ?? new Configuration();
            this.config.Initialize(this.pluginInterface);

            this.vc = new VolumeControls(this.pluginInterface.TargetModuleScanner, this.pluginInterface.SendMessage);

            this.pluginInterface.UiBuilder.DisableAutomaticUiHide = true;

            this.ui = new SoundSetterUi(this.vc, this.pluginInterface, this.config);
            this.pluginInterface.UiBuilder.OnBuildUi += this.ui.Draw;
            this.pluginInterface.UiBuilder.OnBuildUi += OnTick;

            this.pluginInterface.UiBuilder.OnOpenConfigUi += ToggleConfig;

            this.commandManager = new PluginCommandManager <SoundSetter>(this, this.pluginInterface);
        }
コード例 #3
0
 public SoundSetterUi(VolumeControls vc, DalamudPluginInterface pi, Configuration config)
 {
     this.vc     = vc;
     this.pi     = pi;
     this.config = config;
 }