예제 #1
0
 /// <summary>
 /// Method called by the Save Game button, saves the information about the current Level so
 /// it can be loaded later to bring the user back to the same point in the game
 /// </summary>
 public void SaveGame()
 {
     //if the current Level does not exist then an error message is displayed
     if (Level.current == null)
     {
         DialogBox.Create("CurrentLevel is null when trying to save", "Error");
     }
     //if there is an error with the replay file name then throw an exception
     else if (saveNameInputField == null || saveNameInputField.text == null)
     {
         throw new Exception("Problem with SaveName InputField");
     }
     //if user does not enter name in input field then desplay a message to him
     else if (saveNameInputField.text == "")
     {
         DialogBox.Create("You must enter a name to create a save game", "Error");
     }
     //create a save
     else
     {
         if (Level.current.Save(saveNameInputField.text))
         {
             DialogBox.Create("Save game created successfully!", "Success");
         }
         else
         {
             DialogBox.Create("There was an error creating the save game...", "Error");
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Method called by the Save Replay button, saves a replay of the current Level
 /// to a file of the replayName.
 /// </summary>
 public void SaveReplay()
 {
     //if the current Level does not exist then an error message is displayed
     if (Level.current == null)
     {
         DialogBox.Create("CurrentLevel is null when trying to saveReplay", "Error");
     }
     //if there is an error with the replay file name then throw an exception
     else if (replayName == null || replayName.text == null)
     {
         throw new Exception("Problem with replayName InputField");
     }
     //if user does not enter name in input field then desplay a message to him
     else if (replayName.text == "")
     {
         DialogBox.Create("You need to enter a name before saving the replay", "Error");
     }
     //else create save the replay
     else
     {
         if (Level.current.SaveReplay(replayName.text))
         {
             DialogBox.Create("Replay has been saved successfully!", "Success");
         }
         else
         {
             DialogBox.Create("There was a problem saving the replay!", "Error");
         }
     }
 }
예제 #3
0
    private bool ReplaceAllDownloadFile()
    {
        for (int i = 0; i < m_DownloadList.Count; i++)
        {
            string sourceFile = LocalPath.LocalPackagingResources + GetDownloadName(m_DownloadList[i]);

            if (!C_ZipUtility.UnzipFile(sourceFile, LocalPath.LocalPackagingResources))
            {
                C_MonoSingleton <C_UIMgr> .GetInstance().CloseUI("UI_StageDownload");

                C_MonoSingleton <GameStageHotUpdateMgr> .GetInstance().CloseDownload();

                DialogBox.Create("LOACAL_MAIN_DOWNLOAD_STAGE_NO_MEMORY_UNZIP_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_NO_MEMORY_UNZIP");

                return(false);
            }
        }

        for (int i = 0; i < m_DownloadList.Count; i++)
        {
            string sourceFile = LocalPath.LocalPackagingResources + GetDownloadName(m_DownloadList[i]);
            if (File.Exists(sourceFile))
            {
                File.Delete(sourceFile);
            }
        }

        m_DownloadList.Clear();

        return(true);
    }
예제 #4
0
    public void Delete()
    {
        //find the selected replay and try to delete it
        foreach (ReplayItem item in replays)
        {
            if (item.toggle.isOn)
            {
                //if delete was successful, refresh the replays
                if (item.DeleteReplay())
                {
                    Refresh();
                }
                //if it wasn't successful, show an error
                else
                {
                    ShowErrorMenu("Problem deleting replay!");
                }
                return;
            }
        }

        //if no replay was selected, show an error
        //ShowErrorMenu("No replay selected.");
        DialogBox.Create("Test message", "Test Title", delegate { Back(); });
    }
예제 #5
0
        public override void SetupLevel()
        {
            Program.Level = 1;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Stack <Action> deck = new Stack <Action>();

            deck.Push(() =>
            {
                Program.Referee.AddRule(Rule.Rules["Goal victory"]);
                Program.Engine.AddEntity(DialogBox.Create("Oh, look! I can win by touching the goal."));
            });
            deck.Push(() =>
            {
                Program.Referee.AddRule(Rule.Rules["control Player"]);
                Program.Engine.AddEntity(DialogBox.Create("Aha! I can move now! But what to do?"));
            });
            deck.Push(() => Program.Engine.AddEntity(DialogBox.Create("What is this? I can't move...")));
            deck.Push(() => Program.Referee.AddRule(Rule.Rules["top-down"]));


            SinWaveSound sound = new SinWaveSound(true,
                                                  100, 44100 / Program.TPS * 10,
                                                  0, 44100 / Program.TPS * 90);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 2.5) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.ClearRules();

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #6
0
 /// <summary>
 /// Method called by the Restart button on the gameover menu to set level to its beginning
 /// </summary>
 public void Restart()
 {
     //if there is not a current Level, display error message
     if (Level.current == null)
     {
         DialogBox.Create("Can't restart level, current level is set to null", "Error");
     }
     else
     {
         Level.current.RestartLevel();
         GameStates.gameState = GameStates.GameState.Playing;
     }
 }
예제 #7
0
 /// <summary>
 /// Method called by the Restart button on the gameover menu to set level to its beginning
 /// </summary>
 public void Restart()
 {
     //if there is not a current Level, display error message
     if (Level.current == null)
     {
         DialogBox.Create("Current Level is null, can't restart", "Error");
     }
     else
     {
         Level.current.RestartLevel();
         Unpause();
     }
 }
예제 #8
0
    /// <summary>
    /// Method called by the Continue button, creates the next Level and sets the screen to Playing
    /// </summary>
    public void Contiue()
    {
        //if the current Level does not exist then an error message is displayed
        if (Level.current == null)
        {
            DialogBox.Create("CurrentLevel is null when trying to go to next Level", "Error");
        }
        //if there is a problem loading the next Level, display an error
        if (Level.current.NextLevel() == null)
        {
            DialogBox.Create("Problem loading next Level", "Error");
        }

        GameStates.gameState = GameStates.GameState.Playing;
    }
예제 #9
0
        public bool CreateDirectory()
        {
            var parentLayer = new FormContainerElement();

            var directoryInput = new TextInputElement();

            directoryInput.Label = "Имя папки: ";
            directoryInput.Text  = "Новая папка";

            parentLayer.ChildElements.Add(directoryInput);

            var dialog = DialogBox.Create("Ввод имени папки:", parentLayer, ButtonDef.OkCancelButtons);

            dialog.AutoSize = false;
            dialog.Width    = 360;

            if (dialog.ShowDialog() == ButtonDef.OkButton)
            {
                return(fileListView1.CreateDirectory(directoryInput.Text));
            }

            return(false);
        }
예제 #10
0
    public void DownloadStageHotUpdate(string stageName, Action action)
    {
        if (GameDataMgr.c_FreeSpace < 600)
        {
            DialogBox.Create("LOACAL_MAIN_DOWNLOAD_STAGE_NO_MEMORY_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_NO_MEMORY");
            return;
        }

        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            DialogBox.Create("LOACAL_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_NO_NETWORK");
        }
        else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
        {
            DialogBox.Create("LOACAL_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_DATA_NETWORK", null, () =>
            {
                m_bReachableViaCarrierDataNetworkEnabled = true;

                ExecuteDownloadStageHotUpdate(stageName);

                if (action != null)
                {
                    action();
                }
            }, "LOACAL_DOWNLOAD_CANCLE", "LOACAL_DOWNLOAD_CONFIRM");
        }
        else
        {
            ExecuteDownloadStageHotUpdate(stageName);

            if (action != null)
            {
                action();
            }
        }
    }
예제 #11
0
        public override void SetupLevel()
        {
            Program.Level = 6;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            bool           dialogShown = false;
            Stack <Action> deck        = new Stack <Action>();

            deck.Push(() =>
            {
                Program.Engine.AddEntity(Powerup.Create("pop DEATH", 24, Program.ScreenHeight / 2 - 48));
                Entity ent     = Powerup.Create("Enemy hurty", 24, Program.ScreenHeight / 2 - 16);
                ent.TickAction = (loc, e) =>
                {
                    if (!dialogShown && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                    {
                        Program.Engine.AddEntity(DialogBox.Create("I'm lucky those were there."));
                        dialogShown = true;
                    }
                };
                Program.Engine.AddEntity(ent);
            });
            deck.Push(() => Program.Engine.AddEntity(Powerup.Create("shoot Enemy", Program.ScreenWidth / 2, Program.ScreenHeight / 2 + 16)));
            deck.Push(() => { });

            Program.Referee.ClearRules();

            Program.Referee.AddRule(Rule.Rules["Goal victory"]);
            Program.Referee.AddRule(Rule.Rules["Enemy hurty"]);
            Program.Referee.AddRule(Rule.Rules["Powerup hurty"]);
            Program.Referee.AddRule(Rule.Rules["Player pickup Powerup"]);
            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["vvvvvv-platformer"]);

            SinWaveSound sound = new SinWaveSound(true,
                                                  80, 44100 / Program.TPS * 10, 0, 44100 / Program.TPS * 30,
                                                  80, 44100 / Program.TPS * 5, 0, 44100 / Program.TPS * 5, 120, 44100 / Program.TPS * 10, 0, 44100 / Program.TPS * 60,
                                                  80, 44100 / Program.TPS * 10, 0, 44100 / Program.TPS * 30,
                                                  120, 44100 / Program.TPS * 5, 0, 44100 / Program.TPS * 5, 150, 44100 / Program.TPS * 10, 0, 44100 / Program.TPS * 60);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 5) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            ControlSchemas.Reset();

            Program.Engine.AddEntity(DialogBox.Create("This feels very different. And powerups\nhurt me? How am I supposed to progress?"));

            //top
            Program.Engine.AddEntity(Wall.Create(0, 0, 64, 16));
            Program.Engine.AddEntity(Enemy.Create(64, 0));
            Program.Engine.AddEntity(Enemy.Create(80, 0));
            Program.Engine.AddEntity(Wall.Create(96, 0, 64, 16));
            Program.Engine.AddEntity(Enemy.Create(160, 0));
            Program.Engine.AddEntity(Enemy.Create(176, 0));
            Program.Engine.AddEntity(Enemy.Create(192, 0));
            Program.Engine.AddEntity(Wall.Create(208, 0, 128, 16));

            //bottom
            Program.Engine.AddEntity(Wall.Create(0, Program.ScreenHeight, 64, 16));
            Program.Engine.AddEntity(Enemy.Create(64, Program.ScreenHeight));
            Program.Engine.AddEntity(Enemy.Create(80, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(96, Program.ScreenHeight, 64, 16));
            Program.Engine.AddEntity(Enemy.Create(160, Program.ScreenHeight));
            Program.Engine.AddEntity(Enemy.Create(176, Program.ScreenHeight));
            Program.Engine.AddEntity(Enemy.Create(192, Program.ScreenHeight));
            Program.Engine.AddEntity(Enemy.Create(208, Program.ScreenHeight));

            //walls and enemies
            Program.Engine.AddEntity(Wall.Create(Program.ScreenWidth, 0, 16, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(0, 0, 16, Program.ScreenHeight));

            Program.Engine.AddEntity(Powerup.Create("pop SPEED", Program.ScreenWidth - 96, 16));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", Program.ScreenWidth - 96, 32));
            Program.Engine.AddEntity(Wall.Create(Program.ScreenWidth - 96, 48, 16, Program.ScreenHeight - 32));

            for (int i = 16; i < Program.ScreenHeight; i += 16)
            {
                Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 80, i));
            }

            // box and player
            Program.Engine.AddEntity(Enemy.Create(16, Program.ScreenHeight / 2 - 32));
            Program.Engine.AddEntity(Enemy.Create(32, Program.ScreenHeight / 2 - 32));
            Program.Engine.AddEntity(Wall.Create(48, Program.ScreenHeight / 2 - 32, 64, 16));
            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));
            Program.Engine.AddEntity(Wall.Create(48, Program.ScreenHeight / 2 + 32, 64, 16));
            Program.Engine.AddEntity(Wall.Create(112, Program.ScreenHeight / 2 - 32, 16, 80));


            //horizontal split

            Entity trigger   = Powerup.Create("Enemy hurty", 160, Program.ScreenHeight / 2 - 16);
            Guid   triggerId = trigger.Id;

            trigger.AddTickAction((loc, ent) =>
            {
                if (loc.GetEntities <Player>().First().Distance((Description2D)ent.Description) < 20)
                {
                    Program.Engine.AddEntity(DialogBox.Create("WHAT?! I thought they were supposed\nto hurt? Better keep an eye on things."));
                    Program.Referee.AddRule("pop DEATH");
                    loc.RemoveEntity(triggerId);
                }
            });

            Program.Engine.AddEntity(trigger);

            Program.Engine.AddEntity(Wall.Create(112, Program.ScreenHeight / 2, 112, 16));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 128, Program.ScreenHeight / 2 + 32));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 144, Program.ScreenHeight / 2 + 32));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 160, Program.ScreenHeight / 2 + 32));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 176, Program.ScreenHeight / 2 + 32));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 192, Program.ScreenHeight / 2 + 32));
            Program.Engine.AddEntity(Powerup.Create("pop SPEED", 208, Program.ScreenHeight / 2 + 32));


            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #12
0
        public override void SetupLevel()
        {
            bool   wobbleDialog = false;
            Entity movingEnemy  = null;

            Program.Level = 5;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Stack <Action> deck = new Stack <Action>();

            Action spawnPowerups = () =>
            {
                Program.Engine.AddEntity(Powerup.Create("platformer", 224 - 8, Program.ScreenHeight / 2 + 80));
                Program.Engine.AddEntity(Powerup.Create("top-down", 256 - 8, Program.ScreenHeight / 2 + 80));
                Program.Engine.AddEntity(Powerup.Create("platformer", 288 - 8, Program.ScreenHeight / 2 + 80));
                Entity ent = Powerup.Create("top-down", 314 - 8, Program.ScreenHeight / 2 + 80);
                ent.TickAction = (loc, e) =>
                {
                    if (!wobbleDialog && ((Description2D)movingEnemy.Description).Distance((Description2D)e.Description) < 12)
                    {
                        Program.Engine.AddEntity(DialogBox.Create("It'll be hard to keep my orientation.\nBetter keep an eye on it."));
                        wobbleDialog = true;
                    }
                };
                Program.Engine.AddEntity(ent);
            };

            deck.Push(spawnPowerups);
            deck.Push(spawnPowerups);
            deck.Push(spawnPowerups);
            deck.Push(spawnPowerups);
            deck.Push(spawnPowerups);
            deck.Push(spawnPowerups);

            Program.Referee.ClearRules();

            Program.Referee.AddRule(Rule.Rules["Goal victory"]);
            Program.Referee.AddRule(Rule.Rules["Enemy hurty"]);
            Program.Referee.AddRule(Rule.Rules["Any pickup Powerup"]);
            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["platformer"]);

            Program.Engine.AddEntity(DialogBox.Create("Something seems different."));

            SinWaveSound sound = new SinWaveSound(true,
                                                  80, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5, 100, 44100 / Program.TPS * 5, 70, 44100 / Program.TPS * 5,
                                                  150, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5, 120, 44100 / Program.TPS * 5,
                                                  100, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5, 80, 44100 / Program.TPS * 5, 100, 44100 / Program.TPS * 5, 60, 44100 / Program.TPS * 5,
                                                  120, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5, 90, 44100 / Program.TPS * 5, 150, 44100 / Program.TPS * 5);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 3.3) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(Program.ScreenWidth / 2 - 32, Program.ScreenHeight - 24));

            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64 - 16, Program.ScreenHeight / 2));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2 - 16));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64 + 16, Program.ScreenHeight / 2));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2 + 16));

            //border
            Program.Engine.AddEntity(Wall.Create(0, 0, 16, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(Program.ScreenWidth, 0, 16, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(0, 0, Program.ScreenWidth, 16));
            Program.Engine.AddEntity(Wall.Create(0, Program.ScreenHeight, Program.ScreenWidth + 16, 16));

            //others
            Program.Engine.AddEntity(Wall.Create(0, Program.ScreenHeight / 2 + 32, 80, 16));

            Program.Engine.AddEntity(Wall.Create(80, Program.ScreenHeight / 2 + 80, 112, 16));

            Program.Engine.AddEntity(Wall.Create(112, Program.ScreenHeight / 2 + 32, 64, 16));
            Program.Engine.AddEntity(Wall.Create(176, Program.ScreenHeight / 2 - 80, 16, 208));

            Entity ent         = Powerup.Create("clicky attack", 32, 32);
            bool   dialogShown = false;

            ent.TickAction = (loc, e) =>
            {
                if (!dialogShown && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                {
                    Program.Engine.AddEntity(DialogBox.Create("I bet I can use this to clear a path."));
                    dialogShown = true;
                }
            };
            Program.Engine.AddEntity(ent);

            Program.Engine.AddEntity(Powerup.Create("Enemy pickup Powerup", 176, 24));

            movingEnemy = Enemy.Create(224, Program.ScreenHeight / 2 + 80);
            double deltaX = 0.5f;

            movingEnemy.TickAction += (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any())
                {
                    return;
                }

                Description2D d2d = movingEnemy.Description as Description2D;
                if (d2d.X == Program.ScreenWidth - 16 || d2d.X == 208)
                {
                    deltaX = -deltaX;
                }

                d2d.ChangeCoordsDelta(deltaX, 0);
            };

            Program.Engine.AddEntity(movingEnemy);

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #13
0
        public override void SetupLevel()
        {
            Program.Level = 7;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Program.Referee.ClearRules();

            Entity entb = Boss.Create(Program.ScreenHeight - 16, Program.ScreenHeight / 2);

            Program.Engine.AddEntity(entb);

            Stack <Action> deck = new Stack <Action>();

            if (Boss.savedHealth == 100 || Program.Diff != Program.Difficulty.EASY)
            {
                deck.Push(() =>
                {
                    Program.Engine.AddEntity(Powerup.Create("shoot Boss", Program.ScreenWidth - 128, Program.ScreenHeight / 2));
                    Program.Engine.AddEntity(DialogBox.Create("I just need to get close enough..."));
                });
                deck.Push(() => Program.Engine.AddEntity(DialogBox.Create("This isn't good. I have to do something.")));
                deck.Push(() => { });
            }
            else
            {
                Program.Referee.AddRule(Rule.Rules["shoot Boss"]);
            }

            Program.Referee.AddRule(Rule.Rules["Enemy hurty"]);
            Program.Referee.AddRule(Rule.Rules["Player pickup Powerup"]);
            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["top-down"]);

            SinWaveSound sound = new SinWaveSound(true);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 10) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            string machineName = Environment.MachineName;

            if (!introDialogShown)
            {
                Program.Engine.AddEntity(
                    DialogBox.Create("[???]: What where did you come from?",
                                     DialogBox.Create("Who are you?",
                                                      DialogBox.Create($"[???] I am {machineName}.",
                                                                       DialogBox.Create("That couldn't be true.",
                                                                                        DialogBox.Create($"[{machineName}] It is. And you're not\nsupposed to be here. It's time\nto delete you."))))));
                introDialogShown = true;
            }
            else
            {
                Program.Engine.AddEntity(DialogBox.Create($"[{machineName}] It's time to delete you."));
            }

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Wall.Create(0, 0, 16, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(Program.ScreenWidth, 0, 16, Program.ScreenHeight));
            Program.Engine.AddEntity(Wall.Create(0, 0, Program.ScreenWidth, 16));
            Program.Engine.AddEntity(Wall.Create(0, Program.ScreenHeight, Program.ScreenWidth + 16, 16));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.ResetTimer(Program.TPS * 180);

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #14
0
        public override void SetupLevel()
        {
            Program.Level = 3;
            int delay = Program.TPS * 1;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            bool           dialogShown = false;
            Stack <Action> deck        = new Stack <Action>();

            deck.Push(() =>
            {
                Program.Referee.AddRule(Rule.Rules["Player pickup Powerup"]);
                Program.Engine.AddEntity(DialogBox.Create("I bet I can collect it now."));
                dialogShown = false;
            });

            deck.Push(() =>
            {
                Entity ent     = Powerup.Create("pop DEATH", Program.ScreenWidth - 32, Program.ScreenHeight / 2);
                delay          = Program.TPS * 5;
                ent.TickAction = (loc, e) =>
                {
                    if (!dialogShown && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                    {
                        if (!Program.Referee.Piles[Rule.RuleType.POWERUP].Any())
                        {
                            Program.Engine.AddEntity(DialogBox.Create("I guess nothing happens?"));
                        }
                        else
                        {
                            Program.Engine.AddEntity(DialogBox.Create("Time to reach the goal."));
                        }
                        dialogShown = true;
                    }
                };
                Program.Engine.AddEntity(ent);
                Program.Engine.AddEntity(DialogBox.Create("What's that? Better go check it out."));
            });
            deck.Push(() => Program.Referee.AddRule(Rule.Rules["Goal hurty"]));
            deck.Push(() => Program.Referee.AddRule(Rule.Rules["Goal victory"]));
            deck.Push(() =>
            {
                Program.Engine.AddEntity(DialogBox.Create("I better watch out for any tricks."));
            });

            Program.Referee.ClearRules();

            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["top-down"]);

            SinWaveSound sound = new SinWaveSound(true,
                                                  100, 44100 / Program.TPS * 20, 150, 44100 / Program.TPS * 15, 200, 44100 / Program.TPS * 10, 300, 44100 / Program.TPS * 5, 0, 44100 / Program.TPS * 5,
                                                  120, 44100 / Program.TPS * 5, 150, 44100 / Program.TPS * 2, 200, 44100 / Program.TPS * 2, 0, 44100 / Program.TPS * 10, 100, 44100 / Program.TPS * 30, 80, 44100 / Program.TPS * 30, 60, 44100 / Program.TPS * 30
                                                  );

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % delay == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #15
0
파일: ServerHelper.cs 프로젝트: jonntd/Xbl
 public static void ErrorCodeDialogBox(int errorCode)
 {
     DialogBox.Create("LOACAL_HINT", "LOACAL_ERROR_" + errorCode);
 }
예제 #16
0
    private void CheckDownload()
    {
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            c_State = 0;

            C_Singleton <C_TimerMgr> .GetInstance().PauseTimer(m_nCheckDownloadTimer);

            if (m_StageDownloadList.Count > 0)
            {
                m_StageDownloadList[0].StopDownload();
            }

            DialogBox.Create("LOACAL_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_NO_NETWORK", () =>
            {
                C_Singleton <C_TimerMgr> .GetInstance().ResumeTimer(m_nCheckDownloadTimer);
            });

            return;
        }

        c_State = 1;

        if (!m_bReachableViaCarrierDataNetworkEnabled && Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
        {
            C_Singleton <C_TimerMgr> .GetInstance().PauseTimer(m_nCheckDownloadTimer);

            if (m_StageDownloadList.Count > 0)
            {
                m_StageDownloadList[0].StopDownload();
            }

            DialogBox.Create("LOACAL_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_DATA_NETWORK", () =>
            {
                C_Singleton <C_TimerMgr> .GetInstance().RemoveTimer(m_nCheckDownloadTimer);
                m_nCheckDownloadTimer = 0;

                C_MonoSingleton <C_UIMgr> .GetInstance().CloseUI("UI_StageDownload");

                //C_Singleton<StageMgr>.GetInstance().RefreshUITag(m_StageDownloadList[0].StageName);
            }, () =>
            {
                if (m_StageDownloadList.Count > 0)
                {
                    m_StageDownloadList[0].StartDownload();
                }

                m_bReachableViaCarrierDataNetworkEnabled = true;

                C_Singleton <C_TimerMgr> .GetInstance().ResumeTimer(m_nCheckDownloadTimer);
            }, "LOACAL_DOWNLOAD_CANCLE", "LOACAL_DOWNLOAD_CONFIRM");

            return;
        }

        if (c_FillAmount < m_fMark)
        {
            if (c_FillAmount == m_fFillAmountMark)
            {
                m_nCountMark++;
            }
            else
            {
                m_fFillAmountMark = c_FillAmount;
                m_nCountMark      = 0;
            }

            if (m_nCountMark == 3)
            {
                DialogBox.Create("LOACAL_MAIN_DOWNLOAD_STAGE_BAD_NETWORK_HINT", "LOACAL_MAIN_DOWNLOAD_STAGE_BAD_NETWORK");

                if (m_StageDownloadList.Count > 0)
                {
                    m_StageDownloadList[0].StopDownload();
                }

                m_nCountMark = 0;

                return;
            }
        }

        if (m_StageDownloadList.Count > 0)
        {
            m_StageDownloadList[0].StartDownload();
        }
    }
예제 #17
0
        public override void SetupLevel()
        {
            Program.Level = 2;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Action good = () =>
            {
                Program.Referee.AddRule(Rule.Rules["Goal victory"]);
                Program.Referee.Piles[Rule.RuleType.DEATH].Pop();
            };

            Action bad = () =>
            {
                Program.Referee.Piles[Rule.RuleType.VICTORY].Pop();
                Program.Referee.AddRule("Goal hurty");
            };

            Stack <Action> deck = new Stack <Action>();

            for (int i = 0; i < 3; i++)
            {
                deck.Push(bad);
                deck.Push(good);
            }

            deck.Push(bad);
            deck.Push(() =>
            {
                good();
                Program.Engine.Location.AddEntity(DialogBox.Create("And now it's back! Better time this right."));
            });
            deck.Push(() =>
            {
                bad();
                Program.Engine.Location.AddEntity(DialogBox.Create("Wait... the victory condition is removed?\nAnd the goal will hurt me?!"));
            });
            deck.Push(() => Program.Engine.Location.AddEntity(DialogBox.Create("Let's make it to the goal again.")));

            Program.Referee.ClearRules();

            Program.Referee.AddRule(Rule.Rules["Goal victory"]);
            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["top-down"]);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            SinWaveSound sound = new SinWaveSound(true,
                                                  100, 44100 / Program.TPS * 20, 250, 44100 / Program.TPS * 15, 200f, 44100 / Program.TPS * 10, 0, 44100 / Program.TPS * 15,
                                                  100, 44100 / Program.TPS * 20, 150, 44100 / Program.TPS * 15, 200f, 44100 / Program.TPS * 10, 300f, 44100 / Program.TPS * 5, 0, 44100 / Program.TPS * 20
                                                  );

            sound.SetWaveFormat(44100, 2);

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    sound.Quiet = true;
                    return;
                }

                sound.Quiet = false;

                if (deck.Any() && timer++ % (Program.TPS * 1) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }
예제 #18
0
        public override void SetupLevel()
        {
            Program.Level = 4;

            Program.Engine.SetLocation(new Location(new Description2D(0, 0, Program.ScreenWidth, Program.ScreenHeight)));

            Stack <Action> deck = new Stack <Action>();

            deck.Push(() =>
            {
                bool dialogShown = false;
                Entity ent       = Powerup.Create("pop DEATH", 32, Program.ScreenHeight / 2);
                ent.TickAction   = (loc, e) =>
                {
                    if (!dialogShown && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                    {
                        Program.Engine.AddEntity(DialogBox.Create("Now I can sneak by them!"));
                        dialogShown = true;
                    }
                };
                Program.Engine.AddEntity(ent);
            });

            deck.Push(() =>
            {
                bool dialogShown = false;
                Entity ent       = Powerup.Create("pop CONTROL", Program.ScreenWidth - 32, Program.ScreenHeight / 2);
                ent.TickAction   = (loc, e) =>
                {
                    if (!dialogShown && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                    {
                        Program.Engine.AddEntity(DialogBox.Create("Oh no, I can't move. Better restart.\n(Press R)"));
                        dialogShown = true;
                    }
                };
                Program.Engine.AddEntity(ent);
            });
            deck.Push(() => Program.Engine.AddEntity(Powerup.Create("pop VICTORY", Program.ScreenWidth / 2, Program.ScreenHeight / 2)));

            Program.Referee.ClearRules();

            Program.Referee.AddRule(Rule.Rules["Goal victory"]);
            Program.Referee.AddRule(Rule.Rules["Enemy hurty"]);
            Program.Referee.AddRule(Rule.Rules["Player pickup Powerup"]);
            Program.Referee.AddRule(Rule.Rules["control Player"]);
            Program.Referee.AddRule(Rule.Rules["top-down"]);

            SinWaveSound sound = new SinWaveSound(true,
                                                  80, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5,
                                                  150, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5,
                                                  100, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5,
                                                  120, 44100 / Program.TPS * 30, 0, 44100 / Program.TPS * 5);

            sound.SetWaveFormat(44100, 2);

            Entity deckFlipper = new Entity(new Description2D(0, 0, 0, 0));
            int    timer       = 0;

            deckFlipper.TickAction = (loc, ent) =>
            {
                if (Program.Engine.Location.GetEntities <DialogBox>().Any() || Program.Engine.Location.GetEntities <Banner>().Any())
                {
                    return;
                }

                if (Program.Referee.IsStarted && deck.Any() && timer++ % (Program.TPS * 5) == 0)
                {
                    deck.Pop().Invoke();
                }
            };

            Program.Engine.AddEntity(DialogBox.Create("What are those? They don't look\ntoo friendly."));

            Program.Engine.AddEntity(deckFlipper);

            Program.Engine.AddEntity(Player.Create(64, Program.ScreenHeight / 2));

            bool   dialogShown = false;
            Entity entity      = Goal.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2);

            entity.TickAction = (loc, e) =>
            {
                if (!dialogShown && !Program.Referee.Piles[Rule.RuleType.VICTORY].Any() && loc.GetEntities <Player>().First().Distance((Description2D)e.Description) < 12)
                {
                    Program.Engine.AddEntity(DialogBox.Create("Hmm? Didn't I start with a victory\ncondition? Better try this again.\n(Press R)"));
                    dialogShown = true;
                }
            };
            Program.Engine.AddEntity(entity);

            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64 - 16, Program.ScreenHeight / 2));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2 - 16));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64 + 16, Program.ScreenHeight / 2));
            Program.Engine.AddEntity(Enemy.Create(Program.ScreenWidth - 64, Program.ScreenHeight / 2 + 16));

            Program.Engine.AddEntity(HeadsUpDisplay.Create());

            Program.Referee.Start();

            Program.WavProvider.AddMixerInput((ISampleProvider)sound);
            Program.WavPlayer.Play();
        }