private void CreateBattleButtons() { // set up die buttons UpdateDieButtons(); pawnCards = new Dictionary <Pawn, UIObj>(); EnemyPawnCard epc = new EnemyPawnCard(new Vector2i(size.x / 2, 72), new Vector2i(128, 128), battle.enemy, battle, RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER); AddUIObj(epc); pawnCards.Add(battle.enemy, epc); viewPawnImages = new Image[battle.allies.Length + 1]; string[] tabNames = new string[battle.allies.Length]; int spellCount = 0; PlayerPawnCard ppc; PackedSprite viewSprite = RB.PackedSpriteGet("Eye", Game.SPRITEPACK_BATTLE); for (int i = 0; i < battle.allies.Length; i++) { AddUIObj(ppc = new PlayerPawnCard(new Vector2i(8, 8 + 36 * i), new Vector2i(96, 32), battle.allies[i], battle)); pawnCards.Add(battle.allies[i], ppc); AddUIObj(viewPawnImages[i] = new Image(new Vector2i(108, 24 + 36 * i), viewSprite)); if (i > 0) { viewPawnImages[i].isVisible = false; } int x = i; ppc.SetOnClick(() => { ViewSpellTab(x); }); tabNames[i] = battle.allies[i].GetName(); spellCount += battle.allies[i].GetSpells().Length; } spellPane = new TabbedPane(new Vector2i(size.width - 102, 0), new Vector2i(102, size.height), true); spellPane.SetTabs(tabNames); AddUIObj(spellPane); spellButtons = new SpellButton[spellCount]; spellButtonOwnership = new int[spellCount]; int currentSpellIndex = 0; for (int i = 0; i < battle.allies.Length; i++) { currentSpellIndex = FillSpellPane(spellPane, i, currentSpellIndex); } /* * Spell[] knownSpells = battle.GetClientPawn().GetSpells(); * spellButtons = new SpellButton[knownSpells.Length]; * for(int i = 0; i < knownSpells.Length; i++) { * AddUIObj(spellButtons[i] = new SpellButton(battle, knownSpells[i], new Vector2i(size.width - 100, 8 + i * 36))); * }*/ ViewSpellTab(0); }
public override void OnConstruct() { AddUIObj(readyButton = new TextButton(new Vector2i(size.width / 2, size.height - 76), "Ready?", RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER)); readyButton.isVisible = true; readyButton.SetOnClick(() => { Game.client.Send(GameMsg.Ready, new EmptyMessage()); readyButton.currentState = UIObj.State.Disabled; MessageBox waitingMsg = new MessageBox("Waiting for other players..."); ShowMessageBox(waitingMsg); }); int infoPaneWidth = (size.width - 102) - (size.width / 2 + 1); AddUIObj(infoPane = new TabbedPane(new Vector2i(size.width / 2 - infoPaneWidth / 2, size.height - 62), new Vector2i(infoPaneWidth, 62), true)); infoPane.SetTabs(new string[] { "Shop Info", "Spell" }); vendorText = new Text(new Vector2i(size.width / 2 - infoPaneWidth / 2 + 4, size.height - 58), new Vector2i(infoPaneWidth - 8, 54), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP | RB.TEXT_OVERFLOW_WRAP); vendorText.SetText("Yoda:\n\"A new spell I can teach.\""); AddUIObj(vendorText); infoPane.AddToTab(0, vendorText); // Infopane: Spell info AddUIObj(spellName = new Text(new Vector2i(size.width / 2 - infoPaneWidth / 2 + 4, size.height - 58), new Vector2i(infoPaneWidth / 2, 10), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP)); spellName.SetEffect(Text.Outline); spellName.SetColor(Color.white); infoPane.AddToTab(1, spellName); AddUIObj(description = new Text(new Vector2i(size.width / 2 - infoPaneWidth / 2 + 4, size.height - 32), new Vector2i(infoPaneWidth - 6, 30), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP | RB.TEXT_OVERFLOW_WRAP)); description.SetColor(Color.white); infoPane.AddToTab(1, description); buyHeader = new Text(new Vector2i(size.width / 4, -10), new Vector2i(100, 20), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, "@w214Learn"); buyHeader.SetEffect(Text.Outline); buyHeader.SetColor(Color.white); buyHeader.FitSizeToText(); buyHeader.alignment = RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER; AddUIObj(buyHeader); sellHeader = new Text(new Vector2i(3 * size.width / 4, -10), new Vector2i(100, 20), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, "@w214Forget"); sellHeader.SetEffect(Text.Outline); sellHeader.SetColor(Color.white); sellHeader.FitSizeToText(); sellHeader.alignment = RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER; AddUIObj(sellHeader); }
public override void OnConstruct() { AddUIObj(rollButton = new ImageButton(new Vector2i(size.x / 5, size.y / 2 + 32), RB.PackedSpriteGet("RollButton", Game.SPRITEPACK_BATTLE), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER)); rollButton.SetOnClick(() => { if (battle.rollsLeft > 0) { Game.client.Send(GameMsg.Roll, new EmptyMessage()); } }); rollButton.SetKeybind(KeyCode.Space); AddUIObj(passButton = new TextButton(new Vector2i(size.x / 5, size.y / 2 + 48), "Pass", RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER)); passButton.SetOnClick(() => { if (battle.rollsLeft == 0) { Game.client.Send(GameMsg.Pass, new EmptyMessage()); passButton.isVisible = false; } }); passButton.isVisible = false; passButton.SetKeybind(KeyCode.Return); AddUIObj(bottomPane = new TabbedPane(new Vector2i(0, size.height - 72), new Vector2i(size.width / 2 + 1, 72))); bottomPane.SetTabs(new string[] { "Battle Log", "Inventory", "Bestiary" }); AddUIObj(battleLog = new Text(new Vector2i(4, size.height - 64), new Vector2i(size.width / 3 * 2, 60), RB.ALIGN_H_LEFT | RB.ALIGN_V_BOTTOM | RB.TEXT_OVERFLOW_CLIP)); bottomPane.AddToTab(0, battleLog); // Infopane int infoPaneWidth = (size.width - 102) - (size.width / 2 + 1); AddUIObj(infoPane = new TabbedPane(new Vector2i(size.width / 2 + 1, size.height - 62), new Vector2i(infoPaneWidth, 62), true)); infoPane.SetTabs(new string[] { "Player", "Enemy", "Spell", "Item" }); // Infopane: Pawn info AddUIObj(playerName = new Text(new Vector2i(size.width / 2 + 5, size.height - 58), new Vector2i(infoPaneWidth / 2, 10), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP)); playerName.SetEffect(Text.Outline); playerName.SetColor(Color.white); infoPane.AddToTab(0, playerName); AddUIObj(affinities = new Text(new Vector2i(size.width / 2 + 5 + infoPaneWidth / 2, size.height - 58), new Vector2i(infoPaneWidth / 2 - 6, 40), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP)); affinities.SetText("Affinities:"); affinities.SetColor(Color.white); affinities.SetEffect(Text.Outline); infoPane.AddToTab(0, affinities); AddUIObj(affinities = new Text(new Vector2i(size.width / 2 + 5 + infoPaneWidth / 2, size.height - 58), new Vector2i(infoPaneWidth / 2 - 6, 40), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP)); affinities.SetColor(Color.white); string affText = ""; for (int i = 0; i < 6; i++) { affText += "\n " + Element.All[i].GetColorHex() + Element.All[i].GetName(); } affinities.SetText(affText); infoPane.AddToTab(0, affinities); AddUIObj(affinities = new Text(new Vector2i(size.width / 2 + 5 + infoPaneWidth / 2, size.height - 58), new Vector2i(infoPaneWidth / 2 - 6, 40), RB.ALIGN_H_RIGHT | RB.ALIGN_V_TOP)); affinities.SetColor(Color.black); infoPane.AddToTab(0, affinities); TooltipArea tta = new TooltipArea(new Vector2i(size.width / 2 + 5 + infoPaneWidth / 2, size.height - 58), new Vector2i(infoPaneWidth / 2 - 6, 54), "Affinities determine how likely\nyou are to roll a certain aspect."); AddUIObj(tta); infoPane.AddToTab(0, tta); // Infopane: Spell info AddUIObj(spellName = new Text(new Vector2i(size.width / 2 + 5, size.height - 58), new Vector2i(infoPaneWidth / 2, 10), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP)); spellName.SetEffect(Text.Outline); spellName.SetColor(Color.white); infoPane.AddToTab(1, spellName); AddUIObj(description = new Text(new Vector2i(size.width / 2 + 5, size.height - 32), new Vector2i(infoPaneWidth - 6, 30), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP | RB.TEXT_OVERFLOW_WRAP)); description.SetColor(Color.white); infoPane.AddToTab(1, description); }