public void Operating(bool bStatic) { if (PlayerInfoUI == null) { return; } Roleui uiInfo = PlayerInfoUI.GetComponent <Roleui>(); if (uiInfo != null) { uiInfo.SetReady(bStatic); } }
public void PopValueChange(int Value, PropertyType chgType, int hpMax, int mpMax, InvokePkg.CallBack callback = null, bool isCritical = false) { if (Value == 0) { if (callback != null) { callback(); } return; } if (null == PlayerInfoUI) { return; } Roleui roleinfoUI = PlayerInfoUI.GetComponent <Roleui>(); if (null == roleinfoUI) { return; } roleinfoUI.ValueChange(chgType, Value, hpMax, mpMax, true, false); if (isCritical) { EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_Critical, ActorObj.transform.position + ActorObj.transform.forward, null, null, null, (EffectInst inst, ParamData pData) => { inst.gameObject.SetActive(true); //Battle.BattleOver -= inst.GetComponent<EffectInst>().DestorySelf; }); } if (PlayerID == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(chgType, Value, hpMax, mpMax); } if (Battle.Instance.SelfActorBattleBaby != null) { if (PlayerID == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(chgType, Value, hpMax, mpMax); } } if (callback != null) { GlobalInstanceFunction.Instance.Invoke(callback, 1f); } }
public GameObject CreatePlayerUI(BattleActor entity, bool hideBar) { if (null == entity) { return(null); } if (entity.ControlEntity == null) { ApplicationEntry.Instance.PostSocketErr(57557); return(null); } GameObject EntityObj = entity.ControlEntity.ActorObj; GameObject pre = GameObject.Instantiate(HUD) as GameObject; pre.SetActive(true); pre.transform.parent = transform; //hudRoot.transform; Vector3 battlepos = Vector3.zero; if (entity != null) { Transform point = Battle.Instance.GetStagePointByIndex(entity.BattlePos); if (point != null) { battlepos = point.position; } } battlepos.y -= 0.2f; pre.transform.localPosition = GlobalInstanceFunction.WorldToUI(battlepos); pre.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); Roleui rui = pre.GetComponent <Roleui> (); rui.SetRoleObj(EntityObj); rui.InitData(entity); rui.hp.gameObject.SetActive(!hideBar); rui.mp.gameObject.SetActive(!hideBar); pre.name = GlobalValue.ActorUIObjName + entity.InstId; lstEntityUI.Add(pre); EntityObjs.Add(EntityObj); return(pre); }
public void Do(BattleActor caster, BattleActor aim, FinishCallBack callback) { callBack_ = callback; caster_ = caster; aim_ = aim; if (caster_ != null) { EffectInst[] effs = caster_.ControlEntity.ActorObj.GetComponentsInChildren <EffectInst>(); for (int i = 0; i < effs.Length; ++i) { effs[i].DealNotExcuteHandler(); effs[i].DestorySelf(); } } caster.ControlEntity.ActorObj.SetActive(false); caster.ControlEntity.ActorObj.transform.position = aim.ControlEntity.ActorObj.transform.position + aim.ControlEntity.ActorObj.transform.forward * -0.5f; caster.ControlEntity.ActorObj.transform.LookAt(aim.ControlEntity.ActorObj.transform); GlobalInstanceFunction.Instance.Invoke(() => { caster.ControlEntity.ActorObj.SetActive(true); EffectAPI.PlaySceneEffect(EFFECT_ID.EFFECT_Kill, Vector3.zero, aim_.ControlEntity.ActorObj.transform, KillEffCallBack, true); GlobalInstanceFunction.Instance.Invoke(() => { caster.ControlEntity.MoveTo(aim.ControlEntity.ActorObj.transform.position + aim.ControlEntity.ActorObj.transform.forward, (int data) => { GlobalInstanceFunction.Instance.Invoke(() => { if (killEff != null) { GameObject.Destroy(killEff); } aim.SetIprop(PropertyType.PT_HpCurr, 0); if (aim.InstId == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(PropertyType.PT_HpCurr, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax) * -1, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax), GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax)); } if (Battle.Instance.SelfActorBattleBaby != null) { if (aim.InstId == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, aim.battlePlayer.hpMax_ * -1, aim.battlePlayer.hpMax_, aim.battlePlayer.mpMax_); } } if (aim.ControlEntity.PlayerInfoUI != null) { Roleui ro = aim.ControlEntity.PlayerInfoUI.GetComponent <Roleui>(); if (null == ro) { return; } ro.ValueChange(PropertyType.PT_HpCurr, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax) * -1, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax), GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax), false, false); } aim.ControlEntity.hitOver_ = false; aim.ControlEntity.DealEntityDie(); Wait4AimDie(); }, 0.7f); }, false, false, 0.3f, 0, false); }, 0.3f); }, 1f); }
public void Cast(int skillId, int skillLv, BattleActor caster, BattleActor[] aims, COM_ReportTarget[] propertyVals, FinishCallBack finCallback, AttackFinishCallBack attackfinishCallback = null, bool realAimPos = false) { GlobalInstanceFunction.Instance.openTimer_ = true; GlobalInstanceFunction.Instance.deadTimer_ = 0f; GlobalInstanceFunction.Instance.OnDeadFinish += OnDealDeadFinish; if (crt_data_ != null) { ClientLog.Instance.LogError("a skill is casting"); return; } effectInsts_ = new Dictionary <int, EffectInst> (); crt_data_ = SkillData.GetData(skillId, skillLv); if (crt_data_ == null) { ClientLog.Instance.LogError("skill id :" + skillId + "has not data"); return; } realAimPos_ = realAimPos; if (caster.InstId == GamePlayer.Instance.InstId || TeamSystem.isTeamMember(caster.InstId)) { AttaclPanel.Instance.SetSkillIcon(skillId, skillLv, caster.AssetId); //caster.ControlEntity.PlayerInfoUI.GetComponent<Roleui>().ShowSkill(crt_data_.singEffectId_, caster.SkillNamePos()); } isPhysic_ = crt_data_._IsPhysic; if (isPhysic_) { if (caster.battlePlayer.weaponItemId_ != 0) { isMelee_ = !caster.rangeWeapon(); } else { isMelee_ = crt_data_._IsMelee; } } else { isMelee_ = crt_data_._IsMelee; } Transform t = Battle.Instance.GetStagePointByIndex(caster.BattlePos); if (t == null) { return; } caster_ = caster; aims_ = TrimNull(aims); props_ = propertyVals; originObj_ = t.gameObject; finish_call_back_ = finCallback; attack_finish_call_back_ = attackfinishCallback; //caster_.ResetPos(); Battle.Instance.ResetActorDirection(); aimsQue_ = new Queue <BattleActor>(); propQue_ = new Queue <COM_ReportTarget>(); for (int i = 0; i < aims_.Length; ++i) { if (aims_[i] == null) { continue; } aimsQue_.Enqueue(aims_[i]); propQue_.Enqueue(props_[i]); } if (isMelee_) { caster_.attackAnim_ = caster_.GetWeaponAction() + GlobalValue.TAttack; } else { if (isPhysic_) { caster_.castAnim_ = caster_.GetWeaponAction() + GlobalValue.TCast; } else { caster_.castAnim_ = GlobalValue.TCast; } } caster.battlePlayer.mpCrt_ -= crt_data_._Cost_mana; if (caster.InstId == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_); ScrollViewPanel.curMp = caster.battlePlayer.mpCrt_; } if (Battle.Instance.SelfActorBattleBaby != null) { if (caster.InstId == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_); } } if (caster.ControlEntity.PlayerInfoUI != null && caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>() != null) { Roleui roleinfoUI = caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>(); roleinfoUI.ValueChange(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_, false); } //EffectAPI.Load (() => { // if (crt_data_._Cast_effectID != -1) // EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect); // else // AfterCastEffect(); //}, crt_data_._EffectID, crt_data_._Cast_effectID, crt_data_._Cast_effectID); if (crt_data_._Cast_effectID != -1) { EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect); } else { AfterCastEffect(); } }
void MoveToOtherAim() { if (caster_.ControlEntity == null) { ApplicationEntry.Instance.PostSocketErr(57557); return; } Transform crossTrans = null; int aimForGuard = aim_.ForGuardPos; if (aimForGuard != (int)BattlePosition.BP_None) { crossTrans = Battle.Instance.GetStagePointByIndex(aimForGuard); } if (crossTrans != null) { BattleActor actor = Battle.Instance.GetActorByIdx((int)aimForGuard); if (actor.ControlEntity == null) { ApplicationEntry.Instance.PostSocketErr(57557); return; } actor.battlePlayer.mpCrt_ -= crt_data_._Cost_mana; if (actor.InstId == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, actor.battlePlayer.hpMax_, actor.battlePlayer.mpMax_); ScrollViewPanel.curMp = actor.battlePlayer.mpCrt_; } if (Battle.Instance.SelfActorBattleBaby != null) { if (actor.InstId == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, actor.battlePlayer.hpMax_, actor.battlePlayer.mpMax_); } } if (actor.ControlEntity.PlayerInfoUI != null && actor.ControlEntity.PlayerInfoUI.GetComponent <Roleui>() != null) { Roleui roleinfoUI = actor.ControlEntity.PlayerInfoUI.GetComponent <Roleui>(); roleinfoUI.ValueChange(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, actor.battlePlayer.hpMax_, actor.battlePlayer.mpMax_, false); } Vector3 crossPos = (crossTrans.position + crossTrans.forward); caster_.ControlEntity.MoveTo(crossPos, AttackMotion); EffectAPI.PlaySceneEffect(EFFECT_ID.EFFECT_huwei, Vector3.zero, aim_.ControlEntity.ActorObj.transform, null, true); aim_.ControlEntity.MoveTo(crossPos, (int data) => { if (aim_.ControlEntity == null) { ApplicationEntry.Instance.PostSocketErr(57557); return; } // aim_.ControlEntity.PlayEntityAction( GlobalValue.ActionName , GlobalValue.Action_Idle ); aim_.ControlEntity.SetAnimationParam(GlobalValue.FMove, AnimatorParamType.APT_Float, GlobalValue.MoveMinGap); }, false, true, 0.3f); } else { if (realAimPos_) { caster_.ControlEntity.MoveTo(aim_.ControlEntity.ActorObj, AttackMotion); } else { caster_.ControlEntity.MoveTo(Battle.Instance.GetStagePointByIndex(aim_.BattlePos).gameObject, AttackMotion); } } }