コード例 #1
0
ファイル: Loading.cs プロジェクト: targettius/Ploppable-RICO
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            //if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            //return;

            //Load xml only from main menu.
            if (xmlManager == null)
            {
                xmlManager = new RICOPrefabManager();
                xmlManager.Run();
            }

            //Assign xml settings to prefabs.
            convertPrefabs = new ConvertPrefabs();
            convertPrefabs.run();

            //Init GUI
            PloppableTool.Initialize();
            RICOSettingsPanel.Initialize();

            //Deploy Detour
            Detour.BuildingToolDetour.Deploy();
            Debug.Log("Detour Deployed");
        }
コード例 #2
0
        /// <summary>
        /// Creates the panel object in-game and displays it.
        /// </summary>
        internal static void Open(BuildingInfo selected = null)
        {
            try
            {
                // If no instance already set, create one.
                if (uiGameObject == null)
                {
                    // Give it a unique name for easy finding with ModTools.
                    uiGameObject = new GameObject("RICOSettingsPanel");
                    uiGameObject.transform.parent = UIView.GetAView().transform;

                    _panel = uiGameObject.AddComponent <RICOSettingsPanel>();

                    // Set up panel.
                    Panel.Setup();
                }

                // Select appropriate building if there's a preselection.
                if (selected != null)
                {
                    Debugging.Message("selecting preselected building " + selected.name);
                    Panel.SelectBuilding(selected);
                }
                else if (lastSelection != null)
                {
                    Panel.SelectBuilding(lastSelection);

                    // Restore previous filter state.
                    if (lastFilter != null)
                    {
                        Panel.SetFilter(lastFilter);
                    }

                    // Restore previous building selection list postion and selected item.
                    Panel.SetListPosition(lastIndex, lastPostion);
                }

                Panel.Show();
            }
            catch (Exception e)
            {
                Debugging.LogException(e);
                return;
            }
        }
コード例 #3
0
        public static void Initialize()
        {
            try
            {
                // Destroy the UI if already exists
                _gameObject = GameObject.Find("RICOSettingsPanel");
                Destroy();

                // Creating our own gameObect, helps finding the UI in ModTools
                _gameObject = new GameObject("RICOSettingsPanel");
                _gameObject.transform.parent = UIView.GetAView().transform;
                _instance = _gameObject.AddComponent <RICOSettingsPanel>();
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
コード例 #4
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            {
                return;
            }

            //Load xml
            xmlManager = new XMLManager();
            xmlManager.Run();

            //Assign xml settings to prefabs.
            convertPrefabs = new ConvertPrefabs();
            convertPrefabs.run();

            //Init GUI
            PloppableTool.Initialize();
            RICOSettingsPanel.Initialize();

            //Deploy Detour
            Detour.BuildingToolDetour.Deploy();
        }