Functionality:
A randomised game result image will be displayed in the image container depending on the game result played by the user.
However, there are some criteria that are bounded to the randomly displayed game result image. They are:
1.) The randomly displayed images will only be displayed for x times daily. After the x times has been displayed, the resulting image will not be randomised anymore.
2.) The randomly generated image will be displayed x times daily for a period of time: meaning -> image A will be randomly generated for a month from today(23/12/2016 00:00:00) and will end on (23/01/2016 23:59:59). Each day, the image will only be randomly generated 6 times.
Issue:
At this time, I have set the randomly generated method based on the different game result scenario. It does not read the period and the number of times now.
I have got no idea on how to proceed with the following conditions: All I have tried which resulted in error is that I have set a for loop but the following for loop that I have set is only for daily random generation.
Hence, I have got no idea how to achieve the following with the criteria that were stated.
Please advise/ help.
Code
//With reference to prize display for Jackpot Spin
var Prize_1 = ["lib/image/Prize/CeHK.png", "lib/image/Prize/CuSet.png"];
var Prize_2 = ["lib/image/Prize/Suunch.png", "lib/image/Prize/Esit.png", "lib/image/Prize/Mold's.png", "lib/image/Prize/Kiis.png", "lib/image/Prize/Ai.png", "lib/image/Prize/shra.png" ];
var Prize_3 = ["lib/image/Prize/Moto.png", "lib/image/Prize/Saung.png", "lib/image/Prize/Timnd.png", "lib/image/Prize/Blety.png", "lib/image/Prize/Raco.png", "lib/image/Prize/Chaai.png"];
/*Check the slot result: depending on slot result will display the respective result page*/
if ((that.items1[that.result1].id == 'goods-64') && (that.items2[that.result2].id == 'goods-64') && (that.items3[that.result3].id == 'gold-64')) {
//Randomise Winning - Prize 1
var random_Winning_1 = Math.floor(Math.random() * Prize_1.length);
var showPrize_1 = Prize_1[random_Winning_1];
//Display Winning Prize: Prize 1
$("#Winnings_Description").attr('src', showPrize_1).show();
$('#VoucherPreview').fadeIn();
} else if ((that.items1[that.result1].id == 'energy-64') && (that.items2[that.result2].id == 'energy-64') && (that.items3[that.result3].id == 'cash-64')) {
//Randomise Winning - Prize 2
var random_Winning_2 = Math.floor(Math.random() * Prize_2.length);
var showPrize_2 = Prize_2[random_Winning_2];
$("#Winnings_Description").attr('src', showPrize_2).show();
$('#VoucherPreview').fadeIn();
} else if ((that.items1[that.result1].id == 'cash-64') && (that.items2[that.result2].id == 'cash-64') && (that.items3[that.result3].id == 'build-64')) {
//Randomise Winning - Prize 3
var random_Winning_3 = Math.floor(Math.random() * Prize_3.length);
var showPrize_3 = Prize_3[random_Winning_3];
//Display Winning Prize: Prize 3
$("#Winnings_Description").attr('src', showPrize_3).show();
$('#VoucherPreview').fadeIn();
} else if ((that.items1[that.result1].id == 'build-64') && (that.items2[that.result2].id == 'build-64') && (that.items3[that.result3].id == 'build-64')) {
//Display GAP as Prize Winning
//Display Winning Prize: GAP
$("#JackpotWinnings_Description").attr('src', "lib/image/Prize/Gap.png").show();
$('#VoucherPreview').fadeIn();
} else if ((that.items1[that.result1].id == 'staff-64') && (that.items2[that.result2].id == 'staff-64') && (that.items3[that.result3].id == 'staff-64')) {
//Display Guess as Prize Winning
//Display Winning Prize: Guess
$("#JackpotWinnings_Description").attr('src', "lib/image/Prize/Guess.png").show();
$('#VoucherPreview').fadeIn();
} else {
//If user has got no winning sets
alert("game lost: Loser");
}
<div id="VoucherPreview" align="center" style="position:absolute; width:1920px; height:1080px; background-repeat: no-repeat; display: none; z-index=14; top:0px; left:1921px; ">
<img id="Winnings_Description" style="position:absolute; top:333px; left:543px; z-index=99; margin:auto;">
</div>
Plunker: http://ift.tt/2hfoaXa
Aucun commentaire:
Enregistrer un commentaire