/// <summary> /// 後方参照を置換したMessageを返す /// </summary> /// <param name="telop">OnePointTelop</param> /// <returns>置換後のMessage</returns> public static string GetReplacedMessage(OnePointTelop telop) { var builder = new StringBuilder(telop.Message); int index = 1; index += ReplaceMessageWithSpell(builder, telop.TimersMustRunningForStart, index); index += ReplaceMessageWithSpell(builder, telop.TimersMustStoppingForStart, index); index += ReplaceMessageWithTelop(builder, telop.TimersMustRunningForStart, index); index += ReplaceMessageWithTelop(builder, telop.TimersMustStoppingForStart, index); return builder.ToString(); }
/// <summary> /// 指定されたOnePointTelopの条件を確認する /// </summary> /// <param name="telop">OnePointTelop</param> /// <returns>条件を満たしていればtrue</returns> public static bool CheckConditionsForTelop(OnePointTelop telop) { return CheckConditions(telop.TimersMustRunningForStart, telop.TimersMustStoppingForStart); }
/// <summary> /// 詳細を表示する /// </summary> /// <param name="dataSource"></param> private void ShowTelopDetail( OnePointTelop dataSource) { var src = dataSource; if (src == null) { this.TelopDetailGroupBox.Visible = false; return; } // データソースをタグに突っ込んでおく this.TelopDetailGroupBox.Tag = src; this.TelopDetailGroupBox.Visible = true; this.TelopTitleTextBox.Text = src.Title; this.TelopMessageTextBox.Text = src.Message; this.TelopKeywordTextBox.Text = src.Keyword; this.TelopKeywordToHideTextBox.Text = src.KeywordToHide; this.TelopRegexEnabledCheckBox.Checked = src.RegexEnabled; this.TelopDelayNumericUpDown.Value = (decimal)src.Delay; this.DisplayTimeNumericUpDown.Value = (decimal)src.DisplayTime; this.EnabledAddMessageCheckBox.Checked = src.AddMessageEnabled; this.TelopProgressBarEnabledCheckBox.Checked = src.ProgressBarEnabled; this.TelopVisualSetting.FontColor = src.FontColor.FromHTML(); this.TelopVisualSetting.FontOutlineColor = src.FontOutlineColor.FromHTML(); this.TelopVisualSetting.SetFontInfo(src.Font); this.TelopVisualSetting.BackgroundColor = string.IsNullOrWhiteSpace(src.BackgroundColor) ? Settings.Default.BackgroundColor : Color.FromArgb(src.BackgroundAlpha, src.BackgroundColor.FromHTML()); this.TemporarilyDisplayTickerCheckBox.Checked = src.IsTemporaryDisplay; this.TelopNotifyToDiscordCheckBox.Checked = src.NotifyToDiscord; this.TelopVisualSetting.RefreshSampleImage(); var left = (int)src.Left; var top = (int)src.Top; double x, y; TickersController.Instance.GettLocation( src.ID, out x, out y); if (x != 0) { left = (int)x; } if (y != 0) { top = (int)y; } this.TelopLeftNumericUpDown.Value = left; this.TelopLeftNumericUpDown.Tag = left; this.TelopTopNumericUpDown.Value = top; this.TelopTopNumericUpDown.Tag = top; this.TelopMatchSoundComboBox.SelectedValue = src.MatchSound; this.TelopMatchTTSTextBox.Text = src.MatchTextToSpeak; this.TelopDelaySoundComboBox.SelectedValue = src.DelaySound; this.TelopDelayTTSTextBox.Text = src.DelayTextToSpeak; // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青) this.TelopSelectJobButton.ForeColor = src.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) this.TelopSelectZoneButton.ForeColor = src.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // 条件設定ボタンの色を変える(未設定:黒、設定有:青) this.TelopSetConditionButton.ForeColor = (src.TimersMustRunningForStart.Length != 0 || src.TimersMustStoppingForStart.Length != 0) ? Color.Blue : Button.DefaultForeColor; }
/// <summary> /// 指定されたOnePointTelopが稼働中か判定する /// Delayがある場合はDelay経過後から稼働中として扱う /// </summary> /// <param name="telop">OnePointTelop</param> /// <returns>稼働中であればtrue</returns> private static bool IsRunning(OnePointTelop telop) { if (telop.MatchDateTime > DateTime.MinValue && !telop.ForceHide) { var start = telop.MatchDateTime.AddSeconds(telop.Delay); var end = telop.MatchDateTime.AddSeconds(telop.Delay + telop.DisplayTime); if (start <= DateTime.Now && DateTime.Now <= end) { return true; } } return false; }
/// <summary> /// 指定されたOnePointTelopの条件を確認する /// </summary> /// <param name="telop">OnePointTelop</param> /// <returns>条件を満たしていればtrue</returns> public static bool CheckConditionsForTelop(OnePointTelop telop) { return(CheckConditions(telop.TimersMustRunningForStart, telop.TimersMustStoppingForStart)); }