private void LoadUnitListPanel() { if (GetStatistics().team == 1) { _unitListPanel = GameObject.Find("UnitListPanelLeft").GetComponent <UnitListPanel>(); } else if (GetStatistics().team == 2) { _unitListPanel = GameObject.Find("UnitListPanelRight").GetComponent <UnitListPanel>(); } }
public void Bind(IPlayerControllerRepositoryService playerControllerRepositoryService, Army army, ArmyAction armyAction, AgeTransform anchor, GameObject client, int index, UnitListPanel unitListPanel) { IGameService service = Services.GetService <IGameService>(); if (service == null || service.Game == null || this.PlayerControllerRepositoryService != null || this.Army != null || this.ArmyAction != null || this.SeasonService != null) { this.Unbind(); } this.unitListPanel = unitListPanel; this.SeasonService = service.Game.Services.GetService <ISeasonService>(); if (this.SeasonService != null) { this.SeasonService.SeasonChange += this.SeasonService_SeasonChange; } this.CursorService = Services.GetService <ICursorService>(); this.PlayerControllerRepositoryService = playerControllerRepositoryService; this.Army = army; this.ArmyAction = armyAction; this.Client = client; this.ActionToggle.AgeTransform.Visible = (armyAction is IArmyActionWithToggle); this.ActionButton.AgeTransform.Visible = !(armyAction is IArmyActionWithToggle); this.ModifierSector.Reset(); this.ModifierSector.GetComponent <AgePrimitiveSector>().MaxAngle = 0f; this.ActionImage.Image = null; this.ModifierSector.Reset(); IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper; Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper"); GuiElement guiElement; Texture2D image; if (guiPanelHelper.TryGetGuiElement(armyAction.Name, out guiElement) && guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image)) { this.ActionImage.Image = image; } this.AgeTransform.AgeTooltip.Anchor = anchor; if (this.ArmyAction is IArmyActionWithUnitSelection) { this.unitListPanel.SelectionChange += this.UnitListPanel_SelectionChange; } this.RefreshCanExecute(); }
private void LoadUnitListPanel() { _unitListPanel = gameObject.GetComponentInParent <UnitListPanel>(); }