Skip to content
Snippets Groups Projects

Territory management

Merged FERNANDES SAMUEL requested to merge territory-management into develop
Compare and
46 files
+ 2203
0
Preferences
Compare changes
Files
46
+ 242
0
@startuml
!theme reddress-darkgreen
/' -------------------------------
- OBJECTS
-- '/
/' all globals class '/
package GameMaster {
/' MASTER / START '/
class MainScene{
- MainScene()
+ {override} _Ready()
}
/' data loading and reading '/
package Data{
class "<<static>>\nDataManager" as DataManager{
+ {static} LoadTexture(path : string) : Texture2D
+ {static} ReadFile(fileName : string) : StreamReader
+ {static} ReadBuildingDatabase() : StreamReader
}
}
/' personals exceptions '/
package Exceptions {
class UnplaceableException {
+ UnplaceableException()
+ UnplaceableException(gridSize : int, xPlusSize : int, yPlusSize : int)
+ UnplaceableException(actual : CellKind, necessary : CellKind)
+ UnplaceableException(coordinates : Vector2I)
}
}
package GameContext{
class "<<static>>\nGlobalTools" as GlobalTools {
+ TranslateToFlowKind(what : string) : FlowKind
}
interface IVerbosable {
+ Verbose() : string
}
class "<<static>>\nOurPaths" as OurPaths {
+ {static} {readonly} RESSOURCES = "Ressources/" : string
+ {static} {readonly} NODES = "Nodes/" : string
+ {static} {readonly} IMAGES = RESSOURCES + "Images/" : string
+ {static} {readonly} TEXTURES = RESSOURCES + "Textures/" : string
+ {static} {readonly} PROGRAMS = "Programs/" : string
/' etc '/
}
}
package TestsZone {
/' node for tests '/
class Lab {
- Lab()
+ {override} _Ready()
}
class TestsProvider {
- scene : Node
+ TestsProvider(scene : Node)
+ {static} TCellModel()
+ {static} TGrassModel()
+ {static} TBuildingModel()
+ {static} TGridModel()
+ TCellView(print : bool)
+ TGrassView(print : bool)
+ TBuildingView(print : bool)
+ TBuildingFactory(print : bool)
+ TBuildingFactory_WithUnprovidedTexture(print : bool)
+ TGridFactory_GrassOnly(coordinates : Vector2I, print : bool)
+ TGridFactory_WithBuildings(coordinates : Vector2I, print : bool)
+ TGridFactory_WithConflicts(coordinates : Vector2I, print : bool)
- PrintChildrenCount()
}
}
}
/' TerritoryManagement '/
package TerritoryManagement {
package Model{
package Cell{
enum CellKind{
BUILDING,
WASTELAND
}
class CellModel{
- {readonly} name : string
+ CellModel()
+ CellModel(name : string, kind : CellKind)
+ GetName() : string
+ GetKind() : CellKind
}
class GrassModel extends CellModel {
+ GrassModel()
}
}
package Grid{
class GridModel{
- {readonly} size : int
+ GridModel(size : int)
+ GetSize() : int
+ PlaceAt(grass : GrassModel, line : int, column : int, callForUpdate : bool)
+ GetCellAt(line : int, column : int) : CellModel
+ PlaceAt(placeable : IPlaceable, line : int, column : int, callForUpdate : bool)
+ GetPlaceableAt(line : int, column : int) : IPlaceable
+ GetAllPlacements() : (Vector2I, IPlaceable)[*]
+ AddObserver(observer : IGridObserver)
+ RemoveObserver(observer : IGridObserver)
+ NotifyGridChanged()
}
}
package Placeables {
interface IPlaceable {
+ GetName() : string
+ GetComposition() : CellModel
}
enum FlowKind {
ELECRICITY,
RAW_MATERIAL,
WATER,
CEREALS,
MANUFACTURED_MERCHANDISE,
WOOD,
WOODEN_PLANK
}
enum InfluenceScale {
REGIONAL,
NATIONAL,
WORLDWIDE
}
class BuildingModel extends TerritoryManagement.Model.Cell.CellModel implements IPlaceable{
- {readonly} impacts : Real[*]
+ BuildingModel(name : string, impacts : Real[3], influence : InfluenceScale,\n\tneeds : FlowKind[*], production : : FlowKind[*])
+ GetInfluence() : InfluenceScale
+ GetImpacts() : Real[*]
+ ^GetComposition() : CellModel
+ GetNeedsKind() : FlowKind[*]
+ GetQuantityNeeded(kind : FlowKind) : int
+ GetProductionKind() : FlowKind[*]
+ GetQuantityProduced(kind : FlowKind) : int
}
}
}
package Observers {
interface IGridObserver{
+ UpdateMap(grid : GridModel)
}
}
package View{
class BuildingView extends CellView {
- name : string
- texture : Texture2D
- BuildingView()
+ {static} Design(model : BuildingModel, texture : Texture2D) : BuildingView
+ {override} _Ready()
}
class CellView {
# {static} {readonly} defaultTexturePath : string
+ {static} {readonly} globalSize : Real
# CellModel()
+ {static} Design() : CellView
+ {override} _Ready()
# ChangeSkin(name : string)
# ChangeSkin(skin : Texture2D)
+ {static} GetGlobalSize() : Real
- OnMouseOver()
- OnMouseExit()
}
class GrassView extends CellView {
# {static} {readonly} grassTexturePath : string
# GrassView()
+ {static} {override} Design() : GrassView
+ {override} _Ready()
}
class GridView implements TerritoryManagement.Observers.IGridObserver {
- GridView()
+ {static} Design() : GridView
+ ^UpdateMap(grid : GridModel)
}
}
package Factories{
class "<<static>>\nBuildingFactory" as BuildingFactory{
+ {static} LoadModel(name : string, influence : InfluenceScale) : BuildingModel
+ {static} CreateView(model : BuildingModel) : BuildingView
}
class "<<static>>\nGridFactory" as GridFactory{
+ {static} CreateWasteland(size : int) : GridModel
+ {static} CreateView(model : GridModel) : GridView
}
}
}
package Hud {
package Gauges {
class GaugeModel
class GaugeView
}
}
/' -------------------------------
- AGREGATIONS / COMPOSITIONS
-- '/
CellModel o..> CellKind : < define\n- {readonly} kind
GridModel *..> " * "CellModel : < compose\n- {readonly} cells
GridModel *..> " * "TerritoryManagement.Model.Placeables.IPlaceable : < positions into her\n - {readonly} placemenTable
GridModel o..> " * "TerritoryManagement.Observers.IGridObserver : < notifies\n - {readonly} observers
GridFactory ..> " * "TerritoryManagement.Model.Grid.GridModel
GridFactory ..> " * "TerritoryManagement.View.GridView
BuildingFactory ..> " * "TerritoryManagement.Model.Placeables.BuildingModel
BuildingModel o..> " 3 "InfluenceScale : < defines the scope of influence and the quantities produced/needed\n - {static} {readonly} MULTIPLICATION_RATE
BuildingModel o..> " 1 "InfluenceScale : < defines influence scale of\n - {readonly} influence
BuildingModel o..> " * "FlowKind : < needs a specific quantity of\n - {readonly} needs
BuildingModel o..> " * "FlowKind : < products a specific quantity of\n - {readonly} production
GridView *..> " * "CellView : < stores and displays\n - children
MainScene *..> "1"GridModel : > create and store\n - grid
MainScene *..> "3"Hud.Gauges.GaugeModel : > create and store\n - gauge
MainScene *..> "1"TerritoryManagement.View.GridView : > show
MainScene *..> "3"Hud.Gauges.GaugeView : > show
Lab o..> " 1 "TestsProvider : < provide test patterns
@enduml