Scale UI correctly
This commit is contained in:
parent
34aad42ba7
commit
30beb96397
3 changed files with 23 additions and 17 deletions
|
|
@ -24,9 +24,11 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
|||
private TeamChoice team;
|
||||
private int insightLevel;
|
||||
private HandPlayability<BaseCardT> playability;
|
||||
private float scale;
|
||||
|
||||
public HandControls(BattleDeck<BaseCardT> deck, GameObject uiCanvas, GameObject cardPrefab, HandControlsPosition position,
|
||||
TeamChoice team, int insightLevel, HandPlayability<BaseCardT> playability) {
|
||||
public HandControls(BattleDeck<BaseCardT> deck, GameObject uiCanvas, GameObject cardPrefab,
|
||||
HandControlsPosition position, TeamChoice team, int insightLevel,
|
||||
HandPlayability<BaseCardT> playability, float scale) {
|
||||
this.deck = deck;
|
||||
this.uiCanvas = uiCanvas;
|
||||
this.cardPrefab = cardPrefab;
|
||||
|
|
@ -34,6 +36,7 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
|||
this.team = team;
|
||||
this.insightLevel = insightLevel;
|
||||
this.playability = playability;
|
||||
this.scale = scale;
|
||||
|
||||
deck.OnHandPileChanged += this.UpdateState;
|
||||
|
||||
|
|
@ -43,13 +46,13 @@ public class HandControls<BaseCardT> where BaseCardT : BaseCard
|
|||
}
|
||||
|
||||
private Vector3 CalculateHandCardPosition(int index, int count) {
|
||||
const int SPACING = 8;
|
||||
const int DELTA = BattleCardPrefabConstants.CARD_WIDTH + SPACING;
|
||||
float SPACING = 0 * this.scale;
|
||||
float DELTA = BattleCardPrefabConstants.CARD_WIDTH * this.scale + SPACING;
|
||||
|
||||
float x = Screen.width * 0.5f - DELTA / 2 * (count - 1) + DELTA * index;
|
||||
float y = (this.position == HandControlsPosition.Bottom
|
||||
? SPACING + BattleCardPrefabConstants.CARD_HEIGHT / 2
|
||||
: Screen.height - SPACING - BattleCardPrefabConstants.CARD_HEIGHT / 2);
|
||||
? SPACING + BattleCardPrefabConstants.CARD_HEIGHT * this.scale / 2
|
||||
: Screen.height - SPACING - BattleCardPrefabConstants.CARD_HEIGHT * this.scale / 2);
|
||||
|
||||
return new Vector3(x, y, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue