remove controller layer
This commit is contained in:
6
Makefile
Normal file
6
Makefile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
dev:
|
||||||
|
go run main.go
|
||||||
|
build:
|
||||||
|
echo "install"
|
||||||
|
install:
|
||||||
|
echo "install"
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package controller
|
|
||||||
|
|
||||||
import "game/domain"
|
|
||||||
|
|
||||||
type Controller struct {
|
|
||||||
Context domain.Context
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c Controller) Init() {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,12 +13,21 @@ type GameField struct {
|
|||||||
LevelSection LevelSection
|
LevelSection LevelSection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Position struct {
|
||||||
|
X int
|
||||||
|
Y int
|
||||||
|
}
|
||||||
|
|
||||||
type Context struct {
|
type Context struct {
|
||||||
Player Player
|
Player Player
|
||||||
User User
|
User User
|
||||||
GameField GameField
|
CurrentGameField GameField
|
||||||
|
CurrentPosition Position
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateContext() Context {
|
func CreateContext() Context {
|
||||||
return Context{}
|
return Context{
|
||||||
|
Player: Player{},
|
||||||
|
User: User{},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
package domain
|
package domain
|
||||||
|
|
||||||
type ControllerInterface interface {
|
|
||||||
Init()
|
|
||||||
}
|
|
||||||
|
|
||||||
type PresenterInterface interface {
|
type PresenterInterface interface {
|
||||||
Init()
|
Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
type Domain struct {
|
type Domain struct {
|
||||||
Context Context
|
Context Context
|
||||||
Controller ControllerInterface
|
|
||||||
Presenter PresenterInterface
|
Presenter PresenterInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Domain) Init() {
|
func (d Domain) Init() {
|
||||||
d.Controller.Init()
|
|
||||||
d.Presenter.Init()
|
d.Presenter.Init()
|
||||||
menu_manager := MenuManager{}
|
menu_manager := MenuManager{}
|
||||||
menu_manager.Init()
|
menu_manager.Init()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package domain
|
package domain
|
||||||
|
|
||||||
type Screen struct {
|
type Screen struct {
|
||||||
Controller ControllerInterface
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScreenManager struct {
|
type ScreenManager struct {
|
||||||
|
|||||||
12
main.go
12
main.go
@@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"game/controller"
|
|
||||||
"game/domain"
|
"game/domain"
|
||||||
"game/presenter"
|
"game/presenter"
|
||||||
)
|
)
|
||||||
@@ -9,16 +8,11 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
context := domain.CreateContext()
|
context := domain.CreateContext()
|
||||||
|
|
||||||
controller := controller.Controller{
|
|
||||||
Context: context,
|
|
||||||
}
|
|
||||||
presenter := presenter.Presenter{
|
|
||||||
Context: context,
|
|
||||||
}
|
|
||||||
domain := domain.Domain{
|
domain := domain.Domain{
|
||||||
Context: context,
|
Context: context,
|
||||||
Controller: controller,
|
Presenter: presenter.Presenter{
|
||||||
Presenter: presenter,
|
Context: context,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
domain.Init()
|
domain.Init()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user