示例#1
0
 public static void PlaySong(MapScreen screen)
 {
     while (true)
     {
         using (var gameMusic = new AudioFileReader(@"C:\Users\CapeS\source\repos\TileGame\GameSong.wav"))
             using (var menuMusic = new AudioFileReader(@"C:\Users\CapeS\source\repos\TileGame\MenuSong.wav"))
                 using (var outputDevice = new WaveOutEvent())
                 {
                     if (screen.currentlyViewing == "Game")
                     {
                         outputDevice.Init(gameMusic);
                         outputDevice.Play();
                         while (outputDevice.PlaybackState == PlaybackState.Playing && screen.currentlyViewing == "Game")
                         {
                             Thread.Sleep(1000);
                         }
                     }
                     else if (screen.currentlyViewing == "Main Menu")
                     {
                         outputDevice.Init(menuMusic);
                         outputDevice.Play();
                         while (outputDevice.PlaybackState == PlaybackState.Playing && screen.currentlyViewing == "Main Menu")
                         {
                             Thread.Sleep(1000);
                         }
                     }
                 }
     }
 }
示例#2
0
文件: Test.cs 项目: notwo/UnityApp
    // Use this for initialization
    void Start()
    {
        // example of loading csv file
        csv = CSVLoader.Instance;
        //TextAsset txt = csv.loadFile(1, 1, "Alocer_Dania");
        unit = new Unit();
        unit.readCharCSV(1, "Lancelot_Tartare");
        //Debug.Log("step Name: " + BLance.getName());

        // including fade and transition
        fm = FadeManager.Instance;

        // example of sound playing
        snd = SoundManager.Instance;
        //snd.PlayBGM(0);

        // example of random value
        util = UtilCommon.Instance;

        // example of using ClassBase
        cb = ClassBase.Instance;

        ps = ParameterScreen.Instance;
        ps.inactivateGuages();

        mb = MessageBase.Instance;

        ms = MapScreen.Instance;
        //ms.showMap();

        DontDestroyOnLoad(this.gameObject);
    }
示例#3
0
 public static void ClearMasterView()
 {
     masterView.children.Clear();
     _mapScreen  = null;
     _menuScreen = null;
     _gameScreen = null;
 }
示例#4
0
        static void Main(string[] args)
        {
            using (var deck = StreamDeck.OpenDevice())
            {
                deck.ClearKeys();
                var map    = new Map();
                var player = new Player();

                var screenManager = new ScreenManager(deck);
                var titleScreen   = new TitleScreen(screenManager);
                var powerScreen   = new PowersScreen(screenManager, player);

                var mapScreen = new MapScreen(screenManager, map, player);

                titleScreen.NextScreen = powerScreen;
                powerScreen.NextScreen = mapScreen;

                titleScreen.Activate();

                while (true)
                {
                    Task.Delay(1000).GetAwaiter().GetResult();
                }
            }
        }
示例#5
0
    private void InitInstance()
    {
        bool isAlone = !(Instance != null && Instance != this);

        Assert.IsTrue(isAlone);

        Instance = this;
    }
示例#6
0
    private void Awake()
    {
        current = this;

        mapCam = MapCamera.GetComponent<Camera>();
        canvasRectTransform = PlayerTracker.GetComponentInParent<Canvas>().GetComponent<RectTransform>();
        mapCam.GetComponent<MapCameraController>().OnUpdateCamera = UpdateTracker;
    }
示例#7
0
        static void Init()
        {
            MapScreen screen     = new MapScreen(Width, Height);
            Thread    songplayer = new Thread(() => PlaySong(screen));

            songplayer.Start();
            screen.IsFocused     = true;
            Global.CurrentScreen = screen;
        }
 protected override void OnFinalize()
 {
     base.OnFinalize();
     _layer.InputRestrictions.ResetInputRestrictions();
     MapScreen.RemoveLayer(_layer);
     MapScreen.RestartAmbientSounds();
     ScreenManager.TryLoseFocus(_layer);
     _layer      = null;
     _dataSource = null;
 }
示例#9
0
 static void GameInit()
 {
     _rootConsole = new Console(_screenWidth, _screenHeight);
     _actorScreen = new ActorScreen();
     _mapScreen   = new MapScreen();
     _rootConsole.Children.Add(_mapScreen);
     _rootConsole.Children.Add(_actorScreen);
     SadConsole.Global.FocusedConsoles.Push(_actorScreen.actorConsole);
     SadConsole.Global.CurrentScreen = _rootConsole;
 }
示例#10
0
 public static void Postfix(MapScreen __instance, List <EscapeMenuItemVM> __result)
 {
     __result.Insert(1, new EscapeMenuItemVM(
                         new TextObject("{=NqarFr4P}Mod Options", null),
                         obj =>
     {
         OnEscapeMenuToggledMethod.Invoke(__instance, new object[] { false });
         ScreenManager.PushScreen((ScreenBase)Activator.CreateInstance(MBOptionScreenSubModule.SyncObject.ModOptionScreen));
     },
                         null, false, false));
 }
示例#11
0
 private void Awake()
 {
     if (!Instance)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 public void OnFinalize()
 {
     this._armyManagementVM?.OnFinalize();
     this._mapDataSource.OnFinalize();
     this._gauntletArmyManagementMovie?.Release();
     this._movie.Release();
     this._armyManagementVM    = (ArmyManagementVM)null;
     this._gauntletLayer       = (GauntletLayer)null;
     this._mapDataSource       = (EntrepreneurMapVM)null;
     this._encyclopediaManager = (EncyclopediaScreenManager)null;
     this._mapScreen           = (MapScreen)null;
 }
示例#13
0
 void Awake()
 {
     stats     = gameObject.transform.Find("StatsScreen").gameObject.GetComponent <StatsScreen>();
     inventory = gameObject.transform.Find("InventoryScreen").gameObject.GetComponent <InventoryScreen>();
     shop      = gameObject.transform.Find("ShopScreen").gameObject.GetComponent <ShopScreen>();
     journal   = gameObject.transform.Find("JournalScreen").gameObject.GetComponent <JournalScreen>();
     map       = gameObject.transform.Find("MapScreen").gameObject.GetComponent <MapScreen>();
     tabs      = gameObject.transform.Find("GuiTabsButtons").gameObject;
     tabs.SetActive(false);
     playerAttack    = GameObject.Find("MyCharacter").GetComponent <Attack>();
     playerMovement  = GameObject.Find("MyCharacter").GetComponent <Movement>();
     playerRigidBody = GameObject.Find("MyCharacter").GetComponent <Rigidbody2D>();
 }
示例#14
0
        private static void Initialize()
        {
            var contextSettings = new ContextSettings {
                DepthBits = 24
            };
            var vidMode = new VideoMode(640, 480);

            window = new RenderWindow(vidMode, "Map Scroller", Styles.Close | Styles.Titlebar, contextSettings);
            window.SetActive();
            window.SetKeyRepeatEnabled(false);
            window.Closed += (sender, args) => ShutDown();

            map = new MapScreen();
        }
示例#15
0
        private void mnItemMap_Click(object sender, RoutedEventArgs e)
        {
            /* Set the mode as idle */
            try
            {
                IndoorPositioningClient.SetModeAsIdle();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }

            DisposeContent();
            var screen = new MapScreen();

            content.Content = screen;
        }
        protected override void OnTick(float dt)
        {
            base.OnTick(dt);
            GameState  activeState = Game.Current.GameStateManager.ActiveState;
            ScreenBase topScreen1  = ScreenManager.TopScreen;

            switch (topScreen1)
            {
            case MapScreen _:
            case InventoryGauntletScreen _:
            case GauntletPartyScreen _:
            case GauntletCharacterDeveloperScreen _:
            case GauntletClanScreen _:
            case GauntletQuestsScreen _:
            case GauntletKingdomScreen _:
                this._mapDataSource.IsEnabled     = true;
                this._mapDataSource.CurrentScreen = topScreen1.GetType().Name;
                bool flag = ScreenManager.TopScreen is MapScreen;
                this._mapDataSource.MapTimeControl.IsInMap = flag;
                this.Layer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
                if (!(activeState is MapState))
                {
                    this._mapDataSource.MapTimeControl.IsCenterPanelEnabled = false;
                }
                else if (flag)
                {
                    MapScreen topScreen2 = ScreenManager.TopScreen as MapScreen;
                    topScreen2.IsBarExtended = this._mapDataSource.MapInfo.IsInfoBarExtended;
                    this._mapDataSource.MapTimeControl.IsInRecruitment      = topScreen2.IsInRecruitment;
                    this._mapDataSource.MapTimeControl.IsInBattleSimulation = topScreen2.IsInBattleSimulation;
                    this._mapDataSource.MapTimeControl.IsEncyclopediaOpen   = this._encyclopediaManager.IsEncyclopediaOpen;
                    this._mapDataSource.MapTimeControl.IsInArmyManagement   = topScreen2.IsInArmyManagement;
                    this._mapDataSource.MapTimeControl.IsInTownManagement   = topScreen2.IsInTownManagement;
                    this._mapDataSource.MapTimeControl.IsInCampaignOptions  = topScreen2.IsInCampaignOptions;
                }
                else
                {
                    this._mapDataSource.MapTimeControl.IsCenterPanelEnabled = false;
                }
                this._mapDataSource.Tick(dt);
                break;

            default:
                this._mapDataSource.IsEnabled = false;
                this.Layer.InputRestrictions.ResetInputRestrictions();
                break;
            }
        }
        protected override void CreateLayout()
        {
            base.CreateLayout();
            _dataSource = new CustomCampaignOptionsVM(OnClose);
            var gauntletLayer = new GauntletLayer(4401)
            {
                IsFocusLayer = true
            };

            _layer = gauntletLayer;
            _layer.LoadMovie("CustomCampaignOptions", _dataSource);
            _layer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
            _layer.InputRestrictions.SetInputRestrictions();
            MapScreen.AddLayer(_layer);
            MapScreen.PauseAmbientSounds();
            ScreenManager.TrySetFocus(_layer);
        }
示例#18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parent">The Screen that this console will be parented to</param>
        public ActorConsole(SadConsole.Console parent) : base(_actorConsoleWidth, _actorConsoleHeight)
        {
            _actorList   = new List <Actor>();
            _player      = new Player(1, 1);
            _mapScreen   = new MapScreen();
            _kbComponent = new KeyboardComponent(_player, ref _mapScreen);

            this.Components.Add(_kbComponent);
            _actorList.Add(_player);

            foreach (Actor act in _actorList)
            {
                this.Children.Add(act);
            }

            this.Parent = parent;
        }
示例#19
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime, MapScreen Screen)
        {
            base.Draw(gameTime);

            //spriteBatch.Draw(boxTexture, new Rectangle(x++,0, 100, 100), Color.White);

            Game.basicEffect.CurrentTechnique.Passes[0].Apply();
            vertices = new VertexPositionColor[2];

            vertices[0].Color = Color.Black;
            vertices[1].Color = Color.Black;

            foreach (Region region in Regions)
            {
                foreach (Site site in region.Sites)
                {
                    vertices[0].Position = new Vector3(site.Location.X, site.Location.Y, 0);
                    foreach (Site conSite in site.Connections)
                    {
                        vertices[1].Position = new Vector3(conSite.Location.X, conSite.Location.Y, 0);
                        Game.GraphicsDevice.DrawUserPrimitives <VertexPositionColor>(PrimitiveType.LineList, vertices, 0, 1);
                    }
                }

                foreach (Site site in region.Sites)
                {
                    switch (site.Icon)
                    {
                    case IconType.City:
                        spriteBatch.Draw(Screen.SiteIconsTexture, new Rectangle((int)site.Location.X - 16, (int)site.Location.Y - 16, 32, 32), new Rectangle(0, 0, 32, 32), Color.White);
                        break;

                    case IconType.Field:
                        break;

                    case IconType.Battle:
                        break;

                    default:
                        break;
                    }
                }
            }

            spriteBatch.Draw(Game.screenHandler.CharacterSpriteTexture, new Rectangle((int)Player.Site.Location.X - 16, (int)Player.Site.Location.Y - 32, 32, 32), Player.Characters[0].GetAnimatedSpriteFrame(SpriteDirection.Front), Color.White);
        }
示例#20
0
        // Creates all child consoles to be managed
        // make sure they are added as children
        // so they are updated and drawn
        public void CreateConsoles()
        {
            // Display the Splashscreen
            SplashScreen = new SplashScreen();
            Children.Add(SplashScreen);
            SplashScreen.IsVisible = true;

            // Generate the map and add it as a Child of the UI manager
            MapScreen = new MapScreen(MapWidth, MapHeight, ViewPortWidth, ViewPortHeight);
            Children.Add(MapScreen);

            // Create the message log window and set its position.
            MessageLog = new MessageLogWindow(ViewPortWidth, ViewPortHeight / 4, "Message Log");
            Children.Add(MessageLog);
            MessageLog.Show();
            MessageLog.Position = new Point(0, 20);

            // Print a test method
            MessageLog.Add("Welcome to Runic Quest Alpha!");
        }
 public void Initialize(MapScreen mapScreen)
 {
     this._mapScreen            = mapScreen;
     this._mapNavigationHandler = new MapNavigationHandler();
     this._mapDataSource        = new EntrepreneurMapVM((INavigationHandler)this._mapNavigationHandler, (IMapStateHandler)this._mapScreen, new MapBarShortcuts()
     {
         EscapeMenuHotkey  = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", "Exit").ToString(),
         CharacterHotkey   = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 30).ToString(),
         QuestHotkey       = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 35).ToString(),
         PartyHotkey       = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 36).ToString(),
         KingdomHotkey     = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 33).ToString(),
         ClanHotkey        = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 34).ToString(),
         InventoryHotkey   = Game.Current.GameTextManager.GetHotKeyGameText("GenericCampaignPanelsGameKeyCategory", 31).ToString(),
         FastForwardHotkey = Game.Current.GameTextManager.GetHotKeyGameText("MapHotKeyCategory", 48).ToString(),
         PauseHotkey       = Game.Current.GameTextManager.GetHotKeyGameText("MapHotKeyCategory", 46).ToString(),
         PlayHotkey        = Game.Current.GameTextManager.GetHotKeyGameText("MapHotKeyCategory", 47).ToString()
     }, new Action(this.OpenArmyManagement));
     this._gauntletLayer       = new GauntletLayer(200, "GauntletLayer");
     this.Layer                = (ScreenLayer)this._gauntletLayer;
     this._movie               = this._gauntletLayer.LoadMovie("MapBar", (ViewModel)this._mapDataSource);
     this._encyclopediaManager = mapScreen.EncyclopediaScreenManager;
 }
示例#22
0
文件: Engine.cs 项目: Jebeli/Tiles
 public Engine(IFileResolver fileResolver, IGraphics graphics, IFontEngine fonts, ISounds sounds = null)
 {
     this.fileResolver = fileResolver;
     this.graphics     = graphics;
     this.fonts        = fonts;
     this.sounds       = sounds;
     if (sounds == null)
     {
         this.sounds = new NoSounds();
     }
     timeProvider    = new StopWatchTimeInfoProvider();
     input           = new BasicInput();
     textureManager  = new ResourceManager <Texture>();
     tileSetManager  = new ResourceManager <TileSet>();
     musicManager    = new ResourceManager <Music>();
     soundManager    = new ResourceManager <Sound>();
     eventManager    = new EventManager(this);
     entityManager   = new EntityManager(this);
     enemyManager    = new EnemyManager(this);
     campaignManager = new CampaignManager();
     currentScreen   = new NullScreen(this);
     mapScreen       = new MapScreen(this);
     loadScreen      = new LoadScreen(this);
     splashScreen    = new SplashScreen(this);
     titleScreen     = new TitleScreen(this);
     exitScreen      = new ExitScreen(this);
     testScreen      = new TestScreen(this);
     map             = MapFactory.MakeNullMap(this);
     camera          = new Camera(this, map);
     frameCounter    = new FrameCounter();
     loaders         = new List <ILoader>();
     loaders.Add(new XmlLoader(this));
     loaders.Add(new IniLoader(this));
     savers = new List <ISaver>();
     savers.Add(new IniSaver(this));
     savers.Add(new XmlSaver(this));
     nextEnemyTemplates = new List <string>();
 }
示例#23
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            torch.toggleTorch();
        }

        // checks if mousbuttonLEFT is pressed
        if (Input.GetMouseButtonDown(0) && playerAttack.enabled)
        {
            playerAttack.Execute();
        }

        if (Input.GetKeyDown(KeyCode.I))
        {
            guiScreenManager.Toggle(GuiScreenType.Inventory);
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            guiScreenManager.Toggle(GuiScreenType.Stats);
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            guiScreenManager.Toggle(GuiScreenType.Journal);
        }
        if (Input.GetKeyDown(KeyCode.M))
        {
            guiScreenManager.Toggle(GuiScreenType.Map);
        }
        if (Input.GetKeyDown(KeyCode.F))
        {
            MapScreen mapScreen = guiScreenManager.gameObject.transform.Find("MapScreen").GetComponent <MapScreen>();
            mapScreen.StartCoroutine("RemoveCloudsOnDiscoveredArea");
        }
    }
示例#24
0
 void Awake()
 {
     mapScreen = this;
 }
 private static void Init()
 {
     // Here we pass the viewport and map size as the same, but the map could be larger and the camera would center on the player.
     MapScreen = new MapScreen(StartingWidth, StartingHeight, StartingWidth, StartingHeight);
     SadConsole.Global.CurrentScreen = MapScreen;
 }
示例#26
0
 private static void Init()
 {
     MapScreen = new MapScreen(StartingWidth, StartingHeight);
     SadConsole.Global.CurrentScreen = MapScreen;
 }
示例#27
0
 private void Awake()
 {
     map = mapHandler.GetComponent <MapScreen>();
 }
示例#28
0
 public void LoadContent(MapScreen mapScreen)
 {
     this.mapScreen = mapScreen;
     controls = new GamePadController(PlayerIndex.One);
     debugControls = new KeyboardController();
     GameClass.SoundManager.LoadSound("Audio/dialogSound");
 }
示例#29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="actor"> The Actor to be controlled</param>
 /// <param name="mapScreen">The parent MapScreen</param>
 public KeyboardComponent(Actor actor, ref MapScreen mapScreen)
 {
     this._actor     = actor;
     this._mapScreen = mapScreen;
 }
示例#30
0
 /// <summary>
 /// Base initialize method to setup the MapScreen as current screen
 /// </summary>
 private static void Init()
 {
     MapScreen = new MapScreen(Width, Height, Width, Height);
     SadConsole.Global.CurrentScreen = MapScreen;
 }
示例#31
0
        public void Initialise()
        {
            mapScreen = new MapScreen();
            mapScreen.Initialise();
            battleScreen = new BattleScreen();
            battleScreen.Initialise();
            //thanksForPlayingScreen = new ThanksForPlayingScreen();
            //thanksForPlayingScreen.Initialise();

            currentScreen = mapScreen;
            screenTransitionState = ScreenTransitionState.NewScreenIn;
        }