コード例 #1
0
    public static void HidePlayerList(NarrativeUi *self)
    {
        var playerAvatars     = self->playerAvatars;
        var playerBubbles     = self->playerBubbles;
        var playerBubbleTexts = self->playerBubbleTexts;

        float Scr2World = Scr.Scr2World;

        var job = EsWorker.PrepBatch(esWorker, Es.CubicOut, PlayerListTransitionDuration);

        for (int i = 0, count = self->playerCount; i < count; i += 1)
        {
            var playerAvatar     = playerAvatarArr[i];
            var playerBubble     = playerBubbleArr[i];
            var playerBubbleText = playerBubbleTextArr[i];

            EsBatchJob.ShiftPos(job, playerAvatar, 0, Scr2World * -PlayerListShiftOffset);
            EsBatchJob.SetOpacity(job, playerAvatar, 0, EsWorker.SetVisibleAtEnd);

            if (playerBubble->isVisible)
            {
                EsBatchJob.ShiftPos(job, playerBubble, 0, Scr2World * -PlayerListShiftOffset);
                EsBatchJob.ShiftPos(job, playerBubbleText, 0, Scr2World * -PlayerListShiftOffset);
                EsBatchJob.SetOpacity(job, playerBubble, 0, EsWorker.SetVisibleAtEnd);
                EsBatchJob.SetOpacity(job, playerBubbleText, 0, EsWorker.SetVisibleAtEnd);
            }
        }
        EsWorker.ExecBatch(esWorker, job);
    }
コード例 #2
0
    public static void ShowPlayerList(NarrativeUi *self)
    {
        var playerAvatars     = self->playerAvatars;
        var playerBubbles     = self->playerBubbles;
        var playerBubbleTexts = self->playerBubbleTexts;

        float Scr2World = Scr.Scr2World;

        var job = EsWorker.PrepBatch(esWorker, Es.CubicOut, PlayerListTransitionDuration);

        for (int i = 0, count = self->playerCount; i < count; i += 1)
        {
            var playerAvatar = playerAvatarArr[i];

            Node.SetPos(playerAvatar, Rel.TopLeft,
                        Scr2World * PlayerAvatarMarginLeft,
                        Scr2World * (-PlayerAvatarMarginTop - i * PlayerAvatarSpacingY));
            Node.SetOpacity(playerAvatar, 0);
            Node.SetVisible(playerAvatar, true);

            EsBatchJob.RestorePos(job, playerAvatar, 0, Scr2World * PlayerListShiftOffset);
            EsBatchJob.SetOpacity(job, playerAvatar, 1);
        }
        EsWorker.ExecBatch(esWorker, job);
    }
コード例 #3
0
ファイル: NarrativeUi.cs プロジェクト: DotLab/Futilef-Unity
    public static void Init(NarrativeUi *self)
    {
        EsWorker.Init(esWorker);

        InitPlayerList(self);
        // InitBranchSelection(self);
        // InitGal(self);
        // InitMiscButtons(self);
        // InitFunctionMenu(self);
    }
コード例 #4
0
    public static void SetPlayerAvatars(NarrativeUi *self, int[] playerAvatarImgIds)
    {
        var playerAvatars     = self->playerAvatars;
        var playerBubbles     = self->playerBubbles;
        var playerBubbleTexts = self->playerBubbleTexts;

        int oldPlayerCount = playerCount;

        playerCount = playerAvatarImgIds.Length;

        float Scr2World = Scr.Scr2World;

        var job = EsWorker.PrepBatch(esWorker, Es.CubicOut, PlayerListTransitionDuration);

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

            if (i < playerCount)                // already showing, switch
            {
                TpSprite.SetMeta(playerAvatar, Res.GetTpSpriteMeta(playerAvatarImgIds[i]));
                if (playerAvatar->meta->name != playerAvatarImgIds[i])                    // different image
                {
                    EsBatchJob.RestoreScaleAlt(playerAvatar, Rel.Center, 0, 0, Es.BackOut);
                }
            }
            else                  // not showing any more, hide
            {
                EsBatchJob.SetScale(playerAvatar, Rel.Center, 0, 0, EsWorker.SetVisibleAtEnd);
                EsBatchJob.ShiftPos(playerAvatar, 0, Scr2World * PlayerListShiftOffset);
            }

            if (playerBubble->isVisible)                // hide all bubbles
            {
                EsBatchJob.ShiftPos(job, playerBubble, 0, Scr2World * -PlayerListShiftOffset);
                EsBatchJob.ShiftPos(job, playerBubbleText, 0, Scr2World * -PlayerListShiftOffset);
                EsBatchJob.SetOpacity(job, playerBubble, 0, EsWorker.SetVisibleAtEnd);
                EsBatchJob.SetOpacity(job, playerBubbleText, 0, EsWorker.SetVisibleAtEnd);
            }
        }

        for (int i = oldPlayerCount; i < playerCount; i += 1)            // not showing, show
        {
            var playerAvatar = playerAvatarArr[i];

            Node.SetMeta(playerAvatar, Res.GetTpSpriteMeta(playerAvatarImgIds[i]));
            Node.SetOpacity(playerAvatar, 0);
            Node.SetVisible(playerAvatar, true);
            EsBatchJob.RestoreScaleAlt(playerAvatar, Rel.Center, 0, 0, Es.BackOut);
            EsBatchJob.SetOpacity(playerAvatar, 1);
        }
        EsWorker.ExecBatch(esWorker, job);
    }
コード例 #5
0
    public static void HidePlayerBubble(NarrativeUi *self, int playerIdx)
    {
        var playerAvatars     = self->playerAvatars;
        var playerBubbles     = self->playerBubbles;
        var playerBubbleTexts = self->playerBubbleTexts;

        float Scr2World = Scr.Scr2World;

        var job = EsWorker.PrepBatch(esWorker, Es.CubicOut, PlayerListTransitionDuration);

        EsBatchJob.ShiftPos(job, playerBubble, Scr2World * -PlayerListShiftOffset, 0);
        EsBatchJob.ShiftPos(job, playerBubbleText, Scr2World * -PlayerListShiftOffset, 0);
        EsBatchJob.SetOpacity(job, playerBubble, 0, EsWorker.SetVisibleAtEnd);
        EsBatchJob.SetOpacity(job, playerBubbleText, 0, EsWorker.SetVisibleAtEnd);
        EsWorker.ExecBatch(esWorker, job);
    }
コード例 #6
0
ファイル: NarrativeUi.cs プロジェクト: DotLab/Futilef-Unity
    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]);
        }
    }
コード例 #7
0
    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);
            }
        }
    }
コード例 #8
0
    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);
        }
    }
コード例 #9
0
    public static void SetPlayerBubbleText(NarrativeUi *self, int playerIdx, string message)
    {
        var playerAvatar     = self->playerAvatars[playerIdx];
        var playerBubble     = self->playerBubbles[playerIdx];
        var playerBubbleText = self->playerBubbleTexts[playerIdx];

        float Scr2World = Scr.Scr2World;

        Node.SetText(playerBubbleText, message);
        float height = Node.GetHeight(playerBubbleText);

        Node.SetScale(playerBubbleText, 1, .5f);
        Node.SetOpacity(playerBubbleText, 0);
        Node.SetVisible(playerBubbleText, true);

        height += Scr2World * (PlayerBubbleTextMarginTop + PlayerBubbleTextMarginTop);

        var job = EsWorker.PrepBatch(esWorker, Es.CubicOut, PlayerListTransitionDuration);

        if (!playerBubble->isVisible)            // not visible -> fade in from top
        {
            Node.SetHeight(playerBubble, heigh);
            Node.SetOpacity(playerBubble, 0);
            Node.SetVisible(playerBubble, true);

            EsBatchJob.RestorePos(playerBubble, 0, Scr2World * PlayerListShiftOffset);
            EsBatchJob.RestorePos(playerBubbleText, 0, Scr2World * PlayerListShiftOffset);
            EsBatchJob.SetOpacity(playerBubble, 1);
            EsBatchJob.SetOpacity(playerBubbleText, 1);
            EsBatchJob.SetScaleAlt(playerBubbleText, 1, 1, Es.BackOut);
        }
        else              // already visible -> ease height
        {
            EsBatchJob.SetHeight(playerBubble, heigh);
            EsBatchJob.SetOpacity(playerBubbleText, 1);
            EsBatchJob.SetScaleAlt(playerBubbleText, 1, 1, Es.BackOut);
        }
        EsWorker.ExecBatch(esWorker, job);
    }
コード例 #10
0
    static void TouchPlayerList(NarrativeUi *self, Tch *tches, int tchCount)
    {
        var playerBubbles = self->playerBubbles;

        // HidePlayerBubble if touched on the bubble
        for (int i = 0, count = self->playerCount; i < count; i += 1)
        {
            var playerBubble = playerBubbles[i];

            if (playerBubble->isVisible)
            {
                for (int i = 0; i < tchCount; i += 1)
                {
                    var tch = tches + i;
                    if (tch->phase == TchPhase.Enter && Node.Raycast(playerBubble, tch->pos))
                    {
                        HidePlayerBubble(self, i);
                        break;
                    }
                }
            }
        }
    }
コード例 #11
0
ファイル: NarrativeUi.cs プロジェクト: DotLab/Futilef-Unity
 public static void Update(NarrativeUi *self, float deltaTime)
 {
     EsWorker.Update(self->esWorker, deltaTime);
 }
コード例 #12
0
ファイル: NarrativeUi.cs プロジェクト: DotLab/Futilef-Unity
 public static void Touch(NarrativeUi *self, Tch *touches, int touchCount)
 {
     TouchPlayerList(touches, touchCount);
 }
コード例 #13
0
 /**
  * assume: all nodes are visible and in right position
  */
 public static void HideBranchOptions(NarrativeUi *self)
 {
 }
コード例 #14
0
 /**
  * assume: all nodes are not visible
  */
 public static void ShowBranchOptions(NarrativeUi *self, string[] options)
 {
     optionCount = options.Length;
 }
コード例 #15
0
 static void TouchBranchSelect(NarrativeUi *self, Tch *tches, int tchCount)
 {
 }
コード例 #16
0
 public static void SelectBranchOption(NarrativeUi *self, int idx)
 {
 }
コード例 #17
0
 public static void UpdateBranchOptionVotes(NarrativeUi *self, int[] voteImgIds, int[] optionVoteCounts)
 {
 }