예제 #1
0
파일: MainForm.cs 프로젝트: viticm/pap2
            /// <summary>
            /// 在新线程内初始化数据
            /// </summary>
            private void InitInThread()
            {
                int currentValue = 1;
                ProgressForm pForm = new ProgressForm(12);
                pForm.Show();
                pForm.Refresh();

                foreach (string s in iniReader.SectionNames)
                {
                    infoTable[s] = iniReader[s];
                }

                string keyValue = null;

                // 初始化Main
                content = infoTable["MAIN"] as string;

                if (content != null)
                {
                    keyValue = iniReader["MAIN", "NumNPC"];
                    if (keyValue != "")
                    {
                        nNumNPC = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodad"];
                    if (keyValue != "")
                    {
                        nNumDoodad = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRefreshSet"];
                    if (keyValue != "")
                    {
                        nNumNpcRefreshSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRefreshSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumNpcRefreshSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadRefreshSet"];
                    if (keyValue != "")
                    {
                        nNumDoodadRefreshSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadRefreshSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumDoodadRefreshSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumAIGroup"];
                    if (keyValue != "")
                    {
                        nNumAIGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumAIGroupMaxID"];
                    if (keyValue != "")
                    {
                        nNumAIGroupMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumWapPointSet"];
                    if (keyValue != "")
                    {
                        nNumWapPointSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumWapPointSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumWapPointSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneID"];
                    if (keyValue != "")
                    {
                        logicalSceneID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneXStart"];
                    if (keyValue != "")
                    {
                        logicalSceneXStart = float.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneZStart"];
                    if (keyValue != "")
                    {
                        logicalSceneZStart = float.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumLogicalPoly"];
                    if (keyValue != "")
                    {
                        nNumLogicalPoly = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumTrafficPointSet"];
                    if (keyValue != "")
                    {
                        nNumTrafficPointSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumTrafficPoint"];
                    if (keyValue != "")
                    {
                        nNumTrafficPoint = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "AISetCount"];
                    if (keyValue != "")
                    {
                        nNumAISetCount = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcReviveGroup"];
                    if (keyValue != "")
                    {
                        nNumNpcReviveGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadReviveGroup"];
                    if (keyValue != "")
                    {
                        nNumDoodadReviveGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRandomGroup"];
                    if (keyValue != "")
                    {
                        nNumNpcRandomGroup = int.Parse(keyValue);
                    }
                }

                pForm.Progress(currentValue, "读取Main数据...");
                pForm.Refresh();
                currentValue++;                
                Thread.Sleep(100);

                // 初始化AISet
                for (int i = 0; i < nNumAISetCount; i++)
                {
                    string sectionName = string.Format("AISET{0}", i.ToString());
                    aiSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取AISet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化WayPointSet
                for (int i = 0; i < nNumWapPointSet; i++)
                {
                    string sectionName = string.Format("WayPointSet{0}", i.ToString());
                    wayPointSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取WayPointSet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NPC
                for (int i = 0; i < nNumNPC; i++)
                {
                    string sectionName = string.Format("NPC{0}", i.ToString());
                    npcList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NPC数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化Doodad
                for (int i = 0; i < nNumDoodad; i++)
                {
                    string sectionName = string.Format("Doodad{0}", i.ToString());
                    doodadList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取Doodad数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化AIGroup
                for (int i = 0; i < nNumAIGroup; i++)
                {
                    string sectionName = string.Format("AIGroup{0}", i.ToString());
                    aiGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取AIGroup数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化LogicalPoly
                for (int i = 0; i < nNumLogicalPoly; i++)
                {
                    string sectionName = string.Format("LogicalPoly{0}", i.ToString());
                    logicalPolyList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取LogicalPoly数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化TrafficPoint
                for (int i = 0; i < nNumTrafficPoint; i++)
                {
                    string sectionName = string.Format("TrafficPoint{0}", i.ToString());
                    trafficPointList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取TrafficPoint数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化TrafficPointset
                for (int i = 0; i < nNumTrafficPointSet; i++)
                {
                    string sectionName = string.Format("TrafficPointSet{0}", i.ToString());
                    trafficPointSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取TrafficPointSet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NpcReviveGroups
                for (int i = 0; i < nNumNpcReviveGroup; i++)
                {
                    string sectionName = string.Format("NpcReviveSection{0}", i.ToString());
                    npcReviveGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NpcReviveGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化DoodadReviveGroups
                for (int i = 0; i < nNumDoodadReviveGroup; i++)
                {
                    string sectionName = string.Format("DoodadReviveSection{0}", i.ToString());
                    doodadReviveGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取DoodadReviveGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NpcRandomGroups
                for (int i = 0; i < nNumNpcRandomGroup; i++)
                {
                    string sectionName = string.Format("NpcRandomSection{0}", i.ToString());
                    npcRandomGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NpcRandomGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                content = iniReader.FileContent;
                isReady = true;
                pForm.Close();
            }
예제 #2
0
파일: MainForm.cs 프로젝트: weimingtom/pap2
            /// <summary>
            /// 在新线程内初始化数据
            /// </summary>
            private void InitInThread()
            {
                int          currentValue = 1;
                ProgressForm pForm        = new ProgressForm(12);

                pForm.Show();
                pForm.Refresh();

                foreach (string s in iniReader.SectionNames)
                {
                    infoTable[s] = iniReader[s];
                }

                string keyValue = null;

                // 初始化Main
                content = infoTable["MAIN"] as string;

                if (content != null)
                {
                    keyValue = iniReader["MAIN", "NumNPC"];
                    if (keyValue != "")
                    {
                        nNumNPC = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodad"];
                    if (keyValue != "")
                    {
                        nNumDoodad = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRefreshSet"];
                    if (keyValue != "")
                    {
                        nNumNpcRefreshSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRefreshSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumNpcRefreshSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadRefreshSet"];
                    if (keyValue != "")
                    {
                        nNumDoodadRefreshSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadRefreshSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumDoodadRefreshSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumAIGroup"];
                    if (keyValue != "")
                    {
                        nNumAIGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumAIGroupMaxID"];
                    if (keyValue != "")
                    {
                        nNumAIGroupMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumWapPointSet"];
                    if (keyValue != "")
                    {
                        nNumWapPointSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumWapPointSetMaxID"];
                    if (keyValue != "")
                    {
                        nNumWapPointSetMaxID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneID"];
                    if (keyValue != "")
                    {
                        logicalSceneID = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneXStart"];
                    if (keyValue != "")
                    {
                        logicalSceneXStart = float.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "LogicalSceneZStart"];
                    if (keyValue != "")
                    {
                        logicalSceneZStart = float.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumLogicalPoly"];
                    if (keyValue != "")
                    {
                        nNumLogicalPoly = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumTrafficPointSet"];
                    if (keyValue != "")
                    {
                        nNumTrafficPointSet = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumTrafficPoint"];
                    if (keyValue != "")
                    {
                        nNumTrafficPoint = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "AISetCount"];
                    if (keyValue != "")
                    {
                        nNumAISetCount = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcReviveGroup"];
                    if (keyValue != "")
                    {
                        nNumNpcReviveGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumDoodadReviveGroup"];
                    if (keyValue != "")
                    {
                        nNumDoodadReviveGroup = int.Parse(keyValue);
                    }

                    keyValue = iniReader["MAIN", "NumNpcRandomGroup"];
                    if (keyValue != "")
                    {
                        nNumNpcRandomGroup = int.Parse(keyValue);
                    }
                }

                pForm.Progress(currentValue, "读取Main数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化AISet
                for (int i = 0; i < nNumAISetCount; i++)
                {
                    string sectionName = string.Format("AISET{0}", i.ToString());
                    aiSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取AISet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化WayPointSet
                for (int i = 0; i < nNumWapPointSet; i++)
                {
                    string sectionName = string.Format("WayPointSet{0}", i.ToString());
                    wayPointSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取WayPointSet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NPC
                for (int i = 0; i < nNumNPC; i++)
                {
                    string sectionName = string.Format("NPC{0}", i.ToString());
                    npcList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NPC数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化Doodad
                for (int i = 0; i < nNumDoodad; i++)
                {
                    string sectionName = string.Format("Doodad{0}", i.ToString());
                    doodadList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取Doodad数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化AIGroup
                for (int i = 0; i < nNumAIGroup; i++)
                {
                    string sectionName = string.Format("AIGroup{0}", i.ToString());
                    aiGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取AIGroup数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化LogicalPoly
                for (int i = 0; i < nNumLogicalPoly; i++)
                {
                    string sectionName = string.Format("LogicalPoly{0}", i.ToString());
                    logicalPolyList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取LogicalPoly数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化TrafficPoint
                for (int i = 0; i < nNumTrafficPoint; i++)
                {
                    string sectionName = string.Format("TrafficPoint{0}", i.ToString());
                    trafficPointList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取TrafficPoint数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化TrafficPointset
                for (int i = 0; i < nNumTrafficPointSet; i++)
                {
                    string sectionName = string.Format("TrafficPointSet{0}", i.ToString());
                    trafficPointSetList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取TrafficPointSet数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NpcReviveGroups
                for (int i = 0; i < nNumNpcReviveGroup; i++)
                {
                    string sectionName = string.Format("NpcReviveSection{0}", i.ToString());
                    npcReviveGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NpcReviveGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化DoodadReviveGroups
                for (int i = 0; i < nNumDoodadReviveGroup; i++)
                {
                    string sectionName = string.Format("DoodadReviveSection{0}", i.ToString());
                    doodadReviveGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取DoodadReviveGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                // 初始化NpcRandomGroups
                for (int i = 0; i < nNumNpcRandomGroup; i++)
                {
                    string sectionName = string.Format("NpcRandomSection{0}", i.ToString());
                    npcRandomGroupList.Add(iniReader[sectionName]);
                }

                pForm.Progress(currentValue, "读取NpcRandomGroups数据...");
                pForm.Refresh();
                currentValue++;
                Thread.Sleep(100);

                content = iniReader.FileContent;
                isReady = true;
                pForm.Close();
            }