initial commit
This commit is contained in:
15
controller/controller.go
Normal file
15
controller/controller.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
import "game/domain"
|
||||||
|
|
||||||
|
type Controller struct {
|
||||||
|
Context domain.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c Controller) Init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c Controller) Start() {
|
||||||
|
|
||||||
|
}
|
||||||
24
domain/context.go
Normal file
24
domain/context.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type User struct {
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Player struct {
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type GameField struct {
|
||||||
|
Level Level
|
||||||
|
LevelSection LevelSection
|
||||||
|
}
|
||||||
|
|
||||||
|
type Context struct {
|
||||||
|
Player Player
|
||||||
|
User User
|
||||||
|
GameField GameField
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateContext() Context {
|
||||||
|
return Context{}
|
||||||
|
}
|
||||||
26
domain/domain.go
Normal file
26
domain/domain.go
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type ControllerInterface interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
type PresenterInterface interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
type Domain struct {
|
||||||
|
Context Context
|
||||||
|
Controller ControllerInterface
|
||||||
|
Presenter PresenterInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d Domain) Init() {
|
||||||
|
menu_manager := MenuManager{}
|
||||||
|
menu_manager.Init()
|
||||||
|
// level_manager := LevelManager{}
|
||||||
|
screen_manager := ScreenManager{}
|
||||||
|
screen_manager.GetCurrent()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d Domain) Start() {
|
||||||
|
|
||||||
|
}
|
||||||
27
domain/level.go
Normal file
27
domain/level.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type LevelSection struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type Level struct {
|
||||||
|
LevelSections []LevelSection
|
||||||
|
}
|
||||||
|
|
||||||
|
type LevelManager struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (lm LevelManager) Create(screens []LevelSection) Level {
|
||||||
|
return Level{
|
||||||
|
LevelSections: screens,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (lm LevelManager) List() []Level {
|
||||||
|
return []Level{
|
||||||
|
lm.Create(LevelOne()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (lm LevelManager) Get() Level {
|
||||||
|
return Level{}
|
||||||
|
}
|
||||||
5
domain/level.one.go
Normal file
5
domain/level.one.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
func LevelOne() []LevelSection {
|
||||||
|
return []LevelSection{}
|
||||||
|
}
|
||||||
54
domain/menu.go
Normal file
54
domain/menu.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type MenuItem struct {
|
||||||
|
ID string
|
||||||
|
Label string
|
||||||
|
Handler func()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Menu struct {
|
||||||
|
MenuItems []MenuItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type MenuManager struct {
|
||||||
|
MainMenu Menu
|
||||||
|
GameMenu Menu
|
||||||
|
}
|
||||||
|
|
||||||
|
func createMenu(menuItems []MenuItem) Menu {
|
||||||
|
menu := Menu{
|
||||||
|
MenuItems: menuItems,
|
||||||
|
}
|
||||||
|
return menu
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mm MenuManager) Init() {
|
||||||
|
|
||||||
|
mo := MenuOperation{}
|
||||||
|
|
||||||
|
mm.MainMenu = createMenu([]MenuItem{
|
||||||
|
{
|
||||||
|
ID: "new",
|
||||||
|
Label: "New Game",
|
||||||
|
Handler: mo.StartGame,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "load",
|
||||||
|
Label: "Load Game",
|
||||||
|
Handler: mo.LoadtGame,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
mm.GameMenu = createMenu([]MenuItem{
|
||||||
|
{
|
||||||
|
ID: "save",
|
||||||
|
Label: "Save Game",
|
||||||
|
Handler: mo.SaveGame,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: "close",
|
||||||
|
Label: "Close Game",
|
||||||
|
Handler: mo.CloseGame,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
16
domain/menu.operation.go
Normal file
16
domain/menu.operation.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type MenuOperation struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mo MenuOperation) CloseGame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mo MenuOperation) LoadtGame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mo MenuOperation) SaveGame() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mo MenuOperation) StartGame() {
|
||||||
|
}
|
||||||
13
domain/screen.go
Normal file
13
domain/screen.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package domain
|
||||||
|
|
||||||
|
type Screen struct {
|
||||||
|
Controller ControllerInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScreenManager struct {
|
||||||
|
Context Context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sm ScreenManager) GetCurrent() Screen {
|
||||||
|
return Screen{}
|
||||||
|
}
|
||||||
30
main.go
Normal file
30
main.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"game/controller"
|
||||||
|
"game/domain"
|
||||||
|
"game/presenter"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
context := domain.CreateContext()
|
||||||
|
|
||||||
|
controller := controller.Controller{
|
||||||
|
Context: context,
|
||||||
|
}
|
||||||
|
controller.Init()
|
||||||
|
|
||||||
|
presenter := presenter.Presenter{
|
||||||
|
Context: context,
|
||||||
|
}
|
||||||
|
presenter.Init()
|
||||||
|
|
||||||
|
domain := domain.Domain{
|
||||||
|
Context: context,
|
||||||
|
}
|
||||||
|
domain.Init()
|
||||||
|
|
||||||
|
domain.Start()
|
||||||
|
controller.Start()
|
||||||
|
presenter.Start()
|
||||||
|
}
|
||||||
19
presenter/presenter.go
Normal file
19
presenter/presenter.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package presenter
|
||||||
|
|
||||||
|
import "game/domain"
|
||||||
|
|
||||||
|
type Presenter struct {
|
||||||
|
Context domain.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Presenter) Init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Presenter) Start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Presenter) Process() {
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user