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); }
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); }
public void UpdateUIWallObjectSprite(string id) { Sprite sprite = WallsUtils.getWallSprite(id); if (sprite == null) { return; } _shapeImage.GetComponentInChildren <Image>().sprite = sprite; }
private void CheckCoins(string x, string y) { if (WallsUtils.CheckCoinWall(x, y)) { _mainColor = ColorCoin; _secundaryColor = PressedColorCoin; SetTextToggle("o"); } }
private void CheckAvoid(string id, string time) { if (WallsUtils.CheckAvoidWall(id, time)) { _mainColor = ColorAvoid; _secundaryColor = PressedColorAvoid; SetTextToggle("A"); } }
private void CheckHit(WallsUtils.Walltype type, string id) { if (WallsUtils.CheckWallId(type, id)) { _mainColor = ColorHit; _secundaryColor = PressedColorHit; SetTextToggle("H"); } }
private void CheckCustom(WallsUtils.Walltype type, string id) { if (WallsUtils.CheckWallId(type, id)) { _mainColor = ColorCustom; _secundaryColor = PressedColorCustom; SetTextToggle("C"); } }
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; }
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?"); } }
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; } }
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]); }
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); } }
public void OnUpdatingWallId(string id) { WallsUtils.Walltype walltype = WallsUtils.GetWallType(id); _objectsLibraryManager.SelectWallTab(walltype, id); }