Пример #1
0
        public void ApplyLevelBuff_AuthorityHandler(ConfigAbilityAction actionConfig, ActorAbility instancedAbility, ActorModifier instancedModifier, BaseAbilityActor target, BaseEvent evt, ref RecordInvokeEntryContext context)
        {
            LevelBuffSide  overrideCurSide;
            ApplyLevelBuff config    = (ApplyLevelBuff)actionConfig;
            float          duration  = base._Internal_CalculateApplyLevelBuffDuration(config, instancedAbility, evt);
            uint           runtimeID = instancedAbility.caster.runtimeID;

            if (config.UseOverrideCurSide)
            {
                overrideCurSide = config.OverrideCurSide;
            }
            else
            {
                overrideCurSide = base.CalculateLevelBuffSide(instancedAbility.caster.runtimeID);
            }
            MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_RequestLevelBuff>();

            Packet_Level_RequestLevelBuff.StartPacket_Level_RequestLevelBuff(pc.builder);
            Packet_Level_RequestLevelBuff.AddLevelBuffType(pc.builder, (byte)config.LevelBuff);
            Packet_Level_RequestLevelBuff.AddEnteringSlow(pc.builder, config.EnteringTimeSlow);
            Packet_Level_RequestLevelBuff.AddAllowRefresh(pc.builder, config.LevelBuffAllowRefresh);
            Packet_Level_RequestLevelBuff.AddSide(pc.builder, (byte)overrideCurSide);
            Packet_Level_RequestLevelBuff.AddOwnerRuntimeID(pc.builder, runtimeID);
            Packet_Level_RequestLevelBuff.AddNotStartEffect(pc.builder, config.NotStartEffect);
            Packet_Level_RequestLevelBuff.AddDuration(pc.builder, duration);
            Packet_Level_RequestLevelBuff.AddInstancedAbilityID(pc.builder, (byte)instancedAbility.instancedAbilityID);
            Packet_Level_RequestLevelBuff.AddActionLocalID(pc.builder, (byte)config.localID);
            pc.Finish <Packet_Level_RequestLevelBuff>(Packet_Level_RequestLevelBuff.EndPacket_Level_RequestLevelBuff(pc.builder));
            Singleton <MPManager> .Instance.SendReliableToPeer(0x21800001, 1, pc);

            Singleton <MPLevelManager> .Instance.levelActor.GetPlugin <MPLevelAbilityHelperPlugin>().AttachPendingModifiersToNextLevelBuff(config, base._owner.runtimeID, instancedAbility.instancedAbilityID, (target != null) ? target.runtimeID : 0);
        }
Пример #2
0
        protected override void HandleAvatarCreationForStageCreation(EvtStageCreated evt, out bool sendStageReady)
        {
            List <MonoSpawnPoint> avatarSpawnPointList = new List <MonoSpawnPoint>();

            foreach (string str in evt.avatarSpawnNameList)
            {
                int namedSpawnPointIx = Singleton <StageManager> .Instance.GetStageEnv().GetNamedSpawnPointIx(str);

                avatarSpawnPointList.Add(Singleton <StageManager> .Instance.GetStageEnv().spawnPoints[namedSpawnPointIx]);
            }
            if (evt.isBorn)
            {
                this.CreateMPAvatars();
            }
            Singleton <AvatarManager> .Instance.InitAvatarsPos(avatarSpawnPointList);

            Singleton <MonsterManager> .Instance.InitMonstersPos(evt.offset);

            if (!Singleton <MPManager> .Instance.isMaster)
            {
                MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_PeerStageReady>();

                Packet_Level_PeerStageReady.StartPacket_Level_PeerStageReady(pc.builder);
                Packet_Level_PeerStageReady.AddState(pc.builder, PingPongEnum.Request);
                pc.Finish <Packet_Level_PeerStageReady>(Packet_Level_PeerStageReady.EndPacket_Level_PeerStageReady(pc.builder));
                Singleton <MPManager> .Instance.SendReliableToPeer(0x21800001, 1, pc);
            }
            sendStageReady = false;
        }
Пример #3
0
        private void OnAuthorityJustKilled(uint killerID, string animEventID, KillEffect killEffect)
        {
            MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Entity_Kill>();

            StringOffset animEventIDOffset = MPMiscs.CreateString(pc.builder, animEventID);

            pc.Finish <Packet_Entity_Kill>(Packet_Entity_Kill.CreatePacket_Entity_Kill(pc.builder, killerID, animEventIDOffset, (byte)killEffect));
            Singleton <MPManager> .Instance.SendReliableToOthers(base.runtimeID, pc);
        }
Пример #4
0
        public void DestroyMPIdentity(uint runtimeID)
        {
            MPSendPacketContainer pc = this.CreateSendPacket <Packet_Basic_Destroy>();

            Packet_Basic_Destroy.StartPacket_Basic_Destroy(pc.builder);
            pc.Finish <Packet_Basic_Destroy>(Packet_Basic_Destroy.EndPacket_Basic_Destroy(pc.builder));
            this.SendReliableToOthers(runtimeID, pc);
            this.RemoveMPIdentity(runtimeID);
        }
Пример #5
0
        private void SendLevelBuffResponse(LevelBuffAction action, LevelBuffType type, bool enteringSlow, bool notStartEffect, uint ownerID, LevelBuffSide side, int instancedAbilityID = 0, int actionLocalID = 0)
        {
            MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_ResultLevelBuff>();

            bool flag  = enteringSlow;
            bool flag2 = notStartEffect;
            Offset <Packet_Level_ResultLevelBuff> offset = Packet_Level_ResultLevelBuff.CreatePacket_Level_ResultLevelBuff(pc.builder, action, 0, (byte)side, flag, flag2, ownerID, (byte)instancedAbilityID, (byte)actionLocalID);

            pc.Finish <Packet_Level_ResultLevelBuff>(offset);
            Singleton <MPManager> .Instance.SendReliableToOthers(0x21800001, pc);
        }
Пример #6
0
        public T InstantiateMPIdentity <T>(uint runtimeID, MPSendPacketContainer initPc) where T : BaseMPIdentity, new()
        {
            int num = this.AllocChannelSequenceForRuntimeID(runtimeID);
            MPSendPacketContainer pc = this.CreateSendPacket <Packet_Basic_Instantiate>(this._instantiateBuilder);

            Packet_Basic_Instantiate.StartPacket_Basic_Instantiate(pc.builder);
            Packet_Basic_Instantiate.AddPeerType(pc.builder, (byte)MPMappings.MPPeerMapping.Get(typeof(T)));
            Packet_Basic_Instantiate.AddChannelSequence(pc.builder, (byte)num);
            pc.Finish <Packet_Basic_Instantiate>(Packet_Basic_Instantiate.EndPacket_Basic_Instantiate(pc.builder));
            this.SendReliableToOthers(runtimeID, pc);
            this.SendReliableToOthers(runtimeID, initPc);
            return(this.CreateMPIdentity <T>(runtimeID));
        }
Пример #7
0
        public void AuthorityOnAnimatorStateChanged(AnimatorStateInfo fromState, AnimatorStateInfo toState)
        {
            if (!Miscs.ArrayContains <int>(this._muteSyncTagHashes, toState.tagHash))
            {
                MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Entity_AnimatorStateChange>();

                Packet_Entity_AnimatorStateChange.StartPacket_Entity_AnimatorStateChange(pc.builder);
                Packet_Entity_AnimatorStateChange.AddNormalizedTimeTo(pc.builder, (fromState.shortNameHash != toState.shortNameHash) ? toState.normalizedTime : 0f);
                Packet_Entity_AnimatorStateChange.AddToStateHash(pc.builder, toState.shortNameHash);
                Packet_Entity_AnimatorStateChange.AddStateSync(pc.builder, EntityStateSync.CreateEntityStateSync(pc.builder, this._animatorEntity.XZPosition.x, this._animatorEntity.XZPosition.z, MPMiscs.ForwardToXZAngles(this._animatorEntity.FaceDirection)));
                pc.Finish <Packet_Entity_AnimatorStateChange>(Packet_Entity_AnimatorStateChange.EndPacket_Entity_AnimatorStateChange(pc.builder));
                Singleton <MPManager> .Instance.SendStateUpdateToOthers(base.runtimeID, pc);
            }
        }
Пример #8
0
        private void OnInitializeDoneReplicate()
        {
            MPSendPacketContainer initPc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Monster_MonsterCreation>();

            StringOffset monsterNameOffset = initPc.builder.CreateString(this._actor.monster.MonsterName);
            StringOffset monsterTypeOffset = initPc.builder.CreateString(this._actor.monster.TypeName);

            Packet_Monster_MonsterCreation.StartPacket_Monster_MonsterCreation(initPc.builder);
            Packet_Monster_MonsterCreation.AddMonsterName(initPc.builder, monsterNameOffset);
            Packet_Monster_MonsterCreation.AddMonsterType(initPc.builder, monsterTypeOffset);
            Packet_Monster_MonsterCreation.AddLevel(initPc.builder, (int)this._actor.level);
            Packet_Monster_MonsterCreation.AddIsElite(initPc.builder, this._actor.isElite);
            Packet_Monster_MonsterCreation.AddUniqueMonsterID(initPc.builder, this._actor.uniqueMonsterID);
            Vector3 xZPosition = this._actor.monster.XZPosition;

            Packet_Monster_MonsterCreation.AddInitPos(initPc.builder, MPVector2_XZ.CreateMPVector2_XZ(initPc.builder, xZPosition.x, xZPosition.z));
            initPc.Finish <Packet_Monster_MonsterCreation>(Packet_Monster_MonsterCreation.EndPacket_Monster_MonsterCreation(initPc.builder));
            Singleton <MPManager> .Instance.InstantiateMPIdentity <MonsterIdentity>(this._actor.runtimeID, initPc);
        }
Пример #9
0
        private void OnAuthority_PeerStageReady(MPRecvPacketContainer recvPc)
        {
            Packet_Level_PeerStageReady ready = recvPc.As <Packet_Level_PeerStageReady>();

            this._readyPeerCount++;
            if (this._readyPeerCount == Singleton <MPManager> .Instance.peer.totalPeerCount)
            {
                MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_PeerStageReady>();

                Packet_Level_PeerStageReady.StartPacket_Level_PeerStageReady(pc.builder);
                Packet_Level_PeerStageReady.AddState(pc.builder, PingPongEnum.Response);
                pc.Finish <Packet_Level_PeerStageReady>(Packet_Level_PeerStageReady.EndPacket_Level_PeerStageReady(pc.builder));
                Singleton <MPManager> .Instance.SendReliableToOthers(0x21800001, pc);

                EvtStageReady evt = new EvtStageReady {
                    isBorn = true
                };
                Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);
            }
        }
Пример #10
0
        private void FlushRecordInvokeEntriesAndSend()
        {
            if (this._invokeTableOffsets.Count > 0)
            {
                MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket(typeof(Packet_Ability_InvocationTable), this._invokeTableBuilder);

                VectorOffset invokesOffset = Packet_Ability_InvocationTable.CreateInvokesVector(pc.builder, this._invokeTableOffsets.ToArray());
                Offset <Packet_Ability_InvocationTable> offset = Packet_Ability_InvocationTable.CreatePacket_Ability_InvocationTable(pc.builder, invokesOffset);
                pc.Finish <Packet_Ability_InvocationTable>(offset);
                if (this._abilityIdentity.isAuthority)
                {
                    Singleton <MPManager> .Instance.SendReliableToOthers(base._owner.runtimeID, pc);
                }
                else
                {
                    Singleton <MPManager> .Instance.SendReliableToPeer(base._owner.runtimeID, this._abilityIdentity.GetPeerID(), pc);
                }
                this._invokeTableBuilder.Clear();
                this._invokeTableOffsets.Clear();
            }
        }
Пример #11
0
        protected virtual void AuthoritySendTransformSyncCore()
        {
            if ((Time.time - this._lastSentTime) > this._sendInterval)
            {
                float   xzAngle    = MPMiscs.ForwardToXZAngles(this._lastSetForward);
                Vector3 xZPosition = this._animatorEntity.XZPosition;
                Vector3 vector2    = xZPosition - this._lastSendXZ;
                if (MPMiscs.NeedSyncTransform(vector2.sqrMagnitude, xzAngle - this._lastSentXZAngle))
                {
                    MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Entity_TransformSync>();

                    Packet_Entity_TransformSync.StartPacket_Entity_TransformSync(pc.builder);
                    Packet_Entity_TransformSync.AddStateSync(pc.builder, EntityStateSync.CreateEntityStateSync(pc.builder, this._animatorEntity.XZPosition.x, this._animatorEntity.XZPosition.z, xzAngle));
                    pc.Finish <Packet_Entity_TransformSync>(Packet_Entity_TransformSync.EndPacket_Entity_TransformSync(pc.builder));
                    Singleton <MPManager> .Instance.SendStateUpdateToOthers(base.runtimeID, pc);

                    this._lastSendXZ      = xZPosition;
                    this._lastSentXZAngle = xzAngle;
                    this._lastSentTime    = Time.time;
                }
            }
        }
Пример #12
0
        public void AuthorityUserInputControllerChanged(AnimatorParameterEntry entry)
        {
            MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Entity_AnimatorParameterChange>();

            Packet_Entity_AnimatorParameterChange.StartPacket_Entity_AnimatorParameterChange(pc.builder);
            Packet_Entity_AnimatorParameterChange.AddStateHash(pc.builder, entry.stateHash);
            Packet_Entity_AnimatorParameterChange.AddParameter(pc.builder, (byte)entry.type);
            switch (entry.type)
            {
            case AnimatorControllerParameterType.Float:
                Packet_Entity_AnimatorParameterChange.AddFloatValue(pc.builder, entry.floatValue);
                break;

            case AnimatorControllerParameterType.Int:
                Packet_Entity_AnimatorParameterChange.AddIntValue(pc.builder, entry.intValue);
                break;

            case AnimatorControllerParameterType.Bool:
                Packet_Entity_AnimatorParameterChange.AddBoolValue(pc.builder, entry.boolValue);
                break;
            }
            pc.Finish <Packet_Entity_AnimatorParameterChange>(Packet_Entity_AnimatorParameterChange.EndPacket_Entity_AnimatorParameterChange(pc.builder));
            Singleton <MPManager> .Instance.SendReliableToOthers(base.runtimeID, pc);
        }