Example #1
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            // Initialise the video panel.
            playerPanel = new FLCPlayer()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Middle,
                Size         = new Vector2(320, 200),
                BottomMargin = 13
            };
            NativePanel.Components.Add(playerPanel);

            // Start video playing.
            playerPanel.Load(daedraSummoned.vidFile);
            if (playerPanel.FLCFile.ReadyToPlay)
            {
                playerPanel.Start();
            }

            // Add text message area.
            messageLabel = new MultiFormatTextLabel()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                ExtraLeading        = 3,
            };
            playerPanel.Components.Add(messageLabel);
            playerPanel.OnMouseClick += PlayerPanel_OnMouseClick;

            textCursor         = new TextCursor();
            textCursor.Enabled = false;
            playerPanel.Components.Add(textCursor);

            // Initialise message to display,
            if (daedraQuest != null)
            {   // with the quest offer message.
                Message message = daedraQuest.GetMessage((int)QuestMachine.QuestMessages.QuestorOffer);
                messageTokens = message.GetTextTokens();
            }
            else
            {   // with the textId message evaluated with mcp provided.
                messageTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(textId);
                MacroHelper.ExpandMacros(ref messageTokens, mcp);
            }
            idx = 0;
            DisplayNextTextChunk();
        }
Example #2
0
        void StartPlaying()
        {
            if (playerPanel == null || string.IsNullOrEmpty(Filename))
            {
                return;
            }

            playerPanel.Load(Filename);
            if (!playerPanel.FLCFile.ReadyToPlay)
            {
                return;
            }

            playerPanel.Start();
        }
Example #3
0
        protected override void Setup()
        {
            if (IsSetup)
            {
                return;
            }

            // Set background
            backgroundImg    = new ImgFile(Path.Combine(DaggerfallUnity.Arena2Path, nativeImgName), FileUsage.UseMemory, true);
            backgroundBitmap = backgroundImg.GetDFBitmap(0, 0);
            nativeTexture    = new Texture2D(backgroundBitmap.Width, backgroundBitmap.Height, TextureFormat.ARGB32, false);
            if (!nativeTexture)
            {
                throw new Exception("CreateCharClassQuestions: Could not load native texture.");
            }
            nativeTexture.SetPixels32(backgroundImg.GetColor32(backgroundBitmap, 0));
            nativeTexture.Apply(false, true);
            nativeTexture.filterMode      = DaggerfallUI.Instance.GlobalFilterMode;
            NativePanel.BackgroundTexture = nativeTexture;

            // Load both scroll images as one contiguous list of textures
            scrollFile0         = new GfxFile(Path.Combine(DaggerfallUnity.Instance.Arena2Path, scroll0FileName), FileUsage.UseMemory, true);
            scrollFile1         = new GfxFile(Path.Combine(DaggerfallUnity.Instance.Arena2Path, scroll1FileName), FileUsage.UseMemory, true);
            scrollFile0.Palette = backgroundBitmap.Palette;
            scrollFile1.Palette = backgroundBitmap.Palette;
            scrollTextures      = new List <Texture2D>();
            for (int i = 0; i < scrollFile0.frames.Length; i++)
            {
                scrollTextures.Add(TextureReader.CreateFromAPIImage(scrollFile0, 0, i, 0));
                scrollTextures.Last().filterMode = DaggerfallUI.Instance.GlobalFilterMode;
            }
            for (int i = scrollFile0.frames.Length; i < scrollFile0.frames.Length + scrollFile1.frames.Length; i++)
            {
                scrollTextures.Add(TextureReader.CreateFromAPIImage(scrollFile1, 0, i - scrollFile0.frames.Length, 0));
                scrollTextures.Last().filterMode = DaggerfallUI.Instance.GlobalFilterMode;
            }

            // Position scroll image on screen
            questionScroll.Position          = new Vector2(0, 120f);
            questionScroll.Size              = new Vector2(scrollTextures[0].width, scrollTextures[0].height);
            questionScroll.BackgroundTexture = scrollTextures[0];
            questionScroll.Parent            = NativePanel;
            textArea.Position = new Vector2(leftTextOffset, 120f + topTextOffset);
            textArea.Size     = new Vector2(scrollTextures[0].width, scrollTextures[0].height - topTextOffset * 2f);
            textArea.Parent   = NativePanel;
            NativePanel.Components.Add(textArea);
            NativePanel.Components.Add(questionScroll);

            // Setup question label
            questionIndices = GetQuestions();
            DisplayQuestion(questionIndices[questionsAnswered]);

            // Handle scrolling
            NativePanel.OnMouseScrollDown += NativePanel_OnMouseScrollDown;
            NativePanel.OnMouseScrollUp   += NativePanel_OnMouseScrollUp;
            questionScroll.OnMouseDown    += QuestionScroll_OnMouseDown;
            questionScroll.OnMouseUp      += QuestionScroll_OnMouseUp;

            // Setup animations
            rogueAnim.SetTransparentColor(0, 0, 10);
            rogueAnim.TransparencyEnabled = true;
            rogueAnim.Load("ROGUE.CEL");
            rogueAnim.Size            = new Vector2(rogueAnim.FLCFile.Header.Width, rogueAnim.FLCFile.Header.Height);
            rogueAnim.Position        = new Vector2(1f, 1f);
            rogueAnim.BackgroundColor = Color.clear;
            rogueAnim.OnAnimEnd      += CEL_OnAnimEnd;
            mageAnim.SetTransparentColor(0, 0, 10);
            mageAnim.TransparencyEnabled = true;
            mageAnim.Load("MAGE.CEL");
            mageAnim.Size            = new Vector2(mageAnim.FLCFile.Header.Width, mageAnim.FLCFile.Header.Height);
            mageAnim.Position        = new Vector2(79f, 1f);
            mageAnim.BackgroundColor = Color.clear;
            mageAnim.OnAnimEnd      += CEL_OnAnimEnd;
            warriorAnim.SetTransparentColor(0, 0, 10);
            warriorAnim.TransparencyEnabled = true;
            warriorAnim.Load("WARRIOR.CEL");
            warriorAnim.Size            = new Vector2(warriorAnim.FLCFile.Header.Width, warriorAnim.FLCFile.Header.Height);
            warriorAnim.Position        = new Vector2(110f, 1f);
            warriorAnim.BackgroundColor = Color.clear;
            warriorAnim.OnAnimEnd      += CEL_OnAnimEnd;
            rogueAnim.Loop = mageAnim.Loop = warriorAnim.Loop = false;
            NativePanel.Components.Add(rogueAnim);
            NativePanel.Components.Add(mageAnim);
            NativePanel.Components.Add(warriorAnim);

            IsSetup = true;
        }