update
This commit is contained in:
parent
61daf826cc
commit
15df32ec6d
@ -7,7 +7,13 @@
|
|||||||
"text": "我需要{0}件【{1}】,如果你暂时没有备货的话我可以在这等一段时间,但不会太久。"
|
"text": "我需要{0}件【{1}】,如果你暂时没有备货的话我可以在这等一段时间,但不会太久。"
|
||||||
},
|
},
|
||||||
"goods": [],
|
"goods": [],
|
||||||
"reword": [],
|
"reword": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "diamond",
|
||||||
|
"n": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
"weight": 4500
|
"weight": 4500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -18,7 +24,13 @@
|
|||||||
"text": "我需要{0}件【{1}】,如果你暂时没有备货的话我可以在这等一段时间,但不会太久。"
|
"text": "我需要{0}件【{1}】,如果你暂时没有备货的话我可以在这等一段时间,但不会太久。"
|
||||||
},
|
},
|
||||||
"goods": [],
|
"goods": [],
|
||||||
"reword": [],
|
"reword": [
|
||||||
|
{
|
||||||
|
"a": "item",
|
||||||
|
"t": "30001",
|
||||||
|
"n": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
"weight": 4500
|
"weight": 4500
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -39,8 +51,20 @@
|
|||||||
"key": "4",
|
"key": "4",
|
||||||
"text": "我有个宝贝,你要是喜欢的话便宜你点卖你。"
|
"text": "我有个宝贝,你要是喜欢的话便宜你点卖你。"
|
||||||
},
|
},
|
||||||
"goods": [],
|
"goods": [
|
||||||
"reword": [],
|
{
|
||||||
|
"a": "item",
|
||||||
|
"t": "30001",
|
||||||
|
"n": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"reword": [
|
||||||
|
{
|
||||||
|
"a": "attr",
|
||||||
|
"t": "diamond",
|
||||||
|
"n": 10
|
||||||
|
}
|
||||||
|
],
|
||||||
"weight": 500
|
"weight": 500
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -120,6 +120,8 @@ var (
|
|||||||
ff(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): &formview.GrowtaskListView{},
|
ff(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): &formview.GrowtaskListView{},
|
||||||
//worldtask
|
//worldtask
|
||||||
ff(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine): &formview.WorldtaskMineView{},
|
ff(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine): &formview.WorldtaskMineView{},
|
||||||
|
//smithy
|
||||||
|
ff(comm.ModuleSmithy, "customer"): &formview.SmithyView{},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,6 +149,7 @@ var (
|
|||||||
string(comm.ModuleGrowtask),
|
string(comm.ModuleGrowtask),
|
||||||
string(comm.ModuleWorldtask),
|
string(comm.ModuleWorldtask),
|
||||||
string(comm.ModuleReddot),
|
string(comm.ModuleReddot),
|
||||||
|
string(comm.ModuleSmithy),
|
||||||
},
|
},
|
||||||
"gm": {ff(comm.ModuleGM, "cmd")},
|
"gm": {ff(comm.ModuleGM, "cmd")},
|
||||||
"sys": {
|
"sys": {
|
||||||
@ -245,6 +248,9 @@ var (
|
|||||||
"worldtask": {
|
"worldtask": {
|
||||||
ff(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine),
|
ff(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine),
|
||||||
},
|
},
|
||||||
|
"smithy": {
|
||||||
|
ff(comm.ModuleSmithy, "customer"),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -877,6 +883,19 @@ var (
|
|||||||
SubType: worldtask.WorldtaskSubtypeMine,
|
SubType: worldtask.WorldtaskSubtypeMine,
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
},
|
},
|
||||||
|
// smithy
|
||||||
|
string(comm.ModuleSmithy): {
|
||||||
|
NavLabel: "铁匠铺",
|
||||||
|
MainType: string(comm.ModuleSmithy),
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
|
ff(comm.ModuleSmithy, "customer"): {
|
||||||
|
NavLabel: "顾客",
|
||||||
|
Desc: "当前铁匠铺中的顾客",
|
||||||
|
MainType: string(comm.ModuleSmithy),
|
||||||
|
SubType: "customer",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
35
cmd/v2/ui/views/smithy.go
Normal file
35
cmd/v2/ui/views/smithy.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package formview
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/cmd/v2/model"
|
||||||
|
"go_dreamfactory/cmd/v2/service"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SmithyView struct {
|
||||||
|
BaseformView
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SmithyView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
|
//查询顾客
|
||||||
|
loadCustomer := func() {
|
||||||
|
if err := service.GetPttService().SendToClient(
|
||||||
|
t.MainType,
|
||||||
|
"customer",
|
||||||
|
&pb.SmithyCustomerReq{},
|
||||||
|
); err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
customerBtn := widget.NewButton("顾客", loadCustomer)
|
||||||
|
|
||||||
|
btns := container.NewHBox(customerBtn)
|
||||||
|
c := container.NewBorder(btns, nil, nil, nil)
|
||||||
|
return c
|
||||||
|
}
|
@ -4,7 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 贸易
|
// 贸易
|
||||||
@ -16,7 +16,7 @@ func (this *apiComp) SellCheck(session comm.IUserSession, req *pb.SmithySellReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) SellItem(session comm.IUserSession, req *pb.SmithySellReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
if code = this.SellCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.SellCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,9 @@ func newWeightedRandom(items []*cfg.GameSmithyCustomerData) *WeightedRandom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wr *WeightedRandom) pick() *cfg.GameSmithyCustomerData {
|
func (wr *WeightedRandom) pick() *cfg.GameSmithyCustomerData {
|
||||||
|
if wr.totalWeight <= 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
randomNumber := rand.Intn(wr.totalWeight)
|
randomNumber := rand.Intn(wr.totalWeight)
|
||||||
for _, item := range wr.items {
|
for _, item := range wr.items {
|
||||||
if randomNumber < int(item.Weight) {
|
if randomNumber < int(item.Weight) {
|
||||||
|
Loading…
Reference in New Issue
Block a user