Exemplo n.º 1
0
        public int GetPlayingSecond(GameLoader gameLoader)
        {
            string lastValue = PPDGeneralSetting.Setting[gameLoader.GetFullName()];

            if (!int.TryParse(lastValue, out int value))
            {
                value = 0;
            }
            return(value);
        }
Exemplo n.º 2
0
        private void Add(GameLoader gl)
        {
            var component = new GameInfoComponent(device, resourceManager, gl)
            {
                PlayingTime = String.Format("{0:F1}{1}", ConvertSecond(GetPlayingSecond(gl)), Utility.Language["Hour"]),
                Position    = new SharpDX.Vector2(0, listSprite.ChildrenCount * 90)
            };

            listSprite.AddChild(component);
        }
Exemplo n.º 3
0
 public void UpdatePlayingTime(GameLoader gameLoader, int time)
 {
     foreach (GameInfoComponent gameInfoComponent in listSprite.Children)
     {
         if (gameInfoComponent.GameLoader == gameLoader)
         {
             gameInfoComponent.PlayingTime = String.Format("{0:F1}{1}", ConvertSecond(time), Utility.Language["Hour"]);
             break;
         }
     }
 }
Exemplo n.º 4
0
        void glp_GameStarted(object sender, GameEventArgs e)
        {
            mp.StopMovie();
            if (GameHost is MyGame myGame)
            {
                myGame.StartGame(e.GameLoader);
            }

            currentGame = e.GameLoader;
            startTime   = GameHost.GameTimer.ElapsedTime;
        }
Exemplo n.º 5
0
 private void UpdatePlayingTime()
 {
     if (currentGame != null)
     {
         long elapsedTime = (GameHost.GameTimer.ElapsedTime - startTime) / 1000;
         var  value       = glp.GetPlayingSecond(currentGame);
         value += (int)elapsedTime;
         glp.UpdatePlayingTime(currentGame, value);
         PPDGeneralSetting.Setting[currentGame.GetFullName()] = value.ToString();
         currentGame = null;
     }
 }
Exemplo n.º 6
0
        public void StartGame(GameLoader gl)
        {
            currentGame = gl;
            var entrySceneManager = gl.GetEntrySceneManager();

            sceneManager.LoadingScene = gl.GetLoading(device);
            SetPropertyToScene(sceneManager.LoadingScene);
            var spriteResourceManager = new PPDFramework.Resource.SpriteResourceManager(device, entrySceneManager.SpriteDir);

            sceneManager.LoadingScene.ResourceManager = spriteResourceManager;
            sceneManager.LoadingScene.Load();
            var scene = entrySceneManager.GetSceneWithArgs(device, Args, out Dictionary <string, object> dict);

            sceneManager.ChangeGame(scene, dict, spriteResourceManager);
            isHome = false;
        }
Exemplo n.º 7
0
 private void ParseGameList(XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.IsStartElement())
         {
             switch (reader.LocalName)
             {
             case "Game":
                 var sl = new GameLoader(Path.Combine("skins", reader.GetAttribute("Name")));
                 sl.Load();
                 games.Add(sl);
                 break;
             }
         }
     }
     reader.Close();
 }
Exemplo n.º 8
0
 public GameEventArgs(GameLoader gl)
 {
     GameLoader = gl;
 }
Exemplo n.º 9
0
            public GameInfoComponent(PPDDevice device, PPDFramework.Resource.ResourceManager resourceManager, GameLoader gameLoader) : base(device)
            {
                this.GameLoader = gameLoader;

                var gameInfo = gameLoader.GetGameInformation();

                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("gameicon", gameInfo.GameIconPath))
                {
                    Position = new Vector2(13, 13)
                });
                this.AddChild(new TextureString(device, gameInfo.GameName, 20, PPDColors.White)
                {
                    Position = new Vector2(102, 5)
                });
                this.AddChild(new TextureString(device, gameInfo.GameDescription, 14, 500, 60, true, PPDColors.White)
                {
                    Position = new Vector2(102, 32)
                });
                this.AddChild(new TextureString(device, Utility.Language["PlayingTime"], 12, PPDColors.White)
                {
                    Position = new Vector2(630, 8)
                });
                playingTimeText = new TextureString(device, "", 12, PPDColors.White)
                {
                    Position  = new Vector2(795, 8),
                    Alignment = Alignment.Right
                };
                this.AddChild(playingTimeText);
                this.AddChild(new TextureString(device, Utility.Language["Version"], 12, PPDColors.White)
                {
                    Position = new Vector2(630, 25)
                });
                var vertionText = new TextureString(device, gameLoader.Version, 12, PPDColors.White)
                {
                    Position  = new Vector2(795, 25),
                    Alignment = Alignment.Right
                };

                this.AddChild(vertionText);
                this.AddChild(new PictureObject(device, resourceManager, Utility.Path.Combine("gamelist_back.png")));
            }