Example #1
0
        public bool Remove(uint ID, TRewardInfo item)
        {
            this.Single(c => c.BoxTypeID == ID).Remove(item);

            FBoxItem.Single(c => c.BoxTypeID == ID).Remove(item);
            return(true);
        }
Example #2
0
 public void Remove(TRewardInfo item)
 {
     RewardList.Remove(item);
 }
Example #3
0
        public BoxItemList()
        {
            FBoxItem    = new List <TBoxInfo>();
            FDuplicated = true;

            try
            {
                if (File.Exists("Json/BoxRandomData.txt"))
                {
                    var JsonValues = JsonValue.ParseFile("Json/BoxRandomData.txt")["BoxData"].AsJsonArray;
                    foreach (var AMember in JsonValues)
                    {
                        var Box = new TBoxInfo
                        {
                            BoxName = AMember["BoxName"].AsString,

                            BoxParam = AMember["BoxParam"].AsString,

                            BoxType = (uint)AMember["BoxType"].AsInteger,

                            BoxTypeID = (uint)AMember["BoxTypeID"].AsInteger,

                            BoxQuantity = (uint)AMember["BoxQuantity"].AsInteger,

                            SupplyTypeID = (uint)AMember["SupplyTypeID"].AsInteger,

                            SupplyQuantity = (uint)AMember["SupplyQuantity"].AsInteger,

                            SpecialRewardTypeID = (uint)AMember["SpecialRewardTypeID"].AsInteger,

                            SpecialRewardQuantity = (uint)AMember["SpecialRewardQuantity"].AsInteger
                        };
                        foreach (var BMember in AMember["RewardItems"].AsJsonArray)
                        {
                            var Reward = new TRewardInfo
                            {
                                Name   = BMember["Name"].AsString,
                                TypeId = Convert.ToUInt32(BMember["TypeID"].AsInteger),

                                Quantity = (uint)BMember["Quantity"].AsInteger,

                                Prob     = (uint)BMember["Probability"].AsInteger,
                                Type     = (byte)BMember["BoxType"].AsInteger,
                                RareType = (byte)BMember["RareType"].AsInteger,

                                Duplicated = BMember["CanDuplicated"].AsBoolean,

                                Announce = BMember["Announce"].AsBoolean
                            };
                            Box.RewardList.Add(Reward);
                        }
                        Add(Box);
                    }
                }
                else
                {
                    throw new Exception("BoxItemList: BoxRandomData.json file in folder not found !");
                }
            }
            catch (Exception ex)
            {
                WriteConsole.WriteLine(ex.Message, ConsoleColor.Red);
                Console.ReadKey();
                Environment.Exit(0);
            }
            finally
            {
                this.SetCanDup(false);
            }
        }