private GameObject CreateFileOpen()
        {
            FileOpenFactory factory = Undoable.AddComponent <FileOpenFactory>(disposable);

            factory.parent = parent;
            GameObject panel = factory.Generate();

            fileOpenInstance = panel;
            GameObject fileOpenContainer = panel.transform.parent.gameObject;

            fileOpenContainer.transform.localPosition = fileOpenLocalPosition;
            fileOpen = fileOpenInstance.transform.Find("DrivesPanel").GetComponent <FileOpen>();

#if UNITY_EDITOR
            var onOpen = fileOpen.onOpen;
            for (int i = 0; i < onOpen.GetPersistentEventCount(); i++)
            {
                UnityEventTools.RemovePersistentListener(onOpen, 0);
            }
            UnityEventTools.AddPersistentListener(onOpen, fileManager.Open);
            fileOpen.onOpen = onOpen;
#endif

            return(panel);
        }
        private GameObject CreateColorSaturationBrightnessPicker(GameObject parent)
        {
            GameObject         container = EmptyChild(parent, "ColorSaturationBrightnessPicker");
            ColorPickerProfile profile   = Defaults.GetProfile(colorPickerProfile);

            container.transform.localPosition = profile.sbLocalPosition;
            container.transform.localScale    = profile.sbScale;

            var script = Undoable.AddComponent <ColorSaturationBrightnessPicker>(container);

            script.backgroundMaterial = profile.sbMaterial;

            ColorPickerThumbTouchable thumbTouchable = Undoable.AddComponent <ColorPickerThumbTouchable>(container);

            thumbTouchable.fixY  = false;
            thumbTouchable.thumb = sbThumbInstance.transform;

            BoxCollider boxCollider = Undoable.AddComponent <BoxCollider>(container);

            boxCollider.isTrigger = true;

            // FIXME: This needs to be Touchable

            MeshFilter meshFilter = Undoable.AddComponent <MeshFilter>(container);

            meshFilter.mesh = profile.thumbBody.GetComponent <MeshFilter>().mesh;

            MeshRenderer meshRenderer = Undoable.AddComponent <MeshRenderer>(container);

            meshRenderer.materials = new Material[] { profile.sbMaterial };
            return(container);
        }
        protected GameObject DisplayRow(GameObject parent)
        {
            ButtonProfile profile = Defaults.GetMomentaryButtonProfile(momentaryButtonProfile);

            GameObject row   = Row(parent, "DisplayRow", TextAlignment.Left);
            GameObject label = EmptyChild(row, "Display");

            label.transform.localScale = profile.labelScale;
            Vector3 localPosition = new Vector3(0, 0, profile.labelZ);

            label.transform.localPosition = localPosition;
            TextMesh textMesh = Undoable.AddComponent <TextMesh>(label);

            textMesh.text     = "keyboard display";
            textMesh.fontSize = profile.fontSize;
            textMesh.color    = profile.fontColor;
            textMesh.anchor   = TextAnchor.MiddleCenter;

            KeyboardLabel keyboardLabel = Undoable.AddComponent <KeyboardLabel>(label);

            keyboardLabel.keyboard = keyboard;
            keyboardLabel.textMesh = textMesh;

            BoxCollider boxCollider = Undoable.AddComponent <BoxCollider>(label);

            UpdateBoxColliderFromTextMesh updateBoxCollider = Undoable.AddComponent <UpdateBoxColliderFromTextMesh>(label);

            updateBoxCollider.textMesh    = textMesh;
            updateBoxCollider.boxCollider = boxCollider;

            return(row);
        }
        public override GameObject Generate()
        {
            base.Generate();

#if UNITY_EDITOR
            Undo.SetCurrentGroupName("FileOpenFactory Generate");
            int group = Undo.GetCurrentGroup();

            Undo.RegisterCompleteObjectUndo(this, "FileOpenFactory state");
#endif
            CreateDisposable(parent);

            filePanelContainerInstance              = EmptyChild(parent, "FileOpenContainer");
            filePanelContainerRigidbody             = Undoable.AddComponent <Rigidbody>(filePanelContainerInstance);
            filePanelContainerRigidbody.useGravity  = false;
            filePanelContainerRigidbody.isKinematic = true;

            kineticScrollerItem = CreateKineticScrollerItem(filePanelContainerInstance);
            kineticScrollerItem.SetActive(false);

            FilePanel(filePanelContainerInstance);

            CreateKineticScroller(filePanelContainerInstance);

#if UNITY_EDITOR
            Undo.DestroyObjectImmediate(disposable);
            Undo.CollapseUndoOperations(group);
#else
            Destroy(disposable);
#endif
            return(filePanelInstance);
        }
        private GameObject CreateFileSaveAs()
        {
            FileSaveAsFactory factory = Undoable.AddComponent <FileSaveAsFactory>(disposable);

            factory.parent   = parent;
            factory.keyboard = keyboard;
            GameObject panel = factory.Generate();

            fileSaveAsInstance = panel;
            GameObject fileSaveAsContainer = panel.transform.parent.gameObject;

            fileSaveAsContainer.transform.localPosition = fileSaveAsLocalPosition;
            fileSaveAs = fileSaveAsInstance.transform.Find("DrivesPanel").GetComponent <FileSaveAs>();
            fileManager.saveAsPanel = fileSaveAs;


#if UNITY_EDITOR
            var onSaveAs = fileSaveAs.onSaveAs;
            for (int i = 0; i < onSaveAs.GetPersistentEventCount(); i++)
            {
                UnityEventTools.RemovePersistentListener(onSaveAs, 0);
            }
            UnityEventTools.AddPersistentListener(onSaveAs, fileManager.SaveAs);
            fileSaveAs.onSaveAs = onSaveAs;
#endif

            return(panel);
        }
        private GameObject CreateToolsPanel()
        {
            ToolsExamplePanelFactory factory = Undoable.AddComponent <ToolsExamplePanelFactory>(disposable);

            factory.parent        = parent;
            factory.fileOpen      = fileOpen;
            factory.fileSaveAs    = fileSaveAs;
            factory.skyboxManager = skyboxManager;
            GameObject panel = factory.Generate();

            toolsInstance = panel;
            Vector3 localPosition = toolsInstance.transform.localPosition;

            localPosition.x = toolsLocalPosition.x;
            toolsInstance.transform.localPosition = localPosition;

#if UNITY_EDITOR
            var touchPadButtons = touchPadMenuController.touchPadButtons;
            for (int i = 0; i < touchPadButtons[0].onSelected.GetPersistentEventCount(); i++)
            {
                UnityEventTools.RemovePersistentListener(touchPadButtons[0].onSelected, 0);
            }
            UnityEventTools.AddPersistentListener(touchPadButtons[0].onSelected, toolsInstance.GetComponent <StandardPanel>().ToggleVisible);
            touchPadMenuController.touchPadButtons = touchPadButtons;
#endif

            return(panel);
        }
        private GameObject CreateColorHuePicker(GameObject parent)
        {
            GameObject         container = EmptyChild(parent, "ColorHuePicker");
            ColorPickerProfile profile   = Defaults.GetProfile(colorPickerProfile);

            container.transform.localPosition = profile.huePickerLocalPosition;
            container.transform.localScale    = profile.huePickerScale;

            Undoable.AddComponent <ColorHuePicker>(container);

            ColorPickerThumbTouchable thumbTouchable = Undoable.AddComponent <ColorPickerThumbTouchable>(container);

            thumbTouchable.fixY  = true;
            thumbTouchable.thumb = hueThumbInstance.transform;

            BoxCollider boxCollider = Undoable.AddComponent <BoxCollider>(container);

            boxCollider.isTrigger = true;

            // FIXME: This needs to be Touchable

            MeshFilter meshFilter = Undoable.AddComponent <MeshFilter>(container);

            meshFilter.sharedMesh = profile.thumbBody.GetComponent <MeshFilter>().sharedMesh;

            MeshRenderer meshRenderer = Undoable.AddComponent <MeshRenderer>(container);

            meshRenderer.materials = new Material[] { profile.hueMaterial };
            return(container);
        }
Example #8
0
        protected GameObject Panel(GameObject parent, string name)
        {
            PanelContainerProfile profile   = Defaults.GetProfile(panelContainerProfile);
            FilePanelProfile      fpProfile = Defaults.GetProfile(filePanelProfile);
            PanelContainerFactory factory   = Undoable.AddComponent <PanelContainerFactory>(disposable);

            factory.parent                = parent;
            factory.containerName         = name;
            factory.panelContainerProfile = profile;
            GameObject panel = factory.Generate();

            filePanel                         = AddFilePanel(panel);
            filePanel.grabTarget              = filePanelContainerInstance.transform;
            filePanel.folderPrefab            = fpProfile.folderPrefab;
            filePanel.kineticScrollItemPrefab = kineticScrollerItem;
            filePanel.height                  = fpProfile.scrollerHeight;
            filePanel.searchPattern           = fpProfile.searchPattern;
            filePanel.panelProfile            = panelProfile;

#if VRTK
            CreateThis_VRTK_Interactable interactable = Undoable.AddComponent <CreateThis_VRTK_Interactable>(panel);
            CreateThis_VRTK_GrabAttach   grabAttach   = Undoable.AddComponent <CreateThis_VRTK_GrabAttach>(panel);
            interactable.isGrabbable = true;
            interactable.grabAttachMechanicScript = grabAttach;
#endif

            drives = Undoable.AddComponent <Drives>(panel);

            Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(panel);
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;

            return(panel);
        }
Example #9
0
        protected virtual void FilePanel(GameObject parent)
        {
            if (filePanelInstance)
            {
                return;
            }

            FilePanelProfile fpProfile = Defaults.GetProfile(filePanelProfile);

            filePanelInstance = EmptyChild(parent, "FileOpenPanel");
            Vector3 localPosition = filePanelInstance.transform.localPosition;

            localPosition.y = -fpProfile.scrollerHeight * 1.50f;
            filePanelInstance.transform.localPosition = localPosition;

            Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(filePanelInstance);

            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;

            GameObject panel  = Panel(filePanelInstance, "DrivesPanel");
            GameObject column = Column(panel);

            PanelHeader(filePanel, column);
            DriveButtonRow(column);
            SpecialFoldersRow(column);

            panel.transform.localPosition = Vector3.zero;
        }
Example #10
0
        protected GameObject Label(GameObject parent, string name, string text)
        {
            PanelContainerProfile pcProfile = Defaults.GetProfile(panelContainerProfile);
            ButtonProfile         profile   = Defaults.GetMomentaryButtonProfile(momentaryButtonProfile);
            GameObject            label     = EmptyChild(parent, name);

            label.transform.localScale = profile.labelScale;
            Vector3 localPosition = new Vector3(0, 0, profile.labelZ);

            label.transform.localPosition = localPosition;
            TextMesh textMesh = Undoable.AddComponent <TextMesh>(label);

            textMesh.text          = text;
            textMesh.fontSize      = profile.fontSize;
            textMesh.color         = profile.fontColor;
            textMesh.characterSize = pcProfile.labelCharacterSize;
            textMesh.anchor        = TextAnchor.MiddleCenter;

            BoxCollider boxCollider = Undoable.AddComponent <BoxCollider>(label);

            UpdateBoxColliderFromTextMesh updateBoxCollider = Undoable.AddComponent <UpdateBoxColliderFromTextMesh>(label);

            updateBoxCollider.textMesh    = textMesh;
            updateBoxCollider.boxCollider = boxCollider;
            return(label);
        }
        protected GameObject Panel(GameObject parent, string name)
        {
            PanelContainerProfile profile = Defaults.GetProfile(panelContainerProfile);
            PanelContainerFactory factory = Undoable.AddComponent <PanelContainerFactory>(disposable);

            factory.parent                = parent;
            factory.containerName         = name;
            factory.panelContainerProfile = profile;
            GameObject panel = factory.Generate();

            PanelProfile  subPanelProfile = CreateSubPanelProfile(panel);
            StandardPanel standardPanel   = Undoable.AddComponent <StandardPanel>(panel);

            standardPanel.panelProfile = subPanelProfile;
            standardPanel.grabTarget   = keyboard.transform;

#if VRTK
            CreateThis_VRTK_Interactable interactable = Undoable.AddComponent <CreateThis_VRTK_Interactable>(panel);
            CreateThis_VRTK_GrabAttach   grabAttach   = Undoable.AddComponent <CreateThis_VRTK_GrabAttach>(panel);
            interactable.isGrabbable = true;
            interactable.grabAttachMechanicScript = grabAttach;
#endif

            Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(panel);
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;

            return(panel);
        }
        protected GameObject KeyboardBackspaceButton(StandardPanel panel, GameObject parent, string buttonText)
        {
            KeyboardBackspaceButtonFactory factory = Undoable.AddComponent <KeyboardBackspaceButtonFactory>(disposable);

            SetKeyboardButtonValues(factory, panel, parent);
            factory.buttonText = buttonText;
            return(GenerateKeyboardButtonAndSetPosition(factory));
        }
Example #13
0
        protected GameObject ResetButton(StandardPanel panel, GameObject parent, string buttonText)
        {
            ResetButtonFactory factory = Undoable.AddComponent <ResetButtonFactory>(disposable);

            SetMomentaryButtonValues(factory, panel, parent);
            factory.buttonText = buttonText;
            return(GenerateMomentaryButtonAndSetPosition(factory));
        }
Example #14
0
        protected GameObject ModeButton(StandardPanel panel, GameObject parent, string buttonText, ModeType mode)
        {
            ModeButtonFactory factory = Undoable.AddComponent <ModeButtonFactory>(disposable);

            SetToggleButtonValues(factory, panel, parent);
            factory.buttonText = buttonText;
            factory.mode       = mode;
            return(GenerateToggleButtonAndSetPosition(factory));
        }
Example #15
0
        protected GameObject SettingsButton(StandardPanel panel, GameObject parent, string buttonText, ToggleType toggleType)
        {
            SettingsToggleButtonFactory factory = Undoable.AddComponent <SettingsToggleButtonFactory>(disposable);

            SetToggleButtonValues(factory, panel, parent);
            factory.buttonText = buttonText;
            factory.toggleType = toggleType;
            return(GenerateToggleButtonAndSetPosition(factory));
        }
        private GameObject CreateColorPicker(GameObject parent)
        {
            ColorPickerProfile profile     = Defaults.GetProfile(colorPickerProfile);
            GameObject         colorPicker = EmptyChild(parent, "ColorPicker");
            BoxCollider        boxCollider = Undoable.AddComponent <BoxCollider>(colorPicker);

            boxCollider.size = profile.boxColliderSize;
            return(colorPicker);
        }
        protected GameObject PanelToggleVisibilityMomentaryButton(StandardPanel panel, GameObject parent, string buttonText, PanelBase panelToToggle)
        {
            PanelToggleVisibilityMomentaryButtonFactory factory = Undoable.AddComponent <PanelToggleVisibilityMomentaryButtonFactory>(disposable);

            SetMomentaryButtonValues(factory, panel, parent);
            factory.buttonText    = buttonText;
            factory.panelToToggle = panelToToggle;
            return(GenerateMomentaryButtonAndSetPosition(factory));
        }
Example #18
0
    public void Register(Undoable undoable)
    {
        KillButton killButton = lastAction as KillButton;

        if (killButton != null)
        {
            killButton.noRessurection();
        }
        lastAction = undoable;
    }
        protected GameObject SkyboxButton(StandardPanel panel, GameObject parent, string buttonText, string skybox)
        {
            ExampleSkyboxButtonFactory factory = Undoable.AddComponent <ExampleSkyboxButtonFactory>(disposable);

            SetToggleButtonValues(factory, panel, parent);
            factory.buttonText    = buttonText;
            factory.skybox        = skybox;
            factory.skyboxManager = skyboxManager;
            return(GenerateToggleButtonAndSetPosition(factory));
        }
Example #20
0
        protected GameObject DriveButton(FileBase panel, GameObject parent, ButtonProfile buttonProfile, string buttonText)
        {
            DriveButtonFactory factory = Undoable.AddComponent <DriveButtonFactory>(disposable);

            SetButtonValues(factory, panel, parent);
            factory.buttonText    = buttonText;
            factory.filePanel     = panel;
            factory.buttonProfile = buttonProfile;
            return(GenerateKeyboardButtonAndSetPosition(factory));
        }
        protected GameObject Column(GameObject parent)
        {
            PanelContainerProfile  profile = Defaults.GetProfile(panelContainerProfile);
            ColumnContainerFactory factory = Undoable.AddComponent <ColumnContainerFactory>(disposable);

            factory.parent  = parent;
            factory.padding = profile.padding;
            factory.spacing = profile.spacing;
            return(factory.Generate());
        }
        protected GameObject KeyboardABCButton(StandardPanel panel, GameObject parent, string buttonText)
        {
            KeyboardShiftLockButtonFactory factory = Undoable.AddComponent <KeyboardShiftLockButtonFactory>(disposable);

            SetKeyboardToggleButtonValues(factory, panel, parent);
            factory.buttonText    = buttonText;
            factory.on            = false;
            factory.buttonProfile = numLockKeyProfile;
            return(GenerateKeyboardButtonAndSetPosition(factory));
        }
        protected GameObject KeyboardButton(StandardPanel panel, GameObject parent, ButtonProfile profile, string buttonText)
        {
            KeyboardMomentaryKeyButtonFactory factory = Undoable.AddComponent <KeyboardMomentaryKeyButtonFactory>(disposable);

            SetKeyboardButtonValues(factory, panel, parent);
            factory.buttonText    = buttonText;
            factory.value         = buttonText;
            factory.buttonProfile = profile;
            return(GenerateKeyboardButtonAndSetPosition(factory));
        }
Example #24
0
        protected override void AddContainer(GameObject target)
        {
            ColumnContainer container = Undoable.AddComponent <ColumnContainer>(target);

            if (containerName == null)
            {
                target.name = "Column";
            }
            container.padding = padding;
            container.spacing = spacing;
        }
        protected void CreateKeyboard(GameObject parent)
        {
            if (keyboardInstance)
            {
                return;
            }
            keyboardInstance = EmptyChild(parent, "keyboard");

            keyboard = Undoable.AddComponent <Keyboard>(keyboardInstance);
            keyboard.panelProfile = panelProfile;
        }
        protected GameObject ColorPicker(StandardPanel panel, GameObject parent)
        {
            ButtonProfile             profile = Defaults.GetMomentaryButtonProfile(momentaryButtonProfile);
            ExampleColorPickerFactory factory = Undoable.AddComponent <ExampleColorPickerFactory>(disposable);

            factory.parent             = parent;
            factory.colorPickerProfile = Defaults.GetProfile(colorPickerProfile);
            GameObject colorPicker = factory.Generate();

            colorPicker.transform.localPosition = new Vector3(0, 0, profile.labelZ);
            return(colorPicker);
        }
Example #27
0
        protected override void AddContainer(GameObject target)
        {
            RowContainer container = Undoable.AddComponent <RowContainer>(target);

            if (containerName == null)
            {
                target.name = "Row";
            }
            container.padding   = padding;
            container.spacing   = spacing;
            container.alignment = alignment;
        }
        protected GameObject Row(GameObject parent, string name = null, TextAlignment alignment = TextAlignment.Center)
        {
            PanelContainerProfile profile = Defaults.GetProfile(panelContainerProfile);
            RowContainerFactory   factory = Undoable.AddComponent <RowContainerFactory>(disposable);

            factory.containerName = name;
            factory.parent        = parent;
            factory.padding       = profile.padding;
            factory.spacing       = profile.spacing;
            factory.alignment     = alignment;
            return(factory.Generate());
        }
Example #29
0
        protected GameObject CreateKineticScrollerItem(GameObject parent)
        {
            KineticScrollerItemFactory kineticScrollerItemFactory = Undoable.AddComponent <KineticScrollerItemFactory>(disposable);
            ButtonProfile profile = Defaults.GetMomentaryButtonProfile(momentaryButtonProfile);

            kineticScrollerItemFactory.parent    = parent;
            kineticScrollerItemFactory.material  = profile.material;
            kineticScrollerItemFactory.highlight = profile.highlight;
            kineticScrollerItemFactory.outline   = profile.outline;
            kineticScrollerItemFactory.fontColor = profile.fontColor;
            return(kineticScrollerItemFactory.Generate());
        }
Example #30
0
 public void Undo()
 {
     Debug.Log("Undo Call" + lastAction);
     if (null == lastAction)
     {
         return;
     }
     else
     {
         lastAction.Undo();
         lastAction = null;
     }
 }