public override void Update(GameTime gameTime) { _healbarFrame.Update(gameTime); //Update của left button skill Skill _currentLeftSkill = (Skill)_btLefthandSkill.Owner; if ((_currentLeftSkill.ListLevel[_currentLeftSkill.Level].ListSkillInfo[0].Mp * -1) <= _character.Mp) { _btLefthandSkill.ColorToDraw = Color.White; } else { _btLefthandSkill.ColorToDraw = new Color(0, 130, 185); } if (_currentLeftSkill.CheckCoolDown != 0) { float _cooldownLeftRate = (float)_currentLeftSkill.CheckCoolDown / (float)_currentLeftSkill.CoolDownTime; _coolDownLeftSkill.UpdateDrawRect(_cooldownLeftRate); } else { _coolDownLeftSkill.UpdateDrawRect(0); } //Update cua tight button skill Skill _currentRightSkill = (Skill)_btRighthandSkill.Owner; if (_currentRightSkill != null) { if ((_currentRightSkill.ListLevel[_currentRightSkill.Level].ListSkillInfo[0].Mp * -1) <= _character.Mp) { _btRighthandSkill.ColorToDraw = Color.White; } else { _btRighthandSkill.ColorToDraw = new Color(0, 130, 185); } if (_currentRightSkill.CheckCoolDown != 0) { float _cooldownRightRate = (float)_currentRightSkill.CheckCoolDown / (float)_currentRightSkill.CoolDownTime; _coolDownRightSkill.UpdateDrawRect(_cooldownRightRate); } else { _coolDownRightSkill.UpdateDrawRect(0); } } //Update của ống máu float _bloodRate = (float)_character.Hp / (float)_character.MaxHp; _bloodPro.UpdateDrawRect(_bloodRate); //update của ống mana float _manaRate = (float)_character.Mp / (float)_character.MaxMp; _manaPro.UpdateDrawRect(_manaRate); //update ống level float _levelRate = (float)_character.CurrentEXP / (float)_character.NextLevelEXP; _levelProcess.UpdateDrawRect(_levelRate); //Update so luong item _itemFrame.Update(gameTime); //trong cai update này co san~ cai update cua nhung button _lbBlood.StringInfo = _character.HPPortion.Count.ToString(); _lbMana.StringInfo = _character.MPPortion.Count.ToString(); _lbBloodNMana.StringInfo = _character.RestorePortion.Count.ToString(); //update main rect _rect = new Rectangle((int)_healbarFrame.X, (int)_healbarFrame.Y, (int)_healbarFrame.Width, (int)_healbarFrame.Height); if (_rect.Contains(GlobalVariables.CurrentMouseState.X, GlobalVariables.CurrentMouseState.Y)) { GlobalVariables.AlreadyUseLeftMouse = true; GlobalVariables.AlreadyUseRightMouse = true; } //Update chỗ này chỉ để chặn con chuột -> khá dỡ. _bloodPro.Update(gameTime); _manaPro.Update(gameTime); }
public override void UpdateState(GameTime gameTime) { if (_loadDone) { if (_iDelayTime == _delayTime) { Owner.GameState = temp; GlobalVariables.GameCursor.IsIdle = true; } else { _iDelayTime++; } } else { if (_completedSteps == _stepLengh) { _loadDone = true; return; } if (_iDelayTime == _delayTime) { if (_prototypeIndex >= _objectManagerArray[_objectIndex]._nprototype) { _prototypeIndex = 0; _objectIndex++; } if (_objectIndex >= _nObjectManager) { switch (_type.Name) { case "StateMenuManager": { temp = new StateMenuManager(); temp.InitState(_objectManagerArray, this.Owner); temp.EnterState(); _completedSteps++; _delayTime /= 2; _iDelayTime = 0; break; } case "StateMainGame": { temp = new StateMainGame(); temp.InitState(_objectManagerArray, this.Owner); temp.EnterState(); _completedSteps++; _delayTime /= 2; _iDelayTime = 0; break; } } Owner.ResetElapsedTime(); _drawingRate = (float)_completedSteps / (float)_stepLengh; _processBar.UpdateDrawRect(_drawingRate); return; } _objectManagerArray[_objectIndex].InitOne(Owner.Content, _prototypeIndex); _completedSteps++; Owner.ResetElapsedTime(); _drawingRate = (float)_completedSteps / (float)_stepLengh; _processBar.UpdateDrawRect(_drawingRate); _prototypeIndex++; } else { _iDelayTime++; } } }