protected override void AddRow(object[] rowInfo) { stat_blueprintRow row = new stat_blueprintRow(); row.id = GetInt(rowInfo[0]); row.type = GetInt(rowInfo[1]); row.name = GetString(rowInfo[2]); row.description = GetString(rowInfo[3]); row.pointto = GetInt(rowInfo[4]); row.cost_exp = GetInt(rowInfo[5]); row.cost_diamond = GetInt(rowInfo[6]); row.weekday = GetInt(rowInfo[7]); row.timegap = GetInt(rowInfo[8]); rowList.Add(row); }
/// <summary> /// 购买蓝图 , 花费经验和钻石,获取建筑 /// </summary> public void purchaseBlueprint(System.Object data) { List <int> selectedItems = (List <int>)data; int needEXP = 0; int needDiamond = 0; StringBuilder build = new StringBuilder(userInfoProxy.getBlueprintsbudin()); bool isRemoveFirstChar = false; if (build.Length <= 0) { isRemoveFirstChar = true; } foreach (int id in selectedItems) { stat_blueprintRow blueprint = mBuildBlueprintDict[id]; needEXP += blueprint.cost_exp; needDiamond += blueprint.cost_diamond; build.AppendFormat(",{0}", id); } //移除第一个分号 if (build.Length > 0 && isRemoveFirstChar) { build.Remove(0, 1); } int ownExp = userInfoProxy.getEXP(); int ownDiamond = userInfoProxy.getDiamond(); if (needEXP <= ownExp && needDiamond <= ownDiamond) { userInfoProxy.SetDiamond(ownDiamond - needDiamond); userInfoProxy.setEXP(ownExp - needEXP); userInfoProxy.setBlueprintsbudin(build.ToString()); //刷新宝石,建筑信息 AppFacade.GetInstance().SendNotification(NotiConst.GET_USER_INFO_VALUE); SendNotification(BuildingBlueprintMediator.PURCHASE_BLUEPRINT_RESULT, true); } else { SendNotification(BuildingBlueprintMediator.PURCHASE_BLUEPRINT_RESULT, false); } }