更新配置

This commit is contained in:
wh_zcy 2022-09-22 20:13:58 +08:00
parent 8fa0f78888
commit 1a03f9d02d
7 changed files with 471 additions and 88 deletions

View File

@ -94,7 +94,7 @@
101 101
], ],
"sidequest": [ "sidequest": [
2002, 2022,
2004 2004
] ]
}, },

View File

@ -3,6 +3,11 @@
"id": 10001, "id": 10001,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -12,6 +17,11 @@
"id": 10002, "id": 10002,
"num": 2, "num": 2,
"preTid": 104, "preTid": 104,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -21,6 +31,11 @@
"id": 10003, "id": 10003,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -30,6 +45,11 @@
"id": 10004, "id": 10004,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -39,6 +59,11 @@
"id": 10005, "id": 10005,
"num": 2, "num": 2,
"preTid": 105, "preTid": 105,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -48,6 +73,11 @@
"id": 10006, "id": 10006,
"num": 1, "num": 1,
"preTid": 105, "preTid": 105,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -57,6 +87,11 @@
"id": 10007, "id": 10007,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -66,6 +101,11 @@
"id": 10008, "id": 10008,
"num": 3, "num": 3,
"preTid": 0, "preTid": 0,
"Entity": [],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -75,6 +115,15 @@
"id": 10009, "id": 10009,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [
false
],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -84,6 +133,15 @@
"id": 100010, "id": 100010,
"num": 2, "num": 2,
"preTid": 105, "preTid": 105,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [
false
],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -93,6 +151,15 @@
"id": 100011, "id": 100011,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [
false
],
"gotoLevel": 101,
"needItem": [ "needItem": [
0 0
], ],
@ -102,6 +169,15 @@
"id": 100012, "id": 100012,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [
false
],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -111,6 +187,13 @@
"id": 20001, "id": 20001,
"num": 1, "num": 1,
"preTid": 104, "preTid": 104,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -120,6 +203,13 @@
"id": 20002, "id": 20002,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -129,6 +219,13 @@
"id": 20003, "id": 20003,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -138,6 +235,13 @@
"id": 20004, "id": 20004,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -147,6 +251,13 @@
"id": 20005, "id": 20005,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -156,6 +267,13 @@
"id": 20006, "id": 20006,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -165,6 +283,13 @@
"id": 20007, "id": 20007,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -174,6 +299,13 @@
"id": 20008, "id": 20008,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -183,6 +315,13 @@
"id": 20009, "id": 20009,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -192,6 +331,13 @@
"id": 200010, "id": 200010,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -201,6 +347,13 @@
"id": 200011, "id": 200011,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -210,6 +363,13 @@
"id": 200012, "id": 200012,
"num": 2, "num": 2,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -219,6 +379,13 @@
"id": 200013, "id": 200013,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -228,6 +395,13 @@
"id": 200014, "id": 200014,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -237,6 +411,13 @@
"id": 200015, "id": 200015,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],
@ -246,6 +427,13 @@
"id": 200016, "id": 200016,
"num": 1, "num": 1,
"preTid": 0, "preTid": 0,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [],
"gotoLevel": 0,
"needItem": [ "needItem": [
0 0
], ],

View File

@ -18,6 +18,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -80,6 +81,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -108,6 +110,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -139,6 +142,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -171,6 +175,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -199,6 +204,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -230,6 +236,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -262,6 +269,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -276,7 +284,7 @@
"objType": 1, "objType": 1,
"location": "middle", "location": "middle",
"point": "model_02", "point": "model_02",
"storyBegin": 201, "storyBegin": 301,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -294,6 +302,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": true,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -318,7 +327,7 @@
"Reward": [ "Reward": [
{ {
"a": "hero", "a": "hero",
"t": "25004", "t": "44006",
"n": 1 "n": 1
} }
] ]
@ -332,7 +341,7 @@
"objType": 1, "objType": 1,
"location": "middle", "location": "middle",
"point": "model_02", "point": "model_02",
"storyBegin": 202, "storyBegin": 305,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -350,6 +359,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -366,7 +376,7 @@
"objType": 1, "objType": 1,
"location": "middle", "location": "middle",
"point": "model_03", "point": "model_03",
"storyBegin": 203, "storyBegin": 303,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -384,6 +394,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -398,7 +409,7 @@
"objType": 1, "objType": 1,
"location": "middle", "location": "middle",
"point": "model_03", "point": "model_03",
"storyBegin": 203, "storyBegin": 302,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -416,6 +427,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -430,7 +442,7 @@
"objType": 2, "objType": 2,
"location": "right", "location": "right",
"point": "icon_05", "point": "icon_05",
"storyBegin": 204, "storyBegin": 306,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -448,6 +460,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -475,7 +488,7 @@
"objType": 2, "objType": 2,
"location": "right", "location": "right",
"point": "icon_05", "point": "icon_05",
"storyBegin": 207, "storyBegin": 307,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -493,6 +506,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -521,12 +535,13 @@
"modelaction": "Enter", "modelaction": "Enter",
"rotation": { "rotation": {
"x": 0, "x": 0,
"y": -90, "y": 90,
"z": 0 "z": 0
}, },
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -541,7 +556,7 @@
"objType": 1, "objType": 1,
"location": "middle", "location": "middle",
"point": "model_02", "point": "model_02",
"storyBegin": 218, "storyBegin": 308,
"Entity": [ "Entity": [
"Earth" "Earth"
], ],
@ -553,12 +568,13 @@
"modelaction": "Enter", "modelaction": "Enter",
"rotation": { "rotation": {
"x": 0, "x": 0,
"y": 90, "y": -90,
"z": 0 "z": 0
}, },
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -594,11 +610,12 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
"endTid": -1, "endTid": -1,
"storyEnd": 0, "storyEnd": 227,
"reward": [], "reward": [],
"nextTid": 100208, "nextTid": 100208,
"CD": 0 "CD": 0
@ -620,12 +637,13 @@
"modelaction": "", "modelaction": "",
"rotation": { "rotation": {
"x": 0, "x": 0,
"y": -90, "y": 90,
"z": 0 "z": 0
}, },
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -652,12 +670,13 @@
"modelaction": "", "modelaction": "",
"rotation": { "rotation": {
"x": 0, "x": 0,
"y": 90, "y": -90,
"z": 0 "z": 0
}, },
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -690,6 +709,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -725,6 +745,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -760,6 +781,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -795,6 +817,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -829,6 +852,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -863,6 +887,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -897,6 +922,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -931,6 +957,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -968,6 +995,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [ "chooseId": [
@ -1005,6 +1033,7 @@
"modelstate": 0, "modelstate": 0,
"popup": "", "popup": "",
"special": "", "special": "",
"enableAi": false,
"boxreplace": "", "boxreplace": "",
"timeline": "", "timeline": "",
"chooseId": [], "chooseId": [],
@ -1013,5 +1042,40 @@
"reward": [], "reward": [],
"nextTid": 100215, "nextTid": 100215,
"CD": 0 "CD": 0
},
{
"id": 2022,
"objType": 1,
"location": "middle",
"point": "model_02",
"storyBegin": 304,
"Entity": [
"Earth"
],
"EntityChange": [],
"EntityStateChange": [],
"EntityInteractive": [
false
],
"modelaction": "",
"rotation": {
"x": 0,
"y": -180,
"z": 0
},
"modelstate": 0,
"popup": "",
"special": "",
"enableAi": false,
"boxreplace": "",
"timeline": "",
"chooseId": [
20003
],
"endTid": -1,
"storyEnd": 0,
"reward": [],
"nextTid": 100204,
"CD": 0
} }
] ]

View File

@ -88,6 +88,7 @@ func (this *appMonitor) reloadMonitorData() {
d := this.monitorData.AsInterfaceArray() d := this.monitorData.AsInterfaceArray()
this.monitorBinding.Set(d) this.monitorBinding.Set(d)
} }
this.monitorList.ScrollToBottom()
} }
func (this *appMonitor) createMonitorList() { func (this *appMonitor) createMonitorList() {

72
cmd/v2/ui/list.go Normal file
View File

@ -0,0 +1,72 @@
package ui
import "strings"
var replacer *strings.Replacer
func init() {
trimChars := "0123456789-()/½⅓¼⅕⅙⅐⅛⅑⅔⅖¾⅗⅘"
tcs := make([]string, len(trimChars)*2)
for i, c := range trimChars {
tcs[i*2] = string(c)
tcs[i*2+1] = ""
}
replacer = strings.NewReplacer(tcs...)
}
type List struct {
Name string `json:"name"`
Group string `json:"group"`
Items []Item `json:"items"`
// ID is the Mealie API reference for the list.
ID int `json:"id"`
}
var sortableText map[string]string = map[string]string{}
func (l List) Len() int { return len(l.Items) }
func (l List) Swap(i, j int) { l.Items[i], l.Items[j] = l.Items[j], l.Items[i] }
func (l List) Less(i, j int) bool {
var ok bool
var it, jt string
li := l.Items[i]
lit := li.Text
if it, ok = sortableText[lit]; !ok {
it = replacer.Replace(strings.ToUpper(lit))
it = strings.TrimLeft(it, " ")
sortableText[lit] = it
}
lj := l.Items[j]
ljt := lj.Text
if jt, ok = sortableText[ljt]; !ok {
jt = replacer.Replace(strings.ToUpper(ljt))
jt = strings.TrimLeft(jt, " ")
sortableText[ljt] = jt
}
if !li.Checked {
if lj.Checked {
return true
}
return it < jt
}
if !lj.Checked {
return false
}
return it < jt
}
type Item struct {
Title string `json:"title"`
Text string `json:"text"`
Quantity int `json:"quantity"`
Checked bool `json:"checked"`
}
func NewList(name string) List {
return List{
ID: -1,
Name: name,
Items: []Item{},
}
}

View File

@ -12,10 +12,11 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort"
"strings"
"fyne.io/fyne/v2" "fyne.io/fyne/v2"
"fyne.io/fyne/v2/container" "fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/dialog" "fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/storage" "fyne.io/fyne/v2/storage"
@ -27,11 +28,9 @@ import (
type appGen struct { type appGen struct {
appAdapter appAdapter
obs observer.Observer obs observer.Observer
goList *fileList goList *fileList
jsonList *fileList jsonList *fileList
goChkList *widget.List
jsonChkList *widget.List
} }
func (this *appGen) LazyInit(obs observer.Observer) error { func (this *appGen) LazyInit(obs observer.Observer) error {
@ -169,19 +168,20 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
this.goList.titleLabel = widget.NewLabel("Go文件") this.goList.titleLabel = widget.NewLabel("Go文件")
this.goList.titleLabel.Hide() this.goList.titleLabel.Hide()
// 复选列表 // 复选列表
this.goChkList = this.goList.createList() this.goList.itemList = this.goList.createList()
// 覆盖 -go // 覆盖 -go
go_allSelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()} go_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
go_allCancelBtn := &widget.Button{Icon: theme.CheckButtonIcon()} go_allCancelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()}
go_overrideBtn := &widget.Button{Text: "覆盖", Icon: theme.ConfirmIcon()} go_overrideBtn := &widget.Button{Text: "覆盖", Icon: theme.ConfirmIcon()}
go_overrideBtn.Hide() go_overrideBtn.Hide()
go_allSelBtn.Hide() go_allSelBtn.Hide()
// 覆盖
go_overrideBtn.OnTapped = func() { go_overrideBtn.OnTapped = func() {
go_overrideBtn.Disable() go_overrideBtn.Disable()
defer func() { defer func() {
go_overrideBtn.Enable() go_overrideBtn.Enable()
// _ = common.RemoveContents(filepath.Join(tmpDir.Text, "go"))
}() }()
for _, v := range this.goList.selItemIds { for _, v := range this.goList.selItemIds {
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go") // logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
@ -191,18 +191,49 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
} }
this.goList.deleteItem(v)
} }
} }
//取消checked
go_allCancelBtn.OnTapped = func() {
defer func() {
go_allCancelBtn.Hide()
go_allSelBtn.Show()
}()
this.goList.selItemIds = []string{}
for i, v := range this.goList.cachedList.Items {
this.goList.cachedList.Items[i].Checked = false
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
}
this.goList.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.goList.selItemIds), this.goList.fileTotal))
this.goList.itemList.Refresh()
}
//选择所有
go_allSelBtn.OnTapped = func() {
defer func() {
go_allCancelBtn.Show()
go_allSelBtn.Hide()
}()
for i, v := range this.goList.cachedList.Items {
this.goList.cachedList.Items[i].Checked = true
this.goList.selItemIds = append(this.goList.selItemIds, v.Text)
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
}
this.goList.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.goList.selItemIds), this.goList.fileTotal))
this.goList.itemList.Refresh()
}
// json // json
this.jsonList.titleLabel = widget.NewLabel("Json文件") this.jsonList.titleLabel = widget.NewLabel("Json文件")
this.jsonList.titleLabel.Hide() this.jsonList.titleLabel.Hide()
// 复选列表 // 复选列表
this.jsonChkList = this.jsonList.createList() this.jsonList.itemList = this.jsonList.createList()
// 覆盖 -go // 覆盖 -go
json_allSelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()} json_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
json_allCancelBtn := &widget.Button{Icon: theme.CheckButtonIcon()} json_allCancelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()}
json_overrideBtn := &widget.Button{Text: "覆盖", Icon: theme.ConfirmIcon()} json_overrideBtn := &widget.Button{Text: "覆盖", Icon: theme.ConfirmIcon()}
json_overrideBtn.Hide() json_overrideBtn.Hide()
json_allSelBtn.Hide() json_allSelBtn.Hide()
@ -220,10 +251,42 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
} }
logrus.Debug(v) this.jsonList.deleteItem(v)
} }
} }
//取消checked
json_allCancelBtn.OnTapped = func() {
defer func() {
json_allCancelBtn.Hide()
json_allSelBtn.Show()
}()
list := this.jsonList
list.selItemIds = []string{}
for i, v := range list.cachedList.Items {
list.cachedList.Items[i].Checked = false
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
}
list.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(list.selItemIds), list.fileTotal))
list.itemList.Refresh()
}
//选择所有
json_allSelBtn.OnTapped = func() {
defer func() {
json_allCancelBtn.Show()
json_allSelBtn.Hide()
}()
list := this.jsonList
for i, v := range list.cachedList.Items {
list.cachedList.Items[i].Checked = true
list.selItemIds = append(list.selItemIds, v.Text)
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
}
list.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(list.selItemIds), list.fileTotal))
list.itemList.Refresh()
}
genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()} genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()}
genBtn.OnTapped = func() { genBtn.OnTapped = func() {
genBtn.Disable() genBtn.Disable()
@ -277,15 +340,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
left := container.NewVBox(form, container.NewHBox(&layout.Spacer{}, saveBtn, genBtn)) left := container.NewVBox(form, container.NewHBox(&layout.Spacer{}, saveBtn, genBtn))
right := container.NewGridWithColumns(2, right := container.NewGridWithColumns(2,
container.NewBorder( container.NewBorder(
container.NewHBox(go_allCancelBtn, go_overrideBtn, widget.NewLabel("Go文件"), this.goList.titleLabel), container.NewHBox(go_allSelBtn, go_allCancelBtn, go_overrideBtn, widget.NewLabel("Go文件"), this.goList.titleLabel),
nil, nil, nil, nil, nil, nil,
container.NewMax(container.NewVScroll(this.goChkList))), this.goList.itemList),
container.NewBorder( container.NewBorder(
container.NewHBox(json_allCancelBtn, json_overrideBtn, widget.NewLabel("Json文件"), this.jsonList.titleLabel), container.NewHBox(json_allSelBtn, json_allCancelBtn, json_overrideBtn, widget.NewLabel("Json文件"), this.jsonList.titleLabel),
nil, nil, nil, nil, nil, nil,
container.NewMax(container.NewVScroll(this.jsonChkList)), this.jsonList.itemList))
),
)
content.Objects = append(content.Objects, container.NewGridWithColumns(2, left, right)) content.Objects = append(content.Objects, container.NewGridWithColumns(2, left, right))
@ -294,68 +355,78 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
} }
type fileList struct { type fileList struct {
dataBinding binding.UntypedList selItemIds []string //选择的ID
selItemIds []string //选择的ID fileTotal int //文件总数
itemListData *model.ItemModelList titleLabel *widget.Label
fileTotal int //文件总数 cachedList List
titleLabel *widget.Label itemList *widget.List
} }
func NewFileList() *fileList { func NewFileList() *fileList {
return &fileList{ return &fileList{
dataBinding: binding.NewUntypedList(), titleLabel: &widget.Label{},
titleLabel: &widget.Label{}, cachedList: NewList(""),
} }
} }
func (f *fileList) cretaeHeader() *widget.List { func (f *fileList) createList() *widget.List {
// header f.itemList = widget.NewList(
return widget.NewList(
func() int { func() int {
return 1 return len(f.cachedList.Items)
}, },
func() fyne.CanvasObject { func() fyne.CanvasObject {
return container.NewGridWithColumns(3, return widget.NewCheck("Template", func(bool) {})
widget.NewLabelWithStyle("", fyne.TextAlignLeading, fyne.TextStyle{}),
widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{}))
}, },
func(id widget.ListItemID, item fyne.CanvasObject) { func(id widget.ListItemID, item fyne.CanvasObject) {
item.(*fyne.Container).Objects[0].(*widget.Label).SetText(common.APP_MONITOR_TITLE_ID) c, _ := item.(*widget.Check)
item.(*fyne.Container).Objects[1].(*widget.Label).SetText(common.APP_MONITOR_TITLE_DATA) c.Text = f.cachedList.Items[id].Text
}, c.Checked = f.cachedList.Items[id].Checked
)
}
func (f *fileList) createList() *widget.List { c.OnChanged = func(b bool) {
return widget.NewListWithData(f.dataBinding,
func() fyne.CanvasObject {
return container.NewHBox(
&widget.Check{Checked: true},
// widget.NewCheck("", func(b bool) { }),
widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{}),
widget.NewLabel(""),
)
},
func(data binding.DataItem, item fyne.CanvasObject) {
o, _ := data.(binding.Untyped).Get()
pd := o.(*model.ItemModel)
item.(*fyne.Container).Objects[0].(*widget.Check).OnChanged = func(b bool) {
if b { if b {
f.selItemIds = append(f.selItemIds, pd.Id) f.selItemIds = append(f.selItemIds, c.Text)
} else { } else {
f.selItemIds = utils.DeleteString(f.selItemIds, pd.Id) f.selItemIds = utils.DeleteString(f.selItemIds, c.Text)
} }
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal)) f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal))
f.cachedList.Items[id].Checked = b
// sort.Sort(f.cachedList)
f.itemList.Refresh()
} }
item.(*fyne.Container).Objects[1].(*widget.Label).SetText(pd.Label) c.Refresh()
}, },
) )
return f.itemList
}
func (f *fileList) addItem(val string) {
val = strings.TrimSpace(val)
if len(val) == 0 {
return
}
newItem := Item{
Text: val,
Quantity: 1,
Checked: true, //默认选中
}
f.cachedList.Items = append(f.cachedList.Items, newItem)
sort.Sort(f.cachedList)
f.itemList.Refresh()
}
func (f *fileList) deleteItem(name string) {
for i, v := range f.cachedList.Items {
if v.Text == name {
f.cachedList.Items = append(f.cachedList.Items[:i], f.cachedList.Items[i+1:]...)
}
}
f.itemList.Refresh()
} }
func (f *fileList) changeItem(tmpDir, projectDir string) { func (f *fileList) changeItem(tmpDir, projectDir string) {
f.fileTotal = 0 f.fileTotal = 0
f.selItemIds = []string{} f.selItemIds = []string{}
f.itemListData = model.NewItemModelList() f.cachedList = NewList("")
tmpFiles, err := ioutil.ReadDir(tmpDir) tmpFiles, err := ioutil.ReadDir(tmpDir)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
@ -382,25 +453,12 @@ func (f *fileList) changeItem(tmpDir, projectDir string) {
continue continue
} }
} }
fm := &model.ItemModel{ f.addItem(file.Name())
Id: file.Name(), f.selItemIds = append(f.selItemIds, file.Name())
Label: file.Name(),
}
f.itemListData.DataList = append(f.itemListData.DataList, fm)
f.selItemIds = append(f.selItemIds, fm.Id)
f.fileTotal++ f.fileTotal++
logrus.Debugf("%v", fm.Id) logrus.Debugf("%v", file.Name())
} }
} }
f.reloadListData()
}
func (f *fileList) reloadListData() {
if f.itemListData != nil {
d := f.itemListData.AsInterfaceArray()
f.dataBinding.Set(d)
}
} }
func (a *appGen) GetAppName() string { func (a *appGen) GetAppName() string {

View File

@ -45,7 +45,7 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
aSel = &widget.Select{} aSel = &widget.Select{}
gridContainer = container.NewGridWithColumns(3, aSel, tEntry, nEntry) gridContainer = container.NewGridWithColumns(3, aSel, tEntry, nEntry)
aSel.Options = []string{"选择", "attr", "item", "hero", "equi"} aSel.Options = []string{"选择", "attr", "item", "hero", "equi","mapid","pataid"}
aSel.SetSelected("选择") aSel.SetSelected("选择")
aSel.OnChanged = func(s string) { aSel.OnChanged = func(s string) {
if s == "attr" { if s == "attr" {