private void SetState(PlayerHead.HeadState hs) { if (hs != this._state) { this._state = hs; CUIEventScript component = base.GetComponent <CUIEventScript>(); component.enabled = (this._state == PlayerHead.HeadState.Normal || this._state == PlayerHead.HeadState.ReviveReady); } }
private void UpdateReviveCd() { if (!this.MyHero || this.MyHero.get_handle().ActorControl == null) { return; } int num = Mathf.RoundToInt((float)this.MyHero.get_handle().ActorControl.ReviveCooldown * 0.001f); if (num >= 0) { if (this.ReviveCdTxt != null) { this.ReviveCdTxt.text = string.Format("{0}", num); } this.SetState(PlayerHead.HeadState.ReviveCDing); } else if (!Singleton <BattleLogic> .get_instance().GetCurLvelContext().IsMobaMode()) { Player player = Singleton <GamePlayerCenter> .get_instance().GetPlayer(this._myHero.get_handle().TheActorMeta.PlayerId); if (player == null) { return; } PlayerHead.HeadState headState = (!player.IsMyTeamOutOfBattle()) ? PlayerHead.HeadState.ReviveForbid : PlayerHead.HeadState.ReviveReady; if (headState != this._state) { this.SetState(headState); if (this._state == PlayerHead.HeadState.ReviveReady) { this.ReviveCdTxt.text = Singleton <CTextManager> .GetInstance().GetText("PlayerHead_dianji"); this.ReviveCdTxt.color = Color.green; this.ReviveCdTxt.fontSize = 14; this.HeroHeadImg.color = new Color(1f, 1f, 1f); } else { this.ReviveCdTxt.text = Singleton <CTextManager> .GetInstance().GetText("PlayerHead_tuozhan"); this.ReviveCdTxt.color = Color.gray; this.ReviveCdTxt.fontSize = 14; this.HeroHeadImg.color = new Color(0.3f, 0.3f, 0.3f); } } Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null && this._state == PlayerHead.HeadState.ReviveReady && hostPlayer.Captain.get_handle().ActorControl.m_isAutoAI) { this.MyHero.get_handle().ActorControl.Revive(false); } } }
public void SetPrivates(PlayerHead.HeadState inHeadState, PoolObjHandle <ActorRoot> inHero, HeroHeadHud inHudOwner) { this._myHero = inHero; this._hudOwner = inHudOwner; this.SetState(inHeadState); }