Jump to content

load games on javascript file


bumples18
 Share

Recommended Posts

I have a magazine and want to add phaser games to my issues or games.  I added phaser.min.js to my html5 or default.aspx file. Then I added gamet. to a javascript folder. and loaded it in the default.aspx.cs file see below:

 private void LoadJavaScript()
        {
            String javaScript = "";
 
            javaScript += LoadFile("~/Issues/JavaScript/Movime.js");
            javaScript += LoadFile("~/Issues/JavaScript/DivClass.js");
            javaScript += LoadFile("~/Issues/JavaScript/TalkingBalloon.js");
            javaScript += LoadFile("~/Issues/JavaScript/Magazine.js");
            javaScript += LoadFile("~/Issues/JavaScript/PuzzleClass.js");
            javaScript += LoadFile("~/Issues/JavaScript/MemoryClass.js");
            javaScript += LoadFile("~/Issues/JavaScript/MoveObjectsTo.js");
           javaScript += LoadFile("~/Issues/JavaScript/gamet.js");
            javaScript += LoadFile("~/Issues/" + this.IssueName() + "/JavaScript.js");
 
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", javaScript, true);
 
now I need to open the gamet on the javascript file that opens the magazine. Here is a sample:
//////////////////////////////////////////////////////////////////////////////////////////////////
// Issue Settings
//////////////////////////////////////////////////////////////////////////////////////////////////
 
var issueNumber     = 5; 
var issuePageCount  = 56;
var issuePageWidth  = 578;
var issuePageHeight = 680;
var issueNextPage   = 1;
 
 
 
// ===============================================================================================
// Issue Name
// ===============================================================================================
 
Issue_IssueName = function()
{
    return "Issue" + ((issueNumber < 100) ? "0" : "") + ((issueNumber < 10) ? "0" : "") + issueNumber.toString();
}; 
  
 
 
 

// ===============================================================================================
// Page 9 - Funnylotto
// ===============================================================================================
 
var funnyLottoContainer = null;
var funnyLottoGame = null;
 
// ===============================================================================================
// Page 17 - Sandbar Game penny game
// ===============================================================================================
 
var bm_msgSelected = null;
var issue_SandbarGameCount = 15;
 
function Bm_MsgClick(obj)
{
    if(obj == null)
        return;
   
    divType = (obj.id).substring(6,7); // W or A
   
    if(divType == "W")
    {
        if(bm_msgSelected != null)
            bm_msgSelected.style.backgroundColor = "Transparent";
       
        bm_msgSelected = obj;
       
        bm_msgSelected.style.backgroundColor = "#66cde0";
    }
   
    if(divType == "A")
    {    
        if(bm_msgSelected != null)
  {
            if((bm_msgSelected.id).substring(7, 9) == (obj.id).substring(7, 9))
   {
       bmDynamicDiv.UnableObj(bm_msgSelected);
      
       //bm_msgSelected.style.display = "none";
    bm_msgSelected = null;
    
    obj.style.display = "none";
    
    issue_SandbarGameCount--;
   }
  }
    } 
   
    if(issue_SandbarGameCount == 0)
    {
        Issue_PuzzleDone("SandbarGame");
        issue_SandbarGameCount = -1;
    }   
};  
 
function Bm_MsgOver(obj)
{
    if(obj != bm_msgSelected)
        obj.style.backgroundColor = "#cbebf6";
};
 
function Bm_MsgOut(obj)
{
    if(obj != bm_msgSelected)
        obj.style.backgroundColor = "Transparent";
}
 
 
 
 
// ===============================================================================================
// Load
// ===============================================================================================
 
function BmOnLoad()
{
    // ===============================================================================================
    // settings
    // ===============================================================================================
 
 bmPageWidth     = issuePageWidth;
 bmPageHeight    = issuePageHeight;
 bmNextPage      = issueNextPage;
 
 var pageUriTemplate = Issue_IssueName() + "/Pages/page-";
 
 for(var pg = 1; pg <= issuePageCount; pg++)
     bmPages[pg] = pageUriTemplate + ((pg < 10) ? "0" : "") + pg.toString() + ".jpg";
      
    BmInitialize();
   
  
 
  
  // ===============================================================================================
    // Page 9 - FunnyLotto
    // ===============================================================================================
 
    funnyLottoContainer = InsertDinamicDiv(9, "funnylottoContainer", "", 58,236,464,386, "", "", "", "");
 funnyLottoGame = new MemoryGame(funnylottoContainer, 6, 5, "Issue010/Games/funnylotto/piece-", 74,74,4,200);
  
  
   // ===============================================================================================
 // Page 17 - Sandbar Game
    // ===============================================================================================       
   
 var msg01 = InsertDinamicDiv(17, "msgDivW01", "MsgGame", 443, 202, 98, 18, "Bm_MsgClick(this)", "Bm_MsgOver(this)", "Bm_MsgOut(this)", ""); 
 msg01.innerHTML = "Red Icecream";  
 InsertDinamicDivArea(17, "msgDivA01", "", 271,197,302,282, "Bm_MsgClick(obj)", "", "", ""); 
 var msg02 = InsertDinamicDiv(17, "msgDivW02", "MsgGame", 443, 229, 98, 18, "Bm_MsgClick(this)", "Bm_MsgOver(this)",
 
 
 
   
 // ===============================================================================================
 // Start
 // ===============================================================================================
 
 BmStart();
 BmFlipTo(issueNextPage);
}
 
I hope someone can help me
Jen
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...