コード例 #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 OnWallObjectClicked(WallObject wallObject)
 {
     addWallObjectToSelectedList(wallObject, true);
     // _objectsLibraryManager.HideWallEdition(false);
     _objectsLibraryManager.SetPanel(0);
     _objectsLibraryManager.UpdateUIWallTime(wallObject.Time);
     _objectsLibraryManager.SelectWallTab(WallsUtils.GetWallType(wallObject.WallObjectId), wallObject.WallObjectId);
 }
コード例 #3
0
    public void UpdateUIWallObjectSprite(string id)
    {
        Sprite sprite = WallsUtils.getWallSprite(id);

        if (sprite == null)
        {
            return;
        }
        _shapeImage.GetComponentInChildren <Image>().sprite = sprite;
    }
コード例 #4
0
    private void CheckCoins(string x, string y)
    {
        if (WallsUtils.CheckCoinWall(x, y))
        {
            _mainColor      = ColorCoin;
            _secundaryColor = PressedColorCoin;

            SetTextToggle("o");
        }
    }
コード例 #5
0
    private void CheckAvoid(string id, string time)
    {
        if (WallsUtils.CheckAvoidWall(id, time))
        {
            _mainColor      = ColorAvoid;
            _secundaryColor = PressedColorAvoid;

            SetTextToggle("A");
        }
    }
コード例 #6
0
    private void CheckHit(WallsUtils.Walltype type, string id)
    {
        if (WallsUtils.CheckWallId(type, id))
        {
            _mainColor      = ColorHit;
            _secundaryColor = PressedColorHit;

            SetTextToggle("H");
        }
    }
コード例 #7
0
    private void CheckCustom(WallsUtils.Walltype type, string id)
    {
        if (WallsUtils.CheckWallId(type, id))
        {
            _mainColor      = ColorCustom;
            _secundaryColor = PressedColorCustom;

            SetTextToggle("C");
        }
    }
コード例 #8
0
    public IEnumerator Paste(bool flipped = false)
    {
        float initTime = Mathf.Infinity;

        clearListOfSelectedObject();
        List <WallObject> wallObjectsToCreate = new List <WallObject>();

        foreach (WallObject wallObject in _clipboard)
        {
            if (wallObject.Time < initTime)
            {
                initTime = wallObject.Time;
            }
        }

        bool pasteWithoutProblems = canPasteWithoutProblems(initTime);

        if (!pasteWithoutProblems)
        {
            DialogsWindowsManager.Instance.ShowWindow(DialogsWindowsManager.Window.ConfirmPaste);

            while (!FinishPasteDialog)
            {
                yield return(null);
            }

            FinishPasteDialog = false;

            if (!ConfirmPaste)
            {
                yield break;
            }
        }

        foreach (WallObject wallObject in _clipboard)
        {
            float time = _cursorTime + wallObject.Time - initTime;
            if (!pasteWithoutProblems && time > ClipInfo.ClipTimeSize)
            {
                continue;
            }

            // time = time > ClipInfo.ClipTimeSize ? ClipInfo.ClipTimeSize : time;

            string newWallObjectID = flipped == true?WallsUtils.FlipWallObject(wallObject.WallObjectId) : wallObject.WallObjectId;

            WallObject currentWallObject = _songManager.CreateWallObject(newWallObjectID, time, true, this);
            addWallObjectToSelectedList(currentWallObject);
            currentWallObject.GetComponent <Transform>().Find("MarkLine").gameObject.SetActive(_zoom >= WallMarklineVisibleAtZoomLevel);
            currentWallObject.GetComponent <Transform>().Find("Toggle/Wall Id").gameObject.SetActive(_zoom >= WallIdVisibleAtZoomLevel);
        }


        yield break;
    }
コード例 #9
0
 private void CheckPose(WallsUtils.Walltype type, string id)
 {
     if (WallsUtils.CheckWallId(type, id))
     {
         _mainColor      = ColorPose;
         _secundaryColor = PressedColorPose;
         SetTextToggle("P");
     }
     else
     {
         Log.AddLine("Bad pose -> " + id + " at: " + Time);
         SetTextToggle("P?");
     }
 }
コード例 #10
0
    public void Flip()
    {
        _clipboard = new HashSet <WallObject>(_selectedWallObjects);
        // clearListOfSelectedObject();

        foreach (WallObject wallObject in _clipboard)
        {
            string flippedId = WallsUtils.FlipWallObject(wallObject.WallObjectId);
            if (_clipboard.Count == 1)
            {
                OnUpdateWallId(flippedId);
            }

            wallObject.WallObjectId = flippedId;
        }
    }
コード例 #11
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]);
    }
コード例 #12
0
    public static Sprite getWallSprite(string id) // TODO CamelCase
    {
        WallsUtils.Walltype wallType = WallsUtils.GetWallType(id);

        switch (wallType)
        {
        case WallsUtils.Walltype.WP:
            Sprite wallSprite;
            wallSprite = id.Length != 9 ? null : Resources.Load <Sprite>("PhotoWalls/" + id.Substring(4));

            return(wallSprite);

        case WallsUtils.Walltype.WA:
            string[] splittedId = id.Split('.');
            if (splittedId.Length <= 1)
            {
                return(null);
            }
            return(Resources.Load <Sprite>("assets/wall/dodge/" + splittedId[1]));

        default:
            return(null);
        }
    }
コード例 #13
0
 public void OnUpdatingWallId(string id)
 {
     WallsUtils.Walltype walltype = WallsUtils.GetWallType(id);
     _objectsLibraryManager.SelectWallTab(walltype, id);
 }