Exemple #1
0
    public static void Draw(NarrativeUi *self)
    {
        var playerAvatarArr     = (TpSprite **)playerAvatarLst->arr;
        var playerBubbleArr     = (TpSpriteSliced **)playerBubbleLst->arr;
        var playerBubbleTextArr = (BmText **)playerBubbleTextLst->arr;

        for (int i = 0; i < playerCount; i += 1)
        {
            TpSprite.Draw(playerAvatarArr[i]);
        }

        for (int i = 0; i < playerCount; i += 1)
        {
            TpSprite.Draw(playerBubbleArr[i]);
            BmText.Draw(playerBubbleTextArr[i]);
        }
    }
    public static void InitPlayerList(NarrativeUi *self)
    {
        var playerAvatars     = self->playerAvatars;
        var playerBubbles     = self->playerBubbles;
        var playerBubbleTexts = self->playerBubbleTexts;

        float Scr2World = Scr.Scr2World;

        for (int i = 0; i < PlayerListCount; i += 1)
        {
            var playerAvatar     = playerAvatars + i;
            var playerBubble     = playerBubbles + i;
            var playerBubbleText = playerBubbleTexts + i;

            TpSprite.Init(playerAvatar);
            TpSprite.SetPivot(playerAvatar, Rel.TopLeft);
            TpSprite.SetPos(playerAvatar, Rel.TopLeft,
                            Scr2World * PlayerAvatarMarginLeft,
                            -Scr2World * (PlayerAvatarMarginTop + i * PlayerAvatarSpacingY));
            TpSprite.SetSize(playerAvatar,
                             Scr2World * PlayerAvatarSize,
                             Scr2World * PlayerAvatarSize);

            TpSpriteSliced.Init(playerBubble, Res.GetTpSpriteMeta(PlayerBubbleImgId));
            TpSpriteSliced.SetPivot(playerBubble, Rel.TopLeft);
            TpSpriteSliced.SetPosRel(playerBubble, playerAvatar, Rel.TopRight,
                                     Scr2World * PlayerBubbleMarginLeft,
                                     -Scr2World * PlayerBubbleMarginTop);
            TpSpriteSliced.SetSize(playerBubble,
                                   Scr2World * PlayerBubbleWidth,
                                   Scr2World * PlayerBubbleHeight);
            TpSpriteSliced.SetVisible(playerBubble, false);

            BmText.Init(playerBubbleText);
            BmText.SetPivot(playerBubbleText, Rel.TopLeft);
            BmText.SetPosRel(playerBubbleText, playerBubble, Rel.TopLeft,
                             Scr2World * PlayerBubbleTextMarginLeft,
                             -Scr2World * PlayerBubbleTextMarginTop);
            BmText.SetFontSize(playerBubbleText, Scr2World * PlayerBubbleTextFontSize);
            BmText.SetLineWidth(playerBubbleText, Scr2World * PlayerBubbleTextLineWidth);
            BmText.SetLineSpacing(playerBubbleText, Scr2World * PlayerBubbleTextLineSpacing);
            BmText.SetVisible(playerBubbleText, false);
        }
    }
    public static void InitBranchSelect(NarrativeUi *self)
    {
        var branchOptions     = self->branchOptions;
        var branchOptionTexts = self->branchOptionTexts;
        var branchOptionVotes = self->branchOptionVotes;

        float Scr2World = Scr.Scr2World;

        for (int i = 0; i < BranchOptionCount; i += 1)
        {
            var branchOption     = branchOptions + i;
            var branchOptionText = branchOptionTexts + i;

            TpSpriteSliced.Init(branchOption, Res.GetTpSpriteMeta(PlayerBubbleImgId));
            TpSpriteSliced.SetPivot(branchOption, Rel.TopRight);
            TpSpriteSliced.SetPos(branchOption,
                                  -Scr2World * BranchOptionMarginRight,
                                  -Scr2World * (BranchOptionMarginTop + i * BranchOptionSpacingY));
            TpSpriteSliced.SetSize(branchOption,
                                   Scr2World * BranchOptionWidth,
                                   Scr2World * BranchOptionHeight);
            TpSpriteSliced.SetVisible(branchOption, false);

            BmText.Init(branchOptionText, BranchOptionTextMaxLength);
            BmText.SetPivot(branchOptionText, Rel.center);
            BmText.SetPosRel(branchOptionText, branchOption, Rel.center, 0, 0);
            BmText.SetSize(branchOptionText, BranchOptionTextSize);

            for (int j = 0; j < BranchOptionVoteCount; j += 1)
            {
                var branchOptionVote = branchOptionVotes + i * BranchOptionVoteCount + j;

                TpSprite.Init(branchOptionVote);
                TpSprite.SetPivot(branchOptionVote, Rel.TopLeft);
                TpSprite.SetPosRel(branchOptionVote, branchOption, Rel.TopLeft,
                                   -Scr2World * (BranchVoteMarginRight + j * BranchVoteSpacingX),
                                   Scr2World * BranchVoteMarginBottom);
                TpSprite.SetSize(branchOptionVote,
                                 Scr2World * BranchVoteSize,
                                 Scr2World * BranchVoteSize);
                TpSprite.SetVisible(branchOptionVote, false);
            }
        }
    }