示例#1
0
    private void enableChanges() // TODO set in shape class
    {
        foreach (Toggle toggle in _toggles)
        {
            string newCode = "";
            if (toggle.name == "Shape66")
            {
                newCode = WallShape.Id.Substring(0, 4) + "66" + WallShape.Id.Substring(6);
            }
            else
            {
                char[] wallId = WallShape.Id.ToCharArray();

                char changeCharacter = toggle.name.Substring(toggle.name.Length - 1).ToCharArray()[0];
                int  position        = GetPositionOfCharToChange(WallsUtils.Walltype.WP, toggle.name);

                wallId[position] = changeCharacter;

                newCode = new string(wallId);
            }
            Sprite sprite = WallsUtils.getWallSprite(newCode);
            toggle.interactable = sprite != null;
            Image imageButton = toggle.GetComponent <Transform>().Find("Background/Image").GetComponent <Image>();

            imageButton.color = new Color(imageButton.color.r, imageButton.color.g, imageButton.color.b, toggle.interactable ? 1f : 0.5f);
        }
        // WallsUtils.CheckWallId(WallsUtils.Walltype.WP, _wallCode);
    }
示例#2
0
    public void UpdateUIWallObjectSprite(string id)
    {
        Sprite sprite = WallsUtils.getWallSprite(id);

        if (sprite == null)
        {
            return;
        }
        _shapeImage.GetComponentInChildren <Image>().sprite = sprite;
    }
示例#3
0
    public void UpdateDodgeSprite(string id) // TODO Fix
    {
        Sprite sprite = WallsUtils.getWallSprite(id);

        if (sprite == null)
        {
            return;
        }
        string[] splittedId = id.Split('.');
        if (splittedId.Length < 2)
        {
            return;
        }
        WallDodge.WallPosition = splittedId[1];
        _dodgeImage.GetComponentInChildren <Image>().sprite = sprite;
        UpdateDodgeDuration(splittedId[2]);
    }