add time left to missions
This commit is contained in:
@@ -24,6 +24,8 @@ public class MissionsController {
|
||||
@FXML
|
||||
private NumberField quantity;
|
||||
@FXML
|
||||
private NumberField leftTime;
|
||||
@FXML
|
||||
private NumberField reward;
|
||||
@FXML
|
||||
private ToggleButton courierBtn;
|
||||
@@ -52,6 +54,7 @@ public class MissionsController {
|
||||
starportText.setDisable(false);
|
||||
cargo.setDisable(true);
|
||||
quantity.setDisable(true);
|
||||
leftTime.setDisable(false);
|
||||
reward.setDisable(false);
|
||||
} else
|
||||
if (deliveryBtn.equals(n)){
|
||||
@@ -59,6 +62,7 @@ public class MissionsController {
|
||||
starportText.setDisable(false);
|
||||
cargo.setDisable(true);
|
||||
quantity.setDisable(false);
|
||||
leftTime.setDisable(false);
|
||||
reward.setDisable(false);
|
||||
} else
|
||||
if (supplyBtn.equals(n)){
|
||||
@@ -69,12 +73,14 @@ public class MissionsController {
|
||||
starportText.setDisable(false);
|
||||
cargo.setDisable(false);
|
||||
quantity.setDisable(false);
|
||||
leftTime.setDisable(false);
|
||||
reward.setDisable(false);
|
||||
} else {
|
||||
missionType = null;
|
||||
starportText.setDisable(true);
|
||||
cargo.setDisable(true);
|
||||
quantity.setDisable(true);
|
||||
leftTime.setDisable(true);
|
||||
reward.setDisable(true);
|
||||
}
|
||||
});
|
||||
@@ -108,14 +114,15 @@ public class MissionsController {
|
||||
StationModel station = starport.getValue();
|
||||
ItemModel item = cargo.getValue();
|
||||
long count = quantity.getValue().longValue();
|
||||
long time = leftTime.getValue().longValue();
|
||||
double profit = reward.getValue().doubleValue();
|
||||
if (station != null && profit > 0){
|
||||
switch (missionType){
|
||||
case COURIER: missions.add(new MissionModel(station, profit));
|
||||
case COURIER: missions.add(new MissionModel(station, time, profit));
|
||||
break;
|
||||
case DELIVERY: if (count > 0) missions.add(new MissionModel(station, count, profit));
|
||||
case DELIVERY: if (count > 0) missions.add(new MissionModel(station, count, time, profit));
|
||||
break;
|
||||
case SUPPLY: if (item != null && count > 0) missions.add(new MissionModel(station, item, count, profit));
|
||||
case SUPPLY: if (item != null && count > 0) missions.add(new MissionModel(station, item, count, time,profit));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,22 +14,24 @@ public class MissionModel {
|
||||
private final long count;
|
||||
private final double profit;
|
||||
private final Offer offer;
|
||||
private final Long time;
|
||||
private long need;
|
||||
private Collection<RouteReserve> reserves;
|
||||
|
||||
public MissionModel(StationModel target, double profit) {
|
||||
this(target, null, 0, profit);
|
||||
public MissionModel(StationModel target, long time, double profit) {
|
||||
this(target, null, 0, time, profit);
|
||||
}
|
||||
|
||||
public MissionModel(StationModel target, long count, double profit) {
|
||||
this(target, null, count, profit);
|
||||
public MissionModel(StationModel target, long count, long time, double profit) {
|
||||
this(target, null, count, time, profit);
|
||||
}
|
||||
|
||||
|
||||
public MissionModel(StationModel target, ItemModel item, long count, double profit) {
|
||||
public MissionModel(StationModel target, ItemModel item, long count, long time, double profit) {
|
||||
this.target = target;
|
||||
this.item = item;
|
||||
this.count = count;
|
||||
this.time = time;
|
||||
this.profit = profit;
|
||||
if (item != null) {
|
||||
offer = SimpleOffer.fakeBuy(ModelFabric.get(target), ModelFabric.get(item), profit / count, count);
|
||||
@@ -44,6 +46,7 @@ public class MissionModel {
|
||||
this.target = mission.target;
|
||||
this.item = mission.item;
|
||||
this.count = mission.count;
|
||||
this.time = mission.time;
|
||||
this.profit = mission.profit;
|
||||
this.offer = mission.offer;
|
||||
this.need = mission.need;
|
||||
@@ -93,6 +96,7 @@ public class MissionModel {
|
||||
"target=" + target +
|
||||
", item=" + item +
|
||||
", count=" + count +
|
||||
", time=" + time +
|
||||
", profit=" + profit +
|
||||
"} ";
|
||||
}
|
||||
@@ -100,13 +104,16 @@ public class MissionModel {
|
||||
public void toSpecification(CrawlerSpecificator specificator){
|
||||
if (isSupply()){
|
||||
if (isCompleted()){
|
||||
specificator.add(ModelFabric.get(target), true);
|
||||
if (time == 0) specificator.add(ModelFabric.get(target), true);
|
||||
else specificator.add(ModelFabric.get(target), time, true);
|
||||
} else {
|
||||
specificator.buy(offer);
|
||||
if (time == 0) specificator.buy(offer);
|
||||
else specificator.buy(offer, time);
|
||||
}
|
||||
} else
|
||||
if (isCourier() || isDelivery()){
|
||||
specificator.add(ModelFabric.get(target), true);
|
||||
if (time == 0) specificator.add(ModelFabric.get(target), true);
|
||||
else specificator.add(ModelFabric.get(target), time, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +155,7 @@ public class MissionModel {
|
||||
MissionModel that = (MissionModel) o;
|
||||
return Objects.equals(count, that.count) &&
|
||||
Objects.equals(profit, that.profit) &&
|
||||
Objects.equals(time, that.time) &&
|
||||
Objects.equals(target, that.target) &&
|
||||
Objects.equals(item, that.item);
|
||||
}
|
||||
|
||||
@@ -178,4 +178,5 @@ verify.content=Confirmation code:
|
||||
missions.label.starport=Starport:
|
||||
missions.label.cargo=Cargo:
|
||||
missions.label.quantity=Quantity:
|
||||
missions.label.leftTime=Time left:
|
||||
missions.label.reward=Reward:
|
||||
@@ -179,4 +179,5 @@ verify.content=\u041A\u043E\u0434 \u0430\u043A\u0442\u0438\u0432\u0430\u0446\u04
|
||||
missions.label.starport=\u041A\u043E\u0441\u043C\u043E\u043F\u043E\u0440\u0442:
|
||||
missions.label.cargo=\u0413\u0440\u0443\u0437:
|
||||
missions.label.quantity=\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:
|
||||
missions.label.leftTime=\u0412\u0440\u0435\u043C\u044F:
|
||||
missions.label.reward=\u041D\u0430\u0433\u0440\u0430\u0434\u0430:
|
||||
@@ -42,6 +42,8 @@
|
||||
</ComboBox>
|
||||
<Label GridPane.rowIndex="3" text="%missions.label.quantity"/>
|
||||
<NumberField fx:id="quantity" GridPane.rowIndex="3" GridPane.columnIndex="1" value="0"/>
|
||||
<Label GridPane.rowIndex="4" text="%missions.label.reward"/>
|
||||
<NumberField fx:id="reward" GridPane.rowIndex="4" GridPane.columnIndex="1" value="0" />
|
||||
<Label GridPane.rowIndex="4" text="%missions.label.leftTime"/>
|
||||
<NumberField fx:id="leftTime" GridPane.rowIndex="4" GridPane.columnIndex="1" value="0" />
|
||||
<Label GridPane.rowIndex="5" text="%missions.label.reward"/>
|
||||
<NumberField fx:id="reward" GridPane.rowIndex="5" GridPane.columnIndex="1" value="0" />
|
||||
</GridPane>
|
||||
|
||||
Reference in New Issue
Block a user