Exemplo n.º 1
0
    void Start()
    {
        bg     = GameObject.Find("Stage3BG").GetComponent <BG3> ();
        pspeed = bg.GetComponent <BG3> ().speed;

        cheight = 2 * Camera.main.orthographicSize;
        cwidth  = cheight * Camera.main.aspect;

        rend = GetComponent <SpriteRenderer> ();
        var tex = textures [Random.Range(0, textures.Length)];

        if (tex != null)
        {
            rend.sprite = tex;
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        kursiTerisi  = false;
        kursiTerisi2 = false;
        kursiTerisi3 = false;
        kursiTerisi4 = false;

        StartCoroutine(FadingAwal());

        if (TheGame.Level == 1)
        {
            BG1.SetActive(true);
            BG2.SetActive(false);
            BG3.SetActive(false);
        }
        else

        if (TheGame.Level == 2)
        {
            BG1.SetActive(false);
            BG2.SetActive(true);
            BG3.SetActive(false);
        }
        else

        if (TheGame.Level == 3)
        {
            BG1.SetActive(false);
            BG2.SetActive(false);
            BG3.SetActive(true);
        }
        else
        {
            BG1.SetActive(false);
            BG2.SetActive(false);
            BG3.SetActive(false);
        }
    }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the screen as it would be displayed by the SNES.
        /// </summary>
        /// <returns></returns>
        public Bitmap GetScreen()
        {
            if (BG1 == null || BG2 == null || BG3 == null || BG4 == null)
            {
                throw new ArgumentNullException("BGs need to be initialized");
            }
            if (FixedColor == null)
            {
                throw new ArgumentNullException("FixedColor need to be initialized");
            }
            if (Backdrop == null)
            {
                throw new ArgumentNullException("Backdrop need to be initialized");
            }


            Bitmap main, sub;
            Bitmap statusBar  = new Bitmap(LayerSizes.Width, LayerSizes.Height);
            Bitmap bg3_remain = new Bitmap(LayerSizes.Width, LayerSizes.Height);

            //cut layer 3 into status bar end rest.
            using (Graphics g = Graphics.FromImage(statusBar))
                g.DrawImageUnscaledAndClipped(BG3, new Rectangle(0, 0, statusBar.Width, StatusBarHeight));
            using (Graphics g = Graphics.FromImage(bg3_remain))
            {
                Rectangle rec = new Rectangle(0, StatusBarHeight, bg3_remain.Width, bg3_remain.Height - StatusBarHeight);
                g.DrawImageUnscaledAndClipped(BG3.Clone(rec, BG3.PixelFormat), rec);
            }


            Func <bool, bool, bool, bool, WindowMaskLogic, Bitmap, Bitmap> doWindowing = (enable1, enable2, invert1, invert2, logic, bg) =>
            {
                Bitmap mask1 = invert1 ? BitmapEffects.Invert(WindowingMask1) : WindowingMask1;
                Bitmap mask2 = invert2 ? BitmapEffects.Invert(WindowingMask2) : WindowingMask2;

                if (enable1 && enable2)
                {
                    return(BitmapEffects.ApplyMask(bg, MergeMasks(mask1, mask2, logic), 0.5f));
                }
                else if (enable1)
                {
                    return(BitmapEffects.ApplyMask(bg, mask1, 0.5f));
                }
                else if (enable2)
                {
                    return(BitmapEffects.ApplyMask(bg, mask2, 0.5f));
                }
                else
                {
                    return(bg);
                }
            };

            Bitmap bg1Windowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.BG1), Window2Enabled.HasFlag(WindowingLayers.BG1),
                                             Window1Inverted.HasFlag(WindowingLayers.BG1), Window2Inverted.HasFlag(WindowingLayers.BG1), Bg1MaskLogic, BG1);

            Bitmap bg2Windowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.BG2), Window2Enabled.HasFlag(WindowingLayers.BG2),
                                             Window1Inverted.HasFlag(WindowingLayers.BG2), Window2Inverted.HasFlag(WindowingLayers.BG2), Bg2MaskLogic, BG2);

            Bitmap statusBarWindowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.BG3), Window2Enabled.HasFlag(WindowingLayers.BG3),
                                                   Window1Inverted.HasFlag(WindowingLayers.BG3), Window2Inverted.HasFlag(WindowingLayers.BG3), Bg3MaskLogic, statusBar);

            Bitmap bg3RemainWindowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.BG3), Window2Enabled.HasFlag(WindowingLayers.BG3),
                                                   Window1Inverted.HasFlag(WindowingLayers.BG3), Window2Inverted.HasFlag(WindowingLayers.BG3), Bg3MaskLogic, bg3_remain);

            Bitmap bg4Windowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.BG4), Window2Enabled.HasFlag(WindowingLayers.BG4),
                                             Window1Inverted.HasFlag(WindowingLayers.BG4), Window2Inverted.HasFlag(WindowingLayers.BG4), Bg4MaskLogic, BG4);

            Bitmap objWindowed = doWindowing(Window1Enabled.HasFlag(WindowingLayers.OBJ), Window2Enabled.HasFlag(WindowingLayers.OBJ),
                                             Window1Inverted.HasFlag(WindowingLayers.OBJ), Window2Inverted.HasFlag(WindowingLayers.OBJ), ObjMaskLogic, OBJ);

            Bitmap colorWindowed      = BitmapEffects.FromColor(Color.Black, LayerSizes);
            Bitmap colorWindowedHoles = doWindowing(Window1Enabled.HasFlag(WindowingLayers.Color), Window2Enabled.HasFlag(WindowingLayers.Color),
                                                    Window1Inverted.HasFlag(WindowingLayers.Color), Window2Inverted.HasFlag(WindowingLayers.Color), ColorMaskLogic,
                                                    BitmapEffects.FromColor(Color.White, LayerSizes));

            //colorWindowsedHoles is white with holes where the black should be
            using (Graphics g = Graphics.FromImage(colorWindowed))
                g.DrawImage(colorWindowedHoles, 0, 0);

            #region Sub Screen
            List <Bitmap> BGs = new List <Bitmap>();
            if (SubScreenDesignation.HasFlag(ScreenDesignation.OBJ) && !Hide.HasFlag(ScreenDesignation.OBJ))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.OBJ) ? objWindowed : OBJ);
            }

            if (SubScreenDesignation.HasFlag(ScreenDesignation.BG1) && !Hide.HasFlag(ScreenDesignation.BG1))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG1) ? bg1Windowed : BG1);
            }

            if (SubScreenDesignation.HasFlag(ScreenDesignation.BG2) && !Hide.HasFlag(ScreenDesignation.BG2))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG2) ? bg2Windowed : BG2);
            }

            //layer 3 special (status bar split) onyl lower part
            if (SubScreenDesignation.HasFlag(ScreenDesignation.BG3) && !Hide.HasFlag(ScreenDesignation.BG3))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG3) ? bg3RemainWindowed : bg3_remain);
            }

            if (SubScreenDesignation.HasFlag(ScreenDesignation.BG4) && !Hide.HasFlag(ScreenDesignation.BG4))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG4) ? bg4Windowed : BG4);
            }

            BGs.Add(FixedColor);
            sub = BitmapEffects.OverlapImages(BGs.ToArray());
            #endregion

            #region Main Screen

            BGs.Clear();
            if (MainScreenDesignation.HasFlag(ScreenDesignation.OBJ) && !Hide.HasFlag(ScreenDesignation.OBJ))
            {
                Bitmap objUse = MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.OBJ) ? objWindowed : OBJ;
                if (ColorMathDesignation.HasFlag(ColorMathMode.OBJ))
                {
                    BGs.Add(ApplyColorMath(objUse, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
                }
                else
                {
                    BGs.Add(objUse);
                }
            }
            if (MainScreenDesignation.HasFlag(ScreenDesignation.BG1) && !Hide.HasFlag(ScreenDesignation.BG1))
            {
                Bitmap bg1Use = MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG1) ? bg1Windowed : BG1;
                if (ColorMathDesignation.HasFlag(ColorMathMode.BG1))
                {
                    BGs.Add(ApplyColorMath(bg1Use, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
                }
                else
                {
                    BGs.Add(bg1Use);
                }
            }
            if (MainScreenDesignation.HasFlag(ScreenDesignation.BG2) && !Hide.HasFlag(ScreenDesignation.BG2))
            {
                Bitmap bg2Use = MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG2) ? bg2Windowed : BG2;
                if (ColorMathDesignation.HasFlag(ColorMathMode.BG2))
                {
                    BGs.Add(ApplyColorMath(bg2Use, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
                }
                else
                {
                    BGs.Add(bg2Use);
                }
            }
            if (MainScreenDesignation.HasFlag(ScreenDesignation.BG3) && !Hide.HasFlag(ScreenDesignation.BG3))
            {
                //layer 3 special (status bar split) onyl lower half
                Bitmap bg3Use = MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG3) ? bg3RemainWindowed : bg3_remain;
                if (ColorMathDesignation.HasFlag(ColorMathMode.BG3))
                {
                    BGs.Add(ApplyColorMath(bg3Use, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
                }
                else
                {
                    BGs.Add(bg3Use);
                }
            }
            if (MainScreenDesignation.HasFlag(ScreenDesignation.BG4) && !Hide.HasFlag(ScreenDesignation.BG4))
            {
                Bitmap bg4Use = MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG3) ? bg4Windowed : BG4;
                if (ColorMathDesignation.HasFlag(ColorMathMode.BG4))
                {
                    BGs.Add(ApplyColorMath(bg4Use, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
                }
                else
                {
                    BGs.Add(bg4Use);
                }
            }

            //handle the backdrop too
            if (ColorMathDesignation.HasFlag(ColorMathMode.Backdrop))
            {
                BGs.Add(ApplyColorMath(Backdrop, AddColor ? FixedColor : sub, ColorMathDesignation, colorWindowed, ClipToBlack, PreventColorMath));
            }
            else
            {
                BGs.Add(Backdrop);
            }

            main = BitmapEffects.OverlapImages(BGs.ToArray());
            #endregion

            BGs.Clear();

            //check windowing for status bar
            if (MainScreenDesignation.HasFlag(ScreenDesignation.BG3) && !Hide.HasFlag(ScreenDesignation.BG3))
            {
                BGs.Add(MainScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG3) ? statusBarWindowed : statusBar);
            }
            //if not main, check subscreen. (still put it before main for display purpose)
            else if (SubScreenDesignation.HasFlag(ScreenDesignation.BG3) && !Hide.HasFlag(ScreenDesignation.BG3))
            {
                BGs.Add(SubScreenWindowMaskDesignation.HasFlag(ScreenDesignation.BG3) ? statusBarWindowed : statusBar);
            }

            BGs.Add(main);
            BGs.Add(sub);

            return(BitmapEffects.OverlapImages(BGs.ToArray()));
        }
Exemplo n.º 4
0
        private bool UpdateUI()
        {
            WindowXCaption.SetBackground(this, baseColora.Main);
            WindowXCaption.SetForeground(this, baseColora.FontM);

            BG.BeginInit();
            BG.Source = baseColora.Bgpa;
            BG.EndInit();
            BG1.BeginInit();
            BG1.Source = baseColora.Bgpa;
            BG1.EndInit();
            BG2.BeginInit();
            BG2.Source = baseColora.Bgpa;
            BG2.EndInit();
            BG3.BeginInit();
            BG3.Source = baseColora.Bgpa;
            BG3.EndInit();

            //样式
            this.T11.Foreground = baseColora.Fg;
            this.T11.FontFamily = baseColora.Fonts;
            this.T11.FontSize   = 13;
            this.T12.Foreground = baseColora.Fg;
            this.T12.FontFamily = baseColora.Fonts;
            this.T12.FontSize   = 13;
            this.T13.Foreground = baseColora.Fg;
            this.T13.FontFamily = baseColora.Fonts;
            this.T13.FontSize   = 13;
            this.T14.Foreground = baseColora.Fg;
            this.T14.FontFamily = baseColora.Fonts;
            this.T14.FontSize   = 13;
            this.T15.Foreground = baseColora.Fg;
            this.T15.FontFamily = baseColora.Fonts;
            this.T15.FontSize   = 13;
            this.T16.Foreground = baseColora.Fg;
            this.T16.FontFamily = baseColora.Fonts;
            this.T16.FontSize   = 13;
            this.T17.Foreground = baseColora.Fg;
            this.T17.FontFamily = baseColora.Fonts;
            this.T17.FontSize   = 13;
            this.T18.Foreground = baseColora.Fg;
            this.T18.FontFamily = baseColora.Fonts;
            this.T18.FontSize   = 13;
            this.T21.Foreground = baseColora.Fg;
            this.T21.FontFamily = baseColora.Fonts;
            this.T21.FontSize   = 13;
            this.T22.Foreground = baseColora.Fg;
            this.T22.FontFamily = baseColora.Fonts;
            this.T22.FontSize   = 13;
            this.T31.Foreground = baseColora.Fg;
            this.T31.FontFamily = baseColora.Fonts;
            this.T31.FontSize   = 13;
            this.T41.Foreground = baseColora.Fg;
            this.T41.FontFamily = baseColora.Fonts;
            this.T41.FontSize   = 13;

            this.MT11.Foreground = baseColora.Fg;
            this.MT11.FontFamily = baseColora.Fonts;
            this.MT11.FontSize   = 15;
            this.MT12.Foreground = baseColora.Fg;
            this.MT12.FontFamily = baseColora.Fonts;
            this.MT12.FontSize   = 15;
            this.MT13.Foreground = baseColora.Fg;
            this.MT13.FontFamily = baseColora.Fonts;
            this.MT13.FontSize   = 15;
            this.MT21.Foreground = baseColora.Fg;
            this.MT21.FontFamily = baseColora.Fonts;
            this.MT21.FontSize   = 15;
            this.MT31.Foreground = baseColora.Fg;
            this.MT31.FontFamily = baseColora.Fonts;
            this.MT31.FontSize   = 15;
            this.MT41.Foreground = baseColora.Fg;
            this.MT41.FontFamily = baseColora.Fonts;
            this.MT41.FontSize   = 15;

            this.CD11.Background = baseColora.Bg;
            this.CD12.Background = baseColora.Bg;
            this.CD13.Background = baseColora.Bg;
            this.CD21.Background = baseColora.Bg;
            this.CD32.Background = baseColora.Bg;
            this.CD41.Background = baseColora.Bg;

            this.C11.Background = baseColora.DBg;
            this.C31.Background = baseColora.DBg;
            this.C32.Background = baseColora.DBg;
            CheckBoxHelper.SetCheckedBackground(C11, baseColora.DBg);
            CheckBoxHelper.SetCheckedBackground(C31, baseColora.DBg);
            CheckBoxHelper.SetCheckedBackground(C32, baseColora.DBg);
            CheckBoxHelper.SetGlyphBrush(C11, baseColora.DBg);
            CheckBoxHelper.SetGlyphBrush(C31, baseColora.DBg);
            CheckBoxHelper.SetGlyphBrush(C32, baseColora.DBg);
            CheckBoxHelper.SetCheckedGlyphBrush(C11, baseColora.Main);
            CheckBoxHelper.SetCheckedGlyphBrush(C31, baseColora.Main);
            CheckBoxHelper.SetCheckedGlyphBrush(C32, baseColora.Main);

            this.MainTab.Background = baseColora.Bg;
            this.MainTab.Foreground = baseColora.Fg;
            TabControlHelper.SetHeaderPanelBackground(MainTab, baseColora.DBg);
            TabControlHelper.SetItemIcon(MainTab, baseColora.DBg);
            TabControlHelper.SetSelectedBackground(MainTab, baseColora.Bg);
            TabControlHelper.SetSelectedForeground(MainTab, baseColora.Fg);

            this.Theams.Background = baseColora.DBg;
            this.Theams.Foreground = baseColora.Fg;
            ComboBoxHelper.SetShadowColor(Theams, baseColora.Bg.Color);
            ComboBoxHelper.SetHoverBackground(Theams, baseColora.Bg);
            ComboBoxHelper.SetHoverForeground(Theams, baseColora.Fg);
            ComboBoxHelper.SetSelectedBackground(Theams, baseColora.DBg);
            ComboBoxHelper.SetSelectedForeground(Theams, baseColora.Fg);

            this.S11.Background = baseColora.DBg;
            this.S11.Foreground = baseColora.Fg;
            SliderHelper.SetThemeBrush(S11, baseColora.Main);
            this.S12.Background = baseColora.DBg;
            this.S12.Foreground = baseColora.Fg;
            SliderHelper.SetThemeBrush(S12, baseColora.Main);
            this.S13.Background = baseColora.DBg;
            this.S13.Foreground = baseColora.Fg;
            SliderHelper.SetThemeBrush(S13, baseColora.Main);
            this.S14.Background = baseColora.DBg;
            this.S14.Foreground = baseColora.Fg;
            SliderHelper.SetThemeBrush(S14, baseColora.Main);

            this.TopIcon.Background = baseColora.Main;
            this.TopIcon.Foreground = baseColora.FontM;
            ButtonHelper.SetHoverBrush(TopIcon, baseColora.Main);
            ButtonHelper.SetClickCoverOpacity(TopIcon, 1);
            this.MBG.Foreground = baseColora.Fg;
            this.MBG.Background = baseColora.DBg;
            this.SBG.Foreground = baseColora.Fg;
            this.SBG.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(MBG, baseColora.DBg);
            ButtonHelper.SetHoverBrush(SBG, baseColora.DBg);
            this.B21.Foreground = baseColora.Fg;
            this.B21.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(B21, baseColora.DBg);
            this.B41.Foreground = baseColora.Fg;
            this.B41.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(B41, baseColora.DBg);

            this.Password.Background  = baseColora.Bg;
            this.Password.Foreground  = baseColora.Fg;
            this.UpdateLog.Background = baseColora.Bg;
            this.UpdateLog.Foreground = baseColora.Fg;

            return(true);
        }