public static void PropToProtoPropInfoList(Prop[] props, List <ProtoPropInfo> list) { foreach (Prop item in props) { if (item.value != 0) { ProtoPropInfo prop = new ProtoPropInfo(); prop.id = item.id; prop.value = (int)(item.value * WarService.PROP_FLOAT_MULTIPLIER); list.Add(prop); } } }
public static void PropToProtoPropInfoList(float[] props, List <ProtoPropInfo> list) { for (int i = 0; i < props.Length; i++) { if (props[i] != 0) { ProtoPropInfo prop = new ProtoPropInfo(); prop.id = i; prop.value = (int)(props[i] * WarService.PROP_FLOAT_MULTIPLIER); list.Add(prop); } } }
/** 属性 */ public void ExeProp(List <ProtoFightUnitInfo> list) { foreach (ProtoFightUnitInfo unitPropData in list) { UnitCtl unit = War.scene.GetUnitForUID(unitPropData.unit_id); if (unit == null) { continue; } ProtoPropInfo prop_team = null; foreach (ProtoPropInfo propData in unitPropData.props) { if (propData.id == PropId.LegionID) { prop_team = propData; } else { unit.unitData.Props[propData.id] = propData.value / WarService.PROP_FLOAT_MULTIPLIER; } } // if(prop_team != null && unit.unitData.unitType == UnitType.Build) // { // if(prop_team.value != unit.unitData.legionId) // { // unit.unitData.ChangeLegion((int)prop_team.value); // // foreach(ProtoPropInfo propData in unitPropData.props) // { // if(propData.id != PropId.LegionID) // { // unit.unitData.Props[propData.id] = propData.value / WarService.PROP_FLOAT_MULTIPLIER; // } // } // } // } } War.signal.DoProp(list); }