Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andanteyk committed Feb 22, 2015
2 parents 85f7f9d + 3dba744 commit a272098
Show file tree
Hide file tree
Showing 39 changed files with 1,492 additions and 334 deletions.
Binary file modified ElectronicObserver/Assets.zip
Binary file not shown.
Binary file added ElectronicObserver/Assets/Equipment/PicketCrew.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions ElectronicObserver/Data/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,54 @@ public static string GetAACutinKind( int id ) {
}


/// <summary>
/// 勝利ランクを表すIDを取得します。
/// </summary>
public static int GetWinRank( string rank ) {
switch ( rank.ToUpper() ) {
case "E":
return 1;
case "D":
return 2;
case "C":
return 3;
case "B":
return 4;
case "A":
return 5;
case "S":
return 6;
case "SS":
return 7;
default:
return 0;
}
}

/// <summary>
/// 勝利ランクを表す文字列を取得します。
/// </summary>
public static string GetWinRank( int rank ) {
switch ( rank ) {
case 1:
return "E";
case 2:
return "D";
case 3:
return "C";
case 4:
return "B";
case 5:
return "A";
case 6:
return "S";
case 7:
return "SS";
default:
return "不明";
}
}

#endregion


Expand Down
16 changes: 16 additions & 0 deletions ElectronicObserver/Data/KCDatabase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ElectronicObserver.Data.Battle;
using ElectronicObserver.Data.Quest;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -104,6 +105,11 @@ public static KCDatabase Instance {
/// </summary>
public QuestManager Quest { get; private set; }

/// <summary>
/// 任務進捗データ
/// </summary>
public QuestProgressManager QuestProgress { get; private set; }


/// <summary>
/// 戦闘データ
Expand Down Expand Up @@ -146,6 +152,7 @@ private KCDatabase() {
Fleet = new FleetManager();
Material = new MaterialData();
Quest = new QuestManager();
QuestProgress = new QuestProgressManager();
Battle = new BattleManager();
MapInfo = new IDDictionary<MapInfoData>();
Mission = new IDDictionary<MissionData>();
Expand All @@ -161,11 +168,20 @@ public void Load() {
if ( temp != null )
ShipGroup = temp;
}
{
var temp = QuestProgress.Load();
if ( temp != null ) {
if ( QuestProgress != null )
QuestProgress.RemoveEvents();
QuestProgress = temp;
}
}

}

public void Save() {
ShipGroup.Save();
QuestProgress.Save();
}

}
Expand Down
30 changes: 0 additions & 30 deletions ElectronicObserver/Data/Quest/DestroyEquipment.cs

This file was deleted.

29 changes: 0 additions & 29 deletions ElectronicObserver/Data/Quest/DestroyShip.cs

This file was deleted.

145 changes: 145 additions & 0 deletions ElectronicObserver/Data/Quest/ProgressAGo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data.Quest {

/// <summary>
/// 任務「あ号作戦」の進捗を管理します。
/// </summary>
[DataContract( Name = "ProgressAGo" )]
public class ProgressAGo : ProgressData {

/// <summary>
/// 達成に必要な出撃回数
/// </summary>
[IgnoreDataMember]
private int sortieMax { get { return 36; } }

/// <summary>
/// 達成に必要なS勝利回数
/// </summary>
[IgnoreDataMember]
private int sWinMax { get { return 6; } }

/// <summary>
/// 達成に必要なボス戦闘回数
/// </summary>
[IgnoreDataMember]
private int bossMax { get { return 24; } }

/// <summary>
/// 達成に必要なボス勝利回数
/// </summary>
[IgnoreDataMember]
private int bossWinMax { get { return 12; } }


/// <summary>
/// 現在の出撃回数
/// </summary>
[IgnoreDataMember]
private int sortieCount {
get { return Progress & 0xFF; }
set { Progress = ( Progress & ~0xFF ) | ( value & 0xFF ); }
}

/// <summary>
/// 現在のS勝利回数
/// </summary>
[IgnoreDataMember]
private int sWinCount {
get { return ( Progress >> 8 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 8 ) ) | ( ( value & 0xFF ) << 8 ); }
}

/// <summary>
/// 現在のボス戦闘回数
/// </summary>
[IgnoreDataMember]
private int bossCount {
get { return ( Progress >> 16 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 16 ) ) | ( ( value & 0xFF ) << 16 ); }
}

/// <summary>
/// 現在のボス勝利回数
/// </summary>
[IgnoreDataMember]
private int bossWinCount {
get { return ( Progress >> 24 ) & 0xFF; }
set { Progress = ( Progress & ~( 0xFF << 24 ) ) | ( ( value & 0xFF ) << 24 ); }
}



public ProgressAGo( int questID )
: base( questID, 0 ) {
}


public override double ProgressPercentage {
get {
double prog = 0;
prog += Math.Min( (double)sortieCount / sortieMax, 1.0 ) * 0.25;
prog += Math.Min( (double)sWinCount / sWinMax, 1.0 ) * 0.25;
prog += Math.Min( (double)bossCount / bossMax, 1.0 ) * 0.25;
prog += Math.Min( (double)bossWinCount / bossWinMax, 1.0 ) * 0.25;
return prog;
}
}



public override void Increment() {
throw new NotSupportedException();
}


public override void CheckProgress( int progressFlag ) {
//なにもしない
}


/// <summary>
/// 出撃回数を増やします。
/// </summary>
public void IncrementSortie() {
sortieCount = Math.Min( sortieCount + 1, sortieMax );
}

/// <summary>
/// 戦闘回数を増やします。
/// </summary>
public void IncrementBattle( string rank, bool isBoss ) {

int irank = Constants.GetWinRank( rank );

if ( isBoss ) {
bossCount = Math.Min( bossCount + 1, bossMax );

if ( irank >= Constants.GetWinRank( "B" ) )
bossWinCount = Math.Min( bossWinCount + 1, bossWinMax );
}

if ( irank >= Constants.GetWinRank( "S" ) )
sWinCount = Math.Min( sWinCount + 1, sWinMax );

}


public override string ToString() {
return string.Format( "出撃 {0}/{1}, S勝利 {2}/{3}, ボス {4}/{5}, ボス勝利 {6}/{7} ({8:p})",
sortieCount, sortieMax,
sWinCount, sWinMax,
bossCount, bossMax,
bossWinCount, bossMax,
ProgressPercentage );
}

}

}
63 changes: 63 additions & 0 deletions ElectronicObserver/Data/Quest/ProgressBattle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data.Quest {

/// <summary>
/// 戦闘系の任務の進捗を管理します。
/// </summary>
[DataContract( Name = "ProgressBattle" )]
public class ProgressBattle : ProgressData {

/// <summary>
/// 条件を満たす最低ランク
/// </summary>
[DataMember]
private int LowestRank { get; set; }

/// <summary>
/// 対象となる海域
/// </summary>
[DataMember]
private HashSet<int> TargetArea { get; set; }

/// <summary>
/// ボス限定かどうか
/// </summary>
[DataMember]
private bool IsBossOnly { get; set; }


public ProgressBattle( int questID, int maxCount, string lowestRank, int[] targetArea, bool isBossOnly )
: base( questID, maxCount ) {

LowestRank = Constants.GetWinRank( lowestRank );
TargetArea = targetArea == null ? null : new HashSet<int>( targetArea );
IsBossOnly = isBossOnly;
}



public void Increment( string rank, int areaID, bool isBoss ) {

if ( TargetArea != null && !TargetArea.Contains( areaID ) )
return;

if ( Constants.GetWinRank( rank ) < LowestRank )
return;

if ( IsBossOnly && !isBoss )
return;


Increment();
}


}

}
21 changes: 21 additions & 0 deletions ElectronicObserver/Data/Quest/ProgressConstruction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace ElectronicObserver.Data.Quest {

/// <summary>
/// 艦船建造任務の進捗を管理します。
/// </summary>
[DataContract( Name = "ProgressConstruction" )]
public class ProgressConstruction : ProgressData {

public ProgressConstruction( int questID, int maxCount )
: base( questID, maxCount ) {
}

}
}
Loading

0 comments on commit a272098

Please sign in to comment.