Ejemplo n.º 1
0
const char *RealtimeBonus_Get_Icon_Name (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return NULL;
   return pbonus->pIconName;

}
Ejemplo n.º 2
0
BOOL RealtimeBonus_Delete (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return FALSE;

   if (pbonus->pIconName)
      free (pbonus->pIconName);

   if (pbonus->pBonusText)
      free (pbonus->pBonusText);

   if (pbonus->pCollectText)
      free (pbonus->pCollectText);

   if (pbonus->pCollectTitle)
      free (pbonus->pCollectTitle);

   if (pbonus->pCollectIcon)
      free (pbonus->pCollectIcon);


   onBonusDelete (pbonus);
   RealtimeBonus_RemoveFromTable (iID);
   return TRUE;
}
Ejemplo n.º 3
0
int RealtimeBonus_Get_NumberOfPoints (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return -1;

   return pbonus->iNumPoints;

}
Ejemplo n.º 4
0
int RealtimeBonus_Get_Token (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return -1;

   return pbonus->iToken;

}
Ejemplo n.º 5
0
void RealtimeBonus_PopUp (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);


   if (!pbonus)
      return;

   if (pbonus->iType == BONUS_TYPE_POINTS){
      RealtimeBonus_FloatingPopUp(pbonus, pbonus->bHasWebDlg ? on_next : NULL);
      return;
   }
   else if (pbonus->iType == BONUS_TYPE_TREASURE){
      g_pbonus = pbonus;
      RealtimeBonus_FloatingPopUp(pbonus, pbonus->bHasWebDlg ? on_next : NULL);
      //RealtimeBonus_FloatingPopUp(pbonus, RealtimeBonus_PopUpNext);
      return;
   }

}
Ejemplo n.º 6
0
int RealtimeBonus_HandleEvent (int iID) {

   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return TRUE;

   if (pbonus->collected)
      return TRUE;

   pbonus->collected = TRUE;

   if (roadmap_map_settings_road_goodies()){
   if ((pbonus->iType == BONUS_TYPE_TREASURE) && Realtime_is_random_user()){
      roadmap_messagebox_timeout("", roadmap_lang_get ("There may be presents in this treasure chest but you need to be a registered user in order to get them. Register in 'Settings > Profile'"), 10);
      return TRUE;
   }

   roadmap_log( ROADMAP_DEBUG, "Yeahhh Collecting a gift id=%d)", iID);
   Play_Animation_Sound ();
   RealtimeBonus_Animate_Pacman ();
   }

   if (pbonus->bIsCustomeBonus){
      Realtime_CollectCustomBonus(iID,
            roadmap_twitter_is_munching_enabled() && roadmap_twitter_logged_in(),
            roadmap_facebook_is_munching_enabled() && roadmap_facebook_logged_in());
      editor_points_add_new_points (pbonus->iNumPoints);

   }
   else{
   Realtime_CollectBonus(iID, pbonus->iToken,
         roadmap_twitter_is_munching_enabled() && roadmap_twitter_logged_in(),
         roadmap_facebook_is_munching_enabled() && roadmap_facebook_logged_in());
   }
   onBonusDelete(pbonus);
   return TRUE;
}
Ejemplo n.º 7
0
BOOL RealtimeBonus_Exists (int iID) {
   if (NULL == RealtimeBonus_Get (iID))
      return FALSE;

   return TRUE;
}
Ejemplo n.º 8
0
int RealtimeBonus_Get_Type (int iID) {
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   if (!pbonus)
      return -1;
   return pbonus->iType;
}
Ejemplo n.º 9
0
void RealtimeBonus_PopUp (int iID) {
   SsdWidget popup, spacer, container, button, text, icon;
   char msg[512];
   RTBonus *pbonus = RealtimeBonus_Get (iID);
   const char *title;
   int width;

   if (!pbonus)
      return;

   if (ssd_dialog_is_currently_active () && (!strcmp (ssd_dialog_currently_active_name (),
                  "BonusPopUPDlg")))
      ssd_dialog_hide_current (dec_cancel);

   if (pbonus->iType == BONUS_TYPE_POINTS){
      title = roadmap_lang_get ("Bonus points");
   }
   else if (pbonus->iType == BONUS_TYPE_TREASURE){
      title = roadmap_lang_get ("Treasure chest");
   }

   popup = ssd_popup_new ("BonusPopUPDlg", title, NULL,
                  SSD_MAX_SIZE, SSD_MIN_SIZE, &pbonus->position, SSD_POINTER_LOCATION
                                 | SSD_ROUNDED_BLACK | SSD_HEADER_BLACK);

   spacer = ssd_container_new ("space", "", SSD_MIN_SIZE, 5, SSD_END_ROW);
   ssd_widget_set_color (spacer, NULL, NULL);
   ssd_widget_add (popup, spacer);

   container = ssd_container_new ("IconCon", "", 50, SSD_MIN_SIZE, SSD_ALIGN_RIGHT);
   ssd_widget_set_color (container, NULL, NULL);
   icon = ssd_bitmap_new ("bonusIcon", pbonus->pIconName, SSD_ALIGN_VCENTER | SSD_ALIGN_CENTER);
   ssd_widget_add (container, icon);
   ssd_widget_add (popup, container);

   if (pbonus->pBonusText){
      snprintf (msg, sizeof(msg), "%s", pbonus->pBonusText);
   } else if (pbonus->iType == BONUS_TYPE_POINTS){
      snprintf (msg, sizeof(msg), "%s %d %s", roadmap_lang_get("Drive over this road goodie to earn"),pbonus->iNumPoints, roadmap_lang_get ("points!"));
   }
   else if (pbonus->iType == BONUS_TYPE_TREASURE){
      if (!Realtime_is_random_user())
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get ("There may be presents in this treasure chest! You'll know when you drive over it."));
      else
         snprintf (msg, sizeof(msg), "%s", roadmap_lang_get ("There may be presents in this treasure chest! You'll know when you drive over it. Note: You need to be a registered user in order to receive the gift inside. Register in 'Settings > Profile'"));
   }

   if (roadmap_canvas_width() > roadmap_canvas_height())
      width = roadmap_canvas_height() - 90;
   else
      width = roadmap_canvas_width() - 90;
   container = ssd_container_new ("IconCon", "", width, SSD_MIN_SIZE, 0);
   ssd_widget_set_color (container, NULL, NULL);
   text = ssd_text_new ("PointsTxt", msg, 16, SSD_END_ROW);
   ssd_text_set_color (text, "#ffffff");
   ssd_widget_add (container, text);
   ssd_widget_add (popup, container);

#ifdef TOUCH_SCREEN
   spacer = ssd_container_new ("space", "", SSD_MIN_SIZE, 5, SSD_END_ROW);
   ssd_widget_set_color (spacer, NULL, NULL);
   ssd_widget_add (popup, spacer);

   button = ssd_button_label ("Close_button", roadmap_lang_get ("Close"), SSD_ALIGN_CENTER,
                  on_close);
   ssd_widget_add (popup, button);
#endif //TOUCH_SCREEN
   ssd_dialog_activate ("BonusPopUPDlg", NULL);

   if (!roadmap_screen_refresh ()) {
      roadmap_screen_redraw ();
   }
}