public override void Init() { this._avatar = Singleton <AvatarManager> .Instance.GetAvatarByRuntimeID(base.runtimeID); this._avatarActor = Singleton <MPEventManager> .Instance.GetActor <AvatarActor>(base.runtimeID); base._animatorEntity = this._avatar; base._abilityEntity = this._avatar; base._abilityActor = this._avatarActor; this._avatarActor.GetPlugin <MPAvatarActorPlugin>().SetupIdentity(this); this._avatarActor.GetPluginAs <ActorAbilityPlugin, MPActorAbilityPlugin>().SetupIdentity(this); switch (Singleton <MPLevelManager> .Instance.mpMode) { case MPMode.Normal: this._remoteMode = IdentityRemoteMode.Mute; break; case MPMode.PvP_SendNoReceive: this._remoteMode = IdentityRemoteMode.SendAndNoReceive; this._avatar.SetAttackSelectMethod(new Action <BaseMonoAvatar>(AvatarAttackTargetSelectPattern.PvPSelectRemoteAvatar)); break; case MPMode.PvP_ReceiveNoSend: this._remoteMode = IdentityRemoteMode.ReceiveAndNoSend; this._avatar.SetAttackSelectMethod(new Action <BaseMonoAvatar>(AvatarAttackTargetSelectPattern.PvPSelectRemoteAvatar)); break; } base.Init(); }
private bool ListenKilled(EvtKilled evt) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.killerID); MonsterActor actor2 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(evt.targetID); MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera(); if ((((actor != null) && (actor2 != null)) && (Singleton <AvatarManager> .Instance.IsLocalAvatar(actor.runtimeID) && (Singleton <MonsterManager> .Instance.LivingMonsterCount() == 0))) && mainCamera.followState.slowMotionKillState.active) { if (string.IsNullOrEmpty(evt.killerAnimEventID) || !actor.config.AnimEvents.ContainsKey(evt.killerAnimEventID)) { return(false); } AttackResult.AttackCategoryTag[] categoryTag = actor.config.AnimEvents[evt.killerAnimEventID].AttackProperty.CategoryTag; if (categoryTag == null) { return(false); } bool flag = false; for (int i = 0; i < categoryTag.Length; i++) { if (categoryTag[i] == AttackResult.AttackCategoryTag.SwitchIn) { flag = true; break; } } if (flag) { this.Finish(); } } return(false); }
public AvatarStastics GetAvatarStastics(uint avatarRuntimeID) { BaseMonoAvatar helperAvatar = Singleton <AvatarManager> .Instance.GetHelperAvatar(); if ((helperAvatar != null) && (helperAvatar.GetRuntimeID() == avatarRuntimeID)) { return(null); } AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatarRuntimeID); if (actor == null) { return(null); } if (!this._avatarStasticsDict.ContainsKey(actor.avatarDataItem.avatarID)) { AvatarStastics stastics = new AvatarStastics(actor.avatarDataItem.avatarID) { avatarLevel = actor.level, avatarStar = actor.avatarDataItem.star, stageID = Singleton <LevelScoreManager> .Instance.LevelId }; this._avatarStasticsDict[actor.avatarDataItem.avatarID] = stastics; } return(this._avatarStasticsDict[actor.avatarDataItem.avatarID]); }
public void InitForReviveButton(BaseMonoAvatar avatar) { this._button = base.GetComponent <Button>(); this._hpBarImg = base.transform.Find("HPBar/Inner").GetComponent <Image>(); this._spBarImg = base.transform.Find("SPBar/Inner").GetComponent <Image>(); this._iconImage = base.transform.Find("Icon").GetComponent <Image>(); this._CDMaskImg = base.transform.Find("CDMask").GetComponent <Image>(); this.avatarRuntimeID = avatar.GetRuntimeID(); this._avatar = avatar; this._avatarActor = (AvatarActor)Singleton <EventManager> .Instance.GetActor(this.avatarRuntimeID); GameObject obj2 = Miscs.LoadResource <GameObject>(this._avatarActor.avatarIconPath, BundleType.RESOURCE_FILE); this._iconImage.sprite = obj2.GetComponent <SpriteRenderer>().sprite; Transform transform = base.transform.Find("Attr"); for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } transform.Find(this._avatarActor.avatarDataItem.Attribute.ToString()).gameObject.SetActive(true); this.onlyForShow = true; this._button.interactable = true; base.transform.Find("CDMask").gameObject.SetActive(true); }
private void TurnOnModifier() { base.actor.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.OnModifierName); if (this.config.OffModifierName != null) { base.actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.OffModifierName); } if (!string.IsNullOrEmpty(this.config.SkillButtonID)) { AvatarActor actor = base.actor as AvatarActor; actor.GetSkillInfo(this.config.SkillButtonID).costSP = (SafeFloat)this.config.OnModifierReplaceCostSP; actor.GetSkillInfo(this.config.SkillButtonID).needSP = (SafeFloat)this.config.OnModifierReplaceCostSP; actor.GetSkillInfo(this.config.SkillButtonID).iconPath = this.config.OnModifierReplaceIconPath; actor.GetSkillInfo(this.config.SkillButtonID).muteHighlighted = true; Singleton <MainUIManager> .Instance.GetInLevelUICanvas().mainPageContext.GetSkillButtonBySkillID(this.config.SkillButtonID).RefreshSkillInfo(); if (this.config.OnModifierSwitchToInstantTrigger) { actor.config.Skills[this.config.SkillButtonID].IsInstantTrigger = true; actor.config.Skills[this.config.SkillButtonID].InstantTriggerEvent = this.config.OnModifierInstantTriggerEvent; } } this._timer.Reset(true); this._state = true; }
private void OnUpdateAttackTarget(BaseMonoEntity entity) { if ((entity != null) && this._isTutorialAvailable) { MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(entity.GetRuntimeID()); BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()); EntityNature attackerNature = (EntityNature)attackee.metaConfig.nature; EntityNature attribute = (EntityNature)actor.avatarDataItem.Attribute; float num = DamageModelLogic.GetNatureDamageBonusRatio(attackerNature, attribute, attackee); if (((((attackee != null) && (actor != null)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep))) && ((!this.IsAllStepDone() && (num > 1f)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep)))) && !this.IsAllStepDone()) { this.ActiveCurrentStep(); this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep0)); } if ((((attackee != null) && (actor != null)) && ((this._killAmount >= 2) && (this._monsterCreatedAmount > 2))) && (((num > 1f) && (base.step == 2)) && ((base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep) && !this.IsAllStepDone()))) { this.ActiveCurrentStep(); this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep2)); } } }
public void AbilityBeingHit(EvtBeingHit evt) { if ((this.abilityState & AbilityState.WitchTimeSlowed) != AbilityState.None) { float resumeTime = 0.5f; if ((evt.animEventID != null) && (Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.sourceID) == 3)) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.sourceID); if ((actor != null) && (actor.config != null)) { ConfigAvatarAnimEvent event2 = SharedAnimEventData.ResolveAnimEvent(actor.config, evt.animEventID); if ((event2 != null) && (event2.WitchTimeResume != null)) { resumeTime = event2.WitchTimeResume.ResumeTime; } } } if (evt.attackData.isAnimEventAttack && (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)) { this.entity.SetTimeScale(1f, 1); this._witchTimeResumeTimer.timespan = resumeTime; this._witchTimeResumeTimer.Reset(true); } } }
public override void OnRemoved() { Singleton <EventManager> .Instance.RemoveEventListener <EvtBeingHit>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtAttackStart>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtLevelBuffState>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtSkillStart>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtEvadeStart>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtEvadeSuccess>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtDefendStart>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtDefendSuccess>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtAvatarCreated>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtAvatarSwapInEnd>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtAvatarSwapOutStart>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtMonsterCreated>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtKilled>(this._levelActor.runtimeID); Singleton <EventManager> .Instance.RemoveEventListener <EvtStageReady>(this._levelActor.runtimeID); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(Singleton <AvatarManager> .Instance.GetLocalAvatar().GetRuntimeID()); actor.onSPChanged = (Action <float, float, float>)Delegate.Remove(actor.onSPChanged, new Action <float, float, float>(this.OnSPChanged)); Singleton <LevelManager> .Instance.levelActor.onLevelComboChanged = (Action <int, int>)Delegate.Remove(Singleton <LevelManager> .Instance.levelActor.onLevelComboChanged, new Action <int, int>(this.OnLevelComboChanged)); }
private bool ListenBeingHit(EvtBeingHit evt) { if (!this._saveActive) { return(false); } if (evt.attackData.rejected) { return(false); } if (this._alliedIDs.Contains(evt.targetID)) { AvatarActor other = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.targetID); if ((other.HP == 0f) && other.IsOnStage()) { Singleton <LevelManager> .Instance.levelActor.TriggerSwapLocalAvatar(other.runtimeID, base.actor.runtimeID, true); base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.AdditionalActions, base.instancedAbility, base.instancedModifier, other, null); this._saveCountRemains--; } if (this._saveCountRemains == 0) { this.StopSaving(); } } return(true); }
public override void OnAwake() { this._avatar = base.GetComponent <BaseMonoAvatar>(); this._avatarActor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(this._avatar.GetRuntimeID()); this._avatarAIPlugin = this._avatarActor.GetPlugin <AvatarAIPlugin>(); }
public void RemoveAttacker(AvatarActor attackerActor) { this.attackerSet.Remove(attackerActor.runtimeID); if (this.attackerSet.Count <= 0) { this.SetDisable(); } }
protected override void ClearTargetAttackTarget(uint sourceID) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(sourceID); if (actor != null) { (actor.entity as BaseMonoAvatar).SetAttackTarget(null); } }
public AbilityAvatarQTEMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this._qteTargetList = new List <QTETarget>(); this.config = (AvatarQTEMixin)config; this._avatarActor = base.actor as AvatarActor; this._qteMaxTimer = new EntityTimer(instancedAbility.Evaluate(this.config.QTEMaxTimeSpan)); this._qteMaxTimer.Reset(false); this._delayQteTimer = new EntityTimer(instancedAbility.Evaluate(this.config.DelayQTETimeSpan)); this._delayQteTimer.Reset(false); }
private bool CheckCanShowButtonAllowSwitchEffect() { bool flag = false; AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(Singleton <AvatarManager> .Instance.GetLocalAvatar().GetRuntimeID()); if (((!Singleton <AvatarManager> .Instance.IsLocalAvatar(this._avatar.GetRuntimeID()) && (actor != null)) && (actor.IsOnStage() && !Singleton <LevelManager> .Instance.IsPaused())) && actor.AllowOtherSwitchIn) { flag = true; } return(flag); }
public void AttachMuteOtherQTE(BaseMonoAbilityEntity target, bool muteOtherQTE) { this.CheckInit <Tuple <AvatarActor, bool> >(ref this._attachMuteOtherQTE); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(target.GetRuntimeID()); if (actor != null) { actor.MuteOtherQTE = muteOtherQTE; this._attachMuteOtherQTE.Add(Tuple.Create <AvatarActor, bool>(actor, muteOtherQTE)); } }
private bool OnAvatarCreated(EvtAvatarCreated evt) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()); if (actor != null) { actor.AddAbilityState(AbilityState.Undamagable, true); } return(false); }
private void CheatForPariticleMode(AvatarActor actor) { if (this.pariticleMode) { foreach (AvatarActor.SKillInfo info in actor.skillInfoList) { info.CD = 0f; } actor.baseMaxHP = actor.HP = actor.maxHP = 999999f; actor.baseMaxSP = actor.SP = actor.maxSP = 999999f; actor.ChangeSwitchInCDTime(0.1f); } }
public void SetupView(AvatarActor attacker, MonsterActor attackee, float offset, Action <MonoSubMonsterHPBar> hideHPBarCallBack = null) { base.gameObject.SetActive(true); if (!this.attackerSet.Contains(attacker.runtimeID)) { this.attackerSet.Add(attacker.runtimeID); } this.attackee = attackee; this._offset = offset; this.enable = true; this._monster = attackee.entity as BaseMonoMonster; this._hideHPBarCallBack = hideHPBarCallBack; }
private void SetupAvatarId() { foreach (BaseMonoAvatar avatar in Singleton <AvatarManager> .Instance.GetAllPlayerAvatars()) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatar.GetRuntimeID()); if ((actor != null) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(avatar.GetRuntimeID())) { this.targetSwapAvatarId = actor.runtimeID; } } this.sourceSwapAvatarId = Singleton <AvatarManager> .Instance.GetLocalAvatar().GetRuntimeID(); }
private bool ListenKilled(EvtKilled evt) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.killerID); MonsterActor actor2 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(evt.targetID); if (((actor != null) && (actor2 != null)) && this._inStastics) { int num = this._killedAmountLs.SeekAddPosition <Tuple <float, int> >(); this._killedAmountLs[num] = Tuple.Create <float, int>(this._stasticsTimer, 1); } return(false); }
public override void OnRemoved() { AvatarActor actor = base.actor as AvatarActor; if (actor.GetSkillInfo(this.config.SkillID) != null) { actor.GetSkillInfo(this.config.SkillID).muted = false; actor.GetSkillInfo(this.config.SkillID).maskIconPath = null; if (Singleton <AvatarManager> .Instance.IsLocalAvatar(base.actor.entity.GetRuntimeID())) { Singleton <MainUIManager> .Instance.GetInLevelUICanvas().mainPageContext.GetSkillButtonBySkillID(this.config.SkillID).RefreshSkillInfo(); } } }
private bool ListenTutorialState(EvtTutorialState evt) { if ((evt != null) && (evt.state == EvtTutorialState.State.Start)) { this._actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(Singleton <AvatarManager> .Instance.GetLocalAvatar().GetRuntimeID()); if (this._actor == null) { return(false); } this.WaitShowTutorialStep(0.5f, new Action(this.StartCheckStageReady)); } return(false); }
private bool ListenAvatarSwapOutStart(EvtAvatarSwapOutStart evt) { AvatarStastics avatarStastics = this.GetAvatarStastics(evt.targetID); if (avatarStastics != null) { avatarStastics.swapOutTimes = SafeInt32.op_Increment(avatarStastics.swapOutTimes); avatarStastics.isOnStage = 0; AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(Singleton <AvatarManager> .Instance.GetLocalAvatar().GetRuntimeID()); actor.onSPChanged = (Action <float, float, float>)Delegate.Remove(actor.onSPChanged, new Action <float, float, float>(this.OnSPChanged)); } return(true); }
private void SetUpAvatarSkill(AvatarActor actor, DevAvatarData devAvatarData) { if (devAvatarData.avatarTestSkills.Length > 0) { for (int i = 0; i < devAvatarData.avatarTestSkills.Length; i++) { string str = devAvatarData.avatarTestSkills[i]; if (!string.IsNullOrEmpty(str)) { actor.abilityPlugin.InsertPreInitAbility(AbilityData.GetAbilityConfig(devAvatarData.avatarTestSkills[i])); } } } }
public static void AddAvatarWeaponAdditionalAbilities(int weaponID, AvatarActor avatar) { ConfigWeapon weaponConfig = GetWeaponConfig(weaponID); for (int i = 0; i < weaponConfig.AdditionalAbilities.Length; i++) { ConfigAbility abilityConfig = AbilityData.GetAbilityConfig(weaponConfig.AdditionalAbilities[i].AbilityName, weaponConfig.AdditionalAbilities[i].AbilityOverride); avatar.CreateAppliedAbility(abilityConfig); if (!string.IsNullOrEmpty(weaponConfig.AdditionalAbilities[i].AbilityReplaceID)) { avatar.abilityIDMap[weaponConfig.AdditionalAbilities[i].AbilityReplaceID] = abilityConfig.AbilityName; } } }
public override void OnAdded() { if (this.config.OffModifierName != null) { base.actor.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.OffModifierName); } AvatarActor actor = base.actor as AvatarActor; if (!string.IsNullOrEmpty(this.config.SkillButtonID)) { this._originSpCost = (float)actor.GetSkillInfo(this.config.SkillButtonID).costSP; this._originSpNeed = (float)actor.GetSkillInfo(this.config.SkillButtonID).needSP; this._originIconPath = actor.GetSkillInfo(this.config.SkillButtonID).iconPath; } }
private void StopSaving() { this._saveActive = false; for (int i = 0; i < this._alliedIDs.Count; i++) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(this._alliedIDs[i]); if ((actor != null) && ((actor.abilityState & AbilityState.Limbo) != AbilityState.None)) { actor.RemoveAbilityState(AbilityState.Limbo); } } this._alliedIDs.Clear(); Singleton <EventManager> .Instance.RemoveEventListener <EvtBeingHit>(base.actor.runtimeID); }
private bool ListenAttackStart(EvtAttackStart evt) { if (this.isUpdating) { switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID)) { case 3: { this.avatarAttackTimes++; if (this.attackTimeList.ContainsKey(evt.skillID)) { Dictionary <string, uint> dictionary; string str; uint num3 = dictionary[str]; (dictionary = this.attackTimeList)[str = evt.skillID] = num3 + 1; } else { this.attackTimeList[evt.skillID] = 1; } AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.targetID); if (((actor != null) && actor.config.Skills.ContainsKey(evt.skillID)) && (actor.config.Skills[evt.skillID].SkillCategoryTag != null)) { for (int i = 0; i < actor.config.Skills[evt.skillID].SkillCategoryTag.Length; i++) { if ((actor.config.Skills[evt.skillID].SkillCategoryTag[i] == AttackResult.AttackCategoryTag.Branch) || (actor.config.Skills[evt.skillID].SkillCategoryTag[i] == AttackResult.AttackCategoryTag.Charge)) { AvatarStastics avatarStastics = this.GetAvatarStastics(evt.targetID); if (avatarStastics != null) { avatarStastics.avatarSpecialAttackTimes = SafeInt32.op_Increment(avatarStastics.avatarSpecialAttackTimes); } this.specialAttackTimes++; break; } } } break; } case 4: this.monsterAttackTimes++; break; } } return(true); }
private void SetupAvatarId() { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); foreach (BaseMonoAvatar avatar2 in Singleton <AvatarManager> .Instance.GetAllPlayerAvatars()) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatar2.GetRuntimeID()); if ((actor != null) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(avatar2.GetRuntimeID())) { this.targetSwapAvatarId = actor.runtimeID; } } this.sourceSwapAvatarId = localAvatar.GetRuntimeID(); Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.SwapBtnVisible, false)); }
public void InitFromAvatarActor(AvatarActor avatarActor, float hpRatioOfParent) { base.ownerID = avatarActor.runtimeID; this.owner = avatarActor.avatar; this.ownerActor = avatarActor; base.level = this.ownerActor.level; base.attack = this.ownerActor.attack; base.critical = this.ownerActor.critical; base.defense = this.ownerActor.defense; base.HP = base.maxHP = hpRatioOfParent * avatarActor.maxHP; base.avatarDataItem = avatarActor.avatarDataItem.Clone(); base._isOnStage = true; base.avatar.DisableShadow(); Physics.IgnoreCollision(this.owner.transform.GetComponent <CapsuleCollider>(), base.avatar.transform.GetComponent <CapsuleCollider>()); base.avatar.transform.position = this.owner.transform.position; }