示例#1
0
        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);
 }
示例#3
0
        private void OnNameChanged(Pattern.Pattern pattern)
        {
            if (pattern == null)
            {
                nameText.text = "Could not load pattern correctly";
                return;
            }

            nameText.text = pattern.name;
        }
示例#4
0
 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);
 }
示例#5
0
        /// <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();
        }
示例#6
0
        /// <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);
        }
示例#7
0
        /// <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();
        }
示例#8
0
 private void OnPatternRemoved(Pattern.Pattern pattern)
 {
 }
示例#9
0
 //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();
 }
示例#10
0
 private void OnSelected(Pattern.Pattern pattern)
 {
     mainUI.OpenPaintMode(pattern);
 }
示例#11
0
 public void Init(Pattern.Pattern pattern)
 {
     this.pattern = pattern;
 }