Esempio n. 1
0
        public static int GetModeTypeNum(int type)
        {
            string _type = "";

            if (type == 1)
            {
                _type = "ishopType_General";
            }
            else if (type == 2)
            {
                _type = "ishopType_Special";
            }
            else if (type == 3)
            {
                _type = "ishopType_Funcion";
            }
            else if (type == 4)
            {
                _type = "ishopType_Cheap";
            }
            int num = 0;

            foreach (var mode in m_ItemModeList)
            {
                if (CFormat.PureString(mode.type) == CFormat.PureString(_type) &&
                    CFormat.PureString(mode.item_id) != "")
                {
                    num++;
                }
            }
            return(num);
        }
Esempio n. 2
0
        public static bool AddShopItem(string id, int index, int level, string item)
        {
            List <ShopData_Str> shopDataList = new List <ShopData_Str>();

            if (level >= 0 && level < 4)
            {
                shopDataList = m_ShopDataList[level];
            }
            else
            {
                return(false);
            }

            foreach (var it in shopDataList)
            {
                if (CFormat.ToSimplified(it.code) == id)
                {
                    //it.list.Add(item);
                    it.list.Insert(index, item);
                    return(true);
                }
            }

            m_ShopDataList[level] = shopDataList;

            return(false);
        }
Esempio n. 3
0
        public static bool DelShopItem(string id, int level, string item)
        {
            List <ShopData_Str> shopDataList = new List <ShopData_Str>();

            if (level >= 0 && level < 4)
            {
                shopDataList = m_ShopDataList[level];
            }
            else
            {
                return(false);
            }

            foreach (var it in shopDataList)
            {
                if (CFormat.ToSimplified(it.code) == id)
                {
                    it.list.Remove(CFormat.ToTraditional(item));
                    return(true);
                }
            }
            m_ShopDataList[level] = shopDataList;

            return(false);
        }
Esempio n. 4
0
        public static bool ItemSendNext(string code, int level, string item)
        {
            List <ShopData_Str> shopDataList = new List <ShopData_Str>();

            if (level >= 0 && level < 4)
            {
                shopDataList = m_ShopDataList[level];
            }
            else
            {
                return(false);
            }
            foreach (var shop in shopDataList)
            {
                if (CFormat.PureString(shop.code) == CFormat.PureString(code))
                {
                    for (int i = 0; i < shop.list.Count; i++)
                    {
                        if (CFormat.ToSimplified(shop.list[i]) == item && i < shop.list.Count - 1)
                        {
                            string tmp;
                            tmp = shop.list[i + 1];
                            shop.list[i + 1] = shop.list[i];
                            shop.list[i]     = tmp;

                            return(true);
                        }
                    }
                }
            }
            m_ShopDataList[level] = shopDataList;

            return(false);
        }
Esempio n. 5
0
        public static bool AddSingleDrop(string id, string name, string num)
        {
            Drop_Single_Str single = new Drop_Single_Str();

            single.name = name;
            single.num  = num;
            for (int i = 0; i < m_DropList.Count; i++)
            {
                if (CFormat.ToSimplified(m_DropList[i].id) == id)
                {
                    m_DropList[i].list.Add(single);
                    return(true);
                }
            }
            try
            {
                //找不到该id
                Drop_Str drop = new Drop_Str();
                drop.list = new List <Drop_Single_Str>();
                drop.id   = id;
                drop.list.Add(single);
                m_DropList.Add(drop);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 6
0
        public static bool ModeSendFwd(string code)
        {
            Int32 _code    = Int32.Parse(code);
            Int32 codeType = _code / 100;

            //当前类型是否最前
            if (_code - 1 <= codeType * 100)
            {
                return(false);//到顶,不操作
            }

            //
            Item_Mode_Str tmp;

            for (int i = 0; i < m_ItemModeList.Count; i++)
            {
                if (CFormat.ToSimplified(m_ItemModeList[i].code) == code)
                {
                    tmp = m_ItemModeList[i - 1];
                    m_ItemModeList[i - 1] = m_ItemModeList[i];
                    m_ItemModeList[i]     = tmp;
                    ReSort();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 7
0
        public static string GameStrToSimpleCN(string src)
        {
            byte[] utf8bytes = System.Text.Encoding.Default.GetBytes(src);
            string temp      = System.Text.Encoding.GetEncoding(950).GetString(utf8bytes);

            temp = CFormat.ToSimplified(temp);

            return(temp);
        }
Esempio n. 8
0
 private static string GetShopNameId(string shopName)
 {
     foreach (var item in m_ShopNameList)
     {
         if (CFormat.ToSimplified(item.name) == CFormat.ToSimplified(shopName))
         {
             return(item.id);
         }
     }
     return("");
 }
Esempio n. 9
0
 private static string GetShopNameById(string id)
 {
     foreach (var item in m_ShopDataList[0])
     {
         if (CFormat.ToSimplified(item.code) == id)
         {
             return(item.ShopName);
         }
     }
     return("");
 }
Esempio n. 10
0
 public static bool DelItemModeInfo(string code)
 {
     foreach (var mode in m_ItemModeList)
     {
         if (CFormat.PureString(mode.code) == CFormat.PureString(code))
         {
             m_ItemModeList.Remove(mode);
             ReSort();
             return(true);
         }
     }
     return(false);
 }
Esempio n. 11
0
        public bool MdfyItemAttr(string id, Item_Str item)
        {
            for (int i = 0; i < m_ItemList.Count; i++)
            {
                if (CFormat.ToSimplified(m_ItemList[i].code) == id)
                {
                    m_ItemList[i] = item;
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 12
0
        public bool AddListMap(string code, Map_Str map)
        {
            foreach (var item in m_ArmyList)
            {
                if (CFormat.ToSimplified(item.code) == code)
                {
                    item.map.Add(map);
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 13
0
        public static bool ClearSingleDrops(string id)
        {
            for (int i = 0; i < m_DropList.Count; i++)
            {
                if (CFormat.ToSimplified(m_DropList[i].id) == id)
                {
                    m_DropList[i].list.Clear();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 14
0
        public List <Player_Str> GetPlayersByDrop(string drop)
        {
            List <Player_Str> list = new List <Player_Str>();

            foreach (var item in m_PlayerList)
            {
                if (CFormat.ToSimplified(item.drop) == drop)
                {
                    list.Add(item);
                }
            }

            return(list);
        }
Esempio n. 15
0
        public string GetPalyerName(string id)
        {
            string name = "";

            foreach (var player in m_PlayerNameList)
            {
                if (CFormat.ToSimplified(CFormat.PureString(id)) == CFormat.ToSimplified(CFormat.PureString(player.id)))
                {
                    return(player.name);
                }
            }

            return(name);
        }
Esempio n. 16
0
        public static bool GetItemModeInfo(string code, out Item_Mode_Str newMode)
        {
            foreach (var mode in m_ItemModeList)
            {
                if (CFormat.ToSimplified(mode.code) == code)
                {
                    newMode = mode;
                    return(true);
                }
            }
            newMode = new Item_Mode_Str();

            return(false);
        }
Esempio n. 17
0
 public static bool AddTailItemModeInfo(string code, Item_Mode_Str newMode)
 {
     foreach (var mode in m_ItemModeList)
     {
         if (CFormat.PureString(mode.code) == CFormat.PureString(code))
         {
             int index = m_ItemModeList.IndexOf(mode);
             m_ItemModeList.Insert(index, newMode);
             ReSort();
             return(true);
         }
     }
     return(false);
 }
Esempio n. 18
0
        public static bool MdfyItemModeInfo(string code, Item_Mode_Str newMode)
        {
            for (int i = 0; i < m_ItemModeList.Count; i++)
            {
                if (CFormat.ToSimplified(m_ItemModeList[i].code) == code)
                {
                    m_ItemModeList[i] = newMode;
                    ReSort();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 19
0
        public string GetItemHelp(string id)
        {
            string name = "";

            foreach (var item in m_ItemHelpList)
            {
                if (CFormat.ToSimplified(CFormat.PureString(id)) == CFormat.ToSimplified(CFormat.PureString(item.id)))
                {
                    return(item.name);
                }
            }

            return(name);
        }
Esempio n. 20
0
        public string GetIdByCode(string code)
        {
            string id = "";

            foreach (var item in m_ItemDefList)
            {
                if (CFormat.ToSimplified(CFormat.PureString(code)) == CFormat.ToSimplified(CFormat.PureString("item_" + item.name)))
                {
                    return(item.id);
                }
            }

            return(id);
        }
Esempio n. 21
0
        public string NameSimpToTrad(string name)
        {
            string ret = "";

            foreach (var item in m_ItemDefList)
            {
                if (CFormat.ToSimplified(CFormat.PureString(name)) == CFormat.ToSimplified(CFormat.PureString(item.name)))
                {
                    return(item.name);
                }
            }

            return(ret);
        }
Esempio n. 22
0
 //role_XX ID   此处把 role_XX称作id
 public bool GetAttrById(string id, out Player_Str player)
 {
     foreach (var item in m_PlayerList)
     {
         if (CFormat.ToSimplified(item.code) == id)
         {
             player = item;
             return(true);
         }
     }
     player      = new Player_Str();
     player.more = new List <string>();
     return(false);
 }
Esempio n. 23
0
 //item_XX ID   此处把 item_XX称作id
 public bool GetAttrById(string id, out Item_Str item)
 {
     foreach (var it in m_ItemList)
     {
         if (CFormat.ToSimplified(it.code) == id)
         {
             item = it;
             return(true);
         }
     }
     item      = new Item_Str();
     item.more = new List <string>();
     return(false);
 }
Esempio n. 24
0
        public static string GetIdByName(string name)
        {
            string id = "";

            foreach (var item in m_StageDefList)
            {
                if (CFormat.ToSimplified(item.name) == name)
                {
                    id = item.id;
                    break;
                }
            }
            return(id);
        }
Esempio n. 25
0
        public string GetIdByCode(string code)
        {
            string id = "";

            foreach (var player in m_PlayerDefList)
            {
                if (CFormat.ToSimplified(CFormat.PureString(code)) == CFormat.ToSimplified(CFormat.PureString("role_" + player.name)))
                {
                    return(player.id);
                }
            }

            return(id);
        }
Esempio n. 26
0
        private static bool ReSort()
        {
            List <Item_Mode_Str> m_ItemModeListNew = new List <Item_Mode_Str>();

            Item_Mode_Str newMode = new Item_Mode_Str();
            int           code1   = 100;
            int           code2   = 200;
            int           code3   = 300;
            int           code4   = 400;

            foreach (var mode in m_ItemModeList)
            {
                if (CFormat.PureString(mode.item_id) == "")
                {
                    continue;
                }
                newMode = mode;
                if (newMode.type == "ishopType_General")
                {
                    code1++;
                    newMode.code = code1.ToString();
                }
                else if (newMode.type == "ishopType_Special")
                {
                    code2++;
                    newMode.code = code2.ToString();
                }
                else if (newMode.type == "ishopType_Funcion")
                {
                    code3++;
                    newMode.code = code3.ToString();
                }
                else if (newMode.type == "ishopType_Cheap")
                {
                    code4++;
                    newMode.code = code4.ToString();
                }
                m_ItemModeListNew.Add(newMode);
            }
            m_ItemModeList.Clear();
            m_ItemModeList = m_ItemModeListNew;

            max_code1 = code1;
            max_code2 = code2;
            max_code3 = code3;
            max_code4 = code4;

            return(true);
        }
Esempio n. 27
0
        public static bool ModeSendNext(string code)
        {
            Int32 _code    = Int32.Parse(code);
            Int32 codeType = _code / 100;
            //当前类型是否最后
            int max_code = 0;

            if (codeType == 1)
            {
                max_code = max_code1;
            }
            else if (codeType == 2)
            {
                max_code = max_code2;
            }
            else if (codeType == 3)
            {
                max_code = max_code3;
            }
            else if (codeType == 4)
            {
                max_code = max_code4;
            }
            else
            {
                return(false);
            }
            if (_code >= max_code)
            {
                return(false);
            }

            //
            Item_Mode_Str tmp;

            for (int i = 0; i < m_ItemModeList.Count; i++)
            {
                if (CFormat.ToSimplified(m_ItemModeList[i].code) == code)
                {
                    tmp = m_ItemModeList[i + 1];
                    m_ItemModeList[i + 1] = m_ItemModeList[i];
                    m_ItemModeList[i]     = tmp;
                    ReSort();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 28
0
        public static string GetNameById(string id)
        {
            string name = "";

            foreach (var item in m_ShopDefList)
            {
                if (CFormat.ToSimplified(item.id) == id)
                {
                    name = item.name;
                    break;
                }
            }

            return(name);
        }
Esempio n. 29
0
        public static bool ShopDataExit(string shop_name, int level)
        {
            if (level >= 0 && level < 4)
            {
                foreach (var shop in m_ShopDataList[level])
                {
                    if (CFormat.PureString(shop_name) == shop.ShopName)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 30
0
 public static bool GetDropAttrById(string id, out Drop_Str drop)
 {
     foreach (var item in m_DropList)
     {
         if (CFormat.ToSimplified(item.id) == id)
         {
             drop = item;
             return(true);
         }
     }
     drop      = new Drop_Str();
     drop.list = new List <Drop_Single_Str>();
     drop.id   = id;
     return(false);
 }