Пример #1
0
 protected override void OnUpdate()
 {
     Main.isDemo = false;
     RockWeather.TickWeather();
     Persona.Update();
     RandomLevelDownloader.Update();
     if (!NetworkDebugger.enabled)
     {
         FireManager.Update();
     }
     DamageManager.Update();
     if (!Network.isActive)
     {
         NetRand.generator = Rando.generator;
     }
     if (this.joinedLobby || !Program.testServer || (Network.isActive || !Steam.lobbySearchComplete))
     {
         return;
     }
     if (Steam.lobbySearchResult != null)
     {
         Network.JoinServer("", 0, Steam.lobbySearchResult.id.ToString());
         this.joinedLobby = true;
     }
     else
     {
         User who = Steam.friends.Find((Predicate <User>)(x => x.name == "superjoebob"));
         if (who == null)
         {
             return;
         }
         Steam.SearchForLobby(who);
     }
 }
Пример #2
0
 protected override bool OnBurn(Vec2 firePosition, Thing litBy)
 {
     if (!this._onFire && (double)this.data.flammable > 0.5)
     {
         this._fireID = (float)FireManager.GetFireID();
         SFX.Play("ignite", pitch: (Rando.Float(0.3f) - 0.3f));
         this._onFire = true;
         this.alpha   = 1f;
     }
     return(true);
 }
Пример #3
0
        public ExtinguisherSmoke(float xpos, float ypos, bool network = false)
            : base(xpos, ypos)
        {
            this.center               = new Vec2(8f, 8f);
            this.hSpeed               = Rando.Float(-0.2f, 0.2f);
            this.vSpeed               = Rando.Float(-0.2f, 0.2f);
            this._life               += Rando.Float(0.2f);
            this.angleDegrees         = Rando.Float(360f);
            this._gravMult            = 0.8f;
            this._sticky              = 0.2f;
            this._life                = 3f;
            this._bounceEfficiency    = 0.2f;
            this.xscale               = this.yscale = Rando.Float(0.4f, 0.5f);
            this._smokeID             = FireManager.GetFireID();
            this._collisionSize       = new Vec2(4f, 4f);
            this._collisionOffset     = new Vec2(-2f, -2f);
            this.needsSynchronization = true;
            this._sprite              = new SpriteMap("tinySmokeTestFront", 16, 16);
            int num1 = Rando.Int(3) * 4;

            this._sprite.AddAnimation("idle", 0.1f, true, num1);
            this._sprite.AddAnimation("puff", Rando.Float(0.15f, 0.25f), false, num1, 1 + num1, 2 + num1, 3 + num1);
            this._orbiter = new SpriteMap("tinySmokeTestFront", 16, 16);
            int num2 = Rando.Int(3) * 4;

            this._orbiter.AddAnimation("idle", 0.1f, true, num2);
            this._orbiter.AddAnimation("puff", Rando.Float(0.15f, 0.25f), false, num2, 1 + num2, 2 + num2, 3 + num2);
            this._sprite2 = new SpriteMap("tinySmokeTestBack", 16, 16);
            this.graphic  = (Sprite)this._sprite;
            this.center   = new Vec2(8f, 8f);
            if (Network.isActive && !network)
            {
                GhostManager.context.particleManager.AddLocalParticle((PhysicsParticle)this);
            }
            this.isLocal    = !network;
            this._orbitInc += 0.2f;
            this._sprite.SetAnimation("idle");
            this._sprite.angleDegrees  = Rando.Float(360f);
            this._orbiter.angleDegrees = Rando.Float(360f);
            this.s1 = Rando.Float(0.8f, 1.1f);
            this.s2 = Rando.Float(0.8f, 1.1f);
            float num3 = 0.6f - Rando.Float(0.2f);
            float num4 = 1f;

            this._sprite.color = new Color(num4, num4, num4);
            this.depth         = new Depth(0.8f);
            this.alpha         = 1f;
            this.layer         = Layer.Game;
            this.s1            = this.xscale;
            this.s2            = this.xscale;
        }
Пример #4
0
        public override void DoUpdate()
        {
            this.lefpres = Mouse.left == InputState.Pressed;
            List <DCLine> dcLineList = (List <DCLine>)null;

            lock (DevConsole.debuggerLines)
            {
                dcLineList = DevConsole.debuggerLines;
                DevConsole.debuggerLines = new List <DCLine>();
            }
            for (int index1 = 0; index1 < 4; ++index1)
            {
                if (index1 >= NetworkDebugger._instances.Count || !NetworkDebugger._instances[index1].active)
                {
                    if (index1 <= NetworkDebugger._instances.Count)
                    {
                        int          init          = -1;
                        InputProfile inputProfile1 = (InputProfile)null;
                        foreach (InputProfile defaultProfile in InputProfile.defaultProfiles)
                        {
                            if (defaultProfile.Pressed("START"))
                            {
                                foreach (InputProfile inputProfile2 in NetworkDebugger.inputProfiles)
                                {
                                    if (defaultProfile == inputProfile2)
                                    {
                                        break;
                                    }
                                }
                                for (int index2 = 0; index2 < 4; ++index2)
                                {
                                    if (NetworkDebugger.inputProfiles[index2].name == "")
                                    {
                                        bool flag = false;
                                        foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces)
                                        {
                                            if (netDebugInterface.visible)
                                            {
                                                flag = true;
                                                break;
                                            }
                                        }
                                        if (!flag)
                                        {
                                            init          = index1;
                                            inputProfile1 = defaultProfile;
                                        }
                                        NetworkDebugger.inputProfiles[index2] = defaultProfile;
                                        break;
                                    }
                                }
                            }
                        }
                        if (init != -1)
                        {
                            this.CreateInstance(init, false);
                            NetworkDebugger._instances[index1].ipro = inputProfile1;
                        }
                    }
                }
                else
                {
                    NetworkInstance instance = NetworkDebugger._instances[index1];
                    NetworkDebugger._networkDrawingIndex = index1;
                    this.LockInstance(instance);
                    float volume = SFX.volume;
                    if (NetworkDebugger.Mute(NetworkDebugger._networkDrawingIndex))
                    {
                        SFX.volume = 0.0f;
                    }
                    InputProfile.Update();
                    foreach (DCLine dcLine in dcLineList)
                    {
                        if (dcLine.threadIndex == index1)
                        {
                            DevConsole.core.lines.Enqueue(dcLine);
                        }
                    }
                    DevConsole.Update();
                    Network.PreUpdate();
                    FireManager.Update();
                    Level.UpdateLevelChange();
                    Level.UpdateCurrentLevel();
                    MonoMain.UpdatePauseMenu();
                    int index2 = 0;
                    foreach (NetDebugInterface netDebugInterface in NetworkDebugger._interfaces)
                    {
                        MonoMain.instance.IsMouseVisible = true;
                        if (index2 == index1 && index2 < NetworkDebugger._instances.Count)
                        {
                            netDebugInterface.Update(NetworkDebugger._instances[index2].network);
                        }
                        ++index2;
                    }
                    Network.PostUpdate();
                    if (DuckNetwork.status == DuckNetStatus.Disconnected)
                    {
                        NetworkDebugger._instances[index1].active = false;
                        foreach (Profile profile in NetworkDebugger._instances[index1].duckNetworkCore.profiles)
                        {
                            for (int index3 = 0; index3 < 4; ++index3)
                            {
                                if (NetworkDebugger.inputProfiles[index3] == profile.inputProfile || NetworkDebugger.inputProfiles[index3] == NetworkDebugger._instances[index1].ipro)
                                {
                                    NetworkDebugger.inputProfiles[index3] = new InputProfile();
                                }
                            }
                        }
                    }
                    SFX.volume = volume;
                    this.UnlockInstance();
                }
            }
            if (!Keyboard.Pressed(Keys.F11))
            {
                return;
            }
            foreach (NetworkInstance instance in NetworkDebugger._instances)
            {
                instance.network.core.ForcefulTermination();
            }
            Network.activeNetwork.core.ForcefulTermination();
            NetworkDebugger._instances.Clear();
            NetworkDebugger.inputProfiles.Clear();
            Level.current = (Level) new NetworkDebugger();
        }