Advertisement
Baoulettes

dokkan_scene_1

Mar 12th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.47 KB | None | 0 0
  1. #include <unidokkan/ui/button.h>
  2. #include <unidokkan/ui/imageview.h>
  3. #include <unidokkan/ui/layout.h>
  4. #include <dokkan/instances.h>
  5. #include <unidokkan/ui/defs.h>
  6. #include <cocos/base/CCDirector.h>
  7. #include <unidokkan/ui/progresstimer.h>
  8. #include <unidokkan/ui/scene.h>
  9. #include <cocos/2d/CCActionInterval.h>
  10. #include <cocos/ui/UIButton.h>
  11. #include "main.h"
  12. #include <fstream>
  13. using namespace UniDokkan::UI;
  14. namespace cocos2d = ud_cocos2d;
  15. void(*ori__CharacterMenuScene_onEnter)(void *self)= nullptr;
  16. void CharacterMenuScene_onEnter(void *self) {
  17. ori__CharacterMenuScene_onEnter(self);
  18. auto screen_size = cocos2d_Director_getVisibleSize(UniDokkan::Dokkan::cocos2d_Director_getInstance());
  19. auto Custom_scene = new Scene();
  20.  
  21. //Scene music Player
  22. auto background_image = new ImageView("background", Custom_scene);
  23. background_image->loadImage("layout/image/common/com_bg_menu.png");
  24. background_image->setAnchorPoint(Node::AnchorBottomLeft);
  25. auto insets = cocos2d::Rect(0, 0, 0, 0);
  26. background_image->scale9(&insets);
  27. background_image->setContentSize(screen_size);
  28. auto layout = new Layout("vertical_layout", Custom_scene, cocos2d::ui::Layout::Type::VERTICAL);
  29. layout->setContentSize(screen_size - cocos2d::Size(100, 100));
  30. layout->setPosition({50, 50});
  31. auto close_list = new Button("close_list", layout);
  32. close_list->setDefaultImage("layout/image/common/btn/com_btn_01_orange.png");
  33. close_list->setCaption("Fermer");
  34. close_list->setFontSize(30.0f);
  35. close_list->setFontColor(cocos2d::Color3B::BLACK);
  36. close_list->setGravity(cocos2d::ui::LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL);
  37. close_list->addClickEventListener([=](Widget*) {
  38. Scene::popCurrent();
  39. ori_CharacterMenuScene_onEnter(self);
  40. });
  41.  
  42. //Home Menu button
  43. auto left_icon = new ImageView("menu_icon_addon", self, 200);
  44. left_icon->loadImage("layout/image/common/btn/menu_icon_addon.png");
  45. left_icon->setAnchorPoint(Node::AnchorCenter);
  46. left_icon->setPosition({370.0f, 277.0f});
  47. auto btn_label = new ImageView("menu_title_addon", self, 200);
  48. btn_label->loadImage("layout/image/common/btn/menu_title_addon.png");
  49. btn_label->setAnchorPoint(Node::AnchorCenter);
  50. btn_label->setPosition({510.0f, 277.0f});
  51. auto open_player = new Button("open_playerbtn", self, 100);
  52. open_player->setDefaultImage("llayout/image/common/btn/com_btn_menu_chara_gray.png");
  53. open_player->setGravity(cocos2d::ui::LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL);
  54. open_player->setPosition({482.0f, 277.0f});
  55. open_player->addClickEventListener([=](Widget*) {
  56. Custom_scene->push();
  57. });
  58. /*for(int i=1; i<999; i++){
  59. auto progress = progress_bar->getPercentage() + 10.0f;
  60. progress_bar->setPercentage(progress, 0.1f);
  61. auto id = std::to_string(i);
  62. if (i <= 9) {id = "0" + id;};
  63. if (i <= 99) {id = "0" + id;};
  64. auto Path = "bgm/bgm_"+id+".awb";
  65. std::ifstream fin(Path);
  66. if (fin.fail()) {
  67. std::string logstring = Path;
  68. UD_LOGI("File Not Exist : %s", logstring.c_str());
  69. } else {
  70. std::string logstring = id;
  71. UD_LOGI("File Exist : %s", logstring.c_str());
  72. }
  73. }*/
  74. }
  75.  
  76. extern "C" {
  77.  
  78. int unidokkan_init_v2(HookLib *hook_lib) {
  79. auto res = hook_lib->applyHooks(
  80. {
  81. {DOKKAN_LIB, "_ZN18CharacterMenuScene7onEnterEv", reinterpret_cast<void *>(CharacterMenuScene_onEnter), reinterpret_cast<void **>(&ori__CharacterMenuScene_onEnter)},
  82. }
  83. );
  84. if (!res) {
  85. return 1;
  86. }
  87. return 0;
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement