Ejemplo n.º 1
0
        protected void Start()
        {
            ms_Instance = this;

            Application.targetFrameRate           = 60;
            Application.backgroundLoadingPriority = ThreadPriority.Low;
            MapManager.GetInstance();
        }
Ejemplo n.º 2
0
        private void DoGUI(DebugPanel.Config config)
        {
            if (!config.IsEditor)
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical();
            }

            // 左侧
            GUILayout.Box($"MapManager State:{m_State} PlayerRealWorldPosition:({_PlayerInfo.RealWorldPosition.x:F1}, {_PlayerInfo.RealWorldPosition.y:F1}, {_PlayerInfo.RealWorldPosition.z:F1}) PlayerGameWorldPosition:({_PlayerInfo.GameWorldPosition.x:F1}, {_PlayerInfo.GameWorldPosition.y:F1}, {_PlayerInfo.GameWorldPosition.z:F1})"
                          , config.BoxStyle);

#if UNITY_EDITOR
            if (PreviewHelper.GetInstance() != null)
            {
                if (_ForDebug._MapUids == null)
                {
                    _ForDebug.InitMapUids();
                }

                _ForDebug._PreviewHelperFoldout = UnityEditor.EditorGUILayout.Foldout(_ForDebug._PreviewHelperFoldout, "Preview Helper");
                if (_ForDebug._PreviewHelperFoldout)
                {
                    UnityEditor.EditorGUILayout.LabelField("Map:");
                    config.BeginToolbarHorizontal();
                    const float BUTTON_MAX_WIDTH  = 120.0f;
                    int         buttonCountPreRow = Mathf.CeilToInt(config.PanelWidth / BUTTON_MAX_WIDTH);
                    for (int iMap = 0; iMap < _ForDebug._MapUids.Count; iMap++)
                    {
                        if (iMap > 0 &&
                            iMap % buttonCountPreRow == 0)
                        {
                            UnityEditor.EditorGUILayout.EndHorizontal();
                            config.BeginToolbarHorizontal();
                        }

                        if (config.ToolbarButton(_ForDebug._MapUids[iMap] == GetCurrentMapUid(), _ForDebug._MapUids[iMap].ToString()))
                        {
                            TryChangeMap(_ForDebug._MapUids[iMap]);
                        }
                    }
                    UnityEditor.EditorGUILayout.EndHorizontal();
                    UnityEditor.EditorGUILayout.Space();

                    if (m_CurrentMapController != null)
                    {
                        MapInfo mapInfo = m_CurrentMapController._GetMapInfo();
                        if (mapInfo != null)
                        {
                            UnityEditor.EditorGUILayout.LabelField("Area:");
                            config.BeginToolbarHorizontal();
                            for (int iArea = 0; iArea < mapInfo.AreaInfos.Length; iArea++)
                            {
                                if (iArea > 0 &&
                                    iArea % buttonCountPreRow == 0)
                                {
                                    UnityEditor.EditorGUILayout.EndHorizontal();
                                    config.BeginToolbarHorizontal();
                                }

                                if (config.ToolbarButton(mapInfo.AreaInfos[iArea].Uid == GetCurrentAreaUid(), mapInfo.AreaInfos[iArea].Uid.ToString()))
                                {
                                    PreviewHelper.GetInstance().SetRealPosition(mapInfo.AreaInfos[iArea].Position);
                                }
                            }
                            UnityEditor.EditorGUILayout.EndHorizontal();
                        }
                    }
                    UnityEditor.EditorGUILayout.Space();
                }
            }
#endif

            if (m_CurrentMapController != null)
            {
                GUILayout.Label("Current Map", config.LabelStyle);
                m_CurrentMapController._DoGUI(config);
            }

            if (!config.IsEditor)
            {
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
        }