コード例 #1
0
 public void OnLevelWasLoaded(int level)
 {
     if (_partManager != null)
     {
         _partManager.Unload();
         _partManager = null;
     }
 }
コード例 #2
0
        public void OnLevelWasInitialized(int level)
        {
            var sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;

            if (sceneName == "CustomScene")
            {
                var customMainMenu = GameObject.Find("CustomMainMenu");
                _partManager = customMainMenu.AddComponent <PartManager>();
            }
        }
コード例 #3
0
        public void OnUpdate()
        {
            try
            {
                if (_partManager != null)
                {
                    var currentBoneModFile = PartManager.GetCurrentlyEditedBoneModFilePath();

                    if (currentBoneModFile == null && _partManager.HasGUI)
                    {
                        // Character changed to one w/o bone mod
                        _partManager.Unload();
                        _editedBoneModeFilePath = null;
                    }

                    if (currentBoneModFile != null && currentBoneModFile != _editedBoneModeFilePath)
                    {
                        // Loaded BoneModFile changed changed
                        _partManager.Unload();
                    }

                    if (currentBoneModFile != null)
                    {
                        if (!_partManager.HasGUI && PartManager.CanCreateGUI())
                        {
                            if (PartManager.EditableFileExists())
                            {
                                _partManager.Load();
                                _editedBoneModeFilePath = currentBoneModFile;
                            }
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.LeftControl) &&
                    Input.GetKeyDown(KeyCode.LeftShift) &&
                    Input.GetKeyDown(KeyCode.M))
                {
                    if (_partManager != null)
                    {
                        _partManager.MirrorEdit = !_partManager.MirrorEdit;
                    }
                }
            }
            catch (Exception e)
            {
                _log.Error($"Exception of type {e.GetType()} thrown: {e}");
                throw;
            }
        }