Exemplo n.º 1
0
        public Kh2Field(
            Kernel kernel,
            Camera camera,
            Dictionary <string, string> settings,
            GraphicsDevice graphicsDevice,
            KingdomShader shader,
            InputManager inputManager)
        {
            _kernel         = kernel;
            _camera         = camera;
            _targetCamera   = new TargetCamera(_camera);
            _graphicsDevice = graphicsDevice;
            _shader         = shader;
            _inputManager   = inputManager;

            var viewport = graphicsDevice.Viewport;

            _drawing = new MonoSpriteDrawing(graphicsDevice, _shader);
            _drawing.SetProjection(
                viewport.Width,
                viewport.Height,
                Global.ResolutionWidth,
                Global.ResolutionHeight,
                1.0f);
            _messageRenderer    = new Kh2MessageRenderer(_drawing, _kernel.EventMessageContext);
            _messageDrawContext = new DrawContext
            {
                IgnoreDraw = false,

                x           = 0,
                y           = 0,
                xStart      = 0,
                Width       = 0,
                Height      = 0,
                WindowWidth = 512,

                Scale           = 1,
                WidthMultiplier = 1,
                Color           = new ColorF(1.0f, 1.0f, 1.0f, 1.0f)
            };
            _eventMessageProvider = new Kh2MessageProvider();

            _spawnScriptMap = settings.GetInt("SpawnScriptMap", -1);
            _spawnScriptBtl = settings.GetInt("SpawnScriptBtl", -1);
            _spawnScriptEvt = settings.GetInt("SpawnScriptEvt", -1);
            FadeFromBlack(1.0f);
        }
Exemplo n.º 2
0
        public void Initialize(StateInitDesc initDesc)
        {
            Kernel          = initDesc.Kernel;
            _archiveManager = initDesc.ArchiveManager;
            InputManager    = initDesc.InputManager;
            _stateChange    = initDesc.StateChange;

            var viewport = initDesc.GraphicsDevice.GraphicsDevice.Viewport;

            _shader = new KingdomShader(initDesc.ContentManager);
            drawing = new MonoSpriteDrawing(initDesc.GraphicsDevice.GraphicsDevice, _shader);
            drawing.SetProjection(
                viewport.Width,
                viewport.Height,
                Global.ResolutionWidth,
                Global.ResolutionHeight,
                1.0f);

            if (Kernel.IsReMix)
            {
                _archiveManager.LoadArchive($"menu/{Kernel.Region}/titlejf.2ld");
            }
            _archiveManager.LoadArchive($"menu/{Kernel.Region}/title.2ld");
            _archiveManager.LoadArchive($"menu/{Kernel.Region}/save.2ld");

            _isTheaterModeUnlocked = false;
            if (Kernel.IsReMix)
            {
                if (_isTheaterModeUnlocked)
                {
                    _titleLayoutDesc = ReMixTheaterTitleLayout;
                }
                else
                {
                    _titleLayoutDesc = ReMixTitleLayout;
                }
            }
            else if (Kernel.RegionId == Kh2.Constants.RegionFinalMix)
            {
                if (_isTheaterModeUnlocked)
                {
                    _titleLayoutDesc = FinalMixTheaterTitleLayout;
                }
                else
                {
                    _titleLayoutDesc = FinalMixTitleLayout;
                }
            }
            else
            {
                _titleLayoutDesc = VanillaTitleLayout;
            }

            var messageContext = Kernel.SystemMessageContext;

            _messageRenderer = new Kh2MessageRenderer(drawing, messageContext);

            IEnumerable <ISpriteTexture> images;

            (_titleLayout, images) = GetLayoutResources("titl", "titl");

            layoutRendererBg = new LayoutRenderer(_titleLayout, drawing, images);
            layoutRendererFg = new LayoutRenderer(_titleLayout, drawing, images);
            layoutRendererBg.SelectedSequenceGroupIndex = _titleLayoutDesc.Copyright;
            _sequenceRendererMenu = new SequenceRenderer(_titleLayout.SequenceItems[0], drawing, images.First());

            Log.Info($"Theater={_titleLayoutDesc.HasTheater}");
            if (_titleLayoutDesc.HasTheater)
            {
                (_theaterLayout, images) = GetLayoutResources("even", "even");
                layoutRendererTheater    = new LayoutRenderer(_theaterLayout, drawing, images);
            }


            SetOption(0);
        }
Exemplo n.º 3
0
        public void Initialize(StateInitDesc initDesc)
        {
            _kernel         = initDesc.Kernel;
            _content        = initDesc.DataContent;
            _archiveManager = initDesc.ArchiveManager;
            Input           = initDesc.Input;

            var viewport = initDesc.GraphicsDevice.GraphicsDevice.Viewport;

            _shader  = new KingdomShader(initDesc.ContentManager);
            _drawing = new MonoSpriteDrawing(initDesc.GraphicsDevice.GraphicsDevice, _shader);
            _drawing.SetProjection(
                viewport.Width,
                viewport.Height,
                Global.ResolutionWidth,
                Global.ResolutionHeight,
                1.0f);
            initDesc.GraphicsDevice.GraphicsDevice.DepthStencilState = new Microsoft.Xna.Framework.Graphics.DepthStencilState
            {
                DepthBufferEnable = false,
                StencilEnable     = false,
            };

            var messageContext = _kernel.SystemMessageContext;

            _messageRenderer = new Kh2MessageRenderer(_drawing, messageContext);

            _archiveManager.LoadArchive($"menu/{_kernel.Region}/camp.2ld");
            (_campLayout, _textures) = GetLayoutResources("camp", "camp");
            _layoutRenderer          = new LayoutRenderer(_campLayout, _drawing, _textures)
            {
                SelectedSequenceGroupIndex = 0
            };

            SequenceFactory = new AnimatedSequenceFactory(
                _drawing,
                initDesc.Kernel.MessageProvider,
                _messageRenderer,
                _kernel.SystemMessageContext.Encoder,
                _campLayout.SequenceItems[1],
                _textures.First());

            _backgroundSeq = SequenceFactory.Create(new List <AnimatedSequenceDesc>
            {
                new AnimatedSequenceDesc
                {
                    SequenceIndexStart = 107,
                    SequenceIndexLoop  = 108,
                    SequenceIndexEnd   = 109,
                },
                new AnimatedSequenceDesc
                {
                    SequenceIndexStart = 110,
                    SequenceIndexLoop  = 111,
                    SequenceIndexEnd   = 112,
                },
                new AnimatedSequenceDesc
                {
                    SequenceIndexStart = 113,
                    SequenceIndexLoop  = 114,
                    SequenceIndexEnd   = 115,
                }
            });
            _subMenuDescriptionSeq = SequenceFactory.Create(new List <AnimatedSequenceDesc>());
        }