Example #1
0
    public HeroData(HeroDataInfo dataInfo, int lv)
    {
        Id          = dataInfo.Id;
        Name        = dataInfo.Name;
        Description = dataInfo.Description;

        Lv  = new ENum <int>(lv);
        Sex = dataInfo.Sex;
        Hp  = new ENum <int>(dataInfo.Hp);
        Mp  = new ENum <int>(dataInfo.Mp);
        Def = new ENum <int>(dataInfo.Def);
        Att = new ENum <int>(dataInfo.Att);

        //PetId = new ENum<int>(dataInfo.Pet);
        //WeaponId = new ENum<int>(dataInfo.Weapon);
        //WeaponLv = new ENum<int>(1);

        //EquipId = new ENum<int>(dataInfo.Equip);
        //EquipLv = new ENum<int>(1);
        Job       = dataInfo.Job;
        Icon      = dataInfo.Icon;
        Cg        = dataInfo.Cg;
        FightIcon = dataInfo.FightIcon;
        ColorUtility.TryParseHtmlString(dataInfo.Color, out TheColor);
    }
Example #2
0
    static ENum <T> CalSum(Dictionary <int, ENum <T> > data)
    {
        ENum <T> result = new ENum <T>();

        long   tempLong   = 0;
        double tempDouble = 0;

        bool isLong   = (typeof(T) == typeof(int) || typeof(T) == typeof(long));
        bool isDouble = (typeof(T) == typeof(float) || typeof(T) == typeof(double));

        foreach (KeyValuePair <int, ENum <T> > keyValuePair in data)
        {
            ENum <T> eNum = keyValuePair.Value;
            if (isLong)
            {
                long longNum = (long)Convert.ChangeType(eNum.Value, typeof(long));
                tempLong += longNum;
            }
            else if (isDouble)
            {
                double doubleNum = (double)Convert.ChangeType(eNum.Value, typeof(double));
                tempDouble += doubleNum;
            }
        }
        if (isLong)
        {
            result.Value = (T)Convert.ChangeType(tempLong, typeof(T));
        }
        else if (isDouble)
        {
            result.Value = (T)Convert.ChangeType(tempDouble, typeof(T));
        }

        return(result);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        StringBuilder sb = new StringBuilder();

        ENum <int> myNumber1 = new ENum <int>(1);

        for (int i = 0; i < 100; i++)
        {
            myNumber1.Value += 10;
            sb.Append(myNumber1.Value).Append(",");
        }
        Debug.Log("myNumber1 = " + sb);
        sb = new StringBuilder();
        ENum <float> myNumber2 = new ENum <float>(1.1f);

        for (int i = 0; i < 100; i++)
        {
            myNumber2.Value += 1.1f;
            sb.Append(myNumber2.Value).Append(",");
        }
        Debug.Log("myNumber2 = " + sb);
        sb = new StringBuilder();
        ENum <double> myNumber3 = new ENum <double>(1.2d);

        for (int i = 0; i < 100; i++)
        {
            myNumber3.Value += 1.2f;
            sb.Append(myNumber3.Value).Append(",");
        }
        Debug.Log("myNumber3 = " + sb);
    }
Example #4
0
 public void Init()
 {
     _data       = new Dictionary <int, ENum <T> >();
     _scaleData  = new Dictionary <int, ENum <float> >();
     _scaleTotal = new ENum <float>(1); //默认值
     _dataTotal  = new ENum <T>();
     _total      = new ENum <T>();
 }
Example #5
0
 public void SetValue(int type, ENum <T> value)
 {
     //double beforeValue = _datas[(int)type].m_value.ToDouble();
     if (!_data.ContainsKey(type))
     {
         _data.Add(type, value);
     }
     else
     {
         _data[type] = value;
     }
     //double curValue = _datas[(int)type].m_value.ToDouble();
     RefreshValue(true, false);
 }
Example #6
0
    public Item(int id, int count)
    {
        Id    = id;
        Count = new ENum <int>(count);

        ItemDataInfo dataInfo = (ItemDataInfo)ConfigDataMgr.Instance.GetDataInfo <ItemTableData>(Id);

        Name        = dataInfo.Name;
        Description = dataInfo.Description;
        Type        = dataInfo.Type;
        Command     = dataInfo.Command;
        Icon        = dataInfo.Icon;
        Price.Value = dataInfo.Price;
        Lv.Value    = dataInfo.Lv;

        UsableInFight = dataInfo.UsableInFight;
        ColorUtility.TryParseHtmlString(dataInfo.Color, out TheColor);
        JobLimited = dataInfo.JobLimited;
    }
Example #7
0
    public EnemyData(MonsterDataInfo dataInfo, int lv, int ai)
    {
        Id          = dataInfo.Id;
        Name        = dataInfo.Name;
        Description = dataInfo.Description;

        Lv    = new ENum <int>(lv);
        Sex   = dataInfo.Sex;
        Hp    = new ENum <int>(dataInfo.Hp);
        HpMax = new ENum <int>(dataInfo.Hp);
        Mp    = new ENum <int>(dataInfo.Mp);
        MpMax = new ENum <int>(dataInfo.Mp);
        Def   = new ENum <int>(dataInfo.Def);
        Att   = new ENum <int>(dataInfo.Att);
        Icon  = dataInfo.Icon;
        Cg    = dataInfo.Cg;

        Ai      = new ENum <int>(ai);
        DropIds = new List <ENum <int> >();
        foreach (int dropId in dataInfo.DropIds)
        {
            DropIds.Add(new ENum <int>(dropId));
        }
    }
Example #8
0
 public void SetScaleValue(int type, ENum <float> value)
 {
     RefreshValue(false, true);
 }