예제 #1
0
        /// <summary>
        /// Called at initialization of the MainMenu scene. Initializes all variables and loads pre-existing settings if they exist.
        /// </summary>
        void Start()
        {
            FindAllGameObjects();
            splashScreen.SetActive(true); //Turns on the loading screen while initializing
            LinkTabs();
            UICallbackManager.RegisterButtonCallbacks(StateMachine.SceneGlobal, gameObject);
            UICallbackManager.RegisterDropdownCallbacks(StateMachine.SceneGlobal, gameObject);

            //Creates the replay directory
            FileInfo file = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Autodesk\Synthesis\Replays\");

            file.Directory.Create();

            //Assigns the currently store registry values or default file path to the proper variables if they exist.
            string robotDirectory = PlayerPrefs.GetString("RobotDirectory", (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Autodesk\synthesis\Robots"));
            string fieldDirectory = PlayerPrefs.GetString("FieldDirectory", (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Autodesk\synthesis\Fields"));

            //If the directory doesn't exist, create it.
            if (!Directory.Exists(robotDirectory))
            {
                file = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Autodesk\synthesis\Robots\");
                file.Directory.Create();
                robotDirectory = file.Directory.FullName;
            }
            if (!Directory.Exists(fieldDirectory))
            {
                file = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Autodesk\synthesis\Fields\");
                file.Directory.Create();
                fieldDirectory = file.Directory.FullName;
            }
            //Saves the current directory information to the registry
            PlayerPrefs.SetString("RobotDirectory", robotDirectory);
            PlayerPrefs.SetString("FieldDirectory", fieldDirectory);

            canvas = GetComponent <Canvas>();

            if (DirectSimulatorLaunch())
            {
                return;
            }

            splashScreen.SetActive(false);

            //This makes it so that if the user exits from the simulator,
            //they are put into the panel where they can select a robot/field
            //In all other cases, users are welcomed with the main menu screen.
            if (!string.IsNullOrEmpty(AppModel.ErrorMessage))
            {
                SwitchErrorScreen();
            }
            else
            {
                StateMachine.SceneGlobal.PushState(new HomeTabState());
            }
        }
예제 #2
0
        /// <summary>
        /// Finds all the necessary UI elements that need to be updated/modified
        /// </summary>
        private void FindElements()
        {
            canvas  = GameObject.Find("Canvas");
            resetUI = Auxiliary.FindGameObject("ResetRobotSpawnpointUI");

            freeroamCameraWindow = Auxiliary.FindObject(canvas, "FreeroamPanel");
            overviewCameraWindow = Auxiliary.FindObject(canvas, "OverviewPanel");
            spawnpointPanel      = Auxiliary.FindObject(canvas, "SpawnpointPanel");
            //multiplayerPanel = Auxiliary.FindObject(canvas, "MultiplayerPanel");
            driverStationPanel   = Auxiliary.FindObject(canvas, "DriverStationPanel");
            changeRobotPanel     = Auxiliary.FindObject(canvas, "ChangeRobotPanel");
            robotListPanel       = Auxiliary.FindObject(changeRobotPanel, "RobotListPanel");
            changeFieldPanel     = Auxiliary.FindObject(canvas, "ChangeFieldPanel");
            inputManagerPanel    = Auxiliary.FindObject(canvas, "InputManagerPanel");
            checkSavePanel       = Auxiliary.FindObject(canvas, "CheckSavePanel");
            unitConversionSwitch = Auxiliary.FindObject(canvas, "UnitConversionSwitch");

            hotKeyPanel  = Auxiliary.FindObject(canvas, "HotKeyPanel");
            hotKeyButton = Auxiliary.FindObject(canvas, "DisplayHotKeyButton");

            orientWindow  = Auxiliary.FindObject(resetUI, "OrientWindow");
            resetDropdown = GameObject.Find("Reset Robot Dropdown");

            exitPanel          = Auxiliary.FindObject(canvas, "ExitPanel");
            loadingPanel       = Auxiliary.FindObject(canvas, "LoadingPanel");
            analyticsPanel     = Auxiliary.FindObject(canvas, "AnalyticsPanel");
            sensorManager      = GameObject.Find("SensorManager").GetComponent <SensorManager>();
            robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>();
            robotCameraGUI     = GetComponent <RobotCameraGUI>();
            mixAndMatchPanel   = Auxiliary.FindObject(canvas, "MixAndMatchPanel");

            changePanel = Auxiliary.FindObject(canvas, "ChangePanel");
            addPanel    = Auxiliary.FindObject(canvas, "AddPanel");

            // tab and toolbar system components
            tabs            = Auxiliary.FindGameObject("Tabs");
            emulationTab    = Auxiliary.FindObject(tabs, "EmulationTab");
            tabStateMachine = tabs.GetComponent <StateMachine>();

            CheckControlPanel();

            LinkToolbars();
            tabStateMachine.ChangeState(new MainToolbarState());
            currentTab = "HomeTab";

            UICallbackManager.RegisterButtonCallbacks(tabStateMachine, canvas);
            UICallbackManager.RegisterDropdownCallbacks(tabStateMachine, canvas);

            helpMenu = Auxiliary.FindObject(canvas, "Help");
            overlay  = Auxiliary.FindObject(canvas, "Overlay");
        }
예제 #3
0
        /// <summary>
        /// Finds all the necessary UI elements that need to be updated/modified
        /// </summary>
        private void FindElements()
        {
            canvas       = GameObject.Find("Canvas");
            resetRobotUI = Auxiliary.FindGameObject("ResetRobotSpawnpointUI");

            navigationTooltip    = Auxiliary.FindObject("NavigationTooltipContainer");
            overviewCameraWindow = Auxiliary.FindObject(canvas, "OverviewPanel");
            //multiplayerPanel = Auxiliary.FindObject(canvas, "MultiplayerPanel");
            driverStationPanel   = Auxiliary.FindObject(canvas, "DriverStationPanel");
            changeRobotPanel     = Auxiliary.FindObject(canvas, "ChangeRobotPanel");
            robotListPanel       = Auxiliary.FindObject(changeRobotPanel, "RobotListPanel");
            changeFieldPanel     = Auxiliary.FindObject(canvas, "ChangeFieldPanel");
            loadEmptyFieldButton = Auxiliary.FindObject(changeFieldPanel, "LoadEmptyButton");

            resetDropdown = GameObject.Find("Reset Robot Dropdown");

            exitPanel          = Auxiliary.FindObject(canvas, "ExitPanel");
            loadingPanel       = Auxiliary.FindObject(canvas, "LoadingPanel");
            sensorManager      = GameObject.Find("SensorManager").GetComponent <SensorManager>();
            robotCameraManager = GameObject.Find("RobotCameraList").GetComponent <RobotCameraManager>();
            robotCameraGUI     = GetComponent <RobotCameraGUI>();
            mixAndMatchPanel   = Auxiliary.FindObject(canvas, "MixAndMatchPanel");

            changePanel = Auxiliary.FindObject(canvas, "ChangePanel");
            addPanel    = Auxiliary.FindObject(canvas, "AddPanel");

            // tab and toolbar system components
            tabs            = Auxiliary.FindGameObject("Tabs");
            gamepieceTab    = Auxiliary.FindObject(tabs, "DriverPracticeTab");
            scoringTab      = Auxiliary.FindObject(tabs, "ScoringTab");
            tabStateMachine = tabs.GetComponent <StateMachine>();

            betaWarningPanel = Auxiliary.FindObject(canvas, "BetaWarningPanel");

            LinkToolbars();
            tabStateMachine.ChangeState(new MainToolbarState());
            currentTab = "HomeTab";

            UICallbackManager.RegisterButtonCallbacks(tabStateMachine, canvas);
            UICallbackManager.RegisterDropdownCallbacks(tabStateMachine, canvas);
        }
예제 #4
0
        /// <summary>
        /// Links the <see cref="NetworkMultiplayerUI"/>'s panels to the <see cref="StateMachine"/> and
        /// registers all button callbacks.
        /// </summary>
        private void Start()
        {
            UIStateMachine  = GetComponent <StateMachine>();
            canvas          = GetComponent <Canvas>();
            tabCanvas       = Auxiliary.FindGameObject("Canvas");
            exitPanel       = Auxiliary.FindGameObject("ExitPanel");
            tabStateMachine = tabCanvas.GetComponent <StateMachine>();
            UICallbackManager.RegisterButtonCallbacks(tabStateMachine, tabCanvas);
            UICallbackManager.RegisterDropdownCallbacks(tabStateMachine, tabCanvas);

            LinkPanels();
            UICallbackManager.RegisterButtonCallbacks(UIStateMachine, gameObject);
            UICallbackManager.RegisterToggleCallbacks(UIStateMachine, gameObject);

            if (PlayerPrefs.GetInt("ShowDisclaimer", 1) == 1)
            {
                UIStateMachine.PushState(new DisclaimerState(true));
            }
            else
            {
                UIStateMachine.PushState(new HostJoinState());
            }
        }