From 3dba744f501f3830a52a43f07db5b4554af12c1b Mon Sep 17 00:00:00 2001 From: andanteyk Date: Sun, 22 Feb 2015 19:47:15 +0900 Subject: [PATCH] Version 0.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・通知設定が保存されない不具合を修正 ・一部ログ出力がおかしい不具合を修正 ・任務窓:進捗によって色を変える --- ElectronicObserver/Notifier/NotifierBase.cs | 12 ++ ElectronicObserver/Notifier/NotifierDamage.cs | 18 +++ .../Notifier/NotifierDialogData.cs | 19 ++++ .../Notifier/NotifierManager.cs | 9 ++ .../Utility/SoftwareInformation.cs | 2 +- ElectronicObserver/Window/FormLog.cs | 3 +- ElectronicObserver/Window/FormMain.cs | 1 + ElectronicObserver/Window/FormQuest.cs | 103 +++++++++++++++--- README.md | 2 +- 9 files changed, 151 insertions(+), 18 deletions(-) diff --git a/ElectronicObserver/Notifier/NotifierBase.cs b/ElectronicObserver/Notifier/NotifierBase.cs index af7f86316..3ca78ddac 100644 --- a/ElectronicObserver/Notifier/NotifierBase.cs +++ b/ElectronicObserver/Notifier/NotifierBase.cs @@ -169,5 +169,17 @@ public virtual void Notify() { } + + public virtual void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + + DialogData.ApplyToConfiguration( config ); + config.PlaysSound = PlaysSound; + config.SoundPath = SoundPath; + config.IsEnabled = IsEnabled; + config.ShowsDialog = ShowsDialog; + config.AccelInterval = AccelInterval; + + } + } } diff --git a/ElectronicObserver/Notifier/NotifierDamage.cs b/ElectronicObserver/Notifier/NotifierDamage.cs index c0018a08d..c3c1fb576 100644 --- a/ElectronicObserver/Notifier/NotifierDamage.cs +++ b/ElectronicObserver/Notifier/NotifierDamage.cs @@ -242,5 +242,23 @@ public void Notify( string[] messages ) { base.Notify(); } + + public override void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + base.ApplyToConfiguration( config ); + + var c = config as Utility.Configuration.ConfigurationData.ConfigNotifierDamage; + + if ( c != null ) { + c.NotifiesBefore = NotifiesBefore; + c.NotifiesNow = NotifiesNow; + c.NotifiesAfter = NotifiesAfter; + c.LevelBorder = LevelBorder; + c.ContainsNotLockedShip = ContainsNotLockedShip; + c.ContainsSafeShip = ContainsSafeShip; + c.ContainsFlagship = ContainsFlagship; + c.NotifiesAtEndpoint = NotifiesAtEndpoint; + } + } + } } diff --git a/ElectronicObserver/Notifier/NotifierDialogData.cs b/ElectronicObserver/Notifier/NotifierDialogData.cs index cabca1c03..d4f4d860f 100644 --- a/ElectronicObserver/Notifier/NotifierDialogData.cs +++ b/ElectronicObserver/Notifier/NotifierDialogData.cs @@ -161,6 +161,25 @@ public void DisposeImage() { } #endregion + + + public void ApplyToConfiguration( Utility.Configuration.ConfigurationData.ConfigNotifierBase config ) { + + config.ImagePath = ImagePath; + config.DrawsImage = DrawsImage; + config.DrawsMessage = DrawsMessage; + config.ClosingInterval = ClosingInterval; + config.CloseOnMouseMove = CloseOnMouseMove; + config.Alignment = Alignment; + config.Location = Location; + config.HasFormBorder = HasFormBorder; + config.TopMost = TopMost; + config.ShowWithActivation = ShowWithActivation; + config.ForeColor = ForeColor; + config.BackColor = BackColor; + + } + } diff --git a/ElectronicObserver/Notifier/NotifierManager.cs b/ElectronicObserver/Notifier/NotifierManager.cs index d02e70aca..780a11d17 100644 --- a/ElectronicObserver/Notifier/NotifierManager.cs +++ b/ElectronicObserver/Notifier/NotifierManager.cs @@ -46,6 +46,15 @@ public void Initialize( FormMain parent ) { } + public void ApplyToConfiguration() { + + Expedition.ApplyToConfiguration( Utility.Configuration.Config.NotifierExpedition ); + Construction.ApplyToConfiguration( Utility.Configuration.Config.NotifierConstruction ); + Repair.ApplyToConfiguration( Utility.Configuration.Config.NotifierRepair ); + Condition.ApplyToConfiguration( Utility.Configuration.Config.NotifierCondition ); + Damage.ApplyToConfiguration( Utility.Configuration.Config.NotifierDamage ); + + } public void ShowNotifier( Form form ) { _parentForm.Invoke( (MethodInvoker)( () => form.Show() ) ); diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs index cdc7b4105..45be6d838 100644 --- a/ElectronicObserver/Utility/SoftwareInformation.cs +++ b/ElectronicObserver/Utility/SoftwareInformation.cs @@ -54,7 +54,7 @@ public static string VersionEnglish { /// public static DateTime UpdateTime { get { - return DateTimeHelper.CSVStringToTime( "2015/02/20 16:00:00" ); + return DateTimeHelper.CSVStringToTime( "2015/02/22 22:22:22" ); } } diff --git a/ElectronicObserver/Window/FormLog.cs b/ElectronicObserver/Window/FormLog.cs index de20709b4..ef3cd177d 100644 --- a/ElectronicObserver/Window/FormLog.cs +++ b/ElectronicObserver/Window/FormLog.cs @@ -24,7 +24,8 @@ public FormLog( FormMain parent ) { private void FormLog_Load( object sender, EventArgs e ) { foreach ( var log in Utility.Logger.Log ) { - LogList.Items.Add( log.ToString() ); + if ( log.Priority >= Utility.Configuration.Config.Log.LogLevel ) + LogList.Items.Add( log.ToString() ); } LogList.TopIndex = LogList.Items.Count - 1; diff --git a/ElectronicObserver/Window/FormMain.cs b/ElectronicObserver/Window/FormMain.cs index ead0e344a..32981e937 100644 --- a/ElectronicObserver/Window/FormMain.cs +++ b/ElectronicObserver/Window/FormMain.cs @@ -211,6 +211,7 @@ private void FormMain_FormClosing( object sender, FormClosingEventArgs e ) { private void FormMain_FormClosed( object sender, FormClosedEventArgs e ) { + NotifierManager.Instance.ApplyToConfiguration(); Utility.Configuration.Instance.Save(); APIObserver.Instance.Stop(); RecordManager.Instance.Save(); diff --git a/ElectronicObserver/Window/FormQuest.cs b/ElectronicObserver/Window/FormQuest.cs index c58baf253..3503638f0 100644 --- a/ElectronicObserver/Window/FormQuest.cs +++ b/ElectronicObserver/Window/FormQuest.cs @@ -17,12 +17,48 @@ namespace ElectronicObserver.Window { public partial class FormQuest : DockContent { + private DataGridViewCellStyle CSDefaultLeft, CSDefaultCenter, CSProgress1, CSProgress50, CSProgress80, CSProgress100; + + public FormQuest( FormMain parent ) { InitializeComponent(); ControlHelper.SetDoubleBuffered( QuestView ); ConfigurationChanged(); + + + #region set cellstyle + + CSDefaultLeft = new DataGridViewCellStyle(); + CSDefaultLeft.Alignment = DataGridViewContentAlignment.MiddleLeft; + CSDefaultLeft.BackColor = SystemColors.Control; + //CSDefaultLeft.Font = Font; + CSDefaultLeft.ForeColor = SystemColors.ControlText; + CSDefaultLeft.SelectionBackColor = Color.FromArgb( 0xFF, 0xFF, 0xCC ); + CSDefaultLeft.SelectionForeColor = SystemColors.ControlText; + CSDefaultLeft.WrapMode = DataGridViewTriState.False; + + CSDefaultCenter = new DataGridViewCellStyle( CSDefaultLeft ); + CSDefaultCenter.Alignment = DataGridViewContentAlignment.MiddleCenter; + + CSProgress1 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress1.BackColor = Color.FromArgb( 0xFF, 0xFF, 0xBB ); + + CSProgress50 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress50.BackColor = Color.FromArgb( 0xDD, 0xFF, 0xBB ); + + CSProgress80 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress80.BackColor = Color.FromArgb( 0xBB, 0xFF, 0xBB ); + + CSProgress100 = new DataGridViewCellStyle( CSDefaultLeft ); + CSProgress100.BackColor = Color.FromArgb( 0xBB, 0xFF, 0xFF ); + + QuestView.DefaultCellStyle = CSDefaultCenter; + QuestView_Name.DefaultCellStyle = CSDefaultLeft; + QuestView_Progress.DefaultCellStyle = CSDefaultLeft; + + #endregion } @@ -70,11 +106,6 @@ void ConfigurationChanged() { - - void APIUpdated( string apiname, dynamic data ) { - Updated(); - } - void Updated() { if ( !KCDatabase.Instance.Quest.IsLoaded ) return; @@ -118,22 +149,63 @@ void Updated() { { string value; + DataGridViewCellStyle style; + if ( q.State == 3 ) { value = "達成!"; + style = CSProgress100; + } else { - switch ( q.Progress ) { - case 0: - value = "-"; break; - case 1: - value = "50%以上"; break; - case 2: - value = "80%以上"; break; - default: - value = "???"; break; + + if ( KCDatabase.Instance.QuestProgress.Progresses.ContainsKey( q.QuestID ) ) { + var p = KCDatabase.Instance.QuestProgress.Progresses[q.QuestID]; + value = p.ToString(); + + double percentage = p.ProgressPercentage; + + if ( percentage >= 1.00 ) { + style = CSProgress100; + + } else if ( percentage >= 0.80 ) { + style = CSProgress80; + + } else if ( percentage >= 0.50 ) { + style = CSProgress50; + + } else if ( percentage > 0.00 ) { + style = CSProgress1; + + } else { + style = CSDefaultLeft; + + } + + } else { + + switch ( q.Progress ) { + case 0: + value = "-"; + style = CSDefaultLeft; + break; + case 1: + value = "50%以上"; + style = CSProgress50; + break; + case 2: + value = "80%以上"; + style = CSProgress80; + break; + default: + value = "???"; + style = CSDefaultLeft; + break; + } } } row.Cells[QuestView_Progress.Index].Value = value; + row.Cells[QuestView_Progress.Index].Style = style; + } QuestView.Rows.Add( row ); @@ -197,6 +269,7 @@ private void QuestView_CellFormatting( object sender, DataGridViewCellFormatting } + /* if ( e.ColumnIndex == QuestView_Progress.Index ) { int? qid = QuestView.Rows[e.RowIndex].Cells[QuestView_Name.Index].Value as int?; @@ -209,7 +282,7 @@ private void QuestView_CellFormatting( object sender, DataGridViewCellFormatting } } } - + */ } diff --git a/README.md b/README.md index ebb1d66e4..545efe174 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ *このリンクの更新は遅れる可能性があります。最新版は[こちら](http://electronicobserver.blog.fc2.com/)で確認してください。* -[ver. 0.2.1 (2015/02/17)](http://bit.ly/1DAz8uG) +[ver. 0.3.0 (2015/02/22)](http://bit.ly/1BAq9KH) ### 開発者の皆様へ ---