Ejemplo n.º 1
0
    public static void ShowWindow()
    {
        // INIT WINDOW
        window = GetWindow <PIAEditorWindow>();
        Vector2 windowSize = new Vector2(995, 800);

        window.position = new Rect(Screen.width / 2 - windowSize.x / 2, 100, windowSize.x, windowSize.y);
        window.minSize  = new Vector2(600, 200);
        Texture2D windowIcon = Application.HasProLicense()? PIATextureDatabase.Instance.GetTexture("brush") : PIATextureDatabase.Instance.GetTexture("brushblack");

        window.titleContent             = new GUIContent("Pixel Editor", windowIcon);
        window.autoRepaintOnSceneChange = false;
        window.Show();
    }
Ejemplo n.º 2
0
    private void OnEnable()
    {
        if (_instance == null)
        {
            _instance = this;
        }

        //DRAWER
        drawer = new PIADrawer();
        grid   = new PIAGrid();

        //INIT INPUT AREAS
        globalInputArea              = new PIAInputArea();
        globalInputArea.OnGUIUpdate += ChangeSelectedTool;
        bodyInputArea              = new PIAInputArea();
        bodyInputArea.OnGUIUpdate += ChangeImageScaleMultiplier;
        bodyInputArea.OnGUIUpdate += (e) => drawer.OnGUIExecute(e, mouseCellCoordinate);
        bodyInputArea.OnGUIUpdate += ChangeImageOffset;
        SelectionTexture           = new PIATexture();
        SelectionTexture.Init(PIASession.Instance.ImageData.Width, PIASession.Instance.ImageData.Height, 0);

        //INIT WINDOW SECTIONS
        InitializeSections();

        //INIT GRAPHICS
        skin             = Resources.Load <GUISkin>("Skins/PIAPixelArtEditorSkin");
        pen              = PIATextureDatabase.Instance.GetTexture("pen");
        eraser           = PIATextureDatabase.Instance.GetTexture("eraser");
        squareTool       = PIATextureDatabase.Instance.GetTexture("squaretool");
        filledSquareTool = PIATextureDatabase.Instance.GetTexture("filledsquaretool");
        selectionBox     = PIATextureDatabase.Instance.GetTexture("selectionbox");
        ditheringTool    = PIATextureDatabase.Instance.GetTexture("ditheringtool");
        selectedToolBG   = PIATextureDatabase.Instance.GetTexture("sideslight");
        blackBarBG       = new Texture2D(1, 1);
        blackBarBG.SetPixel(0, 0, blackBarBGColor);
        blackBarBG.Apply();
    }