123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using I2.Loc;
- namespace DatabaseModel
- {
- public class Enhancement
- {
- public string Name { get; set; }
- public int Lv1Price { get; set; }
- public int Lv1EnhanceEffect { get; set; }
- public int Lv2Price { get; set; }
- public int Lv2EnhanceEffect { get; set; }
- public int Lv3Price { get; set; }
- public int Lv3EnhanceEffect { get; set; }
- public int GetNextLevelPrice(int level)
- {
- switch (level)
- {
- case 0:
- return this.Lv1Price;
- case 1:
- return this.Lv2Price;
- case 2:
- return this.Lv3Price;
- case 3:
- return int.MaxValue;
- default:
- throw new ArgumentOutOfRangeException();
- }
- }
- public int GetEnhanceEffect(int level)
- {
- switch (level)
- {
- case 0:
- return 0;
- case 1:
- return this.Lv1EnhanceEffect;
- case 2:
- return this.Lv2EnhanceEffect;
- case 3:
- return this.Lv3EnhanceEffect;
- default:
- throw new ArgumentOutOfRangeException();
- }
- }
- public string GetDesc(int level)
- {
- string text = ScriptLocalization.Get(string.Format("ui/enhancement/{0}Lv{1}Desc", this.Name, level));
- if (string.IsNullOrEmpty(text))
- {
- text = ScriptLocalization.Get(string.Format("ui/enhancement/{0}Lv0Desc", this.Name));
- }
- return text;
- }
- public string GetNextLevelDesc(int level)
- {
- string text = ScriptLocalization.Get(string.Format("ui/enhancement/{0}Lv{1}NextLevelDesc", this.Name, level));
- if (string.IsNullOrEmpty(text))
- {
- text = ScriptLocalization.Get(string.Format("ui/enhancement/{0}Lv0NextLevelDesc", this.Name));
- }
- return text;
- }
- public string GetControlKeys(int level)
- {
- string text = ScriptLocalization.Get(string.Format("mobile/enhancement/{0}Lv{1}ControlKeys", this.Name, level));
- if (string.IsNullOrEmpty(text))
- {
- text = ScriptLocalization.Get(string.Format("mobile/enhancement/{0}Lv0ControlKeys", this.Name));
- }
- return text;
- }
- public static Enhancement FindByName(string name)
- {
- return DB.Enhancements[name];
- }
- public static Enhancement SetValue(string[] strings)
- {
- return new Enhancement
- {
- Name = strings[0],
- Lv1Price = int.Parse(strings[1]),
- Lv1EnhanceEffect = int.Parse(strings[2]),
- Lv2Price = int.Parse(strings[3]),
- Lv2EnhanceEffect = int.Parse(strings[4]),
- Lv3Price = int.Parse(strings[5]),
- Lv3EnhanceEffect = int.Parse(strings[6])
- };
- }
- }
- }
|