Example #1
0
    public void WinGold()
    {
        int gold = (int)PhotonNetwork.LocalPlayer.CustomProperties["gold"];

        Debug.Log("Old gold: " + gold);
        if (monsterType == "Gor")
        {
            gold += 2;
        }
        else if (monsterType == "Skral")
        {
            gold += 4;
        }
        else
        {
            gold += 6;
        }
        PhotonHashtable h = new PhotonHashtable();

        h.Add("gold", gold);
        PhotonNetwork.LocalPlayer.SetCustomProperties(h);
        Debug.Log("New gold: " + gold);
        LoadGame loading = new LoadGame();

        loading.LoadGameScene();
    }
Example #2
0
        /// <summary>
        /// Drawing
        /// </summary>
        public override void Draw()
        {
            // Clears the background
            Display.ClearBuffers();

            Batch.Begin();


            // Background
            Batch.DrawTile(Tileset, 1, Point.Empty);


            // Draw buttons
            for (int id = 0; id < Buttons.Count; id++)
            {
                ScreenButton button = Buttons[id];


                Batch.DrawString(Font,
                                 new Vector2(button.Rectangle.Location.X, button.Rectangle.Location.Y),
                                 id == MenuID ? Color.FromArgb(255, 85, 85) : Color.White,
                                 button.Text);
            }

            if (LoadGame != null)
            {
                LoadGame.Draw(Batch);
            }


            Batch.End();
        }
Example #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #4
0
    public void WinWillpower()
    {
        int wp = (int)PhotonNetwork.LocalPlayer.CustomProperties["wp"];

        Debug.Log("Old WP: " + wp);
        if (monsterType == "Gor")
        {
            wp += 2;
        }
        else if (monsterType == "Skral")
        {
            wp += 4;
        }
        else
        {
            wp += 6;
        }
        PhotonHashtable h = new PhotonHashtable();

        h.Add("wp", wp);
        PhotonNetwork.LocalPlayer.SetCustomProperties(h);
        Debug.Log("New WP: " + wp);
        LoadGame loading = new LoadGame();

        loading.LoadGameScene();
    }
Example #5
0
 public void BackToMenu()
 {
     WorldManager.firstRun = true;
     SceneManager.LoadScene(0);
     LoadGame.SaveLevel(0);
     WorldManager.ResetLevel();
 }
        private void bt_LoadGame_Click(object sender, EventArgs e)
        {
            if (!LoadGame.LoadHero())
            {
                MessageBox.Show(@"          You dont have Character !
                        Click on ""NEW GAME"" to create your first!");
            }
            else
            {
                this.Close();
                var game = new Game();
                game.Start();
                Frm_HeroSelection.DrawSoftUni();

                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("-------------------Welcome to our game \"World of SofrUni\".-------------------");
                Console.WriteLine();
                Console.WriteLine(new string(Constants.LineSeparator, 79));
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("You have create new hero Mage.");
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine(new string(Constants.LineSeparator, 79));
                Console.WriteLine("1.To continue playing please enter command \"help\" to show you all command.");
                Console.WriteLine(new string(Constants.LineSeparator, 79));
                Console.WriteLine("2.To EXIT and SAVE the game enter command \"exit\".");
                Console.WriteLine(new string(Constants.LineSeparator, 79));
                Console.WriteLine("3.To SAVE and continue playing the game enter command \"save\"");
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Example #7
0
        private void LoadGame_button_Click(object sender, EventArgs e)
        {
            OpenFileDialog loader = new OpenFileDialog();

            if (loader.ShowDialog() == DialogResult.OK)
            {
                if (System.IO.Path.GetExtension(loader.FileName).Equals(".otlo"))
                {
                    string[] filesToOpen = new string[1];
                    filesToOpen = System.IO.File.ReadAllLines(loader.FileName);
                    LoadGame.Invoke(filesToOpen);
                }
                else
                {
                    MessageBox.Show("Unrecognized File");
                    throw new Exception();
                }
            }
            else
            {
                //System.Diagnostics.Process.Start(Application.ExecutablePath);
                throw new Exception();
            }

            FormClosing -= FormGameSettings_FormClosing;
        }
Example #8
0
 public void Hide_AllScreen()
 {
     Setting.SetActive(false);
     StartGame.SetActive(false);
     LoadGame.SetActive(false);
     ExitGame.SetActive(false);
     Admin.SetActive(false);
 }
Example #9
0
 internal LoadGameEvent InvokeEvent(LoadGameEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         LoadGame?.Invoke(_api, arg);
     }
     return(arg);
 }
Example #10
0
 public void LoadsGame()
 {
     LoadGame.LoadInformation();
     if (GameInformation.hasSaved == 1)
     {
         AutoFade.LoadLevel("StartLoad", 1, 1, Color.black);
     }
 }
Example #11
0
 void Start()
 {
     canvas = GetComponent<Canvas> ();
     loadGame = GameObject.Find ("GameLogic").GetComponent<LoadGame> ();
     selectableText = defaultMenu;
     selectableText[selected].color = SEL_COLOR;
     menuText = (GameObject)Resources.Load("UISprites/MenuText");
 }
Example #12
0
 void Start()
 {
     canvas         = GetComponent <Canvas> ();
     loadGame       = GameObject.Find("GameLogic").GetComponent <LoadGame> ();
     selectableText = defaultMenu;
     selectableText[selected].color = SEL_COLOR;
     menuText = (GameObject)Resources.Load("UISprites/MenuText");
 }
        private void BtnLoadGame_LeftClick(object sender, EventArgs e)
        {
            Disable();

            IniFile iniFile = new IniFile(ProgramConstants.GamePath +
                                          ProgramConstants.SAVED_GAME_SPAWN_INI);

            LoadGame?.Invoke(this, new GameLoadEventArgs(iniFile.GetIntValue("Settings", "GameID", -1)));
        }
Example #14
0
        void CreateMenuToolBar()
        {
            var newgame       = new NewGame(_gameVM);
            var loadgame      = new LoadGame(_gameVM);
            var quit          = new Quit(_gameVM);
            var playerOptions = new PlayerOptionsCMD(_gameVM);

            savegame                = new SaveGame(_gameVM);
            sysMap                  = new SystemMap(_gameVM);
            colView                 = new ColonyView(_gameVM);
            componentDesign         = new ComponentDesignViewCMD(_gameVM);
            shipDesign              = new ShipDesignViewCMD(_gameVM);
            missileDesign           = new MissileDesignCMD(_gameVM);
            componentTemplateDesign = new ComponentTemplateViewCMD(_gameVM);
            shipView                = new ShipViewCMD(_gameVM);
            sysInfoView             = new SystemInfoCMD(_gameVM);
            logView                 = new LogViewCMD(_gameVM);

            if (Platform.Supports <MenuBar>())
            {
                Menu = new MenuBar
                {
                    ApplicationItems =
                    {
                        newgame,
                        new SeparatorMenuItem(),
                        savegame,
                        loadgame,
                        new SeparatorMenuItem(),
                        playerOptions,
                        new SeparatorMenuItem(),
                        quit
                    },
                    HelpItems =
                    {
                        new Command {
                            MenuText = "Help Command"
                        }
                    }
                };
            }
            if (Platform.Supports <ToolBar>())
            {
                // create and set the toolbar
                ToolBar = new ToolBar();

                ToolBar.Items.Add(sysMap);
                ToolBar.Items.Add(colView);
                ToolBar.Items.Add(componentDesign);
                ToolBar.Items.Add(shipDesign);
                ToolBar.Items.Add(missileDesign);
                ToolBar.Items.Add(componentTemplateDesign);
                ToolBar.Items.Add(shipView);
                ToolBar.Items.Add(sysInfoView);
                ToolBar.Items.Add(logView);
            }
        }
 private void Start()
 {
     vol = GetComponent <Volume>();
     if (LoadGame.LoadCutscene() != null)
     {
         CutSceneData dataCut = LoadGame.LoadCutscene();
         lastIndex = dataCut.index - 1;
     }
 }
 private void ApplyLoadGame(LoadGame loadGame)
 {
     _tracker.Replace(loadGame.Timestamp, x =>
     {
         x.CommanderName = loadGame.Commander;
         x.GameMode      = loadGame.GameMode;
         x.Group         = loadGame.Group;
     });
 }
Example #17
0
 private void ApplyLoadGame(LoadGame loadGame)
 {
     _tracker.Modify(loadGame.Timestamp, ship =>
     {
         ship.Type   = loadGame.Ship;
         ship.ShipId = loadGame.ShipID;
         ship.Name   = loadGame.ShipName;
         ship.Ident  = loadGame.ShipIdent;
     });
 }
Example #18
0
        public static void Load(DoomGame game, string path)
        {
            var options = game.Options;

            game.InitNew(options.Skill, options.Episode, options.Map);

            var lg = new LoadGame(File.ReadAllBytes(path));

            lg.Load(game);
        }
Example #19
0
        public static void Load(DoomGame game, string path)
        {
            var options = game.Options;

            game.InitNew(options.Skill, options.Episode, options.Map);

            var lg = new LoadGame(DoomApplication.Instance.FileSystem.Read(path));

            lg.Load(game);
        }
            static bool Prefix(LoadGame __instance)
            {
                string path = $"{BetterSaves.GetSaveDirectory()}/{__instance.SelectedSaveFile.FileName}.tung";

                if (!File.Exists(path))
                {
                    return(false);
                }
                return(true);
            }
Example #21
0
        // Loading Active Games To List, Player Can Choose What Game To Continue Playing
        public static void LoadGamesUI()
        {
            Console.Clear();

            List <Game>   games   = new LudoDbAccess().GetAllUnfinishedGames();
            List <Player> players = new LudoDbAccess().GetAllPlayers();

            UserInterface userInterface = new UserInterface();

            if (games.Count == 0)
            {
                Console.WriteLine("Sorry mate, no games to be found " +
                                  "\nPlease create a new game.");
                Thread.Sleep(2000);
                userInterface.MainMenu();
            }

            while (isRunning)
            {
                Console.WriteLine("What game do you want to load?\n");

                for (int i = 0; i < games.Count; i++)
                {
                    playerCounter = 0;
                    Console.WriteLine($"[{games[i].Id}]\nGame Id: {games[i].Id}\nLast Played: {games[i].LastTimePlayedDate}");
                    Console.Write($"Players:");


                    foreach (Player p in players)
                    {
                        if (p.GameId == games[i].Id)
                        {
                            Console.Write($"\nPlayer: {p.Name} | Color: {playerColors[playerCounter]}");
                            playerCounter++;
                        }
                    }


                    Console.WriteLine($"\n---------------------------------------------------------------------------\n");
                }

                int.TryParse(Console.ReadLine(), out userInput);

                foreach (var g in games)
                {
                    if (userInput == g.Id)
                    {
                        LoadGame loadGame = new LoadGame();

                        Console.WriteLine($"Loading game id {g.Id}...");
                        loadGame.LoadAnyGame(g.Id);
                    }
                }
            }
        }
            static void Postfix(LoadGame __instance)
            {
                string oldPath = $"{BetterSaves.GetSaveDirectory()}/{__instance.SelectedSaveFile.FileName}.btung";
                string newPath = $"{BetterSaves.GetSaveDirectory()}/{newName}.btung";

                if (File.Exists(oldPath))
                {
                    File.Copy(oldPath, newPath);
                }
                __instance.GenerateLoadGamesMenu();
            }
 private IEnumerable <ApiEvent> ConvertEvent(LoadGame @event)
 {
     yield return(new ApiEvent("setCommanderCredits")
     {
         EventData = new Dictionary <string, object> {
             { "commanderCredits", @event.Credits },
             { "commanderLoan", @event.Loan }
         },
         Timestamp = @event.Timestamp
     });
 }
            static bool Prefix(LoadGame __instance)
            {
                string path = $"{BetterSaves.GetSaveDirectory()}/{__instance.SelectedSaveFile.FileName}.tung";

                if (!File.Exists(path))
                {
                    newName = GetUniqueSaveName(__instance.SelectedSaveFile.FileName);
                    return(false);
                }
                newName = NewGame.ValidatedUniqueSaveName(__instance.SelectedSaveFile.FileName);
                return(true);
            }
Example #25
0
    void buyStore()
    {
        int i               = (int)PhotonNetwork.CurrentRoom.CustomProperties["CurrentPlayerIndex"];
        int gold            = (int)PhotonNetwork.PlayerList[i].CustomProperties["gold"];
        int wineSkinNum     = getObjectInt(GameObject.Find("WineSkinNumber"));
        int ShieldNumber    = getObjectInt(GameObject.Find("ShieldNumber"));
        int FalconNumber    = getObjectInt(GameObject.Find("FalconNumber"));
        int BowNumber       = getObjectInt(GameObject.Find("BowNumber"));
        int HelmNumber      = getObjectInt(GameObject.Find("HelmNumber"));
        int TelescopeNumber = getObjectInt(GameObject.Find("TelescopeNumber"));
        int StrengthNumber  = getObjectInt(GameObject.Find("StrengthNumber"));

        List <int> totalObj = new List <int> {
            wineSkinNum, ShieldNumber, FalconNumber, BowNumber, HelmNumber, TelescopeNumber, StrengthNumber
        };
        int  cost      = 0;
        bool notEnough = false;

        foreach (var num in totalObj)
        {
            cost += num * 2;
            if (cost > gold)
            {
                notEnough = true;
                setActiveTrue(storePopup, 3);
            }
        }
        if (!notEnough)
        {
            int sp        = (int)PhotonNetwork.PlayerList[i].CustomProperties["sp"];
            int wineskin  = (int)PhotonNetwork.PlayerList[i].CustomProperties["wineskin"];
            int shield    = (int)PhotonNetwork.PlayerList[i].CustomProperties["shield"];
            int bow       = (int)PhotonNetwork.PlayerList[i].CustomProperties["bow"];
            int falcon    = (int)PhotonNetwork.PlayerList[i].CustomProperties["falcon"];
            int telescope = (int)PhotonNetwork.PlayerList[i].CustomProperties["telescope"];
            int helm      = (int)PhotonNetwork.PlayerList[i].CustomProperties["helm"];

            int             newGoldAmount = gold - cost;
            PhotonHashtable p             = new PhotonHashtable();
            p.Add("sp", sp + StrengthNumber);
            p.Add("gold", newGoldAmount);
            p.Add("wineskin", wineskin + wineSkinNum);
            p.Add("shield", shield + ShieldNumber);
            p.Add("falcon", bow + BowNumber);
            p.Add("bow", falcon + FalconNumber);
            p.Add("telescope", telescope + TelescopeNumber);
            p.Add("helm", helm + HelmNumber);
            PhotonNetwork.PlayerList[i].SetCustomProperties(p);
            LoadGame loading = new LoadGame();
            loading.LoadGameScene();
        }
    }
Example #26
0
    private void Start()
    {
        //Set References
        quitGame          = GetComponent <QuitGame> ();
        instructionScreen = GetComponent <SwitchInstructionsScreen> ();
        loadGame          = GetComponent <LoadGame> ();

        //Button onclick listeners
        play.onClick.AddListener(delegate(){ loadGame.LoadScene(); });
        instruction.onClick.AddListener(delegate(){ instructionScreen.OpenScreen(); });
        quit.onClick.AddListener(delegate(){ quitGame.Quit(); });
        back.onClick.AddListener(delegate(){ instructionScreen.CloseScreen(); });
    }
            static void Postfix(LoadGame __instance)
            {
                string oldName = __instance.SelectedSaveFile.FileName;
                string newName = NewGame.ValidatedUniqueSaveName(__instance.RenameInput.text);
                string oldPath = $"{BetterSaves.GetSaveDirectory()}/{oldName}.btung";
                string newPath = $"{BetterSaves.GetSaveDirectory()}/{newName}.btung";

                if (File.Exists(oldPath))
                {
                    File.Move(oldPath, newPath);
                }
                __instance.GenerateLoadGamesMenu();
            }
Example #28
0
    public void NextLevel()
    {
        int level = WorldManager.GetLevel();

        level++;
        LoadGame.SaveLevel(level);
        c.enabled = false;
        Debug.Log("Level " + (level - 1).ToString() + " END");
        if (level < 19)
        {
            WorldManager.GoToLevel(level);
        }
    }
Example #29
0
    public static void SaveGame(LoadGame player)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string path = Application.persistentDataPath + "/player.mg";

        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        stream.Close();
    }
            static void Postfix(LoadGame __instance)
            {
                if (__instance.SelectedSaveFile.FileName == null)
                {
                    return;
                }
                string fileName = $"{BetterSaves.GetSaveDirectory()}/{__instance.SelectedSaveFile.FileName}.btung";

                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }
                __instance.GenerateLoadGamesMenu();
            }
Example #31
0
        public static Planet newOrLoadGame()
        {
            Planet loadPlanet = Universe.Earth;

            Console.ForegroundColor = ConsoleColor.DarkGreen;

            string upgradeQuestion1 = "Use the UP and DOWN arrow keys to select an option" +
                                      ", then press enter.";

            Console.SetCursorPosition((Console.WindowWidth - upgradeQuestion1.Length) / 2, 6);
            Console.WriteLine(upgradeQuestion1);

            List <string> newOrLoad = new List <string> ()
            {
                "New Game", "Load Saved Game"
            };
            int selected = ListNavigation.scrollList(newOrLoad, 8);

            if (selected == 0)
            {
                Console.ForegroundColor = ConsoleColor.DarkGreen;

                string loadQuestion = "Starting a new game will erase your current Save data. Are you Sure?";

                Console.SetCursorPosition((Console.WindowWidth - upgradeQuestion1.Length) / 2, 12);
                Console.WriteLine(loadQuestion);

                List <string> areYouSure = new List <string> ()
                {
                    "Yes, Start New Game", "No, Load Current Saved Game"
                };
                selected = ListNavigation.scrollList(areYouSure, 14);

                if (selected == 1)
                {
                    LoadGame load = new LoadGame();
                    loadPlanet = load.LoadG();
                }
                else
                {
                    Console.SetCursorPosition(0, 22);
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine("What is your name?");
                    Game.NewPlayer.name = Console.ReadLine();
                }
            }
            Console.Title = Game.NewPlayer.name + ": A Life Well Lived";
            return(loadPlanet);
        }
        public void CannotExecute_NotFound()
        {
            //arrange
            var repoMock = new Mock<IRepository>();
            repoMock.Setup(x => x.Query<GameRecord>()).Returns(new GameRecord[0].AsQueryable());

            var query = new LoadGame(Guid.NewGuid());
            var handler = new LoadGameHandler(repoMock.Object);

            //act
            var result = handler.Execute(query);

            //assert
            Assert.Fail();
        }
        public void CanExecute()
        {
            //arrange
            var gameRecord = new GameRecord
            {
                Id = Guid.NewGuid(),
                Moves = new List<GameMoveRecord>(),
            };

            var repoMock = new Mock<IRepository>();
            repoMock.Setup(x => x.Query<GameRecord>()).Returns(new[] { gameRecord }.AsQueryable());

            var query = new LoadGame(gameRecord.Id);
            var handler = new LoadGameHandler(repoMock.Object);

            //act
            var result = handler.Execute(query);

            //assert
            Assert.IsNotNull(result);
        }