Ejemplo n.º 1
0
        public void HandleAddNewSubStep()
        {
            var subStepNumber = CameraSubSteps.Count > 0?SubStepsToCameraSubStepViews[CameraSubSteps.Last()].GetNumberLabelValue() + 1:0;

            var newSubStep = new CameraSubStep();

            CameraSubSteps.Add(newSubStep);
            newSubStep.Delay    = DefaultDelay;
            newSubStep.Duration = DefaultDuration;

            var newStepView = AddNewSubStepView(newSubStep);

            newStepView.SaveCameraData();

            newStepView.SetNumberLabel(subStepNumber);
        }
Ejemplo n.º 2
0
        private void PopulateSubSteps()
        {
            var foundValue = CommandLineArgs.GetArgumentValue(ArgumentName);
            //"(10.0,00.0,10.0):(1,0,0):2:1|10.0,2.0,10.0):(1,0,0):2:1|10.0,-2.0,10.0):(1,0,0):2:1|(10.0,1.0,10.0):(1,0,0):2:1";

            var tokens = foundValue.Split('|');

            CameraSubSteps.Clear();

            if (tokens.Length > 0 && tokens[0].Contains(':'))
            {
                foreach (var token in tokens)
                {
                    CameraSubSteps.Add(CameraSubStep.GenerateFromString(token));
                }
            }
        }
Ejemplo n.º 3
0
        private void RemoveSubStepView(CameraSubStep subStep)
        {
            if (!SubStepsToCameraSubStepViews.ContainsKey(subStep))
            {
                return;
            }

            var subStepView = SubStepsToCameraSubStepViews[subStep];

            SubStepsToCameraSubStepViews.Remove(subStep);

            CameraSubSteps.Remove(subStep);

            GameObject.Destroy(subStepView.gameObject);

            //RefreshAllNumberLabels();
        }
Ejemplo n.º 4
0
        private CameraSubStepView AddNewSubStepView(CameraSubStep subStep)
        {
            var subStepViewObj = GameObject.Instantiate(SubStepViewPrefab);

            var subStepView = subStepViewObj.GetComponent <CameraSubStepView>();

            subStepViewObj.transform.SetParent(SubStepViewRoot, false);
            subStepViewObj.transform.SetAsLastSibling();
            AddButtonRootTransform.transform.SetAsLastSibling();

            subStepView.SubStep              = subStep;
            subStepView.RemoveButtonClicked += RemoveSubStepView;

            SubStepsToCameraSubStepViews.Add(subStep, subStepView);

            return(subStepView);
        }
Ejemplo n.º 5
0
        public static CameraSubStep GenerateFromString(string input)
        {
            var tokens = input.Split(':');

            if (tokens.Length < 4)
            {
                throw new Exception("Cannot convert string " + input + " into a substep!");
            }

            var subStep = new CameraSubStep();

            Vector3 vectorBuffer = Vector3.zero;

            if (!VectorUtility.TryParseVector(tokens[0], ref vectorBuffer))
            {
                throw new Exception("Cannot convert string " + tokens[0] + " into a Vector3!");
            }
            subStep.Position = vectorBuffer;

            if (!VectorUtility.TryParseVector(tokens[1], ref vectorBuffer))
            {
                throw new Exception("Cannot convert string " + tokens[1] + " into a Vector3!");
            }
            subStep.Facing = vectorBuffer;

            float floatBuffer = 0f;

            if (!float.TryParse(tokens[2], out floatBuffer))
            {
                throw new Exception("Cannot convert string " + tokens[2] + " into a float!");
            }
            subStep.Duration = Mathf.Max(floatBuffer, .001f);

            if (!float.TryParse(tokens[3], out floatBuffer))
            {
                throw new Exception("Cannot convert string " + tokens[3] + " into a float!");
            }
            subStep.Delay = Mathf.Max(floatBuffer, .001f);

            return(subStep);
        }
Ejemplo n.º 6
0
        private void DrawFromClipboard(bool clear)
        {
            var foundValue = Clipboard.GetText();
            //"(10.0,00.0,10.0):(1,0,0):2:1|10.0,2.0,10.0):(1,0,0):2:1|10.0,-2.0,10.0):(1,0,0):2:1|(10.0,1.0,10.0):(1,0,0):2:1";

            var tokens = foundValue.Split('|');

            if (clear)
            {
                ClearSubSteps();
            }

            if (tokens.Length > 0 && tokens[0].Contains(':'))
            {
                foreach (var token in tokens)
                {
                    var newStep = CameraSubStep.GenerateFromString(token);

                    CameraSubSteps.Add(newStep);
                }
            }
            AssignSubSteps(CameraSubSteps);
        }