From 2d18c23e892716eccdc3bddb032caf089ad059fe Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 18 Jan 2023 13:59:49 +0000 Subject: [PATCH] fix --- .../GameShell/97_MusicPlayer/music_player_page.go | 8 ++++++-- .../97_MusicPlayer/music_player_page_list_item.go | 15 ++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Menu/GameShell/97_MusicPlayer/music_player_page.go b/Menu/GameShell/97_MusicPlayer/music_player_page.go index 1cf2470..e933293 100644 --- a/Menu/GameShell/97_MusicPlayer/music_player_page.go +++ b/Menu/GameShell/97_MusicPlayer/music_player_page.go @@ -2,6 +2,7 @@ package MusicPlayer import ( "fmt" + "path/filepath" "log" "github.com/cuu/gogame/event" "github.com/cuu/gogame/rect" @@ -128,8 +129,8 @@ func (self *MusicPlayerPage) SyncList() { li.Init("NoName") } } - - li.Labels["Text"].PosX = 7 + x,_ := li.Labels["Text"].Coord() + li.Labels["Text"].NewCoord(x,7) self.MyList = append(self.MyList, li) } @@ -143,7 +144,10 @@ func (self *MusicPlayerPage) SyncPlaying() { self.MyList[i].(*MusicPlayPageListItem).Active = false self.MyList[i].(*MusicPlayPageListItem).PlayingProcess = 0 } + current_song,_ := conn.CurrentSong() + if len(current_song) > 0 { + } } func (self *MusicPlayerPage) Init() { diff --git a/Menu/GameShell/97_MusicPlayer/music_player_page_list_item.go b/Menu/GameShell/97_MusicPlayer/music_player_page_list_item.go index 7a6b8e4..8fe7ce9 100644 --- a/Menu/GameShell/97_MusicPlayer/music_player_page_list_item.go +++ b/Menu/GameShell/97_MusicPlayer/music_player_page_list_item.go @@ -12,7 +12,7 @@ import ( //"github.com/clockworkpi/LauncherGoDev/sysgo" "github.com/clockworkpi/LauncherGoDev/sysgo/UI" - "github.com/cuu/gogame/color" + //"github.com/cuu/gogame/color" "github.com/cuu/gogame/draw" //"github.com/cuu/gogame/event" //"github.com/cuu/gogame/rect" @@ -46,26 +46,27 @@ func NewMusicPlayPageListItem() *MusicPlayPageListItem { func (self *MusicPlayPageListItem) Draw() { x, _ := self.Labels["Text"].Coord() - w, h := self.Labels["Text"].Size() + _, h := self.Labels["Text"].Size() self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2) if self.MyType == UI.ICON_TYPES["DIR"] && self.Path != "[..]" { sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"] - sys_icon.IconIndex = 0. - sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2) + _,h := sys_icon.Size() + sys_icon.SetIconIndex(0) + sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - h)/2 + h/2) sys_icon.Draw() } if self.MyType == UI.ICON_TYPES["FILE"] { sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"] - sys_icon.IconIndex = 1 - sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2) + _,h := sys_icon.Size() + sys_icon.SetIconIndex(1) + sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - h)/2 + h /2) sys_icon.Draw() } - self.Labels["Text"].Active = self.Active self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)