Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            DataTableComponent t = (DataTableComponent)target;

            EditorGUILayout.PropertyField(m_EnableLoadDataTableSuccessEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableFailureEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableUpdateEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableDependencyAssetEvent);

            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
            {
                m_DataTableHelperInfo.Draw();
            }
            EditorGUI.EndDisabledGroup();

            if (EditorApplication.isPlaying)
            {
                EditorGUILayout.LabelField("Data Table Count", t.Count.ToString());

                DataTableBase[] dataTables = t.GetAllDataTables();
                foreach (DataTableBase dataTable in dataTables)
                {
                    DrawDataTable(dataTable);
                }
            }

            serializedObject.ApplyModifiedProperties();

            Repaint();
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            DataTableComponent t = target as DataTableComponent;

            m_EnableLoadDataTableSuccessEvent.boolValue         = EditorGUILayout.ToggleLeft("Enable Load Table Success Event", m_EnableLoadDataTableSuccessEvent.boolValue);
            m_EnableLoadDataTableFailureEvent.boolValue         = EditorGUILayout.ToggleLeft("Enable Load Table Failure Event", m_EnableLoadDataTableFailureEvent.boolValue);
            m_EnableLoadDataTableUpdateEvent.boolValue          = EditorGUILayout.ToggleLeft("Enable Load Table Update Event", m_EnableLoadDataTableUpdateEvent.boolValue);
            m_EnableLoadDataTableDependencyAssetEvent.boolValue = EditorGUILayout.ToggleLeft("Enable Load Table Dependency Asset Event", m_EnableLoadDataTableDependencyAssetEvent.boolValue);

            //运行模式不能绘制辅助器信息
            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
            {
                m_DataTableHelperInfo.Draw();
            }
            EditorGUI.EndDisabledGroup();

            //运行模式绘制数据表
            if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
            {
                EditorGUILayout.LabelField("Data Table Count", t.Count.ToString()); //数据表数量

                DataTableBase[] dataTables = t.GetAllDataTables();                  //获取所有的数据表
                foreach (var dataTable in dataTables)
                {
                    EditorGUILayout.LabelField(Utility.Text.GetFullName(dataTable.Type, dataTable.Name), Utility.Text.Format("{0} Rows", dataTable.Count.ToString()));
                }
            }

            serializedObject.ApplyModifiedProperties();
            Repaint();
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            DataTableComponent t = (DataTableComponent)target;

            EditorGUILayout.PropertyField(m_EnableLoadDataTableSuccessEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableFailureEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableUpdateEvent);
            EditorGUILayout.PropertyField(m_EnableLoadDataTableDependencyAssetEvent);

            if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
            {
                EditorGUILayout.LabelField("Data Table Count", t.DataTablesCount.ToString());

                IDataTable[] dataTables = t.GetAllDataTables();
                foreach (IDataTable dataTable in dataTables)
                {
                    DrawDataTable(dataTable);
                }
            }



            serializedObject.ApplyModifiedProperties();

            Repaint();
        }
Exemplo n.º 4
0
 /// <summary>
 /// 重新加载已加载的数据表
 /// </summary>
 public static void ReloadDataTable(this DataTableComponent dataTableComponent)
 {
     DataTableBase[] allLoadedDataTables = dataTableComponent.GetAllDataTables();
     for (int i = 0; i < allLoadedDataTables.Length; i++)
     {
         Type dataTableType = allLoadedDataTables[i].Type;
         if (dataTableComponent.DestroyDataTable(dataTableType))
         {
             string reloadTableName = dataTableType.ToString().Replace(DataRowClassPrefixName, "");
             dataTableComponent.LoadDataTable(reloadTableName);
             Log.Info("Reload DataTable:[{0}] success", reloadTableName);
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 获取所有数据表。
 /// </summary>
 public DataTableProvider[] GetAllDataTables()
 {
     return(m_DataTableManager.GetAllDataTables());
 }