mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
carrier ops; persistency; ui improvements; refactoring
This commit is contained in:
82
__init__.py
82
__init__.py
@@ -1,90 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
import pickle
|
||||
|
||||
import dcs
|
||||
import os
|
||||
|
||||
import gen
|
||||
import theater.caucasus
|
||||
import game.operation
|
||||
import ui.window
|
||||
import ui.mainmenu
|
||||
|
||||
from game.game import Game
|
||||
from theater import start_generator
|
||||
from theater.controlpoint import *
|
||||
from userdata import persistency
|
||||
|
||||
from dcs.planes import *
|
||||
from dcs.vehicles import *
|
||||
game = persistency.restore_game()
|
||||
if not game:
|
||||
theater = theater.caucasus.CaucasusTheater()
|
||||
start_generator.generate_initial(theater, "Russia")
|
||||
|
||||
m = dcs.Mission()
|
||||
theater = theater.caucasus.CaucasusTheater()
|
||||
|
||||
start_generator.generate_initial(theater, "Russia")
|
||||
g = Game(theater=theater)
|
||||
game = Game(theater=theater)
|
||||
|
||||
w = ui.window.Window()
|
||||
m = ui.mainmenu.MainMenu(w, None, g)
|
||||
m = ui.mainmenu.MainMenu(w, None, game)
|
||||
m.display()
|
||||
|
||||
w.run()
|
||||
|
||||
|
||||
"""
|
||||
selected_cp = None # type: ControlPoint
|
||||
while True:
|
||||
ptr = 0
|
||||
|
||||
print("Budget: {}m".format(g.budget))
|
||||
|
||||
if selected_cp is None:
|
||||
print("Events:")
|
||||
for event in g.events:
|
||||
ptr += 1
|
||||
print("{}. {} {}".format(ptr, event.attacker != g.side and "!" or " ", event))
|
||||
|
||||
print("Control Points:")
|
||||
controlpoints = g.theater.controlpoints
|
||||
controlpoints.sort(key=lambda x: x.captured)
|
||||
for cp in g.theater.controlpoints:
|
||||
ptr += 1
|
||||
print("{}. [{}{}] {}{}{}{}".format(
|
||||
ptr,
|
||||
cp.captured and "x" or " ",
|
||||
int(cp.base.readiness * 10),
|
||||
cp.name,
|
||||
"^" * cp.base.total_planes,
|
||||
"." * cp.base.total_armor,
|
||||
"*" * cp.base.total_aa))
|
||||
|
||||
events_boundary = len(g.events)
|
||||
try:
|
||||
selected_idx = int(input(">").strip()) - 1
|
||||
except:
|
||||
continue
|
||||
|
||||
if selected_idx == -1:
|
||||
g.pass_turn()
|
||||
continue
|
||||
if selected_idx < events_boundary:
|
||||
event = g.events[selected_idx]
|
||||
else:
|
||||
selected_cp = controlpoints[selected_idx - events_boundary]
|
||||
else:
|
||||
print("Units on the base: ")
|
||||
for unit, count in selected_cp.base.all_units:
|
||||
print("{} ({}) ".format(unit.name and unit.name or unit.id, count), end="")
|
||||
print("")
|
||||
|
||||
try:
|
||||
selected_idx = int(input(">").strip()) - 1
|
||||
except:
|
||||
continue
|
||||
if selected_idx == -1:
|
||||
selected_cp = None
|
||||
|
||||
if not os.path.exists("./build"):
|
||||
os.mkdir("./build")
|
||||
|
||||
m.save("build/output.miz")
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user