public int GetCurPetBaseProp(FightCreatureProp prop) { if (CurPet != null) { return((int)GetCurPetBaseProp(prop.ToString())); } return(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); }
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(); } }
public int GetFightPetAttr(int propID) { if (m_fightAttrDic.ContainsKey(CurFightingPet)) { stFightPetAttrPetUserCmd_S cmd = m_fightAttrDic[CurFightingPet]; if (propID == (int)CreatureProp.MaxHp) { return(cmd.maxhp); } else if (propID == (int)FightCreatureProp.PhysicsAttack) { return(cmd.pdam); } else if (propID == (int)FightCreatureProp.MagicAttack) { return(cmd.mdam); } else if (propID == (int)FightCreatureProp.PhysicsDefend) { return(cmd.pdef); } else if (propID == (int)FightCreatureProp.EleDefend) { return(cmd.lightdef); } else if (propID == (int)FightCreatureProp.FireDefend) { return(cmd.heatdef); } else if (propID == (int)FightCreatureProp.WitchDefend) { return(cmd.wavedef); } else if (propID == (int)FightCreatureProp.IceDefend) { return(cmd.biochdef); } else if (propID == (int)FightCreatureProp.Hit) { return(cmd.hit); } else if (propID == (int)FightCreatureProp.Dodge) { return(cmd.hide); } else if (propID == (int)FightCreatureProp.PhysicsCrit) { return(cmd.plucky); } else if (propID == (int)FightCreatureProp.MagicCrit) { return(cmd.mlucky); } else if (propID == (int)FightCreatureProp.MagicDefend) { return(cmd.mdef); } else { FightCreatureProp prop = (FightCreatureProp)propID; Log.Error("no attr " + prop.ToString()); return(0); } } else { //Log.Error("no data"); return(0); } }