void Setprop(PropertyType prop, uint free) { // float a = (float)free / 4; // int b = (int)(curDian * a); // sum += b; // if(sum == curDian) // { // curDian = 0; // } curDian -= (int)free; if (curDian <= 0) { curDian = 0; } if (isContain(prop)) { for (int i = 0; i < propList.Count; i++) { if (propList[i].type_ == prop) { propList[i].uVal_ += free; SetTiLi(propList[i].type_, propList[i]); } } } else { COM_Addprop comprop = new COM_Addprop(); comprop.type_ = prop; comprop.uVal_ += free; propList.Add(comprop); SetTiLi(comprop.type_, comprop); } SetBtnState(); }
void OnClicktiliJa(ButtonScript obj, object args, int param1, int param2) { if (curDian == 0) { return; } curDian--; if (curDian <= 0) { curDian = 0; GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_BabyUIAddPoint, curDian); istargetPrassJia = false; } if (isContain((PropertyType)param1)) { for (int i = 0; i < propList.Count; i++) { if (propList[i].type_ == (PropertyType)param1) { propList[i].uVal_ += 1; SetTiLi(propList[i].type_, propList[i]); } } } else { COM_Addprop comprop = new COM_Addprop(); comprop.type_ = (PropertyType)param1; comprop.uVal_ += 1; propList.Add(comprop); SetTiLi(comprop.type_, comprop); } SetBtnState(); }
float SimAddPoint(PropertyType pointType, PropertyType effectType, COM_Addprop prop) { switch (pointType) { case PropertyType.PT_Stama: switch (effectType) { case PropertyType.PT_HpMax: return(prop.uVal_ * 8f); case PropertyType.PT_MpMax: return(prop.uVal_ * 1f); case PropertyType.PT_Attack: return(prop.uVal_ * 0.1f); case PropertyType.PT_Defense: return(prop.uVal_ * 0.1f); case PropertyType.PT_Agile: return(prop.uVal_ * 0.1f); case PropertyType.PT_Reply: return(prop.uVal_ * 0.8f); case PropertyType.PT_Spirit: return(prop.uVal_ * -0.3f); } return(0f); case PropertyType.PT_Strength: switch (effectType) { case PropertyType.PT_HpMax: return(prop.uVal_ * 2f); case PropertyType.PT_MpMax: return(prop.uVal_ * 2f); case PropertyType.PT_Attack: return(prop.uVal_ * 2f); case PropertyType.PT_Defense: return(prop.uVal_ * 0.2f); case PropertyType.PT_Agile: return(prop.uVal_ * 0.2f); case PropertyType.PT_Reply: return(prop.uVal_ * -0.1f); case PropertyType.PT_Spirit: return(prop.uVal_ * -0.1f); } return(0f); case PropertyType.PT_Power: switch (effectType) { case PropertyType.PT_HpMax: return(prop.uVal_ * 3f); case PropertyType.PT_MpMax: return(prop.uVal_ * 2f); case PropertyType.PT_Attack: return(prop.uVal_ * 0.2f); case PropertyType.PT_Defense: return(prop.uVal_ * 2f); case PropertyType.PT_Agile: return(prop.uVal_ * 0.2f); case PropertyType.PT_Reply: return(prop.uVal_ * -0.1f); case PropertyType.PT_Spirit: return(prop.uVal_ * 0.2f); } return(0f); case PropertyType.PT_Speed: switch (effectType) { case PropertyType.PT_HpMax: return(prop.uVal_ * 3f); case PropertyType.PT_MpMax: return(prop.uVal_ * 2f); case PropertyType.PT_Attack: return(prop.uVal_ * 0.2f); case PropertyType.PT_Defense: return(prop.uVal_ * 0.2f); case PropertyType.PT_Agile: return(prop.uVal_ * 2f); case PropertyType.PT_Reply: return(prop.uVal_ * 0.2f); case PropertyType.PT_Spirit: return(prop.uVal_ * -0.1f); } return(0f); case PropertyType.PT_Magic: switch (effectType) { case PropertyType.PT_HpMax: return(prop.uVal_ * 1f); case PropertyType.PT_MpMax: return(prop.uVal_ * 10f); case PropertyType.PT_Attack: return(prop.uVal_ * 0.1f); case PropertyType.PT_Defense: return(prop.uVal_ * 0.1f); case PropertyType.PT_Agile: return(prop.uVal_ * 0.1f); case PropertyType.PT_Reply: return(prop.uVal_ * -0.3f); case PropertyType.PT_Spirit: return(prop.uVal_ * 0.8f); } return(0f); } return(0f); }
void SetTiLi(PropertyType type, COM_Addprop prop) { addPoints = new float[5]; for (int i = 0; i < propList.Count; ++i) { addPoints[0] += SimAddPoint(propList[i].type_, PropertyType.PT_Attack, propList[i]); addPoints[1] += SimAddPoint(propList[i].type_, PropertyType.PT_Defense, propList[i]); addPoints[2] += SimAddPoint(propList[i].type_, PropertyType.PT_Agile, propList[i]); addPoints[3] += SimAddPoint(propList[i].type_, PropertyType.PT_Reply, propList[i]); addPoints[4] += SimAddPoint(propList[i].type_, PropertyType.PT_Spirit, propList[i]); accatkLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Attack))).ToString(); defensekLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Defense))).ToString(); agilitykLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Agile))).ToString(); replyLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Reply))).ToString(); spiritLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Spirit))).ToString(); string content = ""; Color color = Color.green; UILabel lbl = null; int roundToint = 0; int adjust = 0; for (int j = 0; j < addPoints.Length; ++j) { roundToint = (int)addPoints[j]; switch (j) { case 0: lbl = gongjiSim; adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Attack)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Attack)); break; case 1: lbl = fangyuSim; adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Defense)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Defense)); break; case 2: lbl = minjieSim; adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Agile)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Agile)); break; case 3: lbl = huifuSim; adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Reply)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Reply)); break; case 4: lbl = jingshenSim; adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Spirit)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Spirit)); break; } roundToint += adjust; if (roundToint > 0) { content = string.Format("+{0}", roundToint); color = Color.green; } else if (roundToint < 0) { content = string.Format("-{0}", Mathf.Abs(roundToint)); color = Color.red; } else { content = ""; } lbl.text = content; lbl.color = color; } } //if (type == PropertyType.PT_Stama) //{ // accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString (); // defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString(); // agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString(); // replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString(); // spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString(); //} //else // if(type == PropertyType.PT_Strength) //{ // accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString (); // defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString(); // agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString(); // replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString(); // spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString(); //} //else // if(type == PropertyType.PT_Power) //{ // accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString (); // defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString(); // agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString(); // replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString(); //} //else // if(type == PropertyType.PT_Speed) //{ // accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString (); // defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString(); // agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString(); // replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString(); // spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString(); //} //else // if(type == PropertyType.PT_Magic) //{ // accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString (); // defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString(); // agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString(); // replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString(); // spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString(); //} Shengyu.text = curDian.ToString(); for (int i = 0; i < propList.Count; ++i) { switch (propList[i].type_) { case PropertyType.PT_Stama: tili.text = ((int)Inst.Properties[(int)PropertyType.PT_Stama]).ToString(); if (propList[i].uVal_ == 0) { tiliSim.text = ""; } else { tiliSim.text = string.Format("+{0}", propList[i].uVal_); } break; case PropertyType.PT_Strength: liliang.text = ((int)Inst.Properties[(int)PropertyType.PT_Strength]).ToString(); if (propList[i].uVal_ == 0) { liliangSim.text = ""; } else { liliangSim.text = string.Format("+{0}", propList[i].uVal_); } break; case PropertyType.PT_Power: Qiangdu.text = ((int)Inst.Properties[(int)PropertyType.PT_Power]).ToString(); if (propList[i].uVal_ == 0) { QiangduSim.text = ""; } else { QiangduSim.text = string.Format("+{0}", propList[i].uVal_); } break; case PropertyType.PT_Speed: sudu.text = ((int)Inst.Properties[(int)PropertyType.PT_Speed]).ToString(); if (propList[i].uVal_ == 0) { suduSim.text = ""; } else { suduSim.text = string.Format("+{0}", propList[i].uVal_); } break; case PropertyType.PT_Magic: mofa.text = ((int)Inst.Properties[(int)PropertyType.PT_Magic]).ToString(); if (propList[i].uVal_ == 0) { mofaSim.text = ""; } else { mofaSim.text = string.Format("+{0}", propList[i].uVal_); } break; } } }