continue wifi_list

This commit is contained in:
cuu
2018-11-24 00:09:30 +08:00
parent 35b3abf571
commit 7b9f42ac2e
6 changed files with 569 additions and 4 deletions

View File

@@ -141,7 +141,7 @@ func (self *ConfirmPage) Init() {
func (self *ConfirmPage) KeyDown( ev *event.Event ) {
if ev.Data["Key"] == UI.CurKeys["A"] || ev.Data["Key"] == UI.CurKeys["Menu"] {
if ev.Data["Key"] == CurKeys["A"] || ev.Data["Key"] == CurKeys["Menu"] {
self.ReturnToUpLevelPage()
self.Screen.Draw()
self.Screen.SwapAndShow()

View File

@@ -0,0 +1,73 @@
package UI
import (
"github.com/veandco/go-sdl2/ttf"
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/color"
)
type InfoPageListItem struct {
ListItem
Flag string
ReadOnly bool
}
func NewInfoPageListItem() *InfoPageListItem {
p := &InfoPageListItem{}
p.Height = 30
p.ReadOnly = false
p.Labels = make(map[string]LabelInterface)
p.Icons = make( map[string]IconItemInterface)
p.Fonts = make(map[string]*ttf.Font)
return p
}
func (self *InfoPageListItem) SetSmallText(text string) {
l := NewLabel()
l.PosX = 40
l.SetCanvasHWND(self.Parent.GetCanvasHWND())
l.Init(text,self.Fonts["small"],nil)
self.Labels["Small"] = l
}
func (self *InfoPageListItem) Init(text string ) {
l := NewLabel()
l.PosX = 10
l.SetCanvasHWND(self.Parent.GetCanvasHWND())
l.Init(text,self.Fonts["normal"],nil)
self.Labels["Text"] = l
}
func (self *InfoPageListItem) Draw() {
if self.ReadOnly == true {
self.Labels["Text"].SetColor(&color.Color{130,130,130,255} ) //SkinManager().GiveColor("ReadOnlyText")
}else {
self.Labels["Text"].SetColor(&color.Color{83,83,83,255} ) // SkinManager().GiveColor("Text")
}
x,y := self.Labels["Text"].Coord()
w,h := self.Labels["Text"].Size()
self.Labels["Text"].NewCoord( x + self.PosX, self.PosY + (self.Height - h)/2 )
self.Labels["Text"].Draw()
self.Labels["Text"].NewCoord(x, self.PosY + (self.Height - h)/2 )
if _, ok := self.Labels["Small"]; ok {
x,y = self.Labels["Small"].Coord()
w,h = self.Labels["Small"].Size()
self.Labels["Small"].NewCoord( self.Width - w + 5 , self.PosY + (self.Height - h)/2 )
self.Labels["Small"].Draw()
}
canvas_ := self.Parent.GetCanvasHWND()
draw.Line(canvas_, &color.Color{169,169,169,255}, self.PosX, self.PosY+self.Height -1,self.PosX + self.Width, self.PosY+self.Height -1 ,1)
}

View File

@@ -0,0 +1,51 @@
package UI
import (
// "github.com/veandco/go-sdl2/ttf"
// "github.com/cuu/gogame/surface"
// "github.com/cuu/gogame/event"
"github.com/cuu/gogame/rect"
"github.com/cuu/gogame/color"
"github.com/cuu/gogame/draw"
)
type InfoPageSelector struct {
PageSelector
BackgroundColor *color.Color
}
func NewInfoPageSelector() *InfoPageSelector {
p := &InfoPageSelector{}
p.Width = Width
p.BackgroundColor = &color.Color{131,199,219,255} //SkinManager().GiveColor('Front')
return p
}
func (self *InfoPageSelector) AnimateDraw(x2, y2 int) {
//pass
}
func (self *InfoPageSelector) Draw() {
idx := self.Parent.GetPsIndex()
mylist := self.Parent.GetMyList()
if idx < len(mylist) {
x,y := mylist[idx].Coord()
w,h := mylist[idx].Size()
self.PosY = y+1
self.Height = h-3
canvas_ := self.Parent.GetCanvasHWND()
rect_ := rect.Rect(self.PosX,self.PosY,self.Width-4, self.Height)
draw.AARoundRect(canvas_,&rect_,self.BackgroundColor,4,0,self.BackgroundColor)
}
}

View File

@@ -53,13 +53,14 @@ func (self *SkinManager) Init() {
self.Colors["High"] = &color.Color{51,166,255,255}
self.Colors["Text"] = &color.Color{83,83,83,255}
self.Colors["ReadOnlyText"] = &color.Color{130,130,130,255}
self.Colors["Front"] = &color.Color{131,199,219,255}
self.Colors["URL"] = &color.Color{51,166,255,255}
self.Colors["Line"] = &color.Color{169,169,169,255}
self.Colors["TitleBg"] = &color.Color{228,228,228,255}
self.Colors["Active"] = &color.Color{175,90,0,255}
self.Colors["White"] = &color.Color{255,255,255,255}
self.Colors["Black"] = &color.Color{0,0,0,255}
fname := "skin/"+sysgo.SKIN+"/config.cfg"