void UpdateFleets(IEnumerable<Fleet> rpFleets)
        {
            Fleets = KanColleGame.Current.Port.Fleets.Table.Values.Select(r => new FleetViewModel(r)).ToList();
            SelectedFleet = Fleets.FirstOrDefault();

            r_Parent.Overview.Fleets = Fleets;
        }
Exemplo n.º 2
0
        void UpdateFleets(IEnumerable <Fleet> rpFleets)
        {
            Fleets        = KanColleGame.Current.Port.Fleets.Table.Values.Select(r => new FleetViewModel(r)).ToList();
            SelectedFleet = Fleets.FirstOrDefault();

            r_Parent.Overview.Fleets = Fleets;
        }
        internal FleetsViewModel(GameInformationViewModel rpParent)
        {
            r_Parent = rpParent;

            KanColleGame.Current.Port.Fleets.FleetsUpdated += UpdateFleets;

            SessionService.Instance.Subscribe("api_req_hensei/change", r => SelectedFleet = Fleets[int.Parse(r.Parameters["api_id"]) - 1]);
            SessionService.Instance.Subscribe("api_req_hensei/preset_select", r => SelectedFleet = Fleets[int.Parse(r.Parameters["api_deck_id"]) - 1]);
            SessionService.Instance.Subscribe("api_req_kaisou/slotset", r =>
            {
                Ship rShip;
                if (!KanColleGame.Current.Port.Ships.TryGetValue(int.Parse(r.Parameters["api_id"]), out rShip))
                    return;

                if (rShip.OwnerFleet != null)
                    SelectedFleet = Fleets[rShip.OwnerFleet.ID - 1];
            });

            SessionService.Instance.Subscribe("api_req_map/start", r => SelectedFleet = Fleets[int.Parse(r.Parameters["api_deck_id"]) - 1]);
        }
Exemplo n.º 4
0
        internal FleetsViewModel(GameInformationViewModel rpParent)
        {
            r_Parent = rpParent;

            KanColleGame.Current.Port.Fleets.FleetsUpdated += UpdateFleets;

            ApiService.Subscribe("api_req_hensei/change", r => SelectedFleet        = Fleets[int.Parse(r.Parameters["api_id"]) - 1]);
            ApiService.Subscribe("api_req_hensei/preset_select", r => SelectedFleet = Fleets[int.Parse(r.Parameters["api_deck_id"]) - 1]);
            ApiService.Subscribe("api_req_kaisou/slotset", r =>
            {
                Ship rShip;
                if (!KanColleGame.Current.Port.Ships.TryGetValue(int.Parse(r.Parameters["api_id"]), out rShip))
                {
                    return;
                }

                if (rShip.OwnerFleet != null)
                {
                    SelectedFleet = Fleets[rShip.OwnerFleet.ID - 1];
                }
            });

            ApiService.Subscribe("api_req_map/start", r => SelectedFleet = Fleets[int.Parse(r.Parameters["api_deck_id"]) - 1]);
        }