Пример #1
0
        public static void LoadGateID()
        {
            int I;

            GameFramework.TStringList LoadList;
            string sLineText;
            string sID     = string.Empty;
            string sIPaddr = string.Empty;
            int    nID;

            g_GateIDList.Clear();
            if (File.Exists(g_sGateIDConfFileName))
            {
                LoadList = new GameFramework.TStringList();
                LoadList.LoadFromFile(g_sGateIDConfFileName);
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I];
                    if ((sLineText == "") || (sLineText[1] == ';'))
                    {
                        continue;
                    }
                    sLineText = GameFramework.HUtil32.GetValidStr3(sLineText, ref sID, new string[] { " ", "\09" });
                    sLineText = GameFramework.HUtil32.GetValidStr3(sLineText, ref sIPaddr, new string[] { " ", "\09" });
                    nID       = GameFramework.HUtil32.Str_ToInt(sID, -1);
                    if (nID < 0)
                    {
                        continue;
                    }
                    g_GateIDList.Add(sIPaddr, ((nID) as Object));
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 初始化DBSshare
 /// </summary>
 public static void Initialization()
 {
     //InitializeCriticalSection(g_HumDB_CS);
     g_HumDB_CS = new object();
     //InitializeCriticalSection(g_Ranking_CS)
     g_Ranking_CS         = new object();
     g_MainLogMsgList     = new TGStringList();
     g_DenyChrNameList    = new GameFramework.TStringList();
     g_ServerIPList       = new GameFramework.TStringList();
     g_GateIDList         = new Hashtable();
     g_MapList            = new Hashtable();
     g_ClearMakeIndex     = new GameFramework.TStringList();
     g_DenyRankingChrList = new GameFramework.TStringList();
     g_AICharNameList     = new GameFramework.TStringList();
     for (int i = 0; i < g_RouteInfo.Length; i++)
     {
         g_RouteInfo[i] = new TRouteInfo();
     }
     g_HumDataDB  = TFileDB.GetInstance();
     g_HumCharDB  = new TFileHumDB();
     g_ModuleList = new List <TModuleInfo>();
     //DBShare.g_HumRanking = new TSortStringList();
     //DBShare.g_WarriorRanking = new TSortStringList();
     //DBShare.g_WizzardRanking = new TSortStringList();
     //DBShare.g_MonkRanking = new TSortStringList();
     //DBShare.g_HeroRanking = new TSortStringList();
     //DBShare.g_HeroWarriorRanking = new TSortStringList();
     //DBShare.g_HeroWizzardRanking = new TSortStringList();
     //DBShare.g_HeroMonkRanking = new TSortStringList();
     //DBShare.g_MasterRanking = new TSortStringList();
     g_MagicList   = new List <string>();
     g_StdItemList = new List <string>();
 }
Пример #3
0
        public static void LoadServerInfo()
        {
            int I;

            GameFramework.TStringList LoadList;
            int    nRouteIdx;
            int    nGateIdx;
            int    nServerIndex;
            string sLineText;
            string sSelGateIPaddr  = string.Empty;
            string sGameGateIPaddr = string.Empty;
            string sGameGate;
            string sGameGatePort = string.Empty;
            string sMapName      = string.Empty;
            string sMapInfo;
            string sServerIndex;

            if (!File.Exists(g_sGateConfFileName))//如果文件不存在 则生成!serverinfo.txt
            {
                LoadList = new GameFramework.TStringList();
                LoadList.Add("127.0.0.1 127.0.0.1 7200");
                try
                {
                    LoadList.SaveToFile(g_sGateConfFileName);
                }
                catch
                {
                }
            }
            if (File.Exists(g_sGateConfFileName))//如果文件存在
            {
                LoadList = new GameFramework.TStringList();
                try
                {
                    LoadList.LoadFromFile(g_sGateConfFileName);
                }
                catch
                {
                }
                nRouteIdx = 0;
                nGateIdx  = 0;
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I].Trim();
                    if ((sLineText != "") && (sLineText[1] != ';'))
                    {
                        sGameGate = GameFramework.HUtil32.GetValidStr3(sLineText, ref sSelGateIPaddr, new string[] { " ", "\09" });
                        if ((sGameGate == "") || (sSelGateIPaddr == ""))//如果为空继续
                        {
                            continue;
                        }
                        g_RouteInfo[nRouteIdx].sSelGateIP = sSelGateIPaddr.Trim();//第一个IP 选择网关IP
                        g_RouteInfo[nRouteIdx].nGateCount = 0;
                        nGateIdx = 0;
                        while ((sGameGate != ""))//如果剩下的字符串不为空  如果一直不为空
                        {
                            sGameGate = GameFramework.HUtil32.GetValidStr3(sGameGate, ref sGameGateIPaddr, new string[] { " ", "\09" });
                            sGameGate = GameFramework.HUtil32.GetValidStr3(sGameGate, ref sGameGatePort, new string[] { " ", "\09" });
                            g_RouteInfo[nRouteIdx].sGameGateIP.Add(sGameGateIPaddr.Trim());//游戏网关IP
                            g_RouteInfo[nRouteIdx].nGameGatePort.Add(GameFramework.HUtil32.Str_ToInt(sGameGatePort, 0));
                            nGateIdx++;
                        }
                        g_RouteInfo[nRouteIdx].nGateCount = nGateIdx;
                        nRouteIdx++;
                    }
                }
                LoadList.Dispose();
            }
            GameFramework.IniFile Conf = new GameFramework.IniFile(g_sConfFileName);//Dbsrc.ini
            g_sMapFile = Conf.ReadString("Setup", "MapFile", g_sMapFile);
            g_MapList.Clear();
            if (File.Exists(g_sMapFile))
            {
                LoadList = new GameFramework.TStringList();
                try
                {
                    LoadList.LoadFromFile(g_sMapFile);
                }
                catch
                {
                }
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I];
                    if ((sLineText != "") && (sLineText[0] == '['))
                    {
                        sLineText    = GameFramework.HUtil32.ArrestStringEx(sLineText, "[", "]", ref sMapName);
                        sMapInfo     = GameFramework.HUtil32.GetValidStr3(sMapName, ref sMapName, new string[] { " ", "\09" });
                        sServerIndex = GameFramework.HUtil32.GetValidStr3(sMapInfo, ref sMapInfo, new string[] { " ", "\09" }).Trim();
                        nServerIndex = GameFramework.HUtil32.Str_ToInt(sServerIndex, 0);
                        g_MapList.Add(sMapName, ((nServerIndex) as Object));
                    }
                }
            }
        }