public void update()
 {
     this.backGround.update();
     if ((this.m_person != null) && !this.m_person.dying)
     {
         if (this.m_person.person.state != this.lastState)
         {
             this.backGround.updateTravelButton(this.homeVillageButton, this.m_person.person.homeVillageID);
             this.backGround.updateTravelButton(this.targetVillageButton, this.m_person.person.targetVillageID);
             this.lastState = this.m_person.person.state;
             if (this.lastState == 0)
             {
                 InterfaceMgr.Instance.closePersonInfoPanel();
                 return;
             }
             if (((this.lastState == 1) || (this.lastState == 11)) || (((this.lastState == 0x15) || (this.lastState == 0x1f)) || (this.lastState == 0x4b)))
             {
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0];
             }
             else if (this.lastState == 50)
             {
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1];
             }
         }
         double num        = DXTimer.GetCurrentMilliseconds() / 1000.0;
         double num2       = this.m_person.localEndTime - num;
         string subHeading = VillageMap.createBuildTimeString((int)num2);
         this.backGround.updateSubHeading(subHeading);
     }
     else
     {
         InterfaceMgr.Instance.closePersonInfoPanel();
     }
 }
 public void update()
 {
     this.backGround.update();
     if (this.m_trader != null)
     {
         if (this.m_trader.trader.traderState != this.lastState)
         {
             this.lastState = this.m_trader.trader.traderState;
             this.backGround.updateTravelButton(this.homeVillageButton, this.m_trader.trader.homeVillageID);
             this.backGround.updateTravelButton(this.targetVillageButton, this.m_trader.trader.targetVillageID);
             this.resourceImage.Visible       = false;
             this.resourceAmountLabel.Visible = false;
             if (this.lastState == 0)
             {
                 InterfaceMgr.Instance.closeTraderInfoPanel();
                 return;
             }
             if (((this.lastState == 1) || (this.lastState == 3)) || (this.lastState == 6))
             {
                 this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Trading", "Trading"));
                 if (GameEngine.Instance.World.isUserVillage(this.m_trader.trader.homeVillageID))
                 {
                     this.resourceImage.Image   = (Image)GFXLibrary.getCommodity32DSImage(this.m_trader.trader.resource);
                     this.resourceImage.Visible = true;
                     NumberFormatInfo nFI = GameEngine.NFI;
                     this.resourceAmountLabel.TextDiffOnly = GameEngine.Instance.World.getTradingAmount(this.m_trader.traderID).ToString("N", nFI);
                     this.resourceAmountLabel.Visible      = true;
                 }
                 if (this.lastState == 6)
                 {
                     this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1];
                 }
                 else
                 {
                     this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0];
                 }
             }
             else if ((this.lastState == 2) || (this.lastState == 4))
             {
                 this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Returning", "Returning"));
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1];
             }
             else if (this.lastState == 5)
             {
                 this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Collecting", "Collecting"));
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0];
             }
         }
         double num2 = DXTimer.GetCurrentMilliseconds() / 1000.0;
         double num3 = this.m_trader.localEndTime - num2;
         if (num3 < 0.0)
         {
             num3 = 0.0;
         }
         string subHeading = VillageMap.createBuildTimeString((int)num3);
         this.backGround.updateSubHeading(subHeading);
     }
 }
        public void update()
        {
            double localTime = DXTimer.GetCurrentMilliseconds() / 1000.0;

            foreach (QuestLine line in this.lineList)
            {
                line.update(localTime);
            }
        }
 private void updateSearch()
 {
     if ((this.lastUpdateTime != 0.0) && ((DXTimer.GetCurrentMilliseconds() - this.lastUpdateTime) > 2000.0))
     {
         this.lastUpdateTime = 0.0;
         if (this.textBoxNewRecipient.Text.Length > 2)
         {
             RemoteServices.Instance.GetMailUserSearch(this.textBoxNewRecipient.Text);
         }
     }
 }
 private void textBoxNewRecipient_KeyUp(object sender, KeyEventArgs e)
 {
     this.lastUpdateTime = DXTimer.GetCurrentMilliseconds();
     if (this.textBoxNewRecipient.Text.Length == 0)
     {
         this.btnSearch.Enabled = false;
     }
     else
     {
         this.btnSearch.Enabled = true;
     }
 }
        public void rebuild()
        {
            int[] numArray = GameEngine.Instance.World.getActiveQuests();
            this.outgoingScrollArea.clearControls();
            int y = 0;

            this.lineList.Clear();
            double num1 = DXTimer.GetCurrentMilliseconds() / 1000.0;

            for (int i = 0; i < numArray.Length; i++)
            {
                int quest         = numArray[i];
                int completeState = 0;
                if ((this.completedActiveQuests != null) && (i < this.completedActiveQuests.Length))
                {
                    if (this.completedActiveQuests[i])
                    {
                        completeState = 2;
                    }
                    else
                    {
                        completeState = 1;
                    }
                }
                QuestLine control = new QuestLine();
                if (y != 0)
                {
                    y += 5;
                }
                control.Position = new Point(0, y);
                control.init(quest, this, completeState, i);
                this.outgoingScrollArea.addControl(control);
                y += control.Height;
                this.lineList.Add(control);
            }
            this.outgoingScrollArea.Size = new Size(this.outgoingScrollArea.Width, y);
            if (y < this.outgoingScrollBar.Height)
            {
                this.outgoingScrollBar.Visible = false;
            }
            else
            {
                this.outgoingScrollBar.Visible         = true;
                this.outgoingScrollBar.NumVisibleLines = this.outgoingScrollBar.Height;
                this.outgoingScrollBar.Max             = y - this.outgoingScrollBar.Height;
            }
            this.outgoingScrollArea.invalidate();
            this.outgoingScrollBar.invalidate();
            this.backgroundImage.invalidate();
            this.update();
        }
Beispiel #7
0
        public override void DrawFast(Surface target, int x, int y, int width, int height)
        {
            double currentTime = DXTimer.GetCurrMillis();

            if (lastTime + refresh < currentTime)
            {
                curr     = (curr + 1) % images.NumFrames;
                lastTime = currentTime;
            }

            if (!dying)
            {
                images.DrawFast(target, x, y, width, height, curr, (Direction)direction);
            }
            //else
            //	images.Death[dieFrame].DrawFast(target,x,y,width,height);
        }
Beispiel #8
0
        public override void DrawFast(Surface target, int x, int y, int width, int height)
        {
            double currentTime = DXTimer.GetCurrMillis();

            if (lastTime + refresh < currentTime)
            {
                curr     = (curr + 1) % bob.Length;
                lastTime = currentTime;
            }

            if (!dying)
            {
                images.DrawFast(target, x, y + bob[curr], width, height, moving, (Direction)direction);
            }
            else if (!moving)
            {
                images.Death[dieFrame].DrawFast(target, x, y, width, height);
            }
        }
        private void updateSearch()
        {
            string textInput = "";
            bool   flag      = false;

            if (this.tbPlayerInput.Visible)
            {
                textInput = this.tbPlayerInput.Text;
            }
            else if (this.tbRegionInput.Visible)
            {
                flag      = true;
                textInput = this.tbRegionInput.Text;
            }
            if (this.lastUpdateTime != 0.0)
            {
                double currentMilliseconds = DXTimer.GetCurrentMilliseconds();
                if ((currentMilliseconds - this.lastUpdateTime) > 1000.0)
                {
                    if (textInput.Length == 0)
                    {
                        this.lastUpdateTime = 0.0;
                    }
                    else if ((((textInput.Length == 1) || (textInput.Length == 2)) && ((currentMilliseconds - this.lastUpdateTime) > 2000.0)) || (textInput.Length > 2))
                    {
                        this.lastUpdateTime = 0.0;
                        if (this.customPanel != null)
                        {
                            if (flag)
                            {
                                this.customPanel.searchRegionUpdateCallback(textInput);
                            }
                            else
                            {
                                this.customPanel.searchPlayerUpdateCallback(textInput);
                            }
                        }
                    }
                }
            }
        }
 private void cancelClick()
 {
     if (this.m_army != null)
     {
         double num          = DXTimer.GetCurrentMilliseconds() / 1000.0;
         double localEndTime = this.m_army.localEndTime;
         if (((this.m_army.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) >= num) && (this.m_army.lootType < 0))
         {
             RemoteServices.Instance.set_CancelCastleAttack_UserCallBack(new RemoteServices.CancelCastleAttack_UserCallBack(this.cancelCastleAttackCallBack));
             RemoteServices.Instance.CancelCastleAttack(this.m_army.armyID);
             this.btnCancel.Visible = false;
         }
         else
         {
             this.btnCancel.Visible = false;
             if (this.m_parent != null)
             {
                 this.m_parent.init(false);
             }
         }
     }
 }
        public void update()
        {
            bool   flag      = false;
            double localTime = DXTimer.GetCurrentMilliseconds() / 1000.0;

            foreach (ArmyLine line in this.lineList)
            {
                if (!line.update(localTime))
                {
                    flag = true;
                }
            }
            foreach (ArmyLine line2 in this.lineList2)
            {
                if (!line2.update(localTime))
                {
                    flag = true;
                }
            }
            if (flag)
            {
                this.init(false);
            }
        }
 private void initText(int position, int villageID, int numPeasants, int numArchers, int numPikemen, int numSwordsmen, int numCatapults, int numScouts, DateTime arrivalTime, long armyID, bool showButton, VillageArmiesPanel2 parent, bool returning, bool showTroops, bool tutorial, int attackType)
 {
     this.m_parent      = parent;
     this.m_position    = position;
     this.ClipVisible   = true;
     this.m_army        = GameEngine.Instance.World.getArmy(armyID);
     this.m_origLoot    = this.m_army.lootType;
     this.m_armyID      = armyID;
     this.m_villageID   = villageID;
     this.m_arrivalTime = arrivalTime;
     this.m_returning   = returning;
     this.clearControls();
     if ((position & 1) == 0)
     {
         this.backgroundImage.Image = (Image)GFXLibrary.brown_lineitem_strip_02_light;
     }
     else
     {
         this.backgroundImage.Image = (Image)GFXLibrary.brown_lineitem_strip_02_dark;
     }
     this.backgroundImage.Position = new Point(0, 0);
     base.addControl(this.backgroundImage);
     this.Size = this.backgroundImage.Size;
     if (!tutorial)
     {
         this.lblVillage.Text = GameEngine.Instance.World.getVillageNameOrType(villageID);
     }
     else
     {
         this.lblVillage.Text = SK.Text("GENERIC_TUTORIAL", "Tutorial");
     }
     this.lblVillage.Color         = ARGBColors.Black;
     this.lblVillage.RolloverColor = ARGBColors.White;
     this.lblVillage.Position      = new Point(9, 0);
     this.lblVillage.Size          = new Size(0xdf, this.backgroundImage.Height);
     this.lblVillage.Font          = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
     this.lblVillage.Alignment     = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
     this.lblVillage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.lblVillage_Click), "VillageArmiesPanel2_village");
     this.backgroundImage.addControl(this.lblVillage);
     this.lblReturning.Text      = SK.Text("VillageArmySentLine_Returning", "Returning");
     this.lblReturning.Color     = ARGBColors.Black;
     this.lblReturning.Position  = new Point(0x335, 0);
     this.lblReturning.Size      = new Size(110, this.backgroundImage.Height);
     this.lblReturning.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
     this.lblReturning.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
     this.backgroundImage.addControl(this.lblReturning);
     this.lblReturning.Visible = !showButton;
     if (!showButton)
     {
         if (this.m_returning)
         {
             this.lblReturning.Text = SK.Text("VillageArmySentLine_Returning", "Returning");
         }
         else
         {
             this.lblReturning.Text = SK.Text("GENERIC_Attacking", "Attacking");
         }
     }
     this.leftVillageID            = villageID;
     this.lblArrivalTime.Text      = "";
     this.lblArrivalTime.Color     = ARGBColors.Black;
     this.lblArrivalTime.Position  = new Point(0x2ab, 0);
     this.lblArrivalTime.Size      = new Size(0x72, this.backgroundImage.Height);
     this.lblArrivalTime.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
     this.lblArrivalTime.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
     this.backgroundImage.addControl(this.lblArrivalTime);
     if (showTroops)
     {
         this.lblPeasants.Text      = numPeasants.ToString();
         this.lblPeasants.Color     = ARGBColors.Black;
         this.lblPeasants.Position  = new Point(0x131, 0);
         this.lblPeasants.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblPeasants.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblPeasants.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblPeasants);
         this.lblArchers.Text      = numArchers.ToString();
         this.lblArchers.Color     = ARGBColors.Black;
         this.lblArchers.Position  = new Point(0x16d, 0);
         this.lblArchers.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblArchers.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblArchers.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblArchers);
         this.lblPikemen.Text      = numPikemen.ToString();
         this.lblPikemen.Color     = ARGBColors.Black;
         this.lblPikemen.Position  = new Point(0x1a9, 0);
         this.lblPikemen.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblPikemen.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblPikemen.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblPikemen);
         this.lblSwordsmen.Text      = numSwordsmen.ToString();
         this.lblSwordsmen.Color     = ARGBColors.Black;
         this.lblSwordsmen.Position  = new Point(0x1e5, 0);
         this.lblSwordsmen.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblSwordsmen.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblSwordsmen.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblSwordsmen);
         this.lblCatapults.Text      = numCatapults.ToString();
         this.lblCatapults.Color     = ARGBColors.Black;
         this.lblCatapults.Position  = new Point(0x221, 0);
         this.lblCatapults.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblCatapults.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblCatapults.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblCatapults);
         this.lblScouts.Text      = numScouts.ToString();
         this.lblScouts.Color     = ARGBColors.Black;
         this.lblScouts.Position  = new Point(0x25d, 0);
         this.lblScouts.Size      = new Size(0x37, this.backgroundImage.Height);
         this.lblScouts.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblScouts.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.backgroundImage.addControl(this.lblScouts);
     }
     if (attackType == 30)
     {
         this.lblPeasants.Text      = SK.Text("AllArmiesSentLine_Vassal_Support", "Vassal Support");
         this.lblPeasants.Color     = ARGBColors.Black;
         this.lblPeasants.Position  = new Point(0x131, 0);
         this.lblPeasants.Size      = new Size(250, this.backgroundImage.Height);
         this.lblPeasants.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblPeasants.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
         this.backgroundImage.addControl(this.lblPeasants);
     }
     if (attackType == 0x1f)
     {
         this.lblPeasants.Text      = SK.Text("AllArmiesSentLine_Capital_Support", "Capital Support");
         this.lblPeasants.Color     = ARGBColors.Black;
         this.lblPeasants.Position  = new Point(0x131, 0);
         this.lblPeasants.Size      = new Size(250, this.backgroundImage.Height);
         this.lblPeasants.Font      = FontManager.GetFont("Arial", 8.25f, FontStyle.Regular);
         this.lblPeasants.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT;
         this.backgroundImage.addControl(this.lblPeasants);
     }
     if (showButton)
     {
         this.btnCancel.ImageNorm      = (Image)GFXLibrary.brown_mail2_button_blue_141wide_normal;
         this.btnCancel.ImageOver      = (Image)GFXLibrary.brown_mail2_button_blue_141wide_over;
         this.btnCancel.ImageClick     = (Image)GFXLibrary.brown_mail2_button_blue_141wide_pushed;
         this.btnCancel.Position       = new Point(760, 3);
         this.btnCancel.Text.Text      = SK.Text("GENERIC_Cancel", "Cancel");
         this.btnCancel.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER;
         this.btnCancel.Text.Font      = FontManager.GetFont("Arial", 9f, FontStyle.Bold);
         this.btnCancel.TextYOffset    = -3;
         this.btnCancel.Text.Color     = ARGBColors.Black;
         this.btnCancel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.cancelClick), "VillageArmiesPanel2_cancel");
         this.backgroundImage.addControl(this.btnCancel);
     }
     if (!this.update(DXTimer.GetCurrentMilliseconds() / 1000.0))
     {
         this.btnCancel.Visible = false;
     }
     base.invalidate();
 }
        public void addArmies()
        {
            this.outgoingScrollArea.clearControls();
            this.incomingScrollArea.clearControls();
            int y    = 0;
            int num2 = 0;

            this.lineList.Clear();
            this.lineList2.Clear();
            int    num3 = InterfaceMgr.Instance.getSelectedMenuVillage();
            long   highestArmyIDSeen = -1L;
            int    position          = 0;
            int    num6 = 0;
            double num7 = DXTimer.GetCurrentMilliseconds() / 1000.0;

            foreach (WorldMap.LocalArmyData data in this.armyList)
            {
                if (data.travelFromVillageID == num3)
                {
                    ArmyLine control = new ArmyLine();
                    if (y != 0)
                    {
                        y += 5;
                    }
                    control.Position = new Point(0, y);
                    bool showButton = data.lootType < 0;
                    if (data.localEndTime == 0.0)
                    {
                        showButton = false;
                    }
                    else
                    {
                        double localEndTime = data.localEndTime;
                        if ((data.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) < num7)
                        {
                            showButton = false;
                        }
                    }
                    control.initSent(position, data.targetVillageID, data.numPeasants, data.numArchers, data.numPikemen, data.numSwordsmen, data.numCatapults, data.numScouts, data.serverEndTime, data.armyID, showButton, this, data.lootType >= 0);
                    this.outgoingScrollArea.addControl(control);
                    y += control.Height;
                    this.lineList.Add(control);
                    position++;
                }
                if ((data.targetVillageID == num3) && (data.lootType < 0))
                {
                    ArmyLine line2 = new ArmyLine();
                    if (num2 != 0)
                    {
                        num2 += 5;
                    }
                    if (data.armyID > highestArmyIDSeen)
                    {
                        highestArmyIDSeen = data.armyID;
                    }
                    line2.Position = new Point(0, num2);
                    bool tutorial = false;
                    if (data.attackType == 13)
                    {
                        tutorial = true;
                    }
                    line2.initIncoming(num6, data.travelFromVillageID, 0, 0, 0, 0, 0, 0, data.serverEndTime, data.armyID, false, this, false, tutorial, data.attackType);
                    this.incomingScrollArea.addControl(line2);
                    num2 += line2.Height;
                    this.lineList2.Add(line2);
                    num6++;
                }
            }
            if (highestArmyIDSeen > GameEngine.Instance.World.HighestArmyIDSeen)
            {
                GameEngine.Instance.World.HighestArmyIDSeen = highestArmyIDSeen;
                RemoteServices.Instance.SetHighestArmySeen(highestArmyIDSeen);
            }
            this.outgoingScrollArea.Size = new Size(this.outgoingScrollArea.Width, y);
            if (y < this.outgoingScrollBar.Height)
            {
                this.outgoingScrollBar.Visible = false;
            }
            else
            {
                this.outgoingScrollBar.Visible         = true;
                this.outgoingScrollBar.NumVisibleLines = this.outgoingScrollBar.Height;
                this.outgoingScrollBar.Max             = y - this.outgoingScrollBar.Height;
            }
            this.outgoingScrollArea.invalidate();
            this.outgoingScrollBar.invalidate();
            this.incomingScrollArea.Size = new Size(this.incomingScrollArea.Width, num2);
            if (num2 < this.incomingScrollBar.Height)
            {
                this.incomingScrollBar.Visible = false;
            }
            else
            {
                this.incomingScrollBar.Visible         = true;
                this.incomingScrollBar.NumVisibleLines = this.incomingScrollBar.Height;
                this.incomingScrollBar.Max             = num2 - this.incomingScrollBar.Height;
            }
            this.incomingScrollArea.invalidate();
            this.incomingScrollBar.invalidate();
            this.backgroundImage.invalidate();
            this.update();
        }
Beispiel #14
0
 public void update()
 {
     this.backGround.update();
     this.m_army = GameEngine.Instance.World.getArmy(this.selectedArmyID);
     if (this.m_army == null)
     {
         InterfaceMgr.Instance.closeArmySelectedPanel();
     }
     else if (this.m_army.dead)
     {
         this.m_army = null;
         InterfaceMgr.Instance.closeArmySelectedPanel();
     }
     else
     {
         double num  = DXTimer.GetCurrentMilliseconds() / 1000.0;
         double num2 = this.m_army.localEndTime - num;
         if (num2 < 0.0)
         {
             num2 = 0.0;
         }
         string subHeading = VillageMap.createBuildTimeString((int)num2);
         if ((!GameEngine.Instance.World.isUserVillage(this.m_army.homeVillageID) || ((((this.m_army.localStartTime + (GameEngine.Instance.LocalWorldData.AttackCancelDuration * 60)) < num) && !this.m_army.isScouts()) && !this.targetIsAI(this.m_army.targetVillageID))) || ((this.m_army.lootType >= 0) || this.forceReturnOff))
         {
             this.returnButton.Visible = false;
         }
         else
         {
             this.returnButton.Visible = true;
         }
         if (this.m_army.lootType != this.lastState)
         {
             bool flag = false;
             if ((this.m_army.attackType == 30) || (this.m_army.attackType == 0x1f))
             {
                 this.backGround.updateHeading(SK.Text("SelectArmyPanel_Troops", "Troops"));
                 this.backGround.updatePanelType(0x3e8);
             }
             else if (this.m_army.attackType == 0x11)
             {
                 this.backGround.updateHeading(SK.Text("GENERIC_Invasion", "Invasion"));
                 this.backGround.updatePanelType(0x3e8);
             }
             else if (!this.m_army.isScouts())
             {
                 this.backGround.updateHeading(SK.Text("SelectArmyPanel_Army", "Army"));
                 this.backGround.updatePanelType(0x3e8);
             }
             else
             {
                 flag = true;
                 this.backGround.updatePanelType(0x3ea);
                 this.backGround.updateHeading(SK.Text("SelectArmyPanel_Scouts", "Scouts"));
             }
             this.lastState = this.m_army.lootType;
             if (this.lastState >= 0)
             {
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1];
                 this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Returning", "Returning"));
                 if (this.m_army.attackType != 13)
                 {
                     this.backGround.updateTravelButton(this.homeVillageButton, this.m_army.travelFromVillageID);
                 }
                 else
                 {
                     this.backGround.updateTravelButton(this.homeVillageButton, SK.Text("SelectArmyPanel_Tutorial", "Tutorial"));
                 }
                 this.backGround.updateTravelButton(this.targetVillageButton, this.m_army.targetVillageID);
                 if (flag && (this.homeVillageButton.Text.Text.Length == 0))
                 {
                     this.backGround.updateTravelButton(this.targetVillageButton, SK.Text("GENERIC_Unknown", "Unknown"));
                 }
                 this.fromVillageID        = this.m_army.travelFromVillageID;
                 this.toVillageID          = this.m_army.targetVillageID;
                 this.returnButton.Visible = false;
             }
             else
             {
                 this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0];
                 if ((this.m_army.attackType == 30) || (this.m_army.attackType == 0x1f))
                 {
                     this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Stationing", "Stationing"));
                 }
                 else if (flag)
                 {
                     this.backGround.updatePanelText(SK.Text("SelectArmyPanel_Scouting", "Scouting"));
                 }
                 else if (!GameEngine.Instance.LocalWorldData.AIWorld || (this.m_army.attackType != 0x11))
                 {
                     this.backGround.updatePanelText(SK.Text("GENERIC_Attacking", "Attacking"));
                 }
                 else
                 {
                     bool flag2   = false;
                     int  special = GameEngine.Instance.World.getVillageData(this.m_army.travelFromVillageID).special;
                     int  num4    = GameEngine.Instance.World.getVillageData(this.m_army.targetVillageID).special;
                     if (special == 30)
                     {
                         switch (num4)
                         {
                         case 7:
                         case 8:
                         case 9:
                         case 10:
                         case 11:
                         case 12:
                         case 13:
                         case 14:
                             this.backGround.updatePanelText(SK.Text("BARRACKS_Reinforcing", "Reinforcing"));
                             flag2 = true;
                             break;
                         }
                     }
                     if (!flag2)
                     {
                         this.backGround.updatePanelText(SK.Text("GENERIC_Attacking", "Attacking"));
                     }
                 }
                 if (this.m_army.attackType != 13)
                 {
                     this.backGround.updateTravelButton(this.homeVillageButton, this.m_army.travelFromVillageID);
                 }
                 else
                 {
                     this.backGround.updateTravelButton(this.homeVillageButton, SK.Text("SelectArmyPanel_Tutorial", "Tutorial"));
                 }
                 this.backGround.updateTravelButton(this.targetVillageButton, this.m_army.targetVillageID);
                 if (flag && (this.homeVillageButton.Text.Text.Length == 0))
                 {
                     this.backGround.updateTravelButton(this.targetVillageButton, SK.Text("GENERIC_Unknown", "Unknown"));
                 }
                 this.fromVillageID = this.m_army.travelFromVillageID;
                 this.toVillageID   = this.m_army.targetVillageID;
             }
         }
         this.backGround.updateSubHeading(subHeading);
     }
 }
 private void tbFindInput_TextChanged(object sender, EventArgs e)
 {
     this.lastUpdateTime = DXTimer.GetCurrentMilliseconds();
 }
 private void tbFindInput_KeyUp(object sender, KeyEventArgs e)
 {
     this.lastUpdateTime = DXTimer.GetCurrentMilliseconds();
 }
 public bool updateConstructionGFX(double localBaseTime, DateTime serverBaseTime, bool initialUpdate, VillageMap vm)
 {
     if (this.baseSprite != null)
     {
         if (this.serverDeleting)
         {
             double num = (DXTimer.GetCurrentMilliseconds() - localBaseTime) / 1000.0;
             num -= 1.5;
             DateTime time = serverBaseTime.AddSeconds(num);
             if (!this.complete && (time.CompareTo(this.completionTime) >= 0))
             {
                 this.complete = true;
             }
             TimeSpan span     = (TimeSpan)(this.deletionTime - time);
             int      secsLeft = (int)(span.TotalSeconds - 0.5);
             if (span.TotalDays > 10.0)
             {
                 secsLeft = 0x98967f;
             }
             if ((secsLeft > 0) && (secsLeft < 0x989680))
             {
                 if (!vm.ViewOnly)
                 {
                     string text = VillageMap.createBuildTimeString(secsLeft);
                     this.baseSprite.attachText(text, new Point(0, -50), ARGBColors.White, true, true);
                 }
             }
             else
             {
                 this.baseSprite.clearText();
                 this.baseSprite.clearSecondText();
                 if (secsLeft <= 0)
                 {
                     return(true);
                 }
             }
             this.baseSprite.ColorToUse = Color.FromArgb(0xff, 0xff, 0x80, 0x80);
             if (this.animSprite != null)
             {
                 this.animSprite.ColorToUse = this.baseSprite.ColorToUse;
             }
             if (this.extraAnimSprite1 != null)
             {
                 this.extraAnimSprite1.ColorToUse = this.baseSprite.ColorToUse;
             }
             if (this.extraAnimSprite2 != null)
             {
                 this.extraAnimSprite2.ColorToUse = this.baseSprite.ColorToUse;
             }
             return(false);
         }
         if (this.complete)
         {
             return(false);
         }
         bool   flag = false;
         double num3 = (DXTimer.GetCurrentMilliseconds() - localBaseTime) / 1000.0;
         if (initialUpdate)
         {
             num3 = 0.0;
         }
         num3 -= 3.0;
         DateTime time2 = serverBaseTime.AddSeconds(num3);
         if (time2.CompareTo(this.completionTime) < 0)
         {
             flag = true;
         }
         if (this.buildingType == 0)
         {
             flag = false;
         }
         if (flag)
         {
             if (!this.highlighted)
             {
                 this.baseSprite.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80);
                 if (this.animSprite != null)
                 {
                     this.animSprite.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80);
                 }
                 if (this.extraAnimSprite1 != null)
                 {
                     this.extraAnimSprite1.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80);
                 }
                 if (this.extraAnimSprite2 != null)
                 {
                     this.extraAnimSprite2.ColorToUse = Color.FromArgb(0x80, 0x80, 0x80, 0x80);
                 }
             }
             TimeSpan span2 = (TimeSpan)(this.completionTime - time2);
             int      num4  = (int)(span2.TotalSeconds - 0.5);
             if ((num4 > 0) && (num4 < 0x989680))
             {
                 int num6;
                 int num5 = num4;
                 num4 = vm.updateConstructionDisplayTime(num4, this.completionTime, out num6);
                 Color col = (num6 == 1) ? ARGBColors.White : ARGBColors.WhiteSmoke;
                 if (!vm.ViewOnly)
                 {
                     string str2 = VillageMap.createBuildTimeString(num4);
                     if ((num4 != num5) && this.showFullConstructionText)
                     {
                         this.showFullConstructionText = false;
                         string str3 = str2;
                         str2 = str3 + Environment.NewLine + "(" + VillageMap.createBuildTimeString(num5) + ")";
                     }
                     this.baseSprite.attachText(str2, new Point(0, -40), ARGBColors.White, true, true);
                     if (num6 > 0)
                     {
                         this.baseSprite.attachSecondText(num6.ToString(), new Point(0, -55), col, true, true);
                     }
                     else
                     {
                         this.baseSprite.clearSecondText();
                     }
                 }
             }
             else
             {
                 this.baseSprite.clearText();
                 this.baseSprite.clearSecondText();
             }
         }
         else
         {
             Color white = ARGBColors.White;
             this.baseSprite.ColorToUse = white;
             if (this.animSprite != null)
             {
                 this.animSprite.ColorToUse = white;
             }
             if (this.extraAnimSprite1 != null)
             {
                 this.extraAnimSprite1.ColorToUse = white;
             }
             if (this.extraAnimSprite2 != null)
             {
                 this.extraAnimSprite2.ColorToUse = white;
             }
             this.complete = true;
             if (!initialUpdate)
             {
                 this.localComplete = false;
                 return(true);
             }
             this.baseSprite.clearText();
             this.baseSprite.clearSecondText();
         }
     }
     return(false);
 }
 public void update()
 {
     this.backGround.update();
     this.m_reinforcements = GameEngine.Instance.World.getReinforcement(this.selectedReinforcementID);
     if (this.m_reinforcements != null)
     {
         if (this.m_reinforcements.dead)
         {
             this.m_reinforcements = null;
             InterfaceMgr.Instance.closeReinforcementSelectedPanel();
         }
         else
         {
             if (this.m_reinforcements.attackType != this.lastState)
             {
                 this.backGround.updateTravelButton(this.homeVillageButton, this.m_reinforcements.homeVillageID);
                 this.backGround.updateTravelButton(this.targetVillageButton, this.m_reinforcements.targetVillageID);
                 this.fromVillageID = this.m_reinforcements.homeVillageID;
                 this.toVillageID   = this.m_reinforcements.targetVillageID;
                 this.lastState     = this.m_reinforcements.attackType;
                 if (this.lastState == 20)
                 {
                     this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[0];
                     if (GameEngine.Instance.World.isUserVillage(this.m_reinforcements.homeVillageID))
                     {
                         this.returnButton.Visible = true;
                     }
                     else
                     {
                         this.returnButton.Visible = false;
                     }
                     if (GameEngine.Instance.World.isUserVillage(this.m_reinforcements.homeVillageID))
                     {
                         this.returnButton.Text.TextDiffOnly = SK.Text("SelectArmyPanel_Retrieve", "Retrieve");
                     }
                     else
                     {
                         this.returnButton.Text.TextDiffOnly = SK.Text("SelectArmyPanel_Return", "Return");
                     }
                 }
                 else
                 {
                     this.travelDirection.Image = (Image)GFXLibrary.mrhp_travelling_arrows[1];
                     this.returnButton.Visible  = false;
                 }
             }
             double num  = DXTimer.GetCurrentMilliseconds() / 1000.0;
             double num2 = this.m_reinforcements.localEndTime - num;
             if (num2 < 0.0)
             {
                 this.backGround.updateSubHeading("");
             }
             else
             {
                 string subHeading = VillageMap.createBuildTimeString((int)num2);
                 this.backGround.updateSubHeading(subHeading);
             }
         }
     }
     else
     {
         InterfaceMgr.Instance.closeReinforcementSelectedPanel();
     }
 }