public void UpdateHud(bool visible) { if (!this._hasHud) { if (this.mHpBar) { this.mHpBar.gameObject.SetActive(false); } return; } this.CheckNeedHudUpdate(); if (!this.NeedUpdateHud) { if (this.mHpBar) { this.mHpBar.SkipUpdate(); } return; } if (!this.mHpBar) { this.mHpBar = Singleton <CharacterView> .Instance.CreateHudBar(this.self); if (this.mHpBar == null) { return; } this.mHpBar.On_Spawn(); this.mText = Singleton <CharacterView> .Instance.CreateHudText(this.self); } if (this.mHpBar != null) { this.mHpBar.OnUpdate(visible, false); } }
private void OnPlayerAttached(MobaMessage msg) { this.player = PlayerControlMgr.Instance.GetPlayer(); if (this.player != null) { this.playerBloodBar = this.player.GetUnitComponent <SurfaceManager>().mHpBar; } }
public override void init(Animator _animator) { switch (m_roletype) { case ns_predefine.ModelEnum.Enemy_Bat: m_animcontroler = new EMBat(); break; case ns_predefine.ModelEnum.Enemy_Cactus: m_animcontroler = new EMCactus(); break; case ns_predefine.ModelEnum.Enemy_DeadKnight: m_animcontroler = new EMDeadKnight(); break; case ns_predefine.ModelEnum.Enemy_Dragon: m_animcontroler = new EMDragon(); break; case ns_predefine.ModelEnum.Enemy_Dragon_Fly: m_animcontroler = new EMDragonFly(); break; case ns_predefine.ModelEnum.Enemy_Ghost: m_animcontroler = new EMGhost(); break; case ns_predefine.ModelEnum.Enemy_Plant: m_animcontroler = new EMPlant(); break; case ns_predefine.ModelEnum.Enemy_Rock: m_animcontroler = new EMRock(); break; case ns_predefine.ModelEnum.Enemy_SKArcher: m_animcontroler = new EMSKArcher(); break; case ns_predefine.ModelEnum.Enemy_SKKnight: m_animcontroler = new EMSKKnight(); break; case ns_predefine.ModelEnum.Enemy_SKMage: m_animcontroler = new EMSKMage(); break; } _ObjRole = GameObject.Instantiate(GameResources.loadGameObject((int)m_roletype + 1)) as GameObject; _ObjRole.transform.position = GameResources.Instance()._GameMgr._MapMgr.getspwanpoint(); m_animcontroler.init(_ObjRole.GetComponent <Animator>()); m_property = new RoleProperty(); m_property.SName = m_roletype.ToString(); _EnemyBloodBar = new UIBloodBar(); _EnemyBloodBar.NAME = m_property.SName.Replace("Enemy_", ""); _EnemyBloodBar.BLOOD = (float)m_property.NHp / (float)m_property.NMaxHp; }
protected override void Init() { //这里是 竞技场 View ArenaFightView.Instance.gameObject = FindChild("ArenaFightView"); ArenaFightView.Instance.gameObject.SetActive(false); _topLeftGameObject = Tools.find(gameObject, "TopLeft"); _topRightGameObject = Tools.find(gameObject, "TopRight"); _topGameObject = Tools.find(gameObject, "Top"); _sldBossHp = Tools.find(gameObject, "TopRight/SldBossHp").GetComponent <UIBloodBar>(); _sldBossHp.fillDirection = UIBloodBar.FillDirection.RightToLeft; _sldMonsterHp = Tools.find(gameObject, "TopRight/SldMonsterHp").GetComponent <UIBloodBar>(); _sldMonsterHp.fillDirection = UIBloodBar.FillDirection.RightToLeft; _playerLevelLabel = Tools.find(gameObject, "TopLeft/PlayerInfo/PlayerLevelLabel").GetComponent <UILabel>(); _playerNameLabel = Tools.find(gameObject, "TopLeft/PlayerInfo/PlayerNameLabel").GetComponent <UILabel>(); _playerHeadSprite = Tools.find(gameObject, "TopLeft/PlayerInfo/PlayerHeadIcon").GetComponent <UISprite>(); _sldHp = Tools.find(gameObject, "TopLeft/SldHp").GetComponent <UISlider>(); _sldMagic = Tools.find(gameObject, "TopLeft/SldMagic").GetComponent <UISlider>(); _btnStop = Tools.find(gameObject, "TopLeft/BtnStop").GetComponent <Button>(); _entrustBtn = Tools.find(gameObject, "TopLeft/BtnEntrust").GetComponent <Button>(); _arrowLeft = Tools.find(gameObject, "Left").GetComponent <UISprite>(); _arrowRight = Tools.find(gameObject, "Right").GetComponent <UISprite>(); _leftNum = Tools.find(gameObject, "Left/num").GetComponent <UILabel>(); _rightNum = Tools.find(gameObject, "Right/num").GetComponent <UILabel>(); _btnSkill0 = Tools.find(gameObject, "BottomRight/BtnSkill0").GetComponent <Button>(); _btnSkill1 = Tools.find(gameObject, "BottomRight/BtnSkill1").GetComponent <Button>(); _btnSkill2 = Tools.find(gameObject, "BottomRight/BtnSkill2").GetComponent <Button>(); _btnSkill3 = Tools.find(gameObject, "BottomRight/BtnSkill3").GetComponent <Button>(); _btnSkill4 = Tools.find(gameObject, "BottomRight/BtnSkill4").GetComponent <Button>(); _btnAttack = Tools.find(gameObject, "BottomRight/BtnAttack").GetComponent <Button>(); _btnChat = Tools.find(gameObject, "BottomLeft/BtnChat").GetComponent <Button>(); BtnChatBg = Tools.find(gameObject, "BottomLeft/BtnChat/background").GetComponent <UISprite>(); _healthLabel = Tools.find(gameObject, "TopLeft/SldHp/Label").GetComponent <UILabel>(); _magicLabel = Tools.find(gameObject, "TopLeft/SldMagic/Label").GetComponent <UILabel>(); _skill0Cd = Tools.find(gameObject, "BottomRight/BtnSkill0/CD"); _skill1Cd = Tools.find(gameObject, "BottomRight/BtnSkill1/CD"); _skill2Cd = Tools.find(gameObject, "BottomRight/BtnSkill2/CD"); _skill3Cd = Tools.find(gameObject, "BottomRight/BtnSkill3/CD"); _skill4Cd = Tools.find(gameObject, "BottomRight/BtnSkill4/CD"); _skill0CdTimeLabel = Tools.find(gameObject, "BottomRight/BtnSkill0/Number").GetComponent <UILabel>(); _skill1CdTimeLabel = Tools.find(gameObject, "BottomRight/BtnSkill1/Number").GetComponent <UILabel>(); _skill2CdTimeLabel = Tools.find(gameObject, "BottomRight/BtnSkill2/Number").GetComponent <UILabel>(); _skill3CdTimeLabel = Tools.find(gameObject, "BottomRight/BtnSkill3/Number").GetComponent <UILabel>(); _skill4CdTimeLabel = Tools.find(gameObject, "BottomRight/BtnSkill4/Number").GetComponent <UILabel>(); _skill0Icon = Tools.find(gameObject, "BottomRight/BtnSkill0/Icon").GetComponent <UISprite>(); _skill1Icon = Tools.find(gameObject, "BottomRight/BtnSkill1/Icon").GetComponent <UISprite>(); _skill2Icon = Tools.find(gameObject, "BottomRight/BtnSkill2/Icon").GetComponent <UISprite>(); _skill3Icon = Tools.find(gameObject, "BottomRight/BtnSkill3/Icon").GetComponent <UISprite>(); _skill4Icon = Tools.find(gameObject, "BottomRight/BtnSkill4/Icon").GetComponent <UISprite>(); _normalAttackIcon = Tools.find(gameObject, "BottomRight/BtnAttack/Icon").GetComponent <UISprite>(); _leftTimeLabel = Tools.find(gameObject, "Top/LeftTime/LeftTimeLabel").GetComponent <UILabel>(); //剩余时间 _time = Tools.find(gameObject, "Top/LeftTime").GetComponent <Transform>(); _nguiJoystick = Tools.find(gameObject, "BottomLeft/Joystick/Button").AddComponent <NGUIJoystick>(); _nguiJoystick.radius = 80; _nguiJoystick.IsBattleJoystick = true; _joystickHighLight = Tools.find(gameObject, "BottomLeft/Joystick/Background").GetComponent <UISprite>(); _btnChat.onClick += OnChatBtnClick; _btnSkill0.onClick += CallSkill0; _btnSkill1.onClick += CallSkill1; _btnSkill2.onClick += CallSkill2; _btnSkill3.onClick += CallSkill3; _btnSkill4.onClick += CallSkill4; _entrustBtn.onClick += CallEntrust; _btnAttack.onPress += CallAttack; _btnStop.onClick += StopGame; UpdateInfo(); InitPlayerInfo(); _sldMonsterHp.gameObject.SetActive(false); InitSkillIcon(); _skillCdGameObjects = new[] { _skill1Cd, _skill2Cd, _skill3Cd, _skill4Cd, _skill0Cd }; _skillButtons = new[] { _btnSkill1, _btnSkill2, _btnSkill3, _btnSkill4, _btnSkill0 }; _battleMode = Singleton <BattleMode> .Instance; _skillCdTimeLabels = new[] { _skill1CdTimeLabel, _skill2CdTimeLabel, _skill3CdTimeLabel, _skill4CdTimeLabel, _skill0CdTimeLabel }; if (Application.platform != RuntimePlatform.WindowsEditor) { _btnChat.SetActive(false); } _guideJoy = Tools.find(gameObject, "BottomLeft/GuideJoy"); _guideSkill = Tools.find(gameObject, "BottomRight/GuideSkill"); }