Example #1
0
    public void InitSpriteComponent(Color color)
    {
        ImSpriteComponent sc = new ImSpriteComponent("mainSpriteComponent", "whiteSquare.png");

        sc.sprite.color = color;

        Vector2 fromNodePosition   = ImConfig.PositionForNodePlacement(veinEndpoints.fromNodePlacement);
        Vector2 toNodePosition     = ImConfig.PositionForNodePlacement(veinEndpoints.toNodePlacement);
        Vector2 lowerNodePosition  = fromNodePosition.y <= toNodePosition.y ? fromNodePosition : toNodePosition;
        Vector2 higherNodePosition = toNodePosition.y >= fromNodePosition.y ? toNodePosition : fromNodePosition;

        float sRotation = 90 + 360 - Mathf.Rad2Deg * Mathf.Atan((higherNodePosition.y - lowerNodePosition.y) / (higherNodePosition.x - lowerNodePosition.x));

        if (Mathf.Sign(higherNodePosition.x - lowerNodePosition.x) == -1f)
        {
            sRotation += 180f;
        }

        sc.sprite.anchorY  = 0;
        sc.sprite.width    = 10f;
        sc.sprite.height   = Mathf.Sqrt(Mathf.Pow(toNodePosition.y - fromNodePosition.y, 2) + Mathf.Pow(toNodePosition.x - fromNodePosition.x, 2));
        sc.sprite.rotation = sRotation;

        AddComponent(sc);
    }
Example #2
0
    public ImTableCell(string name, float horizontalPadding, float verticalPadding, float width, Color backgroundColor, TableCellType type)
        : base(name)
    {
        this.tableCellType = type;
        horizontalPadding_ = horizontalPadding;
        verticalPadding_ = verticalPadding;
        width_ = width;

        if (backgroundColor.a > 0) {
            backgroundSpriteComponent = new ImSpriteComponent("backgroundSpriteComponent", "Futile_White");
            backgroundSpriteComponent.sprite.color = backgroundColor;
            backgroundSpriteComponent.sprite.width = width_;
            backgroundSpriteComponent.sprite.anchorX = 0;
            backgroundSpriteComponent.sprite.anchorY = 0;
            backgroundSpriteComponent.sprite.y = 1;
            AddComponent(backgroundSpriteComponent);
        }

        bottomLineSpriteComponent = new ImSpriteComponent("bottomLineSpriteComponent", "Futile_White");
        bottomLineSpriteComponent.sprite.width = width;
        bottomLineSpriteComponent.sprite.height = 1f;
        bottomLineSpriteComponent.sprite.color = Color.black;
        bottomLineSpriteComponent.sprite.alpha = 0.2f;
        bottomLineSpriteComponent.sprite.anchorX = 0;
        //bottomLineSpriteComponent.sprite.y = 1f;
        AddComponent(bottomLineSpriteComponent);
    }
Example #3
0
    public ImTableCell(string name, float horizontalPadding, float verticalPadding, float width, Color backgroundColor, TableCellType type) : base(name)
    {
        this.tableCellType = type;
        horizontalPadding_ = horizontalPadding;
        verticalPadding_   = verticalPadding;
        width_             = width;

        if (backgroundColor.a > 0)
        {
            backgroundSpriteComponent = new ImSpriteComponent("backgroundSpriteComponent", "Futile_White");
            backgroundSpriteComponent.sprite.color   = backgroundColor;
            backgroundSpriteComponent.sprite.width   = width_;
            backgroundSpriteComponent.sprite.anchorX = 0;
            backgroundSpriteComponent.sprite.anchorY = 0;
            backgroundSpriteComponent.sprite.y       = 1;
            AddComponent(backgroundSpriteComponent);
        }

        bottomLineSpriteComponent = new ImSpriteComponent("bottomLineSpriteComponent", "Futile_White");
        bottomLineSpriteComponent.sprite.width   = width;
        bottomLineSpriteComponent.sprite.height  = 1f;
        bottomLineSpriteComponent.sprite.color   = Color.black;
        bottomLineSpriteComponent.sprite.alpha   = 0.2f;
        bottomLineSpriteComponent.sprite.anchorX = 0;
        //bottomLineSpriteComponent.sprite.y = 1f;
        AddComponent(bottomLineSpriteComponent);
    }
Example #4
0
    public void AddRightSprite(string imageName, float spriteScale)
    {
        ImSpriteComponent sc = new ImSpriteComponent("rightSpriteComponent", imageName);

        sc.sprite.scale      = spriteScale;
        sc.sprite.x          = width_ - sc.sprite.width / 2f - horizontalPadding_;
        rightSpriteComponent = sc;
        AddComponent(sc);

        this.height = Mathf.Max(height_, sc.sprite.localRect.height + verticalPadding_ * 2);

        sc.sprite.y = height_ / 2f;
    }
Example #5
0
    public void InitSpriteComponent(Color color)
    {
        ImSpriteComponent sc = new ImSpriteComponent("mainSpriteComponent", "whiteSquare.png");
        sc.sprite.color = color;

        Vector2 fromNodePosition = ImConfig.PositionForNodePlacement(veinEndpoints.fromNodePlacement);
        Vector2 toNodePosition = ImConfig.PositionForNodePlacement(veinEndpoints.toNodePlacement);
        Vector2 lowerNodePosition = fromNodePosition.y <= toNodePosition.y ? fromNodePosition : toNodePosition;
        Vector2 higherNodePosition = toNodePosition.y >= fromNodePosition.y ? toNodePosition : fromNodePosition;

        float sRotation = 90 + 360 - Mathf.Rad2Deg * Mathf.Atan((higherNodePosition.y - lowerNodePosition.y) / (higherNodePosition.x - lowerNodePosition.x));
        if (Mathf.Sign(higherNodePosition.x - lowerNodePosition.x) == -1f) sRotation += 180f;

        sc.sprite.anchorY = 0;
        sc.sprite.width = 10f;
        sc.sprite.height = Mathf.Sqrt(Mathf.Pow(toNodePosition.y - fromNodePosition.y, 2) + Mathf.Pow(toNodePosition.x - fromNodePosition.x, 2));
        sc.sprite.rotation = sRotation;

        AddComponent(sc);
    }
Example #6
0
    public ImNode(NodePlacement nodePlacement, string name = "a node")
        : base(name)
    {
        name = string.Format("node: a node at " + ImConfig.NameForNodePlacement(nodePlacement));

        this.nodePlacement = nodePlacement;

        ImSpriteComponent sc = new ImSpriteComponent("baseSpriteComponent", "circle.psd");
        sc.sprite.scale = 0.5f;
        sc.sprite.color = Color.blue;
        AddComponent(sc);

        ImRadialWipeSpriteComponent ssc = new ImRadialWipeSpriteComponent("diseaseRadialWipeComponent", "circle.psd");
        ssc.sprite.scale = 0.5f;
        ssc.sprite.color = Color.red;
        ssc.sprite.percentage = 0;
        AddComponent(ssc);

        AddComponent(new ImHealthComponent("healthComponent", 100));
    }
Example #7
0
    public ImNode(NodePlacement nodePlacement, string name = "a node") : base(name)
    {
        name = string.Format("node: a node at " + ImConfig.NameForNodePlacement(nodePlacement));

        this.nodePlacement = nodePlacement;

        ImSpriteComponent sc = new ImSpriteComponent("baseSpriteComponent", "circle.psd");

        sc.sprite.scale = 0.5f;
        sc.sprite.color = Color.blue;
        AddComponent(sc);

        ImRadialWipeSpriteComponent ssc = new ImRadialWipeSpriteComponent("diseaseRadialWipeComponent", "circle.psd");

        ssc.sprite.scale      = 0.5f;
        ssc.sprite.color      = Color.red;
        ssc.sprite.percentage = 0;
        AddComponent(ssc);

        AddComponent(new ImHealthComponent("healthComponent", 100));
    }
Example #8
0
    public void InitSpriteComponent()
    {
        string imageName = "";
        float defaultRotation = 0;
        float defaultScale = 0;
        Color color = Color.white;

        switch (organType_) {
        case OrganType.Brain:
            imageName = "brain.png";
            name = "organ: brain";
            defaultRotation = 0f;
            defaultScale = 1.0f;
            color = Color.magenta;
            break;
        case OrganType.Heart:
            imageName = "heart.png";
            name = "organ: heart";
            defaultRotation = -20f;
            defaultScale = 1.0f;
            color = Color.red;
            break;
        case OrganType.Intestines:
            imageName = "intestines.png";
            name = "organ: intestines";
            defaultRotation = 0f;
            defaultScale = 1.0f;
            color = Color.green;
            break;
        case OrganType.Liver:
            imageName = "liver.png";
            name = "organ: liver";
            defaultRotation = -20f;
            defaultScale = 1.0f;
            color = Color.cyan;
            break;
        case OrganType.LungLeft:
            imageName = "lungLeft.png";
            name = "organ: lung left";
            defaultRotation = 20f;
            defaultScale = 1.0f;
            color = Color.blue;
            break;
        case OrganType.LungRight:
            imageName = "lungRight.png";
            name = "organ: lung right";
            defaultRotation = -20f;
            defaultScale = 1.0f;
            color = Color.blue;
            break;
        case OrganType.Stomach:
            imageName = "stomach.png";
            name = "organ: stomach";
            defaultRotation = -30f;
            defaultScale = 1.0f;
            color = Color.yellow;
            break;
        default:
            break;
        }

        ImSpriteComponent sc = new ImSpriteComponent("mainOrganSpriteComponent", imageName);
        sc.sprite.color = color;
        sc.defaultSpriteRotation = defaultRotation;
        sc.defaultSpriteScale = defaultScale;
        AddComponent(sc);
    }
Example #9
0
    public void AddRightSprite(string imageName, float spriteScale)
    {
        ImSpriteComponent sc = new ImSpriteComponent("rightSpriteComponent", imageName);
        sc.sprite.scale = spriteScale;
        sc.sprite.x = width_ - sc.sprite.width / 2f - horizontalPadding_;
        rightSpriteComponent = sc;
        AddComponent(sc);

        this.height = Mathf.Max(height_, sc.sprite.localRect.height + verticalPadding_ * 2);

        sc.sprite.y = height_ / 2f;
    }
Example #10
0
    public void InitSpriteComponent()
    {
        string imageName       = "";
        float  defaultRotation = 0;
        float  defaultScale    = 0;
        Color  color           = Color.white;

        switch (organType_)
        {
        case OrganType.Brain:
            imageName       = "brain.png";
            name            = "organ: brain";
            defaultRotation = 0f;
            defaultScale    = 1.0f;
            color           = Color.magenta;
            break;

        case OrganType.Heart:
            imageName       = "heart.png";
            name            = "organ: heart";
            defaultRotation = -20f;
            defaultScale    = 1.0f;
            color           = Color.red;
            break;

        case OrganType.Intestines:
            imageName       = "intestines.png";
            name            = "organ: intestines";
            defaultRotation = 0f;
            defaultScale    = 1.0f;
            color           = Color.green;
            break;

        case OrganType.Liver:
            imageName       = "liver.png";
            name            = "organ: liver";
            defaultRotation = -20f;
            defaultScale    = 1.0f;
            color           = Color.cyan;
            break;

        case OrganType.LungLeft:
            imageName       = "lungLeft.png";
            name            = "organ: lung left";
            defaultRotation = 20f;
            defaultScale    = 1.0f;
            color           = Color.blue;
            break;

        case OrganType.LungRight:
            imageName       = "lungRight.png";
            name            = "organ: lung right";
            defaultRotation = -20f;
            defaultScale    = 1.0f;
            color           = Color.blue;
            break;

        case OrganType.Stomach:
            imageName       = "stomach.png";
            name            = "organ: stomach";
            defaultRotation = -30f;
            defaultScale    = 1.0f;
            color           = Color.yellow;
            break;

        default:
            break;
        }

        ImSpriteComponent sc = new ImSpriteComponent("mainOrganSpriteComponent", imageName);

        sc.sprite.color          = color;
        sc.defaultSpriteRotation = defaultRotation;
        sc.defaultSpriteScale    = defaultScale;
        AddComponent(sc);
    }