Exemple #1
0
    public void Init()
    {
        for (int iLayer = 0; iLayer < MAXLAYERS; ++iLayer)
        {
            tLayers[iLayer]         = new LogoLayer();
            tLayers[iLayer].eColour = iLayer % 2 == 0 ? ELogoColour.Primary : ELogoColour.Secondary;

            if (iLayer <= 0)
            {
                tLayers[iLayer].eType |= ELogoType.FirstLayer;
            }
            else
            {
                tLayers[iLayer].tParent = tLayers[iLayer - 1];
            }
            if (iLayer == MAXLAYERS - 1)
            {
                tLayers[iLayer].eType |= ELogoType.LastLayer;
            }

            if (iLayer > 0 && iLayer < MAXLAYERS - 1)
            {
                tLayers[iLayer].eType |= ELogoType.Background;
            }
        }

        SetSeed(11);
    }
Exemple #2
0
 void initUI()
 {
     logoLayer             = new LogoLayer();
     logoLayer.Frame       = new RectangleF(140, 60, 100, 100);
     logoLayer.AnchorPoint = new PointF(0, 0);
     View.Layer.AddSublayer(logoLayer)
     ;
     logoView                   = new LogoView();
     logoView.Frame             = new RectangleF(20, 60, 100, 100);
     logoView.Layer.AnchorPoint = new PointF(0, 0);
     View.AddSubview(logoView);
 }
Exemple #3
0
    public void AddLogoLayerToScreen(int iLayer)
    {
        Rect      tImageRect = GetLayerRect(iLayer, false);
        Rect      tMaskRect  = GetLayerRect(iLayer, true);
        LogoLayer tLayer     = tLogoImage.tLayers[iLayer];
        string    sImageName = tLayer.GetImage();
        string    sMaskName  = tLayer.GetMask();
        Color     tImageCol  = iLayer == iCurrentLayer && !bSelectMask ? Color.cyan : Color.white;
        Color     tMaskCol   = iLayer == iCurrentLayer && bSelectMask ? Color.cyan : Color.white;

        if (sImageName.Length < 1)
        {
            sImageName = "LOGOcircle";
            if (bSelectMask || iCurrentLayer != iLayer)
            {
                tImageCol = Color.black;
            }
        }
        if (sMaskName.Length < 1)
        {
            sMaskName = "LOGOcircle";
            if (!bSelectMask || iCurrentLayer != iLayer)
            {
                tMaskCol = Color.black;
            }
        }
        FSprite tImageSprite = new FSprite(sImageName);
        FSprite tMaskSprite  = new FSprite(sMaskName);

        tScreen.AddSprite(tImageSprite);
        tScreen.AddSprite(tMaskSprite);
        tImageSprite.width  = tImageRect.width;
        tImageSprite.height = tImageRect.height;
        tImageSprite.SetPosition(tImageRect.x, tImageRect.y);
        tImageSprite.color = tImageCol;
        tMaskSprite.width  = tMaskRect.width;
        tMaskSprite.height = tMaskRect.width;
        tMaskSprite.SetPosition(tMaskRect.x, tMaskRect.y);
        tMaskSprite.color = tMaskCol;
    }
Exemple #4
0
    public void AddLogoToScreen(float fX, float fY)
    {
        tLogoImage.tColorPrimary   = tPrimary;
        tLogoImage.tColorSecondary = tSecondary;

        for (int iLayer = 0; iLayer < LogoImage.MAXLAYERS; ++iLayer)
        {
            LogoLayer tLayer = tLogoImage.tLayers[iLayer];

            bool bFirst = iLayer == 0;
            bool bLast  = iLayer == LogoImage.MAXLAYERS - 1;

            FMaskedSprite tSprite = new FMaskedSprite(tLayer.GetImage(), tLayer.GetMask());
            tScreen.AddSprite(tSprite);
            float fWidth = tLogoImage.fWidth * tLayer.GetScale();
            tSprite.width  = fWidth;
            tSprite.height = fWidth;
            float fXOffset = tLogoImage.fWidth * tLayer.GetPosition().x;
            float fYOffset = tLogoImage.fWidth * tLayer.GetPosition().y;
            tSprite.SetPosition(fX + fXOffset, fY + fYOffset);
            tSprite.color = tLogoImage.GetColour(tLayer.eColour);
        }
    }
Exemple #5
0
    public void DisplayLayer(float fX, float fY)
    {
        string[] sFilters = new string[LogoImage.FILTERCOUNT] {
            "NONE", "FirstLayer", "Background", "LastLayer", "Circular", "Mask"
        };
        float fH = 80;
        float fW = 200;

        Rect tButtonRect = new Rect(300, Screen.height - 65, Screen.width, 20);

        for (int iFilter = 0; iFilter < sFilters.Length; ++iFilter)
        {
            bool bToggle = true;
            if (iFilter > 0)
            {
                bToggle = ((int)LogoPart.ePartFilter & 1 << (iFilter - 1)) != (int)ELogoType.NONE;
            }
            if (bToggle != GUI.Toggle(new Rect(tButtonRect.x + 80 * iFilter, tButtonRect.y, 50, 20), bToggle, sFilters[iFilter]))
            {
                bToggle = !bToggle;
                int iType = 0;
                if (iFilter > 0)
                {
                    iType = 1 << (iFilter - 1);
                }
                if (bToggle)
                {
                    LogoPart.ePartFilter |= (ELogoType)iType;
                }
                else
                {
                    LogoPart.ePartFilter &= ~(ELogoType)iType;
                }

                iPage   = 0;
                bUpdate = true;
            }
        }
        if (GUI.Button(new Rect(tButtonRect.x, tButtonRect.y + 20, 150, 20), "Set Random Layer"))
        {
            if (iCurrentLayer > -1)
            {
                if (!bSelectMask)
                {
                    tLogoImage.tLayers[iCurrentLayer].sImage = "";
                    tLogoImage.tLayers[iCurrentLayer].eType  = LogoPart.ePartFilter;
                }
                else
                {
                    tLogoImage.tLayers[iCurrentLayer].sMask     = "";
                    tLogoImage.tLayers[iCurrentLayer].eMaskType = LogoPart.ePartFilter;
                }
                bUpdate = true;
            }
        }

        if (iCurrentLayer > -1)
        {
            Rect  tRect = GetLayerRect(0, true);
            float fRectX, fRectY;
            InputManager.ConvertFutilePosition(new Vector2(tRect.x, tRect.y), out fRectX, out fRectY);
            tRect.x      = fRectX + 60;
            tRect.y      = fRectY;
            tRect.width  = 100;
            tRect.height = 15;
            LogoLayer tLayer = tLogoImage.tLayers[iCurrentLayer];
            float     fXMin  = tLayer.fXMin;
            fXMin = GUI.HorizontalSlider(tRect, fXMin, -1.0f, 1.0f);
            float fXMax = tLayer.fXMax;
            tRect.y += 15;
            fXMax    = GUI.HorizontalSlider(tRect, fXMax, -1.0f, 1.0f);
            tRect.y += 30;
            float fYMin = tLayer.fYMin;
            fYMin    = GUI.HorizontalSlider(tRect, fYMin, -1.0f, 1.0f);
            tRect.y += 15;
            float fYMax = tLayer.fYMax;
            fYMax    = GUI.HorizontalSlider(tRect, fYMax, -1.0f, 1.0f);
            tRect.y += 30;
            float fSizeMin = tLayer.fSizeMin;
            fSizeMin = GUI.HorizontalSlider(tRect, fSizeMin, 0.0f, 2.0f);
            tRect.y += 15;
            float fSizeMax = tLayer.fSizeMax;
            fSizeMax = GUI.HorizontalSlider(tRect, fSizeMax, 0.0f, 2.0f);

            if (tLayer.fXMin != fXMin || tLayer.fXMax != fXMax)
            {
                tLayer.SetX(fXMin, fXMax);
                bUpdate = true;
            }
            if (tLayer.fYMin != fYMin || tLayer.fYMax != fYMax)
            {
                tLayer.SetY(fYMin, fYMax);
                bUpdate = true;
            }
            if (tLayer.fSizeMin != fSizeMin || tLayer.fSizeMax != fSizeMax)
            {
                tLayer.SetSize(fSizeMin, fSizeMax);
                bUpdate = true;
            }
        }

        Rect tTextRect = new Rect(300, Screen.height - 25, 50, 20);

        sPrimary[0]   = GUI.TextField(tTextRect, sPrimary[0]);
        tTextRect.x  += 50;
        sPrimary[1]   = GUI.TextField(tTextRect, sPrimary[1]);
        tTextRect.x  += 50;
        sPrimary[2]   = GUI.TextField(tTextRect, sPrimary[2]);
        tTextRect.x  += 80;
        sSecondary[0] = GUI.TextField(tTextRect, sSecondary[0]);
        tTextRect.x  += 50;
        sSecondary[1] = GUI.TextField(tTextRect, sSecondary[1]);
        tTextRect.x  += 50;
        sSecondary[2] = GUI.TextField(tTextRect, sSecondary[2]);

        if (float.TryParse(sPrimary[0], out tPrimary.r))
        {
            tPrimary.r /= 255.0f;
        }
        if (float.TryParse(sPrimary[1], out tPrimary.g))
        {
            tPrimary.g /= 255.0f;
        }
        if (float.TryParse(sPrimary[2], out tPrimary.b))
        {
            tPrimary.b /= 255.0f;
        }
        if (float.TryParse(sSecondary[0], out tSecondary.r))
        {
            tSecondary.r /= 255.0f;
        }
        if (float.TryParse(sSecondary[1], out tSecondary.g))
        {
            tSecondary.g /= 255.0f;
        }
        if (float.TryParse(sSecondary[2], out tSecondary.b))
        {
            tSecondary.b /= 255.0f;
        }

        tTextRect.x    += 60;
        tTextRect.width = 80;
        if (GUI.Button(tTextRect, "UPDATE"))
        {
            bUpdate = true;
        }
    }