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);
         }
     }
 }
示例#2
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();
         }
     }
 }
 private void cancelCastleAttackCallBack(CancelCastleAttack_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             GameEngine.Instance.World.deleteArmy(returnData.oldArmyID);
             if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(returnData.armyData.targetVillageID)))
             {
                 GameEngine.Instance.World.setLastTreasureCastleAttackTime(DateTime.MinValue);
             }
         }
         this.btnCancel.Visible = false;
         if (this.m_parent != null)
         {
             this.m_parent.init(false);
         }
     }
 }
示例#4
0
 private void cancelCastleAttackCallBack(CancelCastleAttack_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             GameEngine.Instance.World.setHonourData(returnData.currentHonourLevel, returnData.currentHonourRate);
             GameEngine.Instance.World.deleteArmy(returnData.oldArmyID);
             if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(returnData.armyData.targetVillageID)))
             {
                 GameEngine.Instance.World.setLastTreasureCastleAttackTime(DateTime.MinValue);
             }
         }
         this.update();
         this.returnButton.Visible = false;
     }
     else
     {
         this.forceReturnOff = false;
     }
 }
 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();
         }
     }
 }
 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);
         }
     }
 }
 private void buyVillageCallback(BuyVillage_ReturnType returnData)
 {
     if (returnData.Success)
     {
         GameEngine.Instance.World.setGoldData(returnData.currentGoldLevel, returnData.currentGoldRate);
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             VillageMap map = GameEngine.Instance.getVillage(returnData.m_villageID);
             if (map != null)
             {
                 map.m_numCaptains--;
             }
         }
         if ((InterfaceMgr.Instance.SelectedVillage >= 0) && GameEngine.Instance.World.isUserVillage(InterfaceMgr.Instance.SelectedVillage))
         {
             InterfaceMgr.Instance.closeSelectedVillagePanel();
         }
     }
     else
     {
         MyMessageBox.Show(ErrorCodes.getErrorString(returnData.m_errorCode, returnData.m_errorID), SK.Text("BuyVillagePopup_Error", "BuyVillage Error"));
     }
 }
 private void cancelCastleAttackCallBack(CancelCastleAttack_ReturnType returnData)
 {
     if (returnData.Success)
     {
         if (returnData.armyData != null)
         {
             ArmyReturnData[] armyReturnData = new ArmyReturnData[] { returnData.armyData };
             GameEngine.Instance.World.doGetArmyData(armyReturnData, null, false);
             GameEngine.Instance.World.addExistingArmy(returnData.armyData.armyID);
             GameEngine.Instance.World.setHonourData(returnData.currentHonourLevel, returnData.currentHonourRate);
             GameEngine.Instance.World.deleteArmy(returnData.oldArmyID);
             if (SpecialVillageTypes.IS_TREASURE_CASTLE(GameEngine.Instance.World.getSpecial(returnData.armyData.targetVillageID)))
             {
                 GameEngine.Instance.World.setLastTreasureCastleAttackTime(DateTime.MinValue);
             }
         }
         this.update();
         this.returnButton.Visible = false;
     }
     else
     {
         this.forceReturnOff = false;
     }
 }
示例#9
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();
         }
     }
 }