Exemplo n.º 1
0
    void Awake()
    {
        canvas = gameObject.GetComponent <CanvasController>();
        Rect camRect = new Rect(screenOffset.left,
                                screenOffset.bottom, Screen.width - screenOffset.horizontal, Screen.height - screenOffset.vertical);

        canvasConfig = canvas.config;



        if (texture == null)
        {
            canvasConfig.canvasSize = new IntVector2(1024, 768);
        }
        else
        {
            canvasConfig.canvasSize = new IntVector2(texture.width, texture.height);
        }

        CanvasCameraConfig camConfig = new CanvasCameraConfig();

        camConfig.camMinSize      = 10;
        camConfig.screenPixelRect = camRect;
        canvas.initialize(canvasConfig, camConfig, texture);

        testDrawing();
        oldWidth  = Screen.width;
        oldHeight = Screen.height;
    }
Exemplo n.º 2
0
 void prebuildCanvasCamConfig()
 {
     canvasCameraConfig             = new CanvasCameraConfig();
     canvasCameraConfig.bgColor     = canvasCamBGColor;
     canvasCameraConfig.camMinSize  = canvasCamMinSize;
     canvasCameraConfig.cameraDepth = canvasCamDepth;
 }
Exemplo n.º 3
0
 public void updateCameraConfig(CanvasCameraConfig camConfig)
 {
     camera.backgroundColor = camConfig.bgColor;
     camera.depth           = camConfig.cameraDepth;
     minSize = camConfig.camMinSize;
     camera.backgroundColor = camConfig.bgColor;
     camera.depth           = camConfig.cameraDepth;
     updateCameraParameters(camConfig.screenPixelRect, canvasSize);
 }
Exemplo n.º 4
0
 public CanvasCamera(CanvasCameraConfig camConfig, IntVector2 canvasSize, GameObject parent)
 {
     camRelativePosition = new CanvasCameraRelativePosition();
     go = new GameObject("canvas camera");
     go.transform.parent = parent.transform;
     go.transform.position = Vector3.zero;
     camera = go.AddComponent<Camera>();
     camera.orthographic = true;
     this.canvasSize = canvasSize.toVector2();
     updateCameraConfig(camConfig);
     updateCameraParameters(camConfig.screenPixelRect, canvasSize);
 }
Exemplo n.º 5
0
 public CanvasCamera(CanvasCameraConfig camConfig, IntVector2 canvasSize, GameObject parent)
 {
     camRelativePosition = new CanvasCameraRelativePosition();
     go = new GameObject("canvas camera");
     go.transform.parent   = parent.transform;
     go.transform.position = Vector3.zero;
     camera = go.AddComponent <Camera>();
     camera.orthographic = true;
     this.canvasSize     = canvasSize.toVector2();
     updateCameraConfig(camConfig);
     updateCameraParameters(camConfig.screenPixelRect, canvasSize);
 }
Exemplo n.º 6
0
    public void initialize(CanvasConfig config, CanvasCameraConfig canvasCameraConfig, Texture2D texture = null)
    {
        canvasBuffer   = new CanvasBuffer(config.canvasSize, config.bufferSize);
        this.config    = config;
        canvasCamera   = new CanvasCamera(canvasCameraConfig, config.canvasSize, gameObject);
        backLayer      = new CanvasLayer(config.canvasSize, 100, config.layersShader, canvasCamera);
        frontLayer     = new CanvasLayer(config.canvasSize, 20, config.layersShader, canvasCamera);
        radialLayer    = new CanvasRadialLayer(config.canvasSize, 25, config.radialFillShader, config.radialFillTexture, canvasCamera);
        canvasCollider = CanvasCollider.createCanvasCollider(config.canvasSize, 10, gameObject, canvasCamera);

        setNewPicture(texture);
        initialized = true;

        handleInnerEvents();
    }
Exemplo n.º 7
0
    void Awake()
    {
        canvas = gameObject.GetComponent<CanvasController>();
        Rect camRect = new Rect(screenOffset.left,
                                screenOffset.bottom, Screen.width - screenOffset.horizontal, Screen.height - screenOffset.vertical);

        canvasConfig = canvas.config;

        if (texture == null)
            canvasConfig.canvasSize = new IntVector2(1024,768);
        else
            canvasConfig.canvasSize = new IntVector2(texture.width, texture.height);

        CanvasCameraConfig camConfig = new CanvasCameraConfig();
        camConfig.camMinSize = 10;
        camConfig.screenPixelRect = camRect;
        canvas.initialize(canvasConfig, camConfig, texture);

        testDrawing();
        oldWidth = Screen.width;
        oldHeight = Screen.height;
    }
Exemplo n.º 8
0
 public void updateCameraConfig(CanvasCameraConfig canvasCameraConfig)
 {
     canvasCamera.updateCameraConfig(canvasCameraConfig);
 }
 void prebuildCanvasCamConfig()
 {
     canvasCameraConfig = new CanvasCameraConfig();
     canvasCameraConfig.bgColor = canvasCamBGColor;
     canvasCameraConfig.camMinSize = canvasCamMinSize;
     canvasCameraConfig.cameraDepth = canvasCamDepth;
 }
Exemplo n.º 10
0
 public void updateCameraConfig(CanvasCameraConfig canvasCameraConfig)
 {
     canvasCamera.updateCameraConfig(canvasCameraConfig);
 }
Exemplo n.º 11
0
    public void initialize(CanvasConfig config, CanvasCameraConfig canvasCameraConfig, Texture2D texture=null)
    {
        canvasBuffer = new CanvasBuffer(config.canvasSize, config.bufferSize);
        this.config = config;
        canvasCamera = new CanvasCamera(canvasCameraConfig, config.canvasSize, gameObject);
        backLayer = new CanvasLayer(config.canvasSize, 100, config.layersShader, canvasCamera);
        frontLayer = new CanvasLayer(config.canvasSize, 20, config.layersShader, canvasCamera);
        radialLayer = new CanvasRadialLayer(config.canvasSize, 25, config.radialFillShader, config.radialFillTexture, canvasCamera);
        canvasCollider = CanvasCollider.createCanvasCollider (config.canvasSize, 10, gameObject, canvasCamera);

        setNewPicture(texture);
        initialized = true;

        handleInnerEvents();
    }
Exemplo n.º 12
0
 public void updateCameraConfig(CanvasCameraConfig camConfig)
 {
     camera.backgroundColor = camConfig.bgColor;
     camera.depth = camConfig.cameraDepth;
     minSize = camConfig.camMinSize;
     camera.backgroundColor = camConfig.bgColor;
     camera.depth = camConfig.cameraDepth;
     updateCameraParameters(camConfig.screenPixelRect, canvasSize);
 }