Exemplo n.º 1
0
 private void MoveToActiveState()
 {
     this.state                          = SequencerExe.SequencerExeState.Active;
     this.stateTimer                     = 0.0f;
     this.targetRamUse                   = SequencerExe.BASE_RAM_COST;
     this.os.warningFlashTimer           = OS.WARNING_FLASH_TIME;
     this.os.netMap.DimNonConnectedNodes = true;
     this.os.netMap.discoverNode(this.targetComp);
     this.os.runCommand("connect " + this.targetComp.ip);
     this.os.delayer.Post(ActionDelayer.Wait(0.05), (Action)(() => this.os.runCommand("probe")));
 }
Exemplo n.º 2
0
        public override void Update(float t)
        {
            base.Update(t);
            if (this.HasBeenKilled)
            {
                return;
            }
            this.bars.Update(t);
            this.UpdateRamCost(t);
            this.stateTimer += t;
            switch (this.state)
            {
            case SequencerExe.SequencerExeState.Unavaliable:
                if (this.os.Flags.HasFlag(this.flagForProgressionName) || Settings.debugCommandsEnabled)
                {
                    this.state = SequencerExe.SequencerExeState.AwaitingActivation;
                    break;
                }
                this.bars.MinLineChangeTime = 1f;
                this.bars.MaxLineChangeTime = 3f;
                break;

            case SequencerExe.SequencerExeState.SpinningUp:
                if (MediaPlayer.State == MediaState.Playing)
                {
                    if (MediaPlayer.PlayPosition.TotalSeconds < this.beatDropTime || (double)this.stateTimer <= 10.0)
                    {
                        break;
                    }
                    this.MoveToActiveState();
                    break;
                }
                if ((double)this.stateTimer > (double)SequencerExe.SPIN_UP_TIME)
                {
                    this.MoveToActiveState();
                }
                break;

            case SequencerExe.SequencerExeState.Active:
                float num = 2.5f;
                if ((double)this.stateTimer < (double)num)
                {
                    if ((double)Utils.randm(1f) < 0.300000011920929 + (double)this.stateTimer / (double)num * 0.699999988079071)
                    {
                        ThemeManager.switchThemeColors(this.os, this.targetTheme);
                        ThemeManager.loadThemeBackground(this.os, this.targetTheme);
                        ThemeManager.currentTheme = this.targetTheme;
                    }
                    else
                    {
                        ThemeManager.switchThemeColors(this.os, this.originalTheme);
                        ThemeManager.loadThemeBackground(this.os, this.originalTheme);
                        ThemeManager.currentTheme = this.originalTheme;
                    }
                    if ((MediaPlayer.PlayPosition.TotalSeconds - this.beatDropTime) % (double)this.beatHits < 0.00999999977648258)
                    {
                        this.os.warningFlash();
                    }
                }
                this.ActiveStateUpdate(t);
                break;
            }
        }
Exemplo n.º 3
0
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            Rectangle rectangle = Utils.InsetRectangle(this.GetContentAreaDest(), 1);
            float     amount    = this.os.warningFlashTimer / OS.WARNING_FLASH_TIME;
            float     minHeight = 2f;

            if ((double)amount > 0.0)
            {
                minHeight += amount * ((float)rectangle.Height - minHeight);
            }
            Color drawColor = Color.Lerp(Utils.AddativeWhite * 0.5f, Utils.AddativeRed, amount);

            this.bars.Draw(this.spriteBatch, this.GetContentAreaDest(), minHeight, 4f, 1f, drawColor);
            switch (this.state)
            {
            case SequencerExe.SequencerExeState.Unavaliable:
                this.spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.5f);
                Rectangle dest = Utils.InsetRectangle(rectangle, 6);
                if (!this.isExiting)
                {
                    TextItem.doFontLabelToSize(dest, "LINK UNAVAILABLE", GuiData.titlefont, Utils.AddativeWhite, false, false);
                }
                Rectangle destinationRectangle1 = dest;
                destinationRectangle1.Y     += destinationRectangle1.Height - 20;
                destinationRectangle1.Height = 20;
                if (this.isExiting)
                {
                    break;
                }
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black * 0.5f);
                if (Button.doButton(32711803, destinationRectangle1.X, destinationRectangle1.Y, destinationRectangle1.Width, destinationRectangle1.Height, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
                {
                    this.isExiting = true;
                }
                break;

            case SequencerExe.SequencerExeState.AwaitingActivation:
                int       height = 30;
                Rectangle destinationRectangle2 = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - height, this.bounds.Width - 2, height * 2);
                this.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Black * 0.92f);
                if (!Button.doButton(8310101, this.bounds.X + 10, this.bounds.Y + this.bounds.Height / 2 - height / 2, this.bounds.Width - 20, height, LocaleTerms.Loc("ACTIVATE"), new Color?(this.os.highlightColor)))
                {
                    break;
                }
                if (this.os.TraceDangerSequence.IsActive)
                {
                    this.os.write("SEQUENCER ERROR: OS reports critical action already in progress.");
                }
                else
                {
                    this.stateTimer             = 0.0f;
                    this.state                  = SequencerExe.SequencerExeState.SpinningUp;
                    this.bars.MinLineChangeTime = 0.1f;
                    this.bars.MaxLineChangeTime = 1f;
                    this.originalTheme          = ThemeManager.currentTheme;
                    MusicManager.FADE_TIME      = 0.6f;
                    this.oldSongName            = MusicManager.currentSongName;
                    MusicManager.transitionToSong("Music\\Roller_Mobster_Clipped");
                    MediaPlayer.IsRepeating = false;
                    this.targetComp         = Programs.getComputer(this.os, this.targetID);
                    WebServerDaemon daemon = (WebServerDaemon)this.targetComp.getDaemon(typeof(WebServerDaemon));
                    if (daemon != null)
                    {
                        daemon.LoadWebPage("index.html");
                    }
                }
                break;

            case SequencerExe.SequencerExeState.SpinningUp:
                Rectangle bounds = rectangle;
                bounds.Height = (int)((double)bounds.Height * ((double)this.stateTimer / (double)SequencerExe.SPIN_UP_TIME));
                bounds.Y      = rectangle.Y + rectangle.Height - bounds.Height + 1;
                bounds.Width += 4;
                this.bars.Draw(this.spriteBatch, bounds, minHeight, 4f, 1f, this.os.brightLockedColor);
                break;

            case SequencerExe.SequencerExeState.Active:
                this.spriteBatch.Draw(Utils.white, this.GetContentAreaDest(), Color.Black * 0.5f);
                TextItem.doFontLabelToSize(this.GetContentAreaDest(), " G O   G O   G O ", GuiData.titlefont, Color.Lerp(Utils.AddativeRed, this.os.brightLockedColor, Math.Min(1f, this.stateTimer / 2f)), false, false);
                this.DrawActiveState();
                break;
            }
        }