protected Vector3 SetNewPostition(int id) { Vector3 result = Vector3.zero; BasePlot p = plotManager.GetComponent <PlotManager>().listPlot.Find(p => p.plotID == id); Vector3 d = p.transform.position; result = new Vector3(d.x, transform.position.y, d.z); return(result); }
private void UpdateDayIncomePlot(IEnumerable <DayIncomeObject> incomes) { var points = new List <DataPoint>(); foreach (var income in incomes) { var dp = new DataPoint(DateTimeAxis.ToDouble(UnixTimeHelper.UnixTimeToDateTime(income.time)), income.value); points.Add(dp); } BasePlot.LoadIncome(points.ToArray()); }
private static GroupPlot getGroupPlot(List <Color> colors, LegendOptions.LegendPositions legendPosition, int columns) { var axisOptionsForGroup = getAxisOptionsForGroup(); var plotOptions1 = getBoxPlotOptions(15F, 20F, 25F, 30F, 35F, 1F, Color.Blue.Name); var plotOptions2 = getBoxPlotOptions(26F, 31F, 34F, 41F, 44F, 1F, Color.Red.Name); var plotOptions3 = getBoxPlotOptions(18F, 22F, 27F, 32F, 38F, 2F, Color.Blue.Name); var plotOptions4 = getBoxPlotOptions(27F, 31F, 35F, 39F, 47F, 2F, Color.Red.Name); var coordinates = new List <Coordinate> { new Coordinate(0F, 5F) }; var boxplot1 = new Plot(coordinates, plotOptions1); var boxplot2 = new Plot(coordinates, plotOptions2); var boxplot3 = new Plot(new List <Coordinate>(), plotOptions3); var boxplot4 = new Plot(new List <Coordinate>(), plotOptions4); var groupOptions = getGroupOptions(legendPosition, columns); var groupedPlots = new List <IBasePlot>(); var plots = new List <Plot> { boxplot1, boxplot2, boxplot3, boxplot4 }; var axisOptionsForPlotWithoutGroupLines = getAxisOptionsForPlot(); var axisOptionsForPlot = getAxisOptionsForPlot(); axisOptionsForPlot.GroupLines.Add(new AxisOptions.GroupLine(1F, 2F, "All", 1)); axisOptionsForPlot.GroupLines.Add(new AxisOptions.GroupLine(1F, 2F, "Total", 2)); var groupedPlot1 = new BasePlot(new AxisOptions(NoConverter.Instance) { IsEmptyGroupPlot = true }, new List <Plot>()); var groupedPlot2 = new BasePlot(axisOptionsForPlotWithoutGroupLines, plots); var groupedPlot3 = new BasePlot(axisOptionsForPlot, plots); groupedPlots.Add(groupedPlot1); groupedPlots.Add(groupedPlot2); groupedPlots.Add(groupedPlot3); groupedPlots.Add(groupedPlot3); var plotItem = new GroupPlot(colors, axisOptionsForGroup, groupOptions, groupedPlots, new Text("Test Figure With Grouped Plots")) { Position = FigureWriter.FigurePositions.H }; return(plotItem); }
public void BuildAHouse() { if (!CanBuild()) { return; } PlotManager pm = plotManager.GetComponent <PlotManager>(); BasePlot plot = pm.listPlot.Find((x) => x.plotID == cur_location); if (plot is Plot_House) { Plot_House plot_house = (plot as Plot_House); if (plot_house.owner != this && plot_house.owner != null) { return; } else if (plot_house.owner == this) { UpgradeAHouse(plot_house); return; } if (gold.amount < (plot as Plot_House).cost) { Debug.LogWarning("Not enough money"); return; } BuildingPoint bp = plot.GetComponent <BuildingPoint>(); if (bp != null) { if (name == "A") { bp.Build(1); } else { bp.Build(2); } (plot as Plot_House).owner = this; Builded = true; gold.amount -= (plot as Plot_House).cost; } } }
private void UpdatePaymentPlot(DayIncomeManager dayIncomeManager, IEnumerable <PaymentObject> payments) { var points = new List <ScatterPoint>(); foreach (var payment in payments) { var Date = UnixTimeHelper.UnixTimeToDateTime(payment.time); var dayIncomeValue = dayIncomeManager.GetRow((long)UnixTimeHelper.Convert(Date)).value; if (dayIncomeValue > 0) { var sp = new ScatterPoint(DateTimeAxis.ToDouble(Date), dayIncomeValue); points.Add(sp); } } BasePlot.LoadPayment(points.ToArray()); }
public void BuildAHouse() { PlotManager pm = plotManager.GetComponent <PlotManager>(); BasePlot plot = pm.listPlot.Find((x) => x.plotID == cur_location); if (plot is Plot_House) { if (gold.amount < (plot as Plot_House).cost) { Debug.LogWarning("Not enough money"); return; } BuildingPoint bp = plot.GetComponent <BuildingPoint>(); if (bp != null) { bp.Build(1); Builded = true; gold.amount -= (plot as Plot_House).cost; } } }
private void UpdatePlot(DayIncomeManager dayIncomeManager, PaymentManager paymentManager) { UpdateDayIncomePlot(dayIncomeManager.GetAll()); UpdatePaymentPlot(dayIncomeManager, paymentManager.GetAll()); BasePlot.UpdatePlot(); }