Esempio n. 1
0
 public void AsTextTest()
 {
     GameStructure target = new GameStructure(); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     actual = target.AsText();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Esempio n. 2
0
        private void ExportFiles(object data)
        {
            m_exportPath = (string)data;
            PrepareExportDirectory(m_exportPath);

            TextureAssetExporter textureExporter = new TextureAssetExporter();

            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Cubemap, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, new ShaderAssetExporter());
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.TextAsset, new TextAssetExporter());
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.AudioClip, new AudioAssetExporter());
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, new FontAssetExporter());
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MovieTexture, new MovieTextureAssetExporter());

            EngineAssetExporter engineExporter = new EngineAssetExporter();

            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Material, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Mesh, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MonoBehaviour, engineExporter);

#if !DEBUG
            try
#endif
            {
                GameStructure.Export(m_exportPath, AssetSelector);
            }
#if !DEBUG
            catch (SerializedFileException ex)
            {
                ReportCrash(ex);
                return;
            }
            catch (Exception ex)
            {
                ReportCrash(ex);
                return;
            }
#endif
            Logger.Log(LogType.Info, LogCategory.General, "Finished!!!");

            Dispatcher.Invoke(() =>
            {
                IntroText.Text              = "Export is finished";
                ExportButton.Visibility     = Visibility.Hidden;
                PostExportButton.Visibility = Visibility.Visible;
                ResetButton.Visibility      = Visibility.Visible;
            }
                              );
        }
Esempio n. 3
0
        private void OnResetButtonClicked(object sender, RoutedEventArgs e)
        {
            IntroText.Text              = m_initialIntroText;
            StatusText.Text             = m_initialStatusText;
            MainGrid.AllowDrop          = true;
            PostExportButton.Visibility = Visibility.Hidden;
            ResetButton.Visibility      = Visibility.Hidden;
            m_processingFiles           = null;

            GameStructure.Dispose();
        }
Esempio n. 4
0
 public override void ChangeLevel()
 {
     if (PreparLevel.SwitchLevelFromHigher)
     {
         return;
     }
     PreparLevel.SwitchLevelFromLower = true;
     CurrentGameDatas.onLevel++;
     CurrentGameDatas.SaveLevel();
     SceneManager.LoadScene(GameStructure.GetLevelName());
 }
Esempio n. 5
0
 public WelcomeScreen(GameStructure i_Game) : base(i_Game)
 {
     m_WelcomeMenu    = new StartMenu(i_Game, this);
     m_Background     = new Background(i_Game, k_AssteNameForBackground, 1);
     m_MainMenuScreen = new MainMenuScreen(i_Game);
     Add(m_Background);
     Add(m_WelcomeMenu);
     m_WelcomeMenu.NotifyGoToMainMenu += GoToMainMenu;
     m_WelcomeMenu.NotifyStartGame    += ExitScreen;
     m_WelcomeMenu.NotifyToExitGame   += () => Game.Exit();
 }
        public SoundsSettingsScreen(GameStructure i_Game) : base(i_Game)
        {
            this.IsOverlayed     = false;
            m_ScreenSettingsMenu = new SoundsSettingsMenu(i_Game, this);
            m_Background         = new Background(i_Game, k_AssteNameForBackground, 1);

            m_ScreenSettingsMenu.NotifyToGoBack += () => ExitScreen();

            Add(m_Background);
            Add(m_ScreenSettingsMenu);
        }
 public MainMenuScreen(GameStructure i_Game) : base(i_Game)
 {
     m_MainMenu             = new MainMenu(i_Game, this);
     m_Background           = new Background(i_Game, k_AssteNameForBackground, 1);
     m_SoundsSettingsScreen = new SoundsSettingsScreen(i_Game);
     m_ScreenSettingsScreen = new ScreenSettingsScreen(i_Game);
     m_MainMenu.notifyScreenSettingsWasChecked += Screen;
     m_MainMenu.notifySoundsSettingsWasChecked += Sound;
     m_MainMenu.notifyPlayWasChosen            += ExitScreen;
     Add(m_Background);
     Add(m_MainMenu);
 }
Esempio n. 8
0
 public Enemy(GameStructure i_Game, int i_Score, int i_CellIndex, Color i_TintColor) : base(k_AssteName, i_Game)
 {
     m_CellIndex      = i_CellIndex;
     m_Score          = i_Score;
     TintColor        = i_TintColor;
     m_DeltaToJump    = 0;
     m_TimeToNextjump = 0.5;
     m_IsEnemyShouldNotifyToSwitchJumpDirction = false;
     m_IsEnemyTouchLeftBoundFirstTime          = true;
     m_IsAlive = true;
     Bullets   = new List <Bullet>();
 }
 public SpaceInvadersGameScreen(GameStructure i_Game) : base(i_Game)
 {
     this.BlendState = Microsoft.Xna.Framework.Graphics.BlendState.NonPremultiplied;
     m_IsGameStarted = false;
     initDefaultData();
     m_CurrentLevel      = 1;
     m_CollisionsManager = Game.Services.GetService(typeof(ICollisionsManager)) as CollisionsManager;
     m_GamePauseScreen   = new GamePauseScreen(Game as GameStructure);
     m_GameOverSound     = SoundFactoryMethod.CreateSound(Game as GameStructure, eSoundName.GameOver);
     m_LevelWinSound     = SoundFactoryMethod.CreateSound(Game as GameStructure, eSoundName.LevelWin);
     m_BackGroundMusic   = SoundFactoryMethod.CreateSound(Game as GameStructure, eSoundName.BackgroundMusic);
 }
Esempio n. 10
0
        private GameStructureExporter(string gameDir, string exportPath, List <string> files)
        {
            GameDir    = gameDir;
            AssetPath  = gameDir;
            ExportPath = exportPath;
            options    = new ExportOptions()
            {
                Version  = new Version(2017, 3, 0, VersionType.Final, 3),
                Platform = Platform.NoTarget,
                Flags    = TransferInstructionFlags.NoTransferInstructionFlags,
            };
            m_GameStructure = GameStructure.Load(files);
            var fileCollection  = m_GameStructure.FileCollection;
            var textureExporter = new TextureAssetExporter();
            var engineExporter  = new EngineAssetExporter();

            fileCollection.Exporter.OverrideExporter(ClassIDType.Material, engineExporter);
            fileCollection.Exporter.OverrideExporter(ClassIDType.Mesh, engineExporter);
            fileCollection.Exporter.OverrideExporter(ClassIDType.Shader, new DummyShaderExporter());
            fileCollection.Exporter.OverrideExporter(ClassIDType.Font, engineExporter);
            fileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, textureExporter);
            fileCollection.Exporter.OverrideExporter(ClassIDType.Cubemap, textureExporter);
            fileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, engineExporter); //engine or texture exporter?
            fileCollection.Exporter.EventExportStarted += () =>
            {
                Logger.Log(LogType.Info, LogCategory.Export, "EventExportStarted");
                UpdateTitle($"EventExportStarted");
            };
            fileCollection.Exporter.EventExportPreparationStarted += () =>
            {
                Logger.Log(LogType.Info, LogCategory.Export, "EventExportPreparationStarted");
                UpdateTitle($"EventExportPreparationStarted");
            };
            fileCollection.Exporter.EventExportPreparationFinished += () =>
            {
                Logger.Log(LogType.Info, LogCategory.Export, "EventExportPreparationFinished");
                UpdateTitle($"EventExportPreparationFinished");
            };
            fileCollection.Exporter.EventExportFinished += () =>
            {
                Logger.Log(LogType.Info, LogCategory.Export, "EventExportFinished");
                UpdateTitle($"EventExportFinished");
            };
            fileCollection.Exporter.EventExportStarted += () =>
            {
                Logger.Log(LogType.Info, LogCategory.Export, "EventExportStarted");
                UpdateTitle($"EventExportStarted");
            };
            fileCollection.Exporter.EventExportProgressUpdated += (int number, int total) =>
            {
                UpdateTitle($"Exported {number / (float)total * 100:0.#} - {number} of {total}");
            };
        }
Esempio n. 11
0
        private void LoadFiles(object data)
        {
            string[] files = (string[])data;

#if !DEBUG
            try
#endif
            {
                OnImportStarted();
                GameStructure = GameStructure.Load(files);
                Validate();
                OnImportFinished();
            }
#if !DEBUG
            catch (SerializedFileException ex)
            {
                Dispatcher.Invoke(() =>
                {
                    Logger.Log(LogType.Error, LogCategory.Import, ex.ToString());
                    AddHyperlinkToConsole("Go to: ", "Create issue", IssuePage);
                    AddHyperlinkToConsole("Attach file: ", ex.FileName, ex.FilePath);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file '{ex.FilePath}'.",
                                    "An error during loading process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
            catch (Exception ex)
            {
                Dispatcher.Invoke(() =>
                {
                    Logger.Log(LogType.Error, LogCategory.Import, ex.ToString());
                    AddHyperlinkToConsole("Go to: ", "Create issue", IssuePage);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file that cause this error.",
                                    "An error during loading process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
#endif

            Dispatcher.Invoke(() =>
            {
                IntroText.Text          = "Files has been loaded";
                ExportButton.Visibility = Visibility.Visible;

#if VIRTUAL
                ButtonAutomationPeer peer  = new ButtonAutomationPeer(ExportButton);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();
#endif
            }
                              );
        }
Esempio n. 12
0
        public static Sound CreateSound(GameStructure i_Game, eSoundName i_eSoundType)
        {
            SoundsManager m_soundManager = i_Game.Services.GetService(typeof(SoundsManager)) as SoundsManager;
            Sound         sound          = null;

            switch (i_eSoundType)
            {
            case eSoundName.BackgroundMusic:
                sound = new Sound(i_Game, k_BackgroundMusicAsset, true, eSoundType.BackgroundMusic);
                break;

            case eSoundName.BarrierHit:
                sound = new Sound(i_Game, k_BarrierHitAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.EnemyGunShot:
                sound = new Sound(i_Game, k_EnemyGunShotAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.EnemyKill:
                sound = new Sound(i_Game, k_EnemyKillAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.GameOver:
                sound = new Sound(i_Game, k_GameOverAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.LevelWin:
                sound = new Sound(i_Game, k_LevelWinAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.LifeDie:
                sound = new Sound(i_Game, k_LifeDieAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.MenuMove:
                sound = new Sound(i_Game, k_MenuMoveAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.MotherShipKill:
                sound = new Sound(i_Game, k_MotherShipKillAsset, false, eSoundType.SoundsEffects);
                break;

            case eSoundName.SSGunShot:
                sound = new Sound(i_Game, k_SSGunShotAsset, false, eSoundType.SoundsEffects);
                break;
            }

            m_soundManager.SetSoundByInstanceType(sound);
            m_soundManager.AddSound(sound);
            return(sound);
        }
Esempio n. 13
0
        // =====================================================
        // Methods
        // =====================================================

        private void LoadFiles(object data)
        {
            string[] files = (string[])data;

            GameStructure = GameStructure.Load(files);
            Validate();

            Dispatcher.Invoke(() =>
            {
                IntroText.Text          = "Files has been loaded";
                ExportButton.Visibility = Visibility.Visible;
            }
                              );
        }
Esempio n. 14
0
 public Game(GameNetwork Network, int NeededNumberOfPlayersForGameToStart, UniqueIDGenerator gamesIDGenerator)
 {
     GamesIDGenerator = gamesIDGenerator;
     GameID           = GamesIDGenerator.GetID();
     Logger.GameID    = GameID;
     Logger.GameLog("Initialising a new Game with " + Convert.ToString(NeededNumberOfPlayersForGameToStart) + " Players");
     this.Network             = Network;
     this.Network.ClientLost += OnClientLost;
     GameState       = GameStates.Initializing;
     GameStructure   = new GameStructure(NeededNumberOfPlayersForGameToStart);
     GameEngine      = new GameEngine(GameStructure);
     NumberOfPlayers = NeededNumberOfPlayersForGameToStart;
     GameEngine.TeamScoredHandler += OnTeamScored;
     GameEngine.OnGameFinished    += HandleFinishedGame;
 }
Esempio n. 15
0
 public SpaceShip(GameStructure i_Game, ePlayerNumber i_PlayerNumber, string i_AssteName, SpaceShipsManager i_SpaceShipManager) : base(i_AssteName, i_Game)
 {
     SpaceShipManager  = i_SpaceShipManager;
     Bullets           = new List <Bullet>();
     ScoreAsText       = new TextAsSprite(i_Game);
     m_PlayerNumber    = i_PlayerNumber;
     Score             = 0;
     m_Speed           = 145;
     m_AssteName       = i_AssteName;
     IsShootableActive = true;
     m_SpaceShipSouls  = new List <Sprite>();
     initSouls();
     m_ShootSound = SoundFactoryMethod.CreateSound(i_Game, eSoundName.SSGunShot);
     m_LifeDie    = SoundFactoryMethod.CreateSound(Game as GameStructure, eSoundName.LifeDie);
 }
Esempio n. 16
0
        protected GameDataBase(string GameBasePath)
        {
            using (var gameStructrue = GameStructure.Load(new[] { GameBasePath }))
            {
                var assests =
                    gameStructrue
                    .FileCollection
                    .FetchAssets()
                    .Where(assest => assest.ClassID == ClassIDType.MonoBehaviour)
                    .Cast <MonoBehaviour>() ?? throw new InvalidDataException();

                ItemSet   = GetProtoList <ItemProto>(assests);
                RecipeSet = GetProtoList <RecipeProto>(assests);
                StringSet = GetProtoList <StringProto>(assests);
            }
        }
        void DoExportAll()
        {
            Util.PrepareExportDirectory(ExportPath);
            var managedPath            = Path.Combine(GameDir, "Managed");
            var globalgamemanagersPath = Path.Combine(GameDir, "globalgamemanagers.assets");
            var gameStructure          = GameStructure.Load(new string[]
            {
                globalgamemanagersPath,
                managedPath
            });

            fileCollection = gameStructure.FileCollection;
            fileCollection.AssemblyManager.ScriptingBackEnd = ScriptingBackEnd.Mono;
            var scripts = fileCollection.FetchAssets().Where(o => o is MonoScript ms).ToArray();

            fileCollection.Exporter.Export(ExportPath, fileCollection, scripts, options);
        }
Esempio n. 18
0
        public IntroToLevelScreen(GameStructure i_Game) : base(i_Game)
        {
            m_Background = new Background(i_Game, k_AssteNameForBackground, 1);
            m_HeadLine   = new TextAsSprite(i_Game)
            {
                Position = new Vector2(250, 100), Scales = new Vector2(2, 2)
            };
            m_CountDownText = new TextAsSprite(i_Game)
            {
                Position = new Vector2(265, 130), Scales = new Vector2(3, 3)
            };
            m_TimeToCountDown = 0;
            ActivationLength  = TimeSpan.FromSeconds(4);

            Add(m_Background);
            Add(m_HeadLine);
            Add(m_CountDownText);
        }
Esempio n. 19
0
        private void LoadFiles(object data)
        {
            string[] files = (string[])data;

#if !DEBUG
            try
#endif
            {
                GameStructure = GameStructure.Load(files);
                Validate();
            }
#if !DEBUG
            catch (SerializedFileException ex)
            {
                Dispatcher.Invoke(() =>
                {
                    Logger.Instance.Log(LogType.Error, LogCategory.Import, ex.ToString());
                    AddHyperlinkText("Go to: ", "Create issue", IssuePage);
                    AddHyperlinkText("Attach file: ", ex.FileName, ex.FilePath);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file '{ex.FilePath}'.",
                                    "An error during loading process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
            catch (Exception ex)
            {
                Dispatcher.Invoke(() =>
                {
                    Logger.Instance.Log(LogType.Error, LogCategory.Import, ex.ToString());
                    AddHyperlinkText("Go to: ", "Create issue", IssuePage);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file that cause this error.",
                                    "An error during loading process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
#endif

            Dispatcher.Invoke(() =>
            {
                IntroText.Text          = "Files has been loaded";
                ExportButton.Visibility = Visibility.Visible;
            }
                              );
        }
Esempio n. 20
0
 public StartMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen)
 {
     m_GameScreen = i_GameScreen;
     Enter        = new MenuItem(i_Game)
     {
         Text = "Press Enter To Play"
     };
     Esc = new MenuItem(i_Game)
     {
         Text = "Press Esc To Exit Game"
     };
     M = new MenuItem(i_Game)
     {
         Text = "Press M To Main Menu"
     };
     Add(Enter);
     Add(Esc);
     Add(M);
 }
Esempio n. 21
0
        private void LoadFiles(object data)
        {
            string[] files = (string[])data;

#if !DEBUG
            try
#endif
            {
                OnImportStarted();
                GameStructure = GameStructure.Load(files);
                Validate();
                OnImportFinished();
            }
#if !DEBUG
            catch (SerializedFileException ex)
            {
                ReportCrash(ex);
                return;
            }
            catch (Exception ex)
            {
                ReportCrash(ex);
                return;
            }
#endif

            Dispatcher.Invoke(() =>
            {
                IntroText.Text          = "Files has been loaded";
                ExportButton.Visibility = Visibility.Visible;

                Fileview.AddItem(GameStructure.FileCollection);
                Fileview.Refresh();

#if VIRTUAL
                ButtonAutomationPeer peer  = new ButtonAutomationPeer(ExportButton);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();
#endif
            }
                              );
        }
Esempio n. 22
0
 /**
  * joins 2 same type Structures
  * replaces all another's structures id with current structure id
  * joins tile and meeple list
  * disposes of 2nd structure
  *
  * may be overriden in derived classes
  * eg: Monastery(does not exist), City (has to add shields too)
  */
 public virtual void JoinStructures(GameStructure another)
 {
     if (!this.CanJoin(another))
     {
         return;
     }
     //TODO: de vazut ca teoretic trebuie o lista de structuri in joc, cand se creaza o noua structura se adauga in lista respectiva, cand se face join se scoate o structura din lista respectiva
     if (this.StructureType != another.StructureType)
     {
         throw new Exception("Structures are not same type");
     }
     if (this.StructureId == another.StructureId)
     {
         throw new Exception("Nu ar trebuii sa faci join cu tine insuti");
     }
     another.ReplaceStructureId(this.StructureId);
     this.ComponentTiles.AddRange(another.ComponentTiles);
     this.MeepleList.AddRange(another.MeepleList);
     another.Dispose();
 }
        //Refer MonoManager, ScriptAssetExporter, ScriptExportManager
        void DoExport(Func <MonoScript, bool> selector = null)
        {
            var managedPath            = Path.Combine(GameDir, "Managed");
            var globalgamemanagersPath = Path.Combine(GameDir, "globalgamemanagers.assets");
            var gameStructure          = GameStructure.Load(new string[]
            {
                globalgamemanagersPath,
                managedPath
            });

            fileCollection = gameStructure.FileCollection;
            if (selector == null)
            {
                selector = (o) => true;
            }
            var assets = fileCollection.FetchAssets().Where(o => o is MonoScript ms && selector(ms)).ToArray();
            ScriptExportManager scriptManager = new ScriptExportManager(ExportPath);
            Dictionary <Object, ScriptExportType> exportTypes = new Dictionary <Object, ScriptExportType>();

            foreach (Object asset in assets)
            {
                MonoScript script = (MonoScript)asset;
                if (ScriptByName)
                {
                    using (MD5 md5 = MD5.Create())
                    {
                        var data    = md5.ComputeHash(Encoding.UTF8.GetBytes($"{script.AssemblyName}.{script.Namespace}.{script.ClassName}"));
                        var newGuid = new Guid(data);
                        Util.SetGUID(script, newGuid);
                    }
                }
                ScriptExportType exportType = script.GetExportType(scriptManager);
                exportTypes.Add(asset, exportType);
            }
            foreach (KeyValuePair <Object, ScriptExportType> exportType in exportTypes)
            {
                string path = scriptManager.Export(exportType.Value);
            }
            //scriptManager.ExportRest();
        }
        void DoExportAll()
        {
            Util.PrepareExportDirectory(ExportPath);
            var managedPath   = Path.Combine(GameDir, "Managed");
            var mainAssetPath = Path.Combine(GameDir, "globalgamemanagers.assets");

            if (!File.Exists(mainAssetPath))
            {
                var mainData = Path.Combine(GameDir, "mainData");
                if (File.Exists(mainData))
                {
                    mainAssetPath = mainData;
                }
            }
            var gameStructure = GameStructure.Load(new string[]
            {
                mainAssetPath,
                managedPath
            });

            fileCollection = gameStructure.FileCollection;
            fileCollection.AssemblyManager.ScriptingBackEnd = ScriptingBackEnd.Mono;
            var scripts = fileCollection.FetchAssets().Where(o => o is MonoScript ms).ToArray();

            foreach (Object asset in scripts)
            {
                MonoScript script = (MonoScript)asset;
                if (ScriptByName)
                {
                    using (MD5 md5 = MD5.Create())
                    {
                        var data    = md5.ComputeHash(Encoding.UTF8.GetBytes($"{script.AssemblyName}.{script.Namespace}.{script.ClassName}"));
                        var newGuid = new Guid(data);
                        Util.SetGUID(script, newGuid);
                    }
                }
            }
            fileCollection.Exporter.Export(ExportPath, fileCollection, scripts, options);
        }
Esempio n. 25
0
        public SpaceShipsManager(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen)
        {
            SpaceShips      = new Dictionary <string, SpaceShip>();
            this.BlendState = Microsoft.Xna.Framework.Graphics.BlendState.NonPremultiplied;
            m_SpaceShipPlayer1SoulsPosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 130, 0);
            m_SpaceShipPlayer2SoulsPosition = new Vector2(Game.GraphicsDevice.Viewport.Width - 130, 20);
            SpaceShip spaceShip1 = new SpaceShip(Game as GameStructure, ePlayerNumber.P1, k_AssteNameSpaceShip1, this)
            {
                SoulsPosition = m_SpaceShipPlayer1SoulsPosition, InitPosition = new Vector2(0, Game.GraphicsDevice.Viewport.Height - k_SpaceShipSize), ScorePosition = Vector2.Zero, TextColor = Color.Blue
            };

            spaceShip1.WhenIDie += onWhenSpacehipDie;
            SpaceShips.Add("SpaceShip1", spaceShip1);
            spaceShip1.Add();
            SpaceShip spaceShip2 = new SpaceShip(Game as GameStructure, ePlayerNumber.P2, k_AssteNameSpaceShip2, this)
            {
                SoulsPosition = m_SpaceShipPlayer2SoulsPosition, InitPosition = new Vector2(0 + k_SpaceShipSize, Game.GraphicsDevice.Viewport.Height - k_SpaceShipSize), ScorePosition = new Vector2(0, 20), TextColor = Color.Green
            };

            spaceShip2.Enabled = spaceShip2.Visible = false;
            SpaceShips.Add("SpaceShip2", spaceShip2);
        }
Esempio n. 26
0
        public MainMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen)
        {
            m_NumOfPlayers = new MultiItem(i_Game, "One", "Two")
            {
                FunctionToExecute = notifyNumberOfPlayerChanges,
                MainText          = "Players:"
            };

            m_SoundSettings = new MenuItem(i_Game)
            {
                FunctionToExecute = GotoSoundsSettingsMenu,
                Text = "Sound Settings"
            };

            m_ScreenSettings = new MenuItem(i_Game)
            {
                FunctionToExecute = GotoScreenSettingsMenu,
                Text = "Screen Settings"
            };

            m_Play = new MenuItem(i_Game)
            {
                FunctionToExecute = GoToGameScreen,
                Text = "Play"
            };

            m_Quit = new MenuItem(i_Game)
            {
                FunctionToExecute = Game.Exit,
                Text = "Quit"
            };

            Add(m_NumOfPlayers);
            Add(m_SoundSettings);
            Add(m_ScreenSettings);
            Add(m_Play);
            Add(m_Quit);
        }
Esempio n. 27
0
        public void Load(IReadOnlyList <string> args)
        {
#if !DEBUG_PROGRAM
            try
#endif
            {
                GameStructure = GameStructure.Load(args);
                Validate();

                string exportPath = Path.Combine("Ripped", GameStructure.Name);
                PrepareExportDirectory(exportPath);

                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.TextAsset, new TextAssetExporter());
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, new FontAssetExporter());
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MovieTexture, new MovieTextureAssetExporter());

#if DEBUG
                EngineAssetExporter engineExporter = new EngineAssetExporter();
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Material, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Mesh, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, engineExporter);
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MonoBehaviour, engineExporter);
#endif

                GameStructure.Export(exportPath, AssetSelector);
                Logger.Log(LogType.Info, LogCategory.General, "Finished");
            }
#if !DEBUG_PROGRAM
            catch (Exception ex)
            {
                Logger.Log(LogType.Error, LogCategory.General, ex.ToString());
            }
#endif
        }
        public SoundsSettingsMenu(GameStructure i_Game, GameScreen i_GameScreen) : base(i_Game, i_GameScreen)
        {
            string[] OptionsForVolumeControls = { "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100" };
            m_BackgroundMusicVol = new MultiItem(i_Game, SetBackgroundMusicVol, OptionsForVolumeControls)
            {
                FunctionToExecute = SetBackgroundMusicVol,
                MainText          = "Background Music Volume:",
                IsLooped          = false,
                CurrenOptionIdx   = 5
            };

            m_SoundsEffectsVol = new MultiItem(i_Game, OptionsForVolumeControls)
            {
                FunctionToExecute = SetSoundsEffectsVol,
                MainText          = "Sounds Effects Volume:",
                IsLooped          = false,
                CurrenOptionIdx   = 5
            };

            m_ToggleSound = new MultiItem(i_Game, "On", "Off")
            {
                FunctionToExecute = ToggleSound,
                MainText          = "Toggle Sound:"
            };

            m_Done = new MenuItem(i_Game)
            {
                FunctionToExecute = GoToMainMenu,
                Text = "Done"
            };

            Add(m_BackgroundMusicVol);
            Add(m_SoundsEffectsVol);
            Add(m_ToggleSound);
            Add(m_Done);
        }
Esempio n. 29
0
        private void ExportFiles(object data)
        {
            m_exportPath = (string)data;
            PrepareExportDirectory(m_exportPath);

            TextureAssetExporter textureExporter = new TextureAssetExporter();

            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Cubemap, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, textureExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, new ShaderAssetExporter());
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.AudioClip, new AudioAssetExporter());

            EngineAssetExporter engineExporter = new EngineAssetExporter();

            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Material, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Mesh, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, engineExporter);
            GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, engineExporter);

#if !DEBUG
            try
#endif
            {
                GameStructure.Export(m_exportPath, AssetSelector);
            }
#if !DEBUG
            catch (SerializedFileException ex)
            {
                Logger.Log(LogType.Error, LogCategory.Import, ex.ToString());
                Dispatcher.Invoke(() =>
                {
                    AddHyperlinkToConsole("Go to: ", "Create issue", IssuePage);
                    AddHyperlinkToConsole("Attach file: ", ex.FileName, ex.FilePath);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file '{ex.FilePath}'.",
                                    "An error during export process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
            catch (Exception ex)
            {
                Logger.Log(LogType.Error, LogCategory.Import, ex.ToString());
                Dispatcher.Invoke(() =>
                {
                    AddHyperlinkToConsole("Go to: ", "Create issue", IssuePage);
                    MessageBox.Show(this, $"Please, create an issue on github page {IssuePage} with attached file that cause this error.",
                                    "An error during loading process has occuered!", MessageBoxButton.OK, MessageBoxImage.Error);
                });
                return;
            }
#endif
            Logger.Log(LogType.Info, LogCategory.General, "Finished!!!");

            Dispatcher.Invoke(() =>
            {
                IntroText.Text              = "Export is finished";
                ExportButton.Visibility     = Visibility.Hidden;
                PostExportButton.Visibility = Visibility.Visible;
                ResetButton.Visibility      = Visibility.Visible;
            }
                              );
        }
Esempio n. 30
0
        public void rip(string[] args, string targetDir)
        {
            Logger.Instance                = PythonLogger.Instance;
            Config.IsAdvancedLog           = true;
            Config.IsGenerateGUIDByContent = false;
            Config.IsExportDependencies    = true;

            if (args.Length == 0)
            {
                Console.WriteLine("No arguments");
                return;
            }

            foreach (string arg in args)
            {
                if (FileMultiStream.Exists(arg))
                {
                    continue;
                }
                if (DirectoryUtils.Exists(arg))
                {
                    continue;
                }
                Console.WriteLine(FileMultiStream.IsMultiFile(arg) ?
                                  $"File '{arg}' doesn't has all parts for combining" :
                                  $"Neither file nor directory with path '{arg}' exists");
                return;
            }

            try
            {
                GameStructure = GameStructure.Load(args);
                Validate();

                // MRH - can make this an option to include/exclude.  Including will transcode, e.g. fsb (FSB5) into wav
                GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.AudioClip, new AudioAssetExporter());

                /* MRH - borrowing from the GUI... there seems to be much more work there than in the CLI
                 * uTinyRipperGUI.Exporters.TextureAssetExporter textureExporter = new uTinyRipperGUI.Exporters.TextureAssetExporter();
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, textureExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Cubemap, textureExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, textureExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, new uTinyRipperGUI.Exporters.ShaderAssetExporter());
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.TextAsset, new TextAssetExporter());
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, new FontAssetExporter());
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MovieTexture, new MovieTextureAssetExporter());
                 *
                 * EngineAssetExporter engineExporter = new EngineAssetExporter();
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Material, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Texture2D, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Mesh, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Shader, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Font, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.Sprite, engineExporter);
                 * GameStructure.FileCollection.Exporter.OverrideExporter(ClassIDType.MonoBehaviour, engineExporter);
                 *
                 * PrepareExportDirectory(targetDir);
                 */

                GameStructure.Export(targetDir, AssetSelector);
                Logger.Log(LogType.Info, LogCategory.General, "Finished");
            }
            catch (Exception ex)
            {
                Logger.Log(LogType.Error, LogCategory.General, ex.ToString());
            }
        }
Esempio n. 31
0
 public static void LoadGuideAndSetMode()
 {
     FinishMap.normalGame = true;
     LoadSceneStatic(GameStructure.GetLevelName());
 }