Ejemplo n.º 1
0
 private void setupGetItemPanel(NavigateEventArgs e)
 {
     Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
         string ammo          = e.Data["api_itemget"]["api_getcount"].ToString();
         string kind          = e.Data["api_itemget"]["api_id"].ToString();
         labEnemyName.Content = string.Format("獲得 {0} {1}", ammo, itemgetMap[kind]);
     });
 }
Ejemplo n.º 2
0
        private void KCODt_MapNavigate(object sender, NavigateEventArgs e)
        {
            Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
                labArea.Content = string.Format("{0}-{1}-{2}",
                                                e.Data["api_maparea_id"].ToString(),
                                                e.Data["api_mapinfo_no"].ToString(),
                                                e.Data["api_no"].ToString());
                clearEnemyPanel();
            });
            if (e.Data["api_enemy"] != null)
            {
                string eid = e.Data["api_enemy"]["api_enemy_id"].ToString();
                if (KCODt.Instance.EnemyDeckMap.ContainsKey(eid))
                {
                    setupEnemyPanel(e);
                }
            }
            else if (e.Data["api_itemget"] != null)
            {
                setupGetItemPanel(e);
            }
            else if (e.Data["api_happening"] != null)
            {
                Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
                    string mstName = "UnKnow";
                    switch (e.Data["api_happening"]["api_mst_id"].ToString())
                    {
                    case "1":
                        mstName = "燃料";
                        break;

                    case "2":
                        mstName = "弾薬";
                        break;

                    default:
                        break;
                    }
                    labEnemyName.Content = string.Format("掉落 {0} {1}",
                                                         e.Data["api_happening"]["api_count"].ToString(), mstName);
                });
            }
            else
            {
                Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
                    labEnemyName.Content = "無戰鬥";
                });
            }
        }
Ejemplo n.º 3
0
        protected virtual void OnMapNavigateEvent(NavigateEventArgs e)
        {
            NavigateStack.Push(new NavigateDetail(e.Type, e.Data));
            if (e.Data["api_enemy"] != null)
            {
                string eid = e.Data["api_enemy"]["api_enemy_id"].ToString();
                if (!EnemyDeckMap.ContainsKey(eid))
                {
                    Debug.Print("EnemyDeckMap doesn't had data on " + eid);
                    enemyDeckId = eid;
                }
            }
            MapNavigateEventHandler handler = MapNavigate;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 4
0
 private void setupEnemyPanel(NavigateEventArgs e)
 {
     Dispatcher.FromThread(UIThread).Invoke((MainWindow.Invoker) delegate {
         try {
             string eid           = e.Data["api_enemy"]["api_enemy_id"].ToString();
             JToken ed            = KCODt.Instance.EnemyDeckMap[eid];
             labEnemyName.Content = ed["Name"].ToString();
             string fk            = ed["Formation"].ToString();
             if (fk != "" && formationMap.ContainsKey(fk))
             {
                 labFormation.Content = formationMap[ed["Formation"].ToString()];
             }
             JArray esh = ed["Ship"] as JArray;
             for (int i = 0; i < edi.Count; i++)
             {
                 string shipId = esh[i + 1].ToString();
                 var qs        = from spec in KCODt.Instance.ShipSpec
                                 from stype in KCODt.Instance.ShipType
                                 where spec["api_id"].ToString() == shipId &&
                                 spec["api_stype"].ToString() == stype["api_id"].ToString()
                                 select JToken.FromObject(new ShipSpecDetail(spec, stype));
                 if (qs.Count() == 0)
                 {
                     edi[i].Source = null;
                 }
                 else
                 {
                     JToken sd      = qs.First() as JToken;
                     Int32Rect rect = new Int32Rect(50, 40, 85, 60);
                     edi[i].Source  = (CroppedBitmap)uic.Convert(new Uri(sd["ShipIcoName"].ToString()),
                                                                 null, rect, null);
                 }
             }
         } catch (Exception ex) {
             Debug.Print(ex.ToString());
         }
     });
 }