コード例 #1
0
ファイル: ItemCtrl.cs プロジェクト: napatkung/qysg
        public bool LoadItemHelpList()
        {
            //文件存在
            if (!File.Exists(m_Forder + "\\ITEM_HELP_STRING.TXT"))
            {
                return(false);
            }

            //读取
            m_ItemHelpList.Clear();

            FileStream   fs     = new FileStream(m_Forder + "\\ITEM_HELP_STRING.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];
                if (strLine.Contains("item = ") && strLine.Substring(0, CFormat.StringLength("item = ")) == "item = ")
                {
                    ItemHelp_Str item_help;
                    string       tmp  = strLine.Split(new string[] { "item = " }, StringSplitOptions.RemoveEmptyEntries)[0];
                    string       id   = tmp.Split(',')[0];
                    string       name = tmp.Split(',')[1];

                    item_help.id   = id;
                    item_help.name = name;
                    m_ItemHelpList.Add(item_help);
                }
                strLine = null;
                strLine = reader.ReadLine();
            }

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #2
0
        public static bool LoadShopNameList()
        {
            //文件存在
            if (!File.Exists("data\\SHOP_NAME.TXT"))
            {
                return(false);
            }

            //读取
            m_ShopNameList.Clear();

            FileStream   fs     = new FileStream("data\\SHOP_NAME.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];
                if (strLine.Contains("item = ") && strLine.Substring(0, CFormat.StringLength("item = ")) == "item = ")
                {
                    ShopName_Str shopName;
                    string       tmp  = strLine.Split(new string[] { "item = " }, StringSplitOptions.RemoveEmptyEntries)[0];
                    string       id   = tmp.Split(',')[0];
                    string       name = tmp.Split(',')[1];

                    shopName.id   = CFormat.PureString(id);
                    shopName.name = CFormat.PureString(name);
                    m_ShopNameList.Add(shopName);
                }
                strLine = null;
                strLine = reader.ReadLine();
            }

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #3
0
        public bool LoadPlayerList()
        {
            //文件存在
            if (!File.Exists(m_Forder + "\\PLAYERS.TXT"))
            {
                return(false);
            }

            //读取
            m_PlayerList.Clear();

            FileStream   fs     = new FileStream(m_Forder + "\\PLAYERS.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            Player_Str player;

            player.code         = "";
            player.name         = "";
            player.appear_ratio = "";
            player.drop         = "";
            player.drop_enable  = true;
            player.drop_mission = "";
            player.more         = new List <string>();

            bool   get     = false;
            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];

                if (strLine.Contains("[character]") && strLine.Substring(0, CFormat.StringLength("[character]")) == "[character]")
                {
                    if (get)
                    {
                        //add army
                        m_PlayerList.Add(player);
                    }
                    get                 = true;
                    player.code         = "";
                    player.name         = "";
                    player.drop         = "";
                    player.drop_enable  = true;
                    player.drop_mission = "";
                    player.appear_ratio = "";
                    player.more         = new List <string>();
                }
                else if (strLine.Contains("code = ") && strLine.Substring(0, CFormat.StringLength("code = ")) == "code = ")
                {
                    player.code = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("name = ") && strLine.Substring(0, CFormat.StringLength("name = ")) == "name = ")
                {
                    player.name  = CFormat.PureString(strLine.Split('=')[1]);
                    m_lastNameId = int.Parse(player.name);
                }
                else if (strLine.Contains("appear_ratio = ") && strLine.Substring(0, CFormat.StringLength("appear_ratio = ")) == "appear_ratio = ")
                {
                    player.appear_ratio = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("drop = ") && strLine.Substring(0, CFormat.StringLength("drop = ")) == "drop = ")
                {
                    player.drop = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("drop_mission = ") && strLine.Substring(0, CFormat.StringLength("drop_mission = ")) == "drop_mission = ")
                {
                    player.drop_mission = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("="))
                {
                    player.more.Add(strLine);
                }

                strLine = null;
                strLine = reader.ReadLine();
            }

            //末了 写一次
            m_PlayerList.Add(player);

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #4
0
ファイル: ItemModeCtrl.cs プロジェクト: napatkung/qysg
        public static bool LoadItemModeInfo()
        {
            //文件存在
            if (!File.Exists("data\\ITEMMODESHOP.TXT"))
            {
                return(false);
            }

            //读取
            m_ItemModeList.Clear();

            FileStream   fs     = new FileStream("data\\ITEMMODESHOP.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            Item_Mode_Str mode = new Item_Mode_Str();

            mode.code        = "";
            mode.type        = "";
            mode.item_id     = "";
            mode.item_number = "";
            mode.cost        = "";
            mode.item_attr   = "";

            bool   get     = false;
            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];
                strLine = strLine.Replace("Item_", "item_");//乱七八糟的Item定义

                if (strLine.Contains("[item_shop]") && strLine.Substring(0, CFormat.StringLength("[item_shop]")) == "[item_shop]")
                {
                    if (get)
                    {
                        //add army
                        m_ItemModeList.Add(mode);
                    }
                    get              = true;
                    mode             = new Item_Mode_Str();
                    mode.code        = "";
                    mode.type        = "";
                    mode.item_id     = "";
                    mode.item_number = "";
                    mode.cost        = "";
                    mode.item_attr   = "";
                }
                else if (strLine.Contains("code = ") && strLine.Substring(0, CFormat.StringLength("code = ")) == "code = ")
                {
                    mode.code = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("type = ") && strLine.Substring(0, CFormat.StringLength("type = ")) == "type = ")
                {
                    mode.type = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("item_id = ") && strLine.Substring(0, CFormat.StringLength("item_id = ")) == "item_id = ")
                {
                    mode.item_id = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("item_number = ") && strLine.Substring(0, CFormat.StringLength("item_number = ")) == "item_number = ")
                {
                    mode.item_number = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("cost = ") && strLine.Substring(0, CFormat.StringLength("cost = ")) == "cost = ")
                {
                    mode.cost = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("item_attr = ") && strLine.Substring(0, CFormat.StringLength("item_attr = ")) == "item_attr = ")
                {
                    mode.item_attr = CFormat.PureString(strLine.Split('=')[1]);
                }

                strLine = null;
                strLine = reader.ReadLine();
            }

            //末了 写一次
            m_ItemModeList.Add(mode);

            ReSort();

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #5
0
        public bool LoadArmyInfo()
        {
            //文件存在
            if (!File.Exists(m_Forder + "\\ARMY.TXT"))
            {
                return(false);
            }

            //读取
            m_ArmyList.Clear();

            FileStream   fs     = new FileStream(m_Forder + "\\ARMY.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            Army_Str army = new Army_Str();;

            army.code           = "";
            army.name           = "";
            army.reborn_delay   = "";
            army.reborn_range   = "";
            army.disappear_time = "";
            army.list           = new List <string>();
            army.map            = new List <Map_Str>();

            bool   get     = false;
            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];

                if (strLine.Contains("[army]") && strLine.Substring(0, CFormat.StringLength("[army]")) == "[army]")
                {
                    if (get)
                    {
                        //add army
                        m_ArmyList.Add(army);
                    }
                    get                 = true;
                    army                = new Army_Str();;
                    army.code           = "";
                    army.name           = "";
                    army.reborn_delay   = "";
                    army.reborn_range   = "";
                    army.disappear_time = "";
                    army.list           = new List <string>();
                    army.map            = new List <Map_Str>();
                }
                else if (strLine.Contains("code = ") && strLine.Substring(0, CFormat.StringLength("code = ")) == "code = ")
                {
                    army.code = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("name = ") && strLine.Substring(0, CFormat.StringLength("name = ")) == "name = ")
                {
                    army.name = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("reborn_delay = ") && strLine.Substring(0, CFormat.StringLength("reborn_delay = ")) == "reborn_delay = ")
                {
                    army.reborn_delay = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("reborn_range = ") && strLine.Substring(0, CFormat.StringLength("reborn_range = ")) == "reborn_range = ")
                {
                    army.reborn_range = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("disappear_time = ") && strLine.Substring(0, CFormat.StringLength("disappear_time = ")) == "disappear_time = ")
                {
                    army.disappear_time = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("list = ") && strLine.Substring(0, CFormat.StringLength("list = ")) == "list = ")
                {
                    var lst = CFormat.PureString(strLine.Split('=')[1]).Split(',');
                    foreach (var item in lst)
                    {
                        army.list.Add(item);
                    }
                }
                else if (strLine.Contains("map = ") && strLine.Substring(0, CFormat.StringLength("map = ")) == "map = ")
                {
                    var     map = CFormat.PureString(strLine.Split('=')[1]).Split(',');
                    Map_Str _map;
                    _map.id = map[0];
                    _map.x  = map[1];
                    _map.y  = map[2];
                    army.map.Add(_map);
                }

                strLine = null;
                strLine = reader.ReadLine();
            }

            //末了 写一次
            m_ArmyList.Add(army);

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #6
0
ファイル: ItemCtrl.cs プロジェクト: napatkung/qysg
        public bool LoadItemList()
        {
            //文件存在
            if (!File.Exists(m_Forder + "\\ITEM.TXT"))
            {
                return(false);
            }

            //读取
            m_ItemList.Clear();

            FileStream   fs     = new FileStream(m_Forder + "\\ITEM.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            Item_Str item;

            item.code         = "";
            item.name         = "";
            item.cost         = "";
            item.sell         = "";
            item.help_string  = "";
            item.type         = "";
            item.use_magic_id = "";
            item.more         = new List <string>();

            bool   get     = false;
            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];
                strLine = strLine.Replace("Item_", "item_");//乱七八糟的Item定义

                if (strLine.Contains("[item]") && strLine.Contains("[item]"))
                {
                    if (get)
                    {
                        //add army
                        m_ItemList.Add(item);
                        if (item.use_magic_id != "" && item.type.Contains("itemTypeLetto"))
                        {
                            m_ItemLettoList.Add(item);
                        }
                    }
                    get               = true;
                    item.code         = "";
                    item.name         = "";
                    item.cost         = "";
                    item.sell         = "";
                    item.help_string  = "";
                    item.type         = "";
                    item.use_magic_id = "";
                    item.more         = new List <string>();
                }
                else if (strLine.Contains("code = ") && strLine.Substring(0, CFormat.StringLength("code =")) == "code =")
                {
                    item.code = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("type = ") && strLine.Substring(0, CFormat.StringLength("type =")) == "type =")
                {
                    item.type = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("use_magic_id = ") && strLine.Substring(0, CFormat.StringLength("use_magic_id =")) == "use_magic_id =")
                {
                    item.use_magic_id = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("name = ") && strLine.Substring(0, CFormat.StringLength("name =")) == "name =")
                {
                    item.name = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("cost = ") && strLine.Substring(0, CFormat.StringLength("cost =")) == "cost =")
                {
                    item.cost = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("sell = ") && strLine.Substring(0, CFormat.StringLength("sell =")) == "sell =")
                {
                    item.sell = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("help_string = ") && strLine.Substring(0, CFormat.StringLength("help_string =")) == "help_string =")
                {
                    item.help_string = CFormat.PureString(strLine.Split('=')[1]);
                }
                else if (strLine.Contains("="))
                {
                    item.more.Add(strLine);
                }

                strLine = null;
                strLine = reader.ReadLine();
            }

            //末了 写一次
            m_ItemList.Add(item);

            reader.Close();
            fs.Close();

            return(true);
        }
コード例 #7
0
        public static bool LoadDropListInfo()
        {
            //文件存在
            if (!File.Exists("data\\DROPITEM.TXT"))
            {
                return(false);
            }

            //读取
            m_DropList.Clear();

            FileStream   fs     = new FileStream("data\\DROPITEM.TXT", FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader(fs, Encoding.GetEncoding(950));

            reader.DiscardBufferedData();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            reader.BaseStream.Position = 0;

            string strLine = "";

            strLine = reader.ReadLine();
            while (strLine != null)
            {
                strLine = strLine.Split('/')[0];
                strLine = strLine.Replace("Item_", "item_");//乱七八糟的Item定义

                if (strLine.Contains("drop = ") && strLine.Substring(0, CFormat.StringLength("drop = ")) == "drop = ")
                {
                    Drop_Str drop;
                    drop.list = new List <Drop_Single_Str>();

                    string tmp      = strLine.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[1];
                    var    dropList = CFormat.PureString(tmp).Split(',');
                    string id       = dropList[0];
                    drop.id = id;

                    string name = "";
                    string num  = "";
                    for (int i = 1; i < dropList.Length; i++)
                    {
                        if (dropList[i] != "" && dropList[i] != null)
                        {
                            if (i % 2 == 1)
                            {
                                //name
                                name = dropList[i];
                            }
                            else
                            {
                                //num
                                num = dropList[i];
                                Drop_Single_Str single = new Drop_Single_Str();
                                single.name = name;
                                single.num  = num;

                                drop.list.Add(single);
                            }
                        }
                    }
                    m_DropList.Add(drop);
                }
                strLine = null;
                strLine = reader.ReadLine();
            }

            reader.Close();
            fs.Close();

            return(true);
        }