public ArmyWindow CreateArmyWindow(Army army) { var window = new ArmyWindow(_guiServices); var hasData = false; var infoText = ""; window.NameText = army.Name; window.Image = _armyWindowImages[army.Owner.Id - 1]; window.ButtonOkText = _texts.Get("ok"); if (army.Owner.IsUserControlled) { window.ButtonMoreText = _texts.Get("commands"); hasData = true; } else { window.ButtonMoreText = _texts.Get("interview"); if (army.DaysToGetInfo > 28 && army.DaysToGetInfo < 100) { hasData = false; infoText = _texts.Get("noInformation"); } else { infoText = army.DaysToGetInfo > 1 ? _texts.Get("informationsInXDays", army.DaysToGetInfo) : _texts.Get("informationsInOneDay"); hasData = false; } if (army.DaysToGetInfo == 0 || army.DaysToGetInfo == 100) { hasData = true; window.ButtonMoreText = _texts.Get("trace"); } } if (!hasData && !_legionConfig.GoDmOdE) { window.InfoText = infoText; } else { var count = army.Characters.Count; window.CountText = count == 1 ? _texts.Get("oneWarrior") : _texts.Get("xWarriors", count); int foodCount = army.Food / army.Characters.Count; if (foodCount > 1) { window.FoodText = _texts.Get("foodForXDays", foodCount); } else if (foodCount == 1) { window.FoodText = _texts.Get("foodForOneDay"); } else { window.FoodText = _texts.Get("noMoreFood"); } window.StrengthText = _texts.Get("strength") + ": " + army.Strength; window.SpeedText = _texts.Get("speed") + ": " + army.Speed; window.ActionText = ""; switch (army.CurrentAction) { case ArmyActions.Camping: window.ActionText = _texts.Get("camping"); /* TODO: * If TEREN>69 * RO$=RO$+" w "+MIASTA$(TEREN-70) * End If */ break; case ArmyActions.Move: case ArmyActions.FastMove: window.ActionText = _texts.Get("moving"); break; case ArmyActions.Attack: window.ActionText = _texts.Get("attackingX", army.Target.Name); /* TODO: * If CELY=0 * R2$=ARMIA$(CELX,0) * Else * R2$=MIASTA$(CELX) * End If * RO$="Atakujemy "+R2$ */ break; case ArmyActions.Hunting: window.ActionText = _texts.Get("hunting"); break; } } if (army.Owner.IsUserControlled) { window.MoreClicked += args => { var ordersWindow = CreateArmyOrdersWindow(army); _modalLayer.Window = ordersWindow; // TODO: implement all actions handling ordersWindow.MoveClicked += moveArgs => HandleMoveClick(army, ArmyActions.Move); ordersWindow.FastMoveClicked += moveArgs => HandleMoveClick(army, ArmyActions.FastMove); ordersWindow.AttackClicked += moveArgs => { _mapRouteDrawer.StartRouteDrawingForMapObject(army, (source, target) => { ((Army)source).CurrentAction = ArmyActions.Attack; ((Army)source).Target = target; }); }; ordersWindow.HuntClicked += moveArgs => army.CurrentAction = ArmyActions.Hunting; ordersWindow.CampClicked += moveArgs => army.CurrentAction = ArmyActions.Camping; ordersWindow.EquipmentClicked += _args => { var equipmentWindow = new EquipmentWindow(_guiServices, _texts) { Army = army }; _modalLayer.Window = equipmentWindow; }; }; } else if (army.DaysToGetInfo > 0 && army.DaysToGetInfo < 100) { window.MoreClicked += args => { _modalLayer.Window = _commonMapGuiFactory.CreateBuyInformationWindow(army); }; } return(window); }
private void Awake() { Instance = this; }