コード例 #1
0
        private static ResExtraGot ToExtraGot(string itemsGotDesc)
        {
            ResExtraGot extraGot = new ResExtraGot();

            extraGot.extraPercent = 0f;
            extraGot.m_extraGot   = new List <ResItemGot>();
            string[] part = itemsGotDesc.Split(';');
            if (part.Length != 3)
            {
                return(extraGot);
            }
            string[] strings = part[1].Split(',');
            if (strings.Length < 3 || strings.Length % 2 == 0)
            {
                return(extraGot);
            }

            extraGot.extraPercent = Convert.ToSingle(strings[0]);
            for (int i = 2; i < strings.Length; i += 2)
            {
                ResItemGot itemGot = new ResItemGot();
                itemGot.m_id         = Convert.ToInt32(strings[i - 1]);
                itemGot.m_probablity = Convert.ToSingle(strings[i]);
                extraGot.m_extraGot.Add(itemGot);
            }
            return(extraGot);
        }
コード例 #2
0
        private static List <ResItemGot> ToItemsGot(string itemsGotDesc)
        {
            string[] part    = itemsGotDesc.Split(';');
            string[] strings = part[0].Split(',');

            List <ResItemGot> itemsGot = new List <ResItemGot>();

            for (int i = 1; i < strings.Length; i += 2)
            {
                ResItemGot itemGot = new ResItemGot();
                itemGot.m_id         = Convert.ToInt32(strings[i - 1]);
                itemGot.m_probablity = Convert.ToSingle(strings[i]);
                itemsGot.Add(itemGot);
            }
            return(itemsGot);
        }