コード例 #1
0
ファイル: SceneManager.cs プロジェクト: AnthonyMir/vrtist
        // Shot Manager
        public static void ApplyShotManagegrAction(ShotManagerActionInfo info)
        {
            switch (info.action)
            {
            case ShotManagerAction.AddShot:
            {
                GameObject cam  = info.camera;
                Shot       shot = new Shot()
                {
                    name    = info.shotName,
                    camera  = cam,
                    color   = info.shotColor,
                    start   = info.shotStart,
                    end     = info.shotEnd,
                    enabled = info.shotEnabled == 1
                };
                ShotManager.Instance.InsertShot(info.shotIndex + 1, shot);
            }
            break;

            case ShotManagerAction.DeleteShot:
            {
                ShotManager.Instance.RemoveShot(info.shotIndex);
            }
            break;

            case ShotManagerAction.DuplicateShot:
            {
                ShotManager.Instance.DuplicateShot(info.shotIndex);
            }
            break;

            case ShotManagerAction.MoveShot:
            {
                ShotManager.Instance.SetCurrentShotIndex(info.shotIndex);
                ShotManager.Instance.MoveShot(info.shotIndex, info.moveOffset);
            }
            break;

            case ShotManagerAction.UpdateShot:
            {
                Shot shot = ShotManager.Instance.shots[info.shotIndex];
                if (info.shotName.Length > 0)
                {
                    shot.name = info.shotName;
                }
                if (null != info.camera)
                {
                    shot.camera = info.camera;
                }
                if (info.shotColor.r != -1)
                {
                    shot.color = info.shotColor;
                }
                if (info.shotStart != -1)
                {
                    shot.start = info.shotStart;
                }
                if (info.shotEnd != -1)
                {
                    shot.end = info.shotEnd;
                }
                if (info.shotEnabled != -1)
                {
                    shot.enabled = info.shotEnabled == 1;
                }
            }
            break;
            }
            ShotManager.Instance.FireChanged();
            Instance.scene.ApplyShotManagerAction(info);
        }
コード例 #2
0
        public static ShotItem GenerateShotItem(Shot shot)
        {
            GameObject root     = new GameObject("shotItem");
            ShotItem   shotItem = root.AddComponent <ShotItem>();

            root.layer = LayerMask.NameToLayer("CameraHidden");

            // Set the item invisible in order to hide it while it is not added into
            // a list. We will activate it after it is added
            root.transform.localScale = Vector3.zero;

            float cx = 0.0f;

            //
            // ACTIVE CAMERA Button
            //
            UILabel currentShotLabel = UILabel.Create(new UILabel.CreateLabelParams
            {
                parent           = root.transform,
                widgetName       = "CurrentShotLabel",
                relativeLocation = new Vector3(0, 0, -UIButton.default_thickness),
                width            = 0.01f,
                height           = 0.03f,
                margin           = 0.001f,
                material         = UIUtils.LoadMaterial("UIBase"),
                selectedColor    = UIOptions.FocusColorVar,
                caption          = "",
            });

            currentShotLabel.SetLightLayer(3);

            cx += 0.01f;

            //
            // ENABLE Checkbox
            //
            UICheckbox shotEnabledCheckbox = UICheckbox.Create(new UICheckbox.CreateParams
            {
                parent           = root.transform,
                widgetName       = "ShotEnabledCheckbox",
                relativeLocation = new Vector3(cx, 0, -UICheckbox.default_thickness),
                width            = 0.03f,
                height           = 0.03f,
                content          = UICheckbox.CheckboxContent.CheckboxOnly,
                margin           = 0.001f,
                material         = UIUtils.LoadMaterial("UIBase"),
            });

            shotEnabledCheckbox.SetLightLayer(3);

            cx += 0.03f;

            //
            // SHOT NAME Label
            //
            UILabel shotNameLabel = UILabel.Create(new UILabel.CreateLabelParams
            {
                parent           = root.transform,
                widgetName       = "ShotNameLabel",
                relativeLocation = new Vector3(cx, 0, -UIButton.default_thickness),
                width            = 0.15f,
                height           = 0.020f,
                margin           = 0.001f,
                material         = UIUtils.LoadMaterial("UIBase"),
            });

            shotNameLabel.SetLightLayer(3);
            UIUtils.SetTMProStyle(shotNameLabel.gameObject);

            //
            // CAMERA NAME Label
            //
            UILabel cameraNameLabel = UILabel.Create(new UILabel.CreateLabelParams
            {
                parent           = root.transform,
                widgetName       = "CameraNameLabel",
                relativeLocation = new Vector3(cx, -0.020f, -UIButton.default_thickness),
                width            = 0.15f,
                height           = 0.01f,
                margin           = 0.001f,
                fgcolor          = UIOptions.Instance.attenuatedTextColor,
                material         = UIUtils.LoadMaterial("UIBase"),
            });

            cameraNameLabel.SetLightLayer(3);
            UIUtils.SetTMProStyle(cameraNameLabel.gameObject, alignment: TextAlignmentOptions.BottomRight);

            cx += 0.15f;

            // Start frame button
            UIButton startFrameButton = UIButton.Create(new UIButton.CreateButtonParams
            {
                parent           = root.transform,
                widgetName       = "StartFrameButton",
                relativeLocation = new Vector3(cx, 0, -UIButton.default_thickness),
                width            = 0.02f,
                height           = 0.03f,
                icon             = UIUtils.LoadIcon("next"),
                buttonContent    = UIButton.ButtonContent.ImageOnly,
                margin           = 0.001f,
            });

            startFrameButton.SetLightLayer(3);

            cx += 0.02f;

            // START: Add UISpinner
            UISpinner startFrameSpinner = UISpinner.Create(new UISpinner.CreateArgs
            {
                parent                 = root.transform,
                widgetName             = "StartFrame",
                relativeLocation       = new Vector3(cx, 0, -UISpinner.default_thickness),
                width                  = 0.055f,
                height                 = 0.03f,
                visibility_type        = UISpinner.TextAndValueVisibilityType.ShowValueOnly,
                value_type             = UISpinner.SpinnerValueType.Int,
                min_spinner_value      = 0,
                max_spinner_value      = 10000,
                cur_spinner_value      = shot.start,
                spinner_value_rate     = 30,
                spinner_value_rate_ray = 30,
                margin                 = 0.001f,
            });

            startFrameSpinner.baseColor.useConstant     = true;
            startFrameSpinner.baseColor.constant        = UIOptions.BackgroundColor;
            startFrameSpinner.selectedColor.useConstant = true;
            startFrameSpinner.selectedColor.constant    = UIOptions.SelectedColor;
            startFrameSpinner.SetLightLayer(3);
            UIUtils.SetTMProStyle(startFrameSpinner.gameObject);

            cx += 0.055f;

            // END: Add UISpinner
            UISpinner endFrameSpinner = UISpinner.Create(new UISpinner.CreateArgs
            {
                parent                 = root.transform,
                widgetName             = "EndFrame",
                relativeLocation       = new Vector3(cx, 0, -UISpinner.default_thickness),
                width                  = 0.055f,
                height                 = 0.03f,
                visibility_type        = UISpinner.TextAndValueVisibilityType.ShowValueOnly,
                value_type             = UISpinner.SpinnerValueType.Int,
                min_spinner_value      = 0,
                max_spinner_value      = 10000,
                cur_spinner_value      = shot.end,
                spinner_value_rate     = 30,
                spinner_value_rate_ray = 30,
                margin                 = 0.001f,
            });

            endFrameSpinner.baseColor.useConstant     = true;
            endFrameSpinner.baseColor.constant        = UIOptions.BackgroundColor;
            endFrameSpinner.selectedColor.useConstant = true;
            endFrameSpinner.selectedColor.constant    = UIOptions.SelectedColor;
            endFrameSpinner.SetLightLayer(3);
            UIUtils.SetTMProStyle(endFrameSpinner.gameObject);

            cx += 0.055f;

            // End frame button
            UIButton endFrameButton = UIButton.Create(new UIButton.CreateButtonParams
            {
                parent           = root.transform,
                widgetName       = "EndFrameButton",
                relativeLocation = new Vector3(cx, 0, -UIButton.default_thickness),
                width            = 0.02f,
                height           = 0.03f,
                icon             = UIUtils.LoadIcon("prev"),
                buttonContent    = UIButton.ButtonContent.ImageOnly,
                margin           = 0.001f,
            });

            endFrameButton.SetLightLayer(3);

            cx += 0.02f;

            // RANGE: Add UILabel
            UILabel frameRangeLabel = UILabel.Create(new UILabel.CreateLabelParams
            {
                parent           = root.transform,
                widgetName       = "FrameRange",
                relativeLocation = new Vector3(cx, 0, -UILabel.default_thickness),
                width            = 0.04f,
                height           = 0.03f,
                margin           = 0.001f,
                material         = UIUtils.LoadMaterial("UIBase"),
            });

            frameRangeLabel.baseColor.useConstant     = true;
            frameRangeLabel.baseColor.constant        = UIOptions.BackgroundColor;
            frameRangeLabel.selectedColor.useConstant = true;
            frameRangeLabel.selectedColor.constant    = UIOptions.SelectedColor;
            frameRangeLabel.SetLightLayer(3);
            UIUtils.SetTMProStyle(frameRangeLabel.gameObject, alignment: TextAlignmentOptions.Center);
            cx += 0.04f;

            // Set camera
            UIButton setCameraButton = UIButton.Create(new UIButton.CreateButtonParams
            {
                parent           = root.transform,
                widgetName       = "SetCameraButton",
                relativeLocation = new Vector3(cx, 0, -UIButton.default_thickness),
                width            = 0.03f,
                height           = 0.03f,
                icon             = UIUtils.LoadIcon("icon-camera"),
                buttonContent    = UIButton.ButtonContent.ImageOnly,
                margin           = 0.001f,
            });

            setCameraButton.isCheckable              = true;
            setCameraButton.checkedSprite            = UIUtils.LoadIcon("icon-camera");
            setCameraButton.checkedColor.useConstant = false;
            setCameraButton.checkedColor.constant    = UIOptions.FocusColor;
            setCameraButton.checkedColor.reference   = UIOptions.FocusColorVar;
            setCameraButton.baseSprite = UIUtils.LoadIcon("icon-camera");
            setCameraButton.SetLightLayer(3);

            // Link widgets to the item script.
            shotItem.currentShotLabel    = currentShotLabel;
            shotItem.shotEnabledCheckbox = shotEnabledCheckbox;
            shotItem.shotNameLabel       = shotNameLabel;
            shotItem.cameraNameLabel     = cameraNameLabel;
            shotItem.startFrameSpinner   = startFrameSpinner;
            shotItem.startFrameButton    = startFrameButton;
            shotItem.frameRangeLabel     = frameRangeLabel;
            shotItem.endFrameSpinner     = endFrameSpinner;
            shotItem.endFrameButton      = endFrameButton;
            shotItem.setCameraButton     = setCameraButton;

            shotItem.SetShot(shot);

            return(shotItem);
        }
コード例 #3
0
ファイル: ShotManager.cs プロジェクト: ubisoft/vrtist
        public void DuplicateShot(int index)
        {
            Shot shot = shots[index].Copy();

            shots.Insert(index + 1, shot);
        }
コード例 #4
0
ファイル: ShotManager.cs プロジェクト: ubisoft/vrtist
 public void InsertShot(int index, Shot shot)
 {
     shots.Insert(index, shot);
 }
コード例 #5
0
ファイル: ShotManager.cs プロジェクト: ubisoft/vrtist
 public void AddShot(Shot shot)
 {
     shots.Add(shot);
 }