public override void OnResponseReceived( dynamic data ) { KCDatabase db = KCDatabase.Instance; //api_material db.Material.LoadFromResponse( APIName, data.api_material ); //api_basic db.Admiral.LoadFromResponse( APIName, data.api_basic ); //api_ship db.Ships.Clear(); foreach ( var elem in data.api_ship ) { var a = new ShipData(); a.LoadFromResponse( APIName, elem ); db.Ships.Add( a ); } //api_ndock foreach ( var elem in data.api_ndock ) { int id = (int)elem.api_id; if ( !db.Docks.ContainsKey( id ) ) { var a = new DockData(); a.LoadFromResponse( APIName, elem ); db.Docks.Add( a ); } else { db.Docks[id].LoadFromResponse( APIName, elem ); } } //api_deck_port db.Fleet.LoadFromResponse( APIName, data.api_deck_port ); db.Fleet.CombinedFlag = data.api_combined_flag() ? (int)data.api_combined_flag : 0; db.Battle.LoadFromResponse( APIName, data ); base.OnResponseReceived( (object)data ); }
public override void OnResponseReceived( dynamic data ) { KCDatabase db = KCDatabase.Instance; foreach ( var dock in data ) { int id = (int)dock.api_id; if ( !db.Docks.ContainsKey( id ) ) { var d = new DockData(); d.LoadFromResponse( APIName, dock ); db.Docks.Add( d ); } else { db.Docks[id].LoadFromResponse( APIName, dock ); } } db.Fleet.LoadFromResponse( APIName, data ); base.OnResponseReceived( (object)data ); }