Beispiel #1
0
    public override void OnAwake()
    {
        base.OnAwake();

        VerifySizingForEmptyObject();
        VerifySizingForEmptyParent();

        if (ViewportWidth > ViewportHeight)
        {
            ViewportWidth = 10f;
        }
        else
        {
            ViewportHeight = 10f;
        }

        _sizeChart      = CinchSprite.NewFromImage("SizeChart", 100f, RegistrationPoint.BottomLeft);
        _sizeChart.Name = "SizeChart";
        _sizeChart.X    = ViewportWidth / -2;
        _sizeChart.Y    = ViewportHeight / -2;
        AddChild(_sizeChart);

        //give it a weird pixels-per-meter to make sure it's not an even width in meters
        _earthContainer = Library.New <DisplayObjectContainer>("EarthContainer");
        _earthContainer.SetPosition(3, 7);
        AddChild(_earthContainer);
        var innerContainer = Library.New <DisplayObjectContainer>("InnerContainer");

        _earthContainer.AddChild(innerContainer);
        var yetAnotherContainer = Library.New <DisplayObjectContainer>("YetAnotherContainer");

        innerContainer.AddChild(yetAnotherContainer);
        var earth = CinchSprite.NewFromImage("Earth", 158f, RegistrationPoint.Center);

        earth.MouseEnabled = true;
        earth.Name         = "Earth";
        earth.AddEventListener <MouseEvent>(MouseEvent.MOUSE_DOWN, onEarthPress);
        yetAnotherContainer.AddChild(earth);

        //give it a weird pixels-per-meter to make sure it's not an even width in meters
        _mars = CinchSprite.NewFromImage("Mars", 212f, RegistrationPoint.BottomLeft);
        _mars.MouseEnabled = true;
        _mars.Name         = "Mars";
        _mars.SetPosition(.5f, .5f);
        _mars.AddEventListener <MouseEvent>(MouseEvent.MOUSE_DOWN, onMarsPress);
        AddChild(_mars);
    }
Beispiel #2
0
    public override void OnAwake()
    {
        base.OnAwake();

        VerifySizingForEmptyObject();
        VerifySizingForEmptyParent();

        if (ViewportWidth > ViewportHeight)
            ViewportWidth = 10f;
        else
            ViewportHeight = 10f;

        _sizeChart = CinchSprite.NewFromImage("SizeChart", 100f, RegistrationPoint.BottomLeft);
        _sizeChart.Name = "SizeChart";
        _sizeChart.X = ViewportWidth/-2;
        _sizeChart.Y = ViewportHeight/-2;
        AddChild(_sizeChart);

        //give it a weird pixels-per-meter to make sure it's not an even width in meters
        _earthContainer = Library.New<DisplayObjectContainer>("EarthContainer");
        _earthContainer.SetPosition(3, 7);
        AddChild(_earthContainer);
        var innerContainer = Library.New<DisplayObjectContainer>("InnerContainer");
        _earthContainer.AddChild(innerContainer);
        var yetAnotherContainer = Library.New<DisplayObjectContainer>("YetAnotherContainer");
        innerContainer.AddChild(yetAnotherContainer);
        var earth = CinchSprite.NewFromImage("Earth", 158f, RegistrationPoint.Center);
        earth.MouseEnabled = true;
        earth.Name = "Earth";
        earth.AddEventListener<MouseEvent>(MouseEvent.MOUSE_DOWN, onEarthPress);
        yetAnotherContainer.AddChild(earth);

        //give it a weird pixels-per-meter to make sure it's not an even width in meters
        _mars = CinchSprite.NewFromImage("Mars", 212f, RegistrationPoint.BottomLeft);
        _mars.MouseEnabled = true;
        _mars.Name = "Mars";
        _mars.SetPosition(.5f, .5f);
        _mars.AddEventListener<MouseEvent>(MouseEvent.MOUSE_DOWN, onMarsPress);
        AddChild(_mars);
    }
Beispiel #3
0
 private void onEarthPress(MouseEvent e)
 {
     _earthContainer.Width  = 2;
     _earthContainer.ScaleY = _earthContainer.ScaleX;
     _earthContainer.SetPosition(4, 4);
 }