예제 #1
0
 private void launch()
 {
     if (this.sliderEnabled)
     {
         if (this.inLaunch)
         {
             TimeSpan span = (TimeSpan)(DateTime.Now - this.lastLaunchTime);
             if (span.TotalSeconds < 20.0)
             {
                 return;
             }
         }
         this.inLaunch       = true;
         this.lastLaunchTime = DateTime.Now;
         int numScouts = this.sliderImage.Value + 1;
         this.aiworld_Scout_ID_ownVillage      = this.m_ownVillage;
         this.aiworld_Scout_ID_selectedVillage = this.m_selectedVillage;
         this.aiworld_Scout_ID_numScouts       = numScouts;
         RemoteServices.Instance.set_SendScouts_UserCallBack(new RemoteServices.SendScouts_UserCallBack(this.sendScoutsCallback));
         RemoteServices.Instance.SendScouts(this.m_ownVillage, this.m_selectedVillage, numScouts);
         AllVillagesPanel.travellersChanged();
         VillageMap map = GameEngine.Instance.getVillage(this.m_ownVillage);
         if (map != null)
         {
             map.addTroops(0, 0, 0, 0, 0, -numScouts);
         }
         this.launchButton.Enabled = false;
         this.closeButton.Enabled  = false;
         CursorManager.SetCursor(CursorManager.CursorType.WaitCursor, base.ParentForm);
     }
 }
 public void sendTroopsToCapitalCallback(SendTroopsToCapital_ReturnType returnData)
 {
     if (returnData.Success)
     {
         ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
         GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
         InterfaceMgr.Instance.getMainTabBar().changeTab(9);
         InterfaceMgr.Instance.getMainTabBar().changeTab(0);
         VillageMap map = GameEngine.Instance.getVillage(returnData.villageID);
         if (map != null)
         {
             map.addTroops(-returnData.numPeasants, -returnData.numArchers, -returnData.numPikemen, -returnData.numSwordsmen, -returnData.numCatapults);
         }
     }
 }
예제 #3
0
 public void sendTroopsToVassalCallback(SendTroopsToVassal_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.vassalArmyReturnData != null)
         {
             this.getVassalArmyInfoCallback(returnData.vassalArmyReturnData);
         }
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             VillageMap map = GameEngine.Instance.getVillage(returnData.villageID);
             if (map != null)
             {
                 map.addTroops(-returnData.numPeasants, -returnData.numArchers, -returnData.numPikemen, -returnData.numSwordsmen, -returnData.numCatapults);
             }
             this.updateValues();
         }
     }
 }
예제 #4
0
 public void sendScoutsCallback(SendScouts_ReturnType returnData)
 {
     CursorManager.SetCursor(CursorManager.CursorType.Default, base.ParentForm);
     this.inLaunch = false;
     if (!returnData.Success && (returnData.m_errorCode == ErrorCodes.ErrorCode.ATTACKING_VILLAGE_INTERDICT_PROTECTED))
     {
         MessageBoxButtons yesNo = MessageBoxButtons.YesNo;
         if (MyMessageBox.Show(SK.Text("GameEngine_Currently_Interdited", "You are currently Interdiction protected") + "\n" + SK.Text("GameEngine_CancelProtection", "Do you wish to cancel this protection?"), SK.Text("GENERIC_Protected", "You Are Protected"), yesNo) == DialogResult.Yes)
         {
             RemoteServices.Instance.set_CancelInterdiction_UserCallBack(new RemoteServices.CancelInterdiction_UserCallBack(this.cancelInterdictionCallback));
             RemoteServices.Instance.CancelInterdiction(-returnData.sourceVillage);
         }
         else
         {
             if (returnData.numScoutsNotTaken > 0)
             {
                 VillageMap map = GameEngine.Instance.getVillage(returnData.sourceVillage);
                 if (map != null)
                 {
                     map.addTroops(0, 0, 0, 0, 0, returnData.numScoutsNotTaken);
                 }
             }
             InterfaceMgr.Instance.closeScoutPopupWindow();
             InterfaceMgr.Instance.getMainTabBar().changeTab(9);
             InterfaceMgr.Instance.getMainTabBar().changeTab(0);
         }
     }
     else
     {
         this.closeButton.Enabled = true;
         if (returnData.Success)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             InterfaceMgr.Instance.displaySelectedVillagePanel(this.m_ownVillage, false, false, false, false);
             InterfaceMgr.Instance.closeScoutPopupWindow();
             if (returnData.cardData != null)
             {
                 GameEngine.Instance.World.UserCardData = returnData.cardData;
             }
             AttackTargetsPanel.addRecent(returnData.targetVillage);
         }
         if (returnData.numScoutsNotTaken > 0)
         {
             VillageMap map2 = GameEngine.Instance.getVillage(returnData.sourceVillage);
             if (map2 != null)
             {
                 map2.addTroops(0, 0, 0, 0, 0, returnData.numScoutsNotTaken);
             }
             if (!returnData.Success)
             {
                 this.launchButton.Enabled = false;
             }
         }
         if (returnData.Success)
         {
             InterfaceMgr.Instance.displaySelectedVillagePanel(this.m_selectedVillage, false, true, false, false);
             InterfaceMgr.Instance.closeScoutPopupWindow();
         }
     }
 }