Пример #1
0
        public static NetPacket Serialize(ParticleOrchestraType particleType, ParticleOrchestraSettings settings)
        {
            NetPacket result = NetModule.CreatePacket <NetParticlesModule>(22);

            result.Writer.Write((byte)particleType);
            settings.Serialize(result.Writer);
            return(result);
        }
Пример #2
0
 public static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int?overrideInvokingPlayerIndex = null)
 {
     settings.IndexOfPlayerWhoInvokedThis = (byte)Main.myPlayer;
     if (overrideInvokingPlayerIndex.HasValue)
     {
         settings.IndexOfPlayerWhoInvokedThis = (byte)overrideInvokingPlayerIndex.Value;
     }
     if (clientOnly)
     {
         SpawnParticlesDirect(type, settings);
     }
     else
     {
         NetManager.Instance.SendToServerOrLoopback(NetParticlesModule.Serialize(type, settings));
     }
 }
Пример #3
0
        public override bool Deserialize(BinaryReader reader, int userId)
        {
            ParticleOrchestraType     particleOrchestraType = (ParticleOrchestraType)reader.ReadByte();
            ParticleOrchestraSettings settings = default(ParticleOrchestraSettings);

            settings.DeserializeFrom(reader);
            if (Main.netMode == 2)
            {
                NetManager.Instance.Broadcast(Serialize(particleOrchestraType, settings), userId);
            }
            else
            {
                ParticleOrchestrator.SpawnParticlesDirect(particleOrchestraType, settings);
            }
            return(true);
        }
Пример #4
0
        public static void SpawnParticlesDirect(
            ParticleOrchestraType type,
            ParticleOrchestraSettings settings)
        {
            if (Main.netMode == 2)
            {
                return;
            }
            switch (type)
            {
            case ParticleOrchestraType.Keybrand:
                ParticleOrchestrator.Spawn_Keybrand(settings);
                break;

            case ParticleOrchestraType.FlameWaders:
                ParticleOrchestrator.Spawn_FlameWaders(settings);
                break;

            case ParticleOrchestraType.StellarTune:
                ParticleOrchestrator.Spawn_StellarTune(settings);
                break;

            case ParticleOrchestraType.WallOfFleshGoatMountFlames:
                ParticleOrchestrator.Spawn_WallOfFleshGoatMountFlames(settings);
                break;

            case ParticleOrchestraType.BlackLightningHit:
                ParticleOrchestrator.Spawn_BlackLightningHit(settings);
                break;

            case ParticleOrchestraType.RainbowRodHit:
                ParticleOrchestrator.Spawn_RainbowRodHit(settings);
                break;

            case ParticleOrchestraType.BlackLightningSmall:
                ParticleOrchestrator.Spawn_BlackLightningSmall(settings);
                break;

            case ParticleOrchestraType.StardustPunch:
                ParticleOrchestrator.Spawn_StardustPunch(settings);
                break;
            }
        }