Exemple #1
0
        public WorldView(World world, CameraClampMode cameraClampMode, InputHandler input)
        {
            _gameConfigCache = CallContext <GameConfigCache> .GetData("GameConfigCache");

            World             = world;
            GameStatusHandler = new GameStatusHandler(GameStatus.OverlandMap);

            Input = input;

            Camera = new Camera(this, new Rectangle(0, 0, 1680, 1080), cameraClampMode, Input);
            var globalContextPresentation = CallContext <GlobalContextPresentation> .GetData("GlobalContextPresentation");

            globalContextPresentation.Camera = Camera;

            OverlandMapView         = new OverlandMapView(this, World.OverlandMap, Input);
            OverlandSettlementViews = new OverlandSettlementViews(this, World.Settlements, Input);
            StackViews     = new StackViews(this, World.Stacks, Input);
            SettlementView = new SettlementView(this, World.Settlements.Count > 0 ? World.Settlements[0] : new Settlement("Test", 1, PointI.Zero, 1, World.OverlandMap.CellGrid, new int[0]), Input);
            HudView        = new HudView(this, StackViews, Input);
            //Tooltip = new Tooltip(Vector2.Zero, Alignment.TopLeft, new Vector2(200.0f, 300.0f), "GUI_Textures_1.sp_frame", 25, 25, 25, 25, "tooltip") { Enabled = false };

            var context = CallContext <GlobalContextPresentation> .GetData("GlobalContextPresentation");

            Viewport        = new Viewport(0, 0, Camera.GetViewport.Width, Camera.GetViewport.Height, 0.0f, 1.0f);
            ViewportAdapter = new ScalingViewportAdapter(context.GraphicsDevice, Camera.GetViewport.Width, Camera.GetViewport.Height);

            MovementTypeImages = InitializeMovementTypeImages();
            ActionButtons      = InitializeActionButtons();
        }
Exemple #2
0
 public Game()
 {
     InitializeComponent();
     ball             = new Ball();
     status           = new GameStatus();
     pitcher          = new Pitcher();
     umpire           = new Umpire();
     random           = new Random();
     ball.BallInPlay += pitcher.Say;
     ball.BallInPlay += pitcher.SayOther;
     ball.BallInPlay += this.UpdateResults;
     outEvent        += umpire.Say;
 }
 void Start()
 {
     level = FindObjectOfType <LevelHandler>();
     level.AddToBreakableBlocks();
     gameStatus = FindObjectOfType <GameStatusHandler>();
 }
Exemple #4
0
 internal void UnsubscribeFromStatusChanges(string owner)
 {
     GameStatusHandler.UnsubscribeFromStatusChanges(owner);
 }
Exemple #5
0
 internal void SubscribeToStatusChanges(string owner, Action <GameStatus, GameStatus, string> action)
 {
     GameStatusHandler.SubscribeToStatusChanges(owner, action);
 }
Exemple #6
0
 internal void ChangeState(GameStatus from, GameStatus to)
 {
     GameStatusHandler.ChangeStatus(from, to);
 }