Example #1
0
    int GetEnumByString(string prop)
    {
        int propid = -1;

        if (Enum.IsDefined(typeof(CreatureProp), prop))
        {
            CreatureProp pp = (CreatureProp)Enum.Parse(typeof(CreatureProp), prop);
            return((int)pp);
        }
        if (Enum.IsDefined(typeof(FightCreatureProp), prop))
        {
            FightCreatureProp pp = (FightCreatureProp)Enum.Parse(typeof(FightCreatureProp), prop);
            return((int)pp);
        }
        if (Enum.IsDefined(typeof(PetProp), prop))
        {
            PetProp pp = (PetProp)Enum.Parse(typeof(PetProp), prop);
            return((int)pp);
        }
        Log.Error("get enum error prop is " + prop);
        return(propid);
    }
Example #2
0
 protected virtual void Init()
 {
     creatureProp = new CreatureProp();
 }
Example #3
0
    void InitLabelData()
    {
        if (CurPet != null)
        {
            bool isFight = petDataManager.IsCurPetFighting();
            var  iter    = labelDic.GetEnumerator();

            while (iter.MoveNext())
            {
                var            labelPair = iter.Current;
                List <UILabel> laList    = labelPair.Value;

                for (int i = 0; i < laList.Count; i++)
                {
                    var label = laList[i];
                    if (label != null)
                    {
                        label.text = petDataManager.GetPropByString(labelPair.Key).ToString();
                        if (labelPair.Key == PetProp.PetGuiYuanStatus.ToString())
                        {
                            int    status = CurPet.GetProp((int)PetProp.PetGuiYuanStatus);
                            string str    = petDataManager.GetGrowStatus(status);
                            label.text = str;
                        }
                        else if (labelPair.Key == PetProp.Character.ToString())
                        {
                            int c = CurPet.GetProp((int)PetProp.Character);
                            label.text = petDataManager.GetPetCharacterStr(c);
                        }
                        else if (labelPair.Key == FightCreatureProp.PhysicsCrit.ToString() ||
                                 labelPair.Key == FightCreatureProp.MagicCrit.ToString() ||
                                 labelPair.Key == FightCreatureProp.Hit.ToString() ||
                                 labelPair.Key == FightCreatureProp.Dodge.ToString())
                        {
                            FightCreatureProp prop = (FightCreatureProp)Enum.Parse(typeof(FightCreatureProp), labelPair.Key);
                            int phy = 0;
                            if (isFight)
                            {
                                phy = petDataManager.GetFightPetAttr((int)prop);
                            }
                            else
                            {
                                phy = CurPet.GetProp((int)prop);
                            }
                            int pv = phy / 100;
                            label.text = pv + "%";
                        }
                        else if (labelPair.Key == FightCreatureProp.PhysicsAttack.ToString() ||
                                 labelPair.Key == FightCreatureProp.PhysicsDefend.ToString() ||
                                 labelPair.Key == FightCreatureProp.MagicAttack.ToString() ||
                                 labelPair.Key == FightCreatureProp.IceDefend.ToString() ||
                                 labelPair.Key == FightCreatureProp.EleDefend.ToString() ||
                                 labelPair.Key == FightCreatureProp.WitchDefend.ToString() ||
                                 labelPair.Key == FightCreatureProp.FireDefend.ToString())
                        {
                            if (isFight)
                            {
                                FightCreatureProp prop = (FightCreatureProp)Enum.Parse(typeof(FightCreatureProp), labelPair.Key);
                                int phy = petDataManager.GetFightPetAttr((int)prop);

                                label.text = phy.ToString();
                            }
                        }
                        else if (labelPair.Key == CreatureProp.MaxHp.ToString())
                        {
                            if (isFight)
                            {
                                CreatureProp prop = (CreatureProp)Enum.Parse(typeof(CreatureProp), labelPair.Key);
                                int          phy  = petDataManager.GetFightPetAttr((int)prop);

                                label.text = phy.ToString();
                            }
                        }
                    }
                }
            }
            m_label_exppetlevel.text = petDataManager.GetCurPetLevelStr();
            ShowNextXiuWei();
        }
    }
Example #4
0
 protected virtual void Init()
 {
     creatureProp = new CreatureProp();
 }