Esempio n. 1
0
    public void ViewSpellTab(int pawnId)
    {
        for (int j = 0; j < viewPawnImages.Length; j++)
        {
            if (viewPawnImages[j] != null)
            {
                viewPawnImages[j].isVisible = j == pawnId;
            }
        }
        spellPane.OpenTab(pawnId);
        infoPane.OpenTab(0);
        PlayerPawn pawn = battle.allies[pawnId] as PlayerPawn;

        playerName.SetText(pawn.GetName());
        string     affText = "";
        FastString perc    = new FastString(3);

        double affTotal = pawn.GetAffinityTotal();

        for (int i = 0; i < 6; i++)
        {
            perc.Clear();
            double aff = pawn.GetAffinity(i);
            perc.Append((int)(aff / affTotal * 100), 2, FastString.FILL_SPACES);
            affText += "\n" /*+ Element.All[i].GetColorHex()*/ + pawn.GetAffinity(i) + " (" + perc + "%)";
        }
        affinities.SetText(affText);

        foreach (Text text in currentItemTexts)
        {
            RemoveUIObj(text);
        }
        string[] eq       = pawn.GetEquipment();
        int      currentY = size.height - 58;

        for (int i = 0; i < eq.Length; i++)
        {
            Equipment e    = Equipments.Get(eq[i]);
            Text      text = new Text(new Vector2i(5, currentY), new Vector2i(), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, e.GetName());
            text.FitSizeToText(1);
            text.SetTooltip(e.GetDescription());
            currentY += text.size.height + 2;
            AddUIObj(text);
            currentItemTexts.Add(text);
            bottomPane.AddToTab(1, text);
        }
        UpdateContext();
    }
Esempio n. 2
0
 public void OnRoll(NetworkMessage msg)
 {
     if (msg.conn.connectionId == battle.currentTurn && battle.rollsLeft > 0)
     {
         PlayerPawn pawn    = battle.GetCurrentPawn() as PlayerPawn;
         int[]      rolls   = new int[battle.rolls.Length];
         double[]   weights = new double[pawn.Affinities.Length];
         for (int i = 0; i < weights.Length; i++)
         {
             weights[i] = pawn.GetAffinity(i);
         }
         for (int i = 0; i < rolls.Length; i++)
         {
             if (battle.locks[i])
             {
                 rolls[i] = battle.rolls[i].GetId();
             }
             else
             {
                 rolls[i] = Element.All[REX.Weighted(weights)].GetId();
             }
             battle.rolls[i] = Element.All[rolls[i]];
         }
         battle.rollsLeft -= 1;
         NetworkServer.SendToAll(GameMsg.Roll, new GameMsg.MsgIntegerArray()
         {
             array = rolls
         });
     }
 }