Exemple #1
0
 private void NetPackageReceiveHandler(object o, PackageReceived pr)
 {
     if (((Pack)pr.pack).packName == packNames.Facing)
     {
         OpponentFacing = (Facing)((Pack)pr.pack).content;
     }
     else if (((Pack)pr.pack).packName == packNames.End)
     {
         if (((Pack)pr.pack).content.ToString() == "Win")
         {
             Win = false;
         }
         else if (((Pack)pr.pack).content.ToString() == "Lost")
         {
             Lost = false;
             Win = true;
         }
         else
         {
             Lost = true;
             Win = true;
         }
     }
     else if (((Pack)pr.pack).packName == packNames.Replay)
     {
         if (((Pack)pr.pack).content.ToString() == "Yes")
         {
             gameWindow.setReplay("Yes");
         }
         else
         {
             gameWindow.setReplay("No");
         }
     }
 }
Exemple #2
0
 private void NetPackageReceiveHandler(object sender, PackageReceived e)
 {
     this.Dispatcher.Invoke((Action)(() => {
         if (e.pack is string) {
             if ((string)e.pack == "START") {
                 if (_lfnet.isClient()) {
                     _lfnet.send("START");
                 }
                 game.initialize(_lfnet, _profile);
                 game.run();
             }
         }
     }));
 }
Exemple #3
0
 /// <summary>
 /// Elküldi a fogadott csomagot egy eventben
 /// </summary>
 /// <param name="e">Csomag</param>
 private void dispatchPackageEvent(PackageReceived e)
 {
     if (ReceiveObservers != null) {
         ReceiveObservers(this, e);
     }
 }