Advertisement
Dmitriiiiiqiq

JackpotLabelTemplate

Oct 8th, 2021
2,783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 6.48 KB | None | 0 0
  1. import QtQuick 2.15
  2. import QtQuick.Layouts 1.3
  3. import QtQuick.Controls 2.12
  4. import QtGraphicalEffects 1.0
  5. import "../../../qml/common/controls"
  6. import "../../PokerGlobalScript.js" as PokerGlobalScript
  7.  
  8. Item{
  9.     id: lobbyLabelJackpot
  10.  
  11.     //Custom properties
  12.     property string textTop: ""
  13.     property string textBottom: ""
  14.     property string textValue: ""
  15.  
  16.  
  17.     property int backgroundRadius: 4
  18.     property string moneyJackpot: "123456789"
  19.     // pokerGlobalsModel.lobbyStateModel.smartJackpot
  20.     // pokerGlobalsModel.lobbyStateModel.winUpJackpot
  21.     // pokerGlobalsModel.lobbyStateModel.badBeatJackpot
  22.  
  23.     anchors.fill: parent
  24.     clip: true
  25.  
  26.     RowLayout{
  27.         id: lobbyLabelJackpotRowlabel
  28.         spacing: 9
  29.         anchors.fill: parent
  30.         anchors.horizontalCenter: parent.horizontalCenter
  31.         anchors.verticalCenter: parent.verticalCenter
  32.  
  33.         SwipeView{
  34.             id: jackpotLabelSwipe
  35.  
  36.             currentIndex: 0
  37.             anchors.fill: parent
  38.             Layout.fillWidth: true
  39.  
  40.             Repeater{
  41.                 id: repeaterSwipeViewContent
  42.                 model: 4
  43.  
  44.                 Item{
  45.                     id: windowOne
  46.  
  47.                     RowLayout{
  48.                         id: labelJackpot
  49.  
  50.                         spacing: 16
  51.                         Layout.fillWidth: true
  52.                         anchors.horizontalCenter: parent.horizontalCenter
  53.                         anchors.verticalCenter: parent.verticalCenter
  54.  
  55.                         Rectangle{
  56.                             id: rectangeTextLabel
  57.  
  58.                             width: linearGradientText.width
  59.                             height: linearGradientText.height
  60.                             color: "transparent"
  61.  
  62.                             Label{
  63.                                 id: labelText
  64.  
  65.                                 renderType: Text.NativeRendering
  66.                                 font.weight: Font.ExtraBold
  67.                                 antialiasing: true
  68.                                 font.pointSize: 9.5
  69.                                 Layout.alignment: Qt.AlignRight
  70.                                 text: PokerGlobalScript.qsNls2( appManager.mainForm ? appManager.mainForm.locale : null, "dlg.lobby.title-jackpot", " SMART BADBEAT" + "\n" + "JACKPOT" )
  71.                             }
  72.  
  73.                             DropShadow {
  74.                                 anchors.fill: labelText
  75.                                 horizontalOffset: 3
  76.                                 verticalOffset: 3
  77.                                 radius: 8.0
  78.                                 samples: 17
  79.                                 color: "#80000000"
  80.                                 source: labelText
  81.                             }
  82.  
  83.                             LinearGradient  {
  84.                                 id: linearGradientText
  85.  
  86.                                 anchors.fill: labelText
  87.                                 source: labelText
  88.                                 gradient: Gradient {
  89.                                     GradientStop { position: 0; color: "#FFC452" }
  90.                                     GradientStop { position: 0.5; color: "#FFC452" }
  91.                                     GradientStop { position: 1; color: "#90630D" }
  92.                                 }
  93.                             }
  94.                         }
  95.  
  96.                         Label{
  97.                             id: amountOfMoney
  98.  
  99.                             font.pointSize: 15
  100.                             color: "#ffffff"
  101.                             font.bold: true
  102.                             text: numberWithCommas(moneyJackpot) + ".00" + "$"
  103.                         }
  104.                     }
  105.                 }
  106.             }
  107.         }
  108.  
  109.         Button{
  110.             id: buttonLeftClick
  111.  
  112.             width: 28
  113.             height: 44
  114. //            Layout.alignment: Qt.AlignLeft
  115.             anchors.left: parent.left
  116.             anchors.verticalCenter: parent.verticalCenter
  117.             background: Image {
  118.                 id: leftarrow
  119.  
  120.                 opacity: 0.3
  121.                 source: "../../../qml/mobile/forms/lobby/home/jackpot/image/Union_Left.png"
  122.             }
  123.             onClicked: {
  124.                 console.log("Left");
  125.                 triggerFlippingLeft();
  126.             }
  127.         }
  128.  
  129.         Button{
  130.             id: buttonRightClick
  131.  
  132.             width: 28
  133.             height: 44
  134.             anchors.right: parent.right
  135. //            Layout.alignment: Qt.AlignRight
  136.             anchors.verticalCenter: parent.verticalCenter
  137.             background: Image {
  138.                 id: rightarrow
  139.  
  140.                 opacity: 0.3
  141.                 source: "../../../qml/mobile/forms/lobby/home/jackpot/image/Union_Right.png"
  142.             }
  143.             onClicked: {
  144.                 console.log("Right");
  145.                 triggerFlippingRight();
  146.             }
  147.         }
  148.     }
  149.  
  150.     Timer{
  151.         id: timerFlippingContentJackpot
  152.  
  153.         interval: 3500;
  154.         running: true;
  155.         repeat: true
  156.         onTriggered:{
  157.             triggerFlippingRight();
  158.         }
  159.     }
  160.  
  161.     //function random value
  162.     function getRandomMoney(min, max) {
  163.         return Math.floor(Math.random() * (max - min) + min)
  164.     }
  165.     //function right button
  166.     function triggerFlippingRight(){
  167.         if(jackpotLabelSwipe.currentIndex < 3){
  168.             jackpotLabelSwipe.currentIndex++;
  169.             moneyJackpot = getRandomMoney(100000000, 500000000);
  170.         }else{
  171.             jackpotLabelSwipe.currentIndex = 0;
  172.         }
  173.     }
  174.     //function left button
  175.     function triggerFlippingLeft(){
  176.         if(jackpotLabelSwipe.currentIndex > 0){
  177.             jackpotLabelSwipe.currentIndex--;
  178.             moneyJackpot = getRandomMoney(100000000, 500000000);
  179.         }else{
  180.             jackpotLabelSwipe.currentIndex = 3;
  181.         }
  182.     }
  183.     //function automatic scrolling
  184.     function triggerDelayTimer() {
  185.         if(timerFlippingContentJackpot.running === true) {
  186.             timerFlippingContentJackpot.running = false;
  187.             sleep(5000);
  188.             timerFlippingContentJackpot.running = true;
  189.         }
  190.     }
  191.     //function sleep timer
  192.     function sleep(millis) {
  193.         var t = (new Date()).getTime();
  194.         var i = 0;
  195.         while (((new Date()).getTime() - t) < millis) {
  196.             i++;
  197.         }
  198.     }
  199.     //function division into categories
  200.     function numberWithCommas(num) {
  201.         return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
  202.     }
  203. }
  204.  
  205.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement