Exemplo n.º 1
0
    void Render( int realX, int realY, bool highlighted, bool clicked )
    {
        AlliancesWindow *parent = (AlliancesWindow *)m_parent;
        int voteId = parent->m_votes[m_voteIndex];
        
        Vote *vote = g_app->GetWorld()->m_votingSystem.LookupVote( voteId );
        Team *myTeam = g_app->GetWorld()->GetMyTeam();
        
        if( vote )
        {
            g_renderer->RectFill( realX, realY, m_w, m_h, Colour(10,10,50,200) );
            
            Colour borderCol(255,255,255,100);
            if( highlighted || clicked ) 
            {
                borderCol.m_a = 255;
                g_renderer->RectFill( realX, realY, m_w, m_h, Colour(100,100,150,100) );
            }
            g_renderer->Rect( realX, realY, m_w, m_h, borderCol );

            switch( vote->m_voteType )
            {
                case Vote::VoteTypeJoinAlliance:
                    if( myTeam->m_teamId == vote->m_createTeamId )
                    {
                        char *allianceName = g_app->GetWorld()->GetAllianceName(vote->m_voteData);
                        g_renderer->TextSimple( realX+10, realY+5, White, 14, LANGUAGEPHRASE("dialog_you_requested_alliance_1") );
						char caption[512];
						sprintf( caption, LANGUAGEPHRASE("dialog_you_requested_alliance_2") );
						LPREPLACESTRINGFLAG( 'A', allianceName, caption );
                        g_renderer->TextSimple( realX+10, realY+20, White, 14, caption );
                    }
                    else 
                    {
                        Team *team = g_app->GetWorld()->GetTeam( vote->m_createTeamId );
						char caption[512];
						sprintf( caption, LANGUAGEPHRASE("dialog_requested_alliance_1") );
						LPREPLACESTRINGFLAG( 'T', team->m_name, caption );
                        g_renderer->TextSimple( realX+10, realY+5, White, 15, caption );
                        g_renderer->TextSimple( realX+10, realY+20, White, 15, LANGUAGEPHRASE("dialog_requested_alliance_2") );
                    }
                    break;

                case Vote::VoteTypeKickPlayer:
                {
                    Team *kickTeam = g_app->GetWorld()->GetTeam(vote->m_voteData);
                    if( myTeam->m_teamId == vote->m_createTeamId )
                    {
                        g_renderer->TextSimple( realX+10, realY+5, White, 15, LANGUAGEPHRASE("dialog_you_requested_kick_1") );
						char caption[512];
						sprintf( caption, LANGUAGEPHRASE("dialog_you_requested_kick_2") );
						LPREPLACESTRINGFLAG( 'T', kickTeam->m_name, caption );
                        g_renderer->TextSimple( realX+10, realY+20, White, 15, caption );
                    }
                    else
                    {
                        Team *team = g_app->GetWorld()->GetTeam( vote->m_createTeamId );
						char caption[512];
						sprintf( caption, LANGUAGEPHRASE("dialog_requested_kick_1") );
						LPREPLACESTRINGFLAG( 'T', team->m_name, caption );
                        g_renderer->TextSimple( realX+10, realY+5, White, 15, caption );
						sprintf( caption, LANGUAGEPHRASE("dialog_requested_kick_2") );
						LPREPLACESTRINGFLAG( 'T', kickTeam->m_name, caption );
                        g_renderer->TextSimple( realX+10, realY+20, White, 15, caption );
                    }
                    break;
                }
            }

            int yes, no, abstain;
            vote->GetCurrentVote( &yes, &no, &abstain );

            g_renderer->Text( realX + 190, realY + 12, White, 17, "%ds", int(vote->m_timer) );
            
            g_renderer->TextSimple( realX + m_w - 70, realY + 5, White, 10,  LANGUAGEPHRASE("dialog_vote_yes") );
            g_renderer->TextSimple( realX + m_w - 70, realY + 15, White, 10, LANGUAGEPHRASE("dialog_vote_no") );
            g_renderer->TextSimple( realX + m_w - 70, realY + 25, White, 10, LANGUAGEPHRASE("dialog_vote_abstain") );

            g_renderer->Text( realX + m_w - 20, realY + 5, White, 10,  "%d", yes );
            g_renderer->Text( realX + m_w - 20, realY + 15, White, 10, "%d", no );
            g_renderer->Text( realX + m_w - 20, realY + 25, White, 10, "%d", abstain );
        }
    }
Exemplo n.º 2
0
   void onRender(Point2I offset, const RectI &updateRect)
   {
      U32 elapsed = Platform::getRealMilliseconds() - wakeTime;

      U32 alpha;
      if (doFadeOut && elapsed < fadeoutTime)
      {
         // fade out
         alpha = 255 - (255 * (F32(elapsed) / F32(fadeoutTime)));
      }
      else if (doFadeIn && elapsed < fadeinTime)
      {
         // fade in
         alpha = 255 * F32(elapsed) / F32(fadeinTime);
      }
      else
      {
         // done state
         alpha = doFadeIn ? 255 : 0;
         done = true;
      }

      ColorI color(255,255,255,alpha);
      if (mTextureObject)
      {
         GFX->getDrawUtil()->setBitmapModulation(color);

         if(mWrap)
         {

            GFXTextureObject* texture = mTextureObject;
            RectI srcRegion;
            RectI dstRegion;
            F32 xdone = ((F32)getExtent().x/(F32)texture->mBitmapSize.x)+1;
            F32 ydone = ((F32)getExtent().y/(F32)texture->mBitmapSize.y)+1;

            S32 xshift = mStartPoint.x%texture->mBitmapSize.x;
            S32 yshift = mStartPoint.y%texture->mBitmapSize.y;
            for(S32 y = 0; y < ydone; ++y)
               for(S32 x = 0; x < xdone; ++x)
               {
                  srcRegion.set(0,0,texture->mBitmapSize.x,texture->mBitmapSize.y);
                  dstRegion.set( ((texture->mBitmapSize.x*x)+offset.x)-xshift,
                     ((texture->mBitmapSize.y*y)+offset.y)-yshift,
                     texture->mBitmapSize.x,
                     texture->mBitmapSize.y);
                  GFX->getDrawUtil()->drawBitmapStretchSR(texture,dstRegion, srcRegion);
               }

         }
         else
         {
            RectI rect(offset, getExtent());
            GFX->getDrawUtil()->drawBitmapStretch(mTextureObject, rect);
         }
      }

      if (mProfile->mBorder || !mTextureObject)
      {
         RectI rect(offset.x, offset.y, getExtent().x, getExtent().y);
         ColorI borderCol(mProfile->mBorderColor);
         borderCol.alpha = alpha;
         GFX->getDrawUtil()->drawRect(rect, borderCol);
      }

      renderChildControls(offset, updateRect);
   }