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
|
||||
}
|
||||
|
||||
type Position struct {
|
||||
X int
|
||||
Y int
|
||||
}
|
||||
|
||||
type Context struct {
|
||||
Player Player
|
||||
User User
|
||||
GameField GameField
|
||||
CurrentGameField GameField
|
||||
CurrentPosition Position
|
||||
}
|
||||
|
||||
func CreateContext() Context {
|
||||
return Context{}
|
||||
return Context{
|
||||
Player: Player{},
|
||||
User: User{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
package domain
|
||||
|
||||
type ControllerInterface interface {
|
||||
Init()
|
||||
}
|
||||
|
||||
type PresenterInterface interface {
|
||||
Init()
|
||||
}
|
||||
|
||||
type Domain struct {
|
||||
Context Context
|
||||
Controller ControllerInterface
|
||||
Presenter PresenterInterface
|
||||
}
|
||||
|
||||
func (d Domain) Init() {
|
||||
d.Controller.Init()
|
||||
d.Presenter.Init()
|
||||
menu_manager := MenuManager{}
|
||||
menu_manager.Init()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package domain
|
||||
|
||||
type Screen struct {
|
||||
Controller ControllerInterface
|
||||
}
|
||||
|
||||
type ScreenManager struct {
|
||||
|
||||
12
main.go
12
main.go
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"game/controller"
|
||||
"game/domain"
|
||||
"game/presenter"
|
||||
)
|
||||
@@ -9,16 +8,11 @@ import (
|
||||
func main() {
|
||||
context := domain.CreateContext()
|
||||
|
||||
controller := controller.Controller{
|
||||
Context: context,
|
||||
}
|
||||
presenter := presenter.Presenter{
|
||||
Context: context,
|
||||
}
|
||||
domain := domain.Domain{
|
||||
Context: context,
|
||||
Controller: controller,
|
||||
Presenter: presenter,
|
||||
Presenter: presenter.Presenter{
|
||||
Context: context,
|
||||
},
|
||||
}
|
||||
domain.Init()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user