private void OnPatternUpdated(Pattern.Pattern pattern) { var format = "dd.MM.yyyy - HH:mm"; lastWriteText.text = "Edited on " + pattern.lastWriteTime.ToString(format); creationText.text = "Created on " + pattern.creationTime.ToString(format); }
public void AddToLookupTable(Pattern.Pattern pattern) { if (pattern.IsComplex) { ComplexPatterns.Add(pattern); return; } tmpSimplePatterns.Add(pattern); }
private void OnNameChanged(Pattern.Pattern pattern) { if (pattern == null) { nameText.text = "Could not load pattern correctly"; return; } nameText.text = pattern.name; }
private void OnPatternChanged(Pattern.Pattern old, Pattern.Pattern newPattern) { if (newPattern == null) { return; } newPattern.OnLoopChanged += LoopChanged; newPattern.OnSpeedChanged += SpeedChanged; LoopChanged(newPattern.looping); SpeedChanged(newPattern.speed); }
/// <summary> /// Removes pattern from pattern list /// </summary> /// <param name="pattern">pattern to remove</param> private void OnPatternRemoved(Pattern.Pattern pattern) { var item = items[pattern]; var gameObject = item.gameObject; item.Selected -= OnSelected; items.Remove(pattern); Destroy(gameObject); ApplyOrderToTransforms(); }
/// <summary> /// Starts the PaintMode. Call this method with the pattern. /// </summary> /// <param name="pattern">Pattern to edit.</param> /// <returns>Returns true for success, false otherwise</returns> public bool Open(Pattern.Pattern pattern) { if (gameObject.activeSelf) { return(false); } if (!(pattern is PaintPattern)) { return(false); } var paintPattern = (PaintPattern)pattern; this.pattern = paintPattern; gameObject.SetActive(true); player.pattern = pattern; player.evaluator = new ClosestEvaluator(GetComponentInChildren <VibratorMesh>(), paintPattern); defaultPaintingTool = new PaintingTool.DefaultPainting(player.evaluator as ClosestEvaluator); currentPaintingTool = defaultPaintingTool; hmdDisplay.SetPaintingToolName(currentPaintingTool.name); reflectionPaintingTool = new PaintingTool.ReflectionPainting(player.evaluator as ClosestEvaluator); eraserModeTool = new PaintingTool.EraserMode(player.evaluator as ClosestEvaluator); foreach (var stroke in paintPattern.strokes) { OnStrokeAdded(stroke); } player.SetTime(0); if (this.pattern.strokes.Count > 0) { selectStroke(this.pattern.strokes[0]); } if (!int.TryParse(Regex.Match(pattern.name, @"\d+").Value, out _)) { } return(true); }
/// <summary> /// Adds pattern to pattern list /// </summary> /// <param name="pattern">Pattern that's added</param> private void OnPatternAdded(Pattern.Pattern pattern) { var item = Instantiate(prefab); item.Init(pattern); var gameObject = item.gameObject; var transform = item.transform as RectTransform; gameObject.SetActive(true); transform?.SetParent(prefab.transform.parent, false); transform?.SetAsFirstSibling(); item.Selected += OnSelected; items.Add(pattern, item); ApplyOrderToTransforms(); }
private void OnPatternRemoved(Pattern.Pattern pattern) { }
//Disables main UI and enables the paintmode as well as all the objects attached to it like the model public void OpenPaintMode(Pattern.Pattern pattern) { paintMode.Open(pattern); Close(); }
private void OnSelected(Pattern.Pattern pattern) { mainUI.OpenPaintMode(pattern); }
public void Init(Pattern.Pattern pattern) { this.pattern = pattern; }