Example #1
0
        public UiController()
        {
            _inGameScreen = ServiceLocator.Get <InGameScreen>();
            _endScreen    = ServiceLocator.Get <EndScreen>();

            SignalBus.Subscribe <GameStartedSignal>(OnGameStarted);
            SignalBus.Subscribe <SimulationEndedSignal>(OnSimulationEnded);
        }
Example #2
0
    public void Set(OutGameScreen outGameScreen, InGameScreen inGameScreen)
    {
        ScreenContextGameDataList.Clear();

        var newScreenContextGameData = new ScreenContextGameData(outGameScreen, inGameScreen);

        ScreenContextGameDataList.Add(newScreenContextGameData);
    }
Example #3
0
    public void Init(char _letterValue, InGameScreen _gameScript)
    {
        _letterValue    = Char.ToUpper(_letterValue);
        letter          = _letterValue;
        letterText.text = _letterValue.ToString();
        gameScript      = _gameScript;

        customMaterial = letterText.gameObject.GetComponent <TextMeshProUGUI>().fontSharedMaterial;
    }
Example #4
0
        public void Dispose()
        {
            _screen.SetActive(false);
            _.GUIManager.DisposeScreen(_screen);
            _screen = null;

            _boardInformer.Border.OnBallCollides -= OnBallFallOff;
            Object.Destroy(_ball);
            Array.ForEach(_bounces, b => Object.Destroy(b.gameObject));
            _bounces = null;
        }
Example #5
0
        public Level CreateLevel(InGameScreen screen)
        {
            StaticData sdb = screen.Load <StaticData>("Entities/entities");
            ViewDB     vdb = new ViewDB();

            vdb.Put("red", screen.Load <Texture2D>("Image/red"));
            vdb.Put("blue", screen.Load <Texture2D>("Image/blue"));
            vdb.Put("bg", screen.Load <Texture2D>("Image/bg"));
            vdb.Put("anim", screen.Load <AnimatedTexture2D>("Image/test"));
            vdb.Put("animSelect", screen.Load <AnimatedTexture2D>("Image/testSelect"));
            return(new Level(screen, sdb, vdb, new Viewport(0, 0, 800, 400)));
        }
Example #6
0
        public PlayingState(StateContext context, ITinyMessengerHub messengerHub, ILogger logger, IRubiksCube cube, ITimer timer, ICubeSolvedChecker cubeSolvedChecker)
            : base(context, messengerHub, logger, cube)
        {
            this.timer             = timer;
            this.cubeSolvedChecker = cubeSolvedChecker;

            inGameScreen = new InGameScreen(messengerHub, timer);

            inGameScreen.Build();

            inGameScreen.TimerIsVisible = Context.Store.GetBool(keyTimerVisible, true);
        }
Example #7
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            font             = Content.Load <SpriteFont>("SpriteFont1");
            arial12Bold      = Content.Load <SpriteFont>("Resource/font/Arial_12_Bold");
            arial13Bold      = Content.Load <SpriteFont>("Resource/font/Arial_13_Bold");
            arial14Bold      = Content.Load <SpriteFont>("Resource/font/Arial_14_Bold");
            gautami12Regular = Content.Load <SpriteFont>("Resource/font/Gautami_12_Regular");
            gautami14Bold    = Content.Load <SpriteFont>("Resource/font/Gautami_14_Bold");
            whiteTexture     = new Texture2D(graphics.GraphicsDevice, 1, 1);
            whiteTexture.SetData(new[] { Color.White });
            zeroTexture = new Texture2D(graphics.GraphicsDevice, 1, 1);
            zeroTexture.SetData(new[] { Color.Transparent });
            whiteTextbox      = Content.Load <Texture2D>("Resource/white_textbox");
            textboxBackground = new Texture2D(graphics.GraphicsDevice, 1, 1);
            textboxBackground.SetData(new[] { new Color(0, 0, 0, 150) });
            transparentTextBox = Content.Load <Texture2D>("Resource/textbox");
            highlightedTextbox = Content.Load <Texture2D>("Resource/Highlighted_textbox");
            caret = Content.Load <Texture2D>("Resource/caret");
            scrollbarBackground      = Content.Load <Texture2D>("Resource/graphic/ScrollBarRailHorz");
            scrollbarBackground_vert = Content.Load <Texture2D>("Resource/graphic/ScrollBarRailVert");
            scrollbar           = Content.Load <Texture2D>("Resource/graphic/ScrollBarButtonHorz");
            scrollbar_horz      = Content.Load <Texture2D>("Resource/graphic/ScrollBarButtonHorz");
            scrollbar_vert      = Content.Load <Texture2D>("Resource/graphic/ScrollBarButtonVert");
            scrollbarHover_Horz = Content.Load <Texture2D>("Resource/graphic/ScrollBarHoverHorz");
            scrollbarHover_Vert = Content.Load <Texture2D>("Resource/graphic/ScrollBarHoverVert");
            panelTexture        = Content.Load <Texture2D>("Resource/graphic/Panel");

            Background_Music        = Content.Load <Song>("Resource/Music/Memoria");
            MediaPlayer.IsRepeating = true;
            //MediaPlayer.Play(Background_Music);

            mMenuScreen            = new MenuScreen(graphics, this.Content, new SivEventHandler(MenuScreenEvent), this);
            mInGameScreen          = new InGameScreen(graphics, this.Content, new SivEventHandler(InGameEvent), this);
            mHostScreen            = new HostScreen(graphics, this.Content, new SivEventHandler(HostScreenEvent), this);
            mRoomScreen            = new RoomScreen(graphics, this.Content, new SivEventHandler(RoomScreenEvent), this);
            mJoinScreen            = new JoinScreen(graphics, this.Content, new SivEventHandler(JoinScreenEvent), this);
            mCharacterSelectScreen = new CharacterSelectScreen(graphics, this.Content, new SivEventHandler(CharacterSelectScreenEvent), this);

            mCurrentScreen = mMenuScreen;

            //update_input_state();
        }
Example #8
0
        public GameInstance(GameController controller, int settingsId, Action loadingCallback)
        {
            _controller    = controller;
            _boardInformer = Object.FindObjectOfType <BoardInformer>();

            _boardInformer.Border.OnBallCollides += OnBallFallOff;

            _screen = _.GUIManager.InitializeComponent <InGameScreen>();
            _screen.SetActive(true);

            var settings = _.DataProvider.GameSettings[settingsId];

            _bounces = new BounceBehaviour[settings.Bounces.Length];
            _.FileLoader.LoadAsset <GameObject>(settings.BallRMId, ball =>
            {
                _ball = (GameObject)Object.Instantiate(ball, _boardInformer.BallPoint);
                _ball.transform.localPosition = Vector3.zero;

                var loadedCount = 0;
                for (var index = 0; index < settings.Bounces.Length; index++)
                {
                    var local = index;
                    var param = settings.Bounces[local];
                    _.FileLoader.LoadAsset <GameObject>(param.RMId,
                                                        obj =>
                    {
                        var bounce = (GameObject)Object.Instantiate(obj, _boardInformer.BounceParent, false);
                        bounce.transform.position = param.Position;
                        bounce.transform.rotation = Quaternion.Euler(param.Rotation);

                        var behaviour   = bounce.AddComponent <BounceBehaviour>();
                        behaviour.Force = param.Force;

                        _bounces[local] = behaviour;
                        ++loadedCount;
                        if (loadedCount >= settings.Bounces.Length)
                        {
                            loadingCallback.SafeInvoke();
                        }
                    });
                }
            });
        }
Example #9
0
 public GameState_InGame()
 {
     this._screen = InGameScreen.GetInstance();
 }
Example #10
0
 public void GoToNewScreen(InGameScreen newInGameScreen)
 {
     GameDataController.SetNewScreenAs(newInGameScreen);
     GoToTheSetupScene();
 }
Example #11
0
    public void Add(OutGameScreen outGameScreen, InGameScreen inGameScreen)
    {
        var newScreenContextGameData = new ScreenContextGameData(outGameScreen, inGameScreen);

        ScreenContextGameDataList.Add(newScreenContextGameData);
    }
Example #12
0
 internal void SetNewScreenAs(InGameScreen newInGameScreen)
 {
     GameData.ScreenContextStackGameData.Add(OutGameScreen.None, newInGameScreen);
 }
Example #13
0
 internal void SetBaseScreenAs(InGameScreen newInGameScreen)
 {
     GameData.ScreenContextStackGameData.Set(OutGameScreen.None, newInGameScreen);
 }
Example #14
0
        private static void Main(string[] args)
        {
            var storage = new Storage(GameContent.Instance);

            storage.Load();

            var screenResult = new ScreenTransitionResult {
                ToScreen = ScreenType.MainMenu
            };

            var exitLoop = false;

            do
            {
                switch (screenResult.ToScreen)
                {
                case ScreenType.None:
                {
                    exitLoop = true;
                    break;
                }

                case ScreenType.MainMenu:
                {
                    var screen = new MainMenuScreen(storage);
                    screenResult = screen.Process();
                    break;
                }

                case ScreenType.NewPlayer:
                {
                    var screen = new NewPlayerScreen(storage);
                    screenResult = screen.Process();
                    break;
                }

                case ScreenType.InGame:
                {
                    try
                    {
                        var screen = new InGameScreen(storage, screenResult.Result.ToString());
                        screenResult = screen.Process();
                    }
                    catch (StageNotFoundExpection ex)
                    {
                        screenResult = new ScreenTransitionResult()
                        {
                            FromScreen = ScreenType.InGame,
                            ToScreen   = ScreenType.GameVictory
                        };
                    }
                    break;
                }

                case ScreenType.GameOver:
                {
                    var screen = new GameOverScreen(storage);
                    screenResult = screen.Process();
                    break;
                }

                case ScreenType.GameVictory:
                {
                    var screen = new GameVictoryScreen(storage);
                    screenResult = screen.Process();
                    break;
                }

                default:
                {
                    throw new ApplicationException("Invalid Screen / Unhandled Screen");
                }
                }
            } while (exitLoop == false);


            //GameRunner runner = new GameRunner();
            //runner.Process();
        }
Example #15
0
 public void CopyFrom(ScreenContextGameData otherScreenContextGameData)
 {
     OutGameScreen = otherScreenContextGameData.OutGameScreen;
     InGameScreen  = otherScreenContextGameData.InGameScreen;
 }
Example #16
0
    // If has OutGameScreen, show that, since it kinda layers on top. Once that is closed, switch back to the InGameScreen.

    public ScreenContextGameData(OutGameScreen outGameScreen, InGameScreen inGameScreen)
    {
        OutGameScreen = outGameScreen;
        InGameScreen  = inGameScreen;
    }