Пример #1
0
        string getReward(int itemId, int LuckyValue)
        {
            string reward = "1:1";

            ConfigComponent       configCom    = Game.Scene.GetComponent <ConfigComponent>();
            List <ZhuanpanConfig> shopInfoList = new List <ZhuanpanConfig>();

            for (int i = 1; i < configCom.GetAll(typeof(ZhuanpanConfig)).Length + 1; ++i)
            {
                ZhuanpanConfig config = (ZhuanpanConfig)configCom.Get(typeof(ZhuanpanConfig), i);

                if (config.itemId == itemId)
                {
                    if (config.propId != 3)
                    {
                        reward = (config.propId + ":" + config.PropNum);
                    }
                    else
                    {
                        reward = (config.propId + ":" + config.PropNum);
                    }

                    if (LuckyValue >= 99)
                    {
                        reward += ";111:10";
                    }
                }
            }

            return(reward);
        }
Пример #2
0
        int getRewardItemId(int luckyValue)
        {
            int itemId = 1;

            int r    = Common_Random.getRandom(1, 1000);
            int temp = 0;

            ConfigComponent       configCom    = Game.Scene.GetComponent <ConfigComponent>();
            List <ZhuanpanConfig> shopInfoList = new List <ZhuanpanConfig>();

            for (int i = 1; i < configCom.GetAll(typeof(ZhuanpanConfig)).Length + 1; ++i)
            {
                ZhuanpanConfig config = (ZhuanpanConfig)configCom.Get(typeof(ZhuanpanConfig), i);

                if (r <= (config.Probability + temp))
                {
                    itemId = config.itemId;
                    break;
                }
                else
                {
                    temp += config.Probability;
                }
            }

            return(itemId);
        }