Пример #1
0
    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);
    }
Пример #2
0
 private int FillSpellPane(TabbedPane pane, int index, int buttonIndexStart)
 {
     Spell[] knownSpells = battle.allies[index].GetSpells();
     for (int i = 0; i < knownSpells.Length; i++)
     {
         SpellButton sb = new SpellButton(this, battle, knownSpells[i], new Vector2i(size.width - 97, 5 + i * 31), index != Game.peerId);
         if (index == Game.peerId)
         {
             sb.SetKeybind(KeyCode.Alpha1 + i);
         }
         spellButtons[i + buttonIndexStart]         = sb;
         spellButtonOwnership[i + buttonIndexStart] = index;
         AddUIObj(sb);
         pane.AddToTab(index, sb);
     }
     return(buttonIndexStart + knownSpells.Length);
 }
Пример #3
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);
    }
Пример #4
0
 public void TextTabbedPaneSelectedItemEvalMethodException()
 {
     TabbedPane pane = new TabbedPane("pane");
     pane.SelectedItemEvalMethod();
 }
Пример #5
0
 public void TestTabbedPaneValidate()
 {
     TabbedPane pane = new TabbedPane("pane").AddItem(2);
 }
Пример #6
0
 public void TestTabbedPaneSelectedItemsException()
 {
     TabbedPane pane = new TabbedPane("pane");
     pane.SelectedItems();
 }
Пример #7
0
 public void TestTabbedPaneSelectedItemsEvalMethod()
 {
     TabbedPane pane = new TabbedPane("pane").AddItem("selectedText");
     Assert.AreEqual("query_base.selectTab(\"selectedText\");", pane.SelectedItemsEvalMethod("query_base"));
 }
Пример #8
0
        // WARNING: This test runs extremely slow
        private void _GenericTestDialogFocus(string pBrowserString)
        {
            using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL))
            {
                _OpenPage(javaSelenium);

                javaSelenium.ObjectID = TABLE_APPLET_ID;
                JavaAction action = new JavaAction(javaSelenium);

                Table table = new Table("table");

                Dialog dialog = new Dialog("dialog");
                TabbedPane pane = new TabbedPane("ColorChooser.tabPane");

                //System.Diagnostics.Debugger.Break();

                Assert.AreEqual(action, action.Focus(table)
                    .Select<Table>(new Cell(0, 1))
                    .Focus(dialog)                      // focuses on the actual dialog component
                    .SetRootComponent(dialog)
                    .Focus(pane)
                    .Select<TabbedPane>("Swatches").Click() // subsequent calls inherit the RootComponent
                    .Select<TabbedPane>("HSB").Click()
                    .Select<TabbedPane>("RGB").Click()
                    );
            }
        }
Пример #9
0
 public void TestTabbedPaneSelectedItemEvalMethodTooManyArguments()
 {
     TabbedPane pane = new TabbedPane("pane").AddItem("selectedText");
     pane.SelectedItemEvalMethod("query_base", "component");
 }
Пример #10
0
 public void TestTabbedPaneSelectedItemEvalMethodNoArguments()
 {
     TabbedPane pane = new TabbedPane("pane").AddItem("selectedText");
     pane.SelectedItemEvalMethod();
 }
Пример #11
0
 public void TestTabbedPaneRemoveNonExistentItem()
 {
     TabbedPane pane = new TabbedPane("pane").RemoveItem("pane");
 }
Пример #12
0
 public void TestTabbedPaneRemoveItems()
 {
     TabbedPane pane = new TabbedPane("pane").RemoveItems(new object[] { "item1" });
 }
Пример #13
0
 public void TestTabbedPaneRemoveItem()
 {
     TabbedPane pane = new TabbedPane("pane").AddItem("some text");
     Assert.AreEqual(pane, pane.RemoveItem("some text"));
 }
Пример #14
0
 public void TestTabbedPaneAddItemsException()
 {
     TabbedPane pane = new TabbedPane("pane");
     Assert.AreEqual(pane, pane.AddItems(new object[] { "item1", "item2" }));
 }
Пример #15
0
        public void TestTabbedPane()
        {
            TabbedPane pane = new TabbedPane("newPane");

            Assert.AreEqual("newPane", pane.Name);
            Assert.AreEqual(String.Empty, pane.Text);
            Assert.IsTrue(pane is Component);

            TabbedPane anotherPane = new TabbedPane("anotherPane", "someText");
            Assert.AreEqual("someText", anotherPane.Text);
            Assert.AreEqual("anotherPane", anotherPane.Name);

            Assert.AreEqual("tabbedPane", anotherPane.Type);
            Assert.AreEqual("tabbedPane(\"anotherPane\")", anotherPane.GetBaseComponentString());
            Assert.AreEqual("getTestFixture().tabbedPane(\"anotherPane\")", anotherPane.GetQueryString());
            Assert.AreEqual("getTestFixture().prefix(\"prefix\").tabbedPane(\"anotherPane\")", anotherPane.GetQueryString("prefix(\"prefix\")"));
        }
Пример #16
0
    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);
    }
Пример #17
0
 public void TestTabbedPaneSelectedItems()
 {
     TabbedPane pane = new TabbedPane("pane");
     Assert.AreEqual(pane, pane.AddItem("item1"));
     Assert.AreEqual("item1", pane.SelectedItems()[0]);
 }
Пример #18
0
        private void _GenericTestClick(string pBrowserString)
        {
            using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL))
            {
                javaSelenium.ObjectID = TEST_APPLET_ID;
                _OpenPage(javaSelenium);

                JavaAction action = new JavaAction(javaSelenium);
                Button button = new Button("clickme");

                Assert.AreEqual(action, action.Click(button));

                javaSelenium.ObjectID = TREE_APPLET_ID;
                Tree tree = new Tree("tree");
                action = new JavaAction(javaSelenium);

                Assert.AreEqual(action, action.Focus(tree).Select<Tree>("root").Click()
                                            .Select<Tree>("root/attribute1").Click()
                                            .Select<Tree>("root/attribute1/attribute1.1").Click()
                                            .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.1").Click()
                                            .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.2").Click()
                                            .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.3").Click()
                                            .Select<Tree>("root/attribute2").Click()
                                            .Select<Tree>("root/attribute3").Click()
                    );

                javaSelenium.ObjectID = COMBO_APPLET_ID;
                ComboBox pattern = new ComboBox("pattern");
                action = new JavaAction(javaSelenium);

                Assert.AreEqual(action, action.Focus(pattern)
                                            .Select<ComboBox>("yyyy.MMMMM.dd GGG hh:mm aaa")
                                            .Select<ComboBox>("K:mm a,z")
                                            .Select<ComboBox>("H:mm:ss:SSS")
                                            .Select<ComboBox>("h:mm a")
                                            .Select<ComboBox>("EEE, MMM d, ''yy")
                                            .Select<ComboBox>("yyy.MM.dd G 'at' hh:mm:ss z")
                                            .Select<ComboBox>("MM/dd/yy")
                    );

                javaSelenium.ObjectID = TAB_APPLET_ID;
                TabbedPane pane = new TabbedPane("pane");
                action = new JavaAction(javaSelenium);

                Assert.AreEqual(action, action.Focus(pane)
                                            .Select<TabbedPane>("Tab 1").Click()
                                            .Select<TabbedPane>("Tab 2").Click()
                                            .Select<TabbedPane>("Tab 3").Click()
                                            .Select<TabbedPane>("Tab 4").Click()
                    );

                javaSelenium.ObjectID = SPINNER_APPLET_ID;
                Spinner month = new Spinner("month");
                Spinner year = new Spinner("year");
                Spinner date = new Spinner("date");

                Assert.AreEqual(action, action
                                            .Focus(month).Click()
                                            .Focus(year).Click()
                                            .Focus(date).Click()
                    );
            }
        }