GVKun编程网logo

用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会(为什么创建不了html文件)

2

本篇文章给大家谈谈用HTML创建Ludo应用程序||无法在用户之间切换机会,以及为什么创建不了html文件的知识点,同时本文还将给你拓展ASP.NETMVC中@Html.Partial,@Html.A

本篇文章给大家谈谈用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会,以及为什么创建不了html文件的知识点,同时本文还将给你拓展ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction、asp.net – Html.Partial vs Html.RenderPartial&Html.Action vs Html.RenderAction.任何人都可以描述不同之处、asp.net 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction、AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf等相关知识,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会(为什么创建不了html文件)

用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会(为什么创建不了html文件)

如何解决用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会?

我在下面的保管箱源链接 (https://www.dropbox.com/s/dc6jb2aka8ffqr9/game.js) 中提供的 js 代码存在问题。当用户只有一个表冠处于开放状态并且几乎在终点线时,如果用户获得的数字高于要求,那么理想情况下应该有机会在用户之间切换,但这种情况不会发生。

HTML 代码如下。

body{
    margin:0px;
    font-family: Serif;
    color:rgba(255,255,255);
    font-weight:bold;
    
     -webkit-user-select: none;
     -moz-user-select: -moz-none;
      -ms-user-select: none;
          user-select: none;
    background-color: black;
background-size: 56.57px 56.57px;
}


.mainframe{
    display: flex;
    height:100vh;
    justify-content: center;
    align-items: center;

}
.welcome{
    background-color:rgba(0,0.7);
    z-index:+99;
    width:100vw;
    height:100vh;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
}
.welcome .setting{
    width:300px;
    background-color: white;
    text-align: center;
    padding-top:20px;
    border-radius: 10px;
    Box-shadow: 0px 0px 4px rgba(0,0.7),inset 0px 0px 10px rgba(0,0.4);
    border:0.5px solid rgba(0,0.2);
}
.setting .name{
    padding-bottom: 12px;
}
.setting .footer{
    font-size: 12px;
    color: #00e34c;
    font-weight: bold;
    font-family:serif;
    padding: 6px 0px;
    color:rgba(0,0.9);
}
.welcome .setting .name input{
    border-radius: 5px;
    padding:5px;
    outline:none;
    width:80%;
    margin:10px 0px;
}

.play{
    outline: none;
    border:0.5px solid black;
    font-size: 18px;
    padding:5px 15px;
    border-radius: 5px;
    background-color: rgba(0,0);
    cursor:pointer;
}
.play:hover{
    background-color: rgba(0,0.2);
}
.ri{
    background-color:rgba(247,22,45,0.6);
    border:0.5px solid rgba(0,0.2);
    Box-shadow: 0px 0px 4px rgba(247,0.9),inset 0px 0px 10px rgba(247,0.7);
}

.gi{
    background-color:rgba(0,227,76,0.2);
    Box-shadow: 0px 0px 4px rgba(0,0.7);
}

.yi{
    background-color:rgba(247,187,5,0.7);
}

.bi{
    background-color:rgba(4,195,201,0.2);
    Box-shadow: 0px 0px 4px rgba(4,inset 0px 0px 10px rgba(4,0.7);
}
input::placeholder{
    color:rgba(0,0.8);
}
.note{
    font-size: 11px;
    padding: 5px 4px;
}
.welcome .setting .logo img{
    width:20%;
}

.ludoboard{
    background-color: white;
    border:0.5px solid black;
    width:600px;
    height:600px;
    display: grid;
    grid-template-columns: repeat(15,40px);
    grid-template-rows: repeat(15,40px);
}

.playername{
    font-size:20px;
}

.diceboard{
    margin:5px;
    display: flex;
    flex-direction: column;
    height:600px;
    justify-content: space-between;
}
.mdiceboard{
    display: none;
}
.diceboard .info{
    display: flex;
    flex-direction: column;
    align-items: center;
}
.centerBox{
    grid-column: 7/10;
    grid-row: 7/10;
    width:0px;
    height:0px;
    border-top:60px solid #00e34c;
    border-bottom:60px solid #04c3c9 ;
    border-left:60px solid #f7162d;
    border-right:60px solid #f7bb05 ;
}
.red{
    display: flex;
    justify-content: center;
    align-items: center;
background-color: #f7162d;
border:0.5px solid #9e0616;
    grid-column: 1/7;
    grid-row: 1/7;
}
.redsafe{
background-color: #f7162d;
border:0.5px solid #9e0616;
}
.playerzone{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 50px;
    overflow:hidden;
}
.crown{
    grid-column: 1/3;
    
}
.player{
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius:50%;
    background-color: white;
    opacity:0.9;
    width:50px;
    height:50px;
}
.green{
    display: flex;
    justify-content: center;
    align-items: center;
  background-color:#00e34c ;
border:0.5px solid #039634;
    grid-column: 10/16;
    grid-row: 1/7;
}
.greensafe{
  background-color:#00e34c ;
border:0.5px solid #039634;  
}
.step{
    border:0.5px solid #b3b3b3;
}
.blue{
    display: flex;
    justify-content: center;
    align-items: center;
     background-color:#04c3c9 ;
border:0.5px solid #027478;
    grid-column: 1/7;
    grid-row: 10/16;
}
.bluesafe{
    background-color:#04c3c9 ;
border:0.5px solid #027478;
}
.yellow{
    display: flex;
    justify-content: center;
    align-items: center;
     background-color:#f7bb05;
border:0.5px solid #9c7605;  
    grid-column: 10/16;
    grid-row: 10/16;
}
.yellowsafe{
     background-color:#f7bb05 ;
border:0.5px solid #9c7605;  
}
.astep{
    display: flex;
    justify-content: center;
    align-items: center;
    overflow:hidden;
    position: relative;
}

.rp{
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.astep span:nth-child(1){
    top:0px;
}
.astep span:nth-child(2){
    top:4px;
}
.astep span:nth-child(3){
    top:8px;
}
.astep span:nth-child(4){
    top:12px;
}
.astep span:nth-child(5){
    top:16px;
}
.astep span:nth-child(6){
    top:20px;
}
.astep span:only-child{
    top:auto;
}
/*
.astep::-webkit-scrollbar {
  width:0px;
}
*/

.rp{
    position: absolute;
    display: inline-block;
    cursor: pointer;
    background-color: white;
    border-radius:50%;
}

.rp:hover{
    border-radius: 50%;
    border:0.5px solid red;
}

.r{
    color:#f7162d;
}
.g{
    color:#00e34c;
}
.b{
    color:#04c3c9;
}
.y{
    color:#f7bb05;
}

.material-icons{
    opacity:0.9;
    font-size: 30px;
}

.rstop{
    background-image: linear-gradient(45deg,#f7162d 25%,#ffbdc4 25%,#ffbdc4 50%,#f7162d 50%,#f7162d 75%,#ffbdc4 75%,#ffbdc4 100%);
background-size: 15px 10px;
}
.gstop{
  background-image: linear-gradient(45deg,#00e34c 25%,#b0ffcc 25%,#b0ffcc 50%,#00e34c 50%,#00e34c 75%,#b0ffcc 75%,#b0ffcc 100%);
background-size: 15px 10px;  
}
.ystop{
    background-image: linear-gradient(45deg,#f7bb05 25%,#fff2c7 25%,#fff2c7 50%,#f7bb05 50%,#f7bb05 75%,#fff2c7 75%,#fff2c7 100%);
background-size: 15px 10px;
}
.bstop{
background-image: linear-gradient(45deg,#04c3c9 25%,#bdfdff 25%,#bdfdff 50%,#04c3c9 50%,#04c3c9 75%,#bdfdff 75%,#bdfdff 100%);
background-size: 15px 10px;    
}

.winner-r{
    width:100%;
    height: 100px;
    background-image: url(crown.png);
}


@media only screen and (max-width: 600px) {
    .fixed{
    position: fixed;
}
    .mainframe{
    flex-direction: column;
}
    .diceboard{
        display: none;
    }
    
    
    .mdiceboard{
    display: flex;
    flex-direction: row;
        width: 100vw;
    justify-content: space-between;
        margin:10px 0px;
}
.mdiceboard .info{
    display: flex;
    flex-direction: column;
    align-items: center;
}
/*
    .r-dice,.g-dice,b-dice,{
        display: none;
    }
*/
.ludoboard{
    background-color: white;
    border:0.5px solid black;
    width:100vw;
    height:100vw;
    display: grid;
    grid-template-columns: repeat(15,1fr);
    grid-template-rows: repeat(15,1fr);
}
    .centerBox{
        height: 100%;
        width: 100%;
    grid-column: 7/10;
    grid-row: 7/10;
/*   background-color: aqua;*/
        background-image: url(center.jpg);
        background-size: cover;
    border:0px solid red;
}
    .playerzone{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 16px;
    overflow:hidden;
}
.crown{
    grid-column: 1/3;
    width:90%;
    align-self: center;
    align-items: center;
    
}
.player{
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius:50%;
    background-color: white;
    opacity:0.9;
    width:1fr;
    height:1fr;
}
}

.r-dice{
    background-color:#f7162d;
    width:50px;
    height:50px;
    border-radius:5px;
    Box-sizing: border-Box;
    border:0.5px solid black;
    Box-shadow: inset 0px 0px 8px black;
    display:flex;
    justify-content:center;
    align-items:center;
    color:white;
    font-size:30px;
    text-shadow:0px 0px 1px black;
    cursor:pointer;
}
.g-dice{
    background-color:#00e34c;
    width:50px;
    height:50px;
    border-radius:5px;
    Box-sizing: border-Box;
    border:0.5px solid black;
    Box-shadow: inset 0px 0px 8px black;
    display:flex;
    justify-content:center;
    align-items:center;
    color:white;
    font-size:30px;
    text-shadow:0px 0px 1px black;
    cursor:pointer;
}
.b-dice{
    background-color:#04c3c9;
    width:50px;
    height:50px;
    border-radius:5px;
    Box-sizing: border-Box;
    border:0.5px solid black;
    Box-shadow: inset 0px 0px 8px black;
    display:flex;
    justify-content:center;
    align-items:center;
    color:white;
    font-size:30px;
    text-shadow:0px 0px 1px black;
    cursor:pointer;
}
.y-dice{
    background-color:#f7bb05;
    width:50px;
    height:50px;
    border-radius:5px;
    Box-sizing: border-Box;
    border:0.5px solid black;
    Box-shadow: inset 0px 0px 8px black;
    display:flex;
    justify-content:center;
    align-items:center;
    color:white;
    font-size:30px;
    text-shadow:0px 0px 1px black;
    cursor:pointer;
}
<script src="https://www.dropBox.com/s/dc6jb2aka8ffqr9/game.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <Meta charset="UTF-8">
    <title>Ludo Board Game v1.0</title>
    <link rel="stylesheet" href="main.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="icon" href="icon.png" type="image/png"/>
    <link
    rel="stylesheet"
    href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css"
  />
  <Meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
<audio id="diceSound">
  <source src="dice.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
<audio id="killedSound">
  <source src="killed.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
<audio id="winSound">
  <source src="win.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
<audio id="inoutSound">
  <source src="inout.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
<audio id="stepSound">
  <source src="step.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
<div>
  <!-- <div>
       <div>
                <divhttps://www.jb51.cc/tag/logo/" target="_blank">logo">
                    <img src="icon.png"https://www.jb51.cc/tag/logo/" target="_blank">logo">
                </div>
                <div>
                    <input type="text"placeholder="Red player name...">
                    <input type="text"placeholder="Green player name...">
                    <input type="text"placeholder="Yellow player name...">
                    <input type="text"placeholder="Blue player name..."><br>
                    <button>Play</button><br>
                    <span>if only two players playing enter only two names</span>
                </div>
                <div>
                    Made by Akky Srivastava Akash with ❤ 
                </div>
       </div>
   </div> -->
    <div>
       <div>
           <div>
               <span>
                  Player 1 
               </span>
               <divonclick="dice(this,0)">   
                0
               </div>
           </div>
           <div>
               
               <divonclick="dice(this,3)">
                   0
               </div>
               <span>
                  Player 4 
               </span>
           </div>
       </div>
       
       <div>
           <div>
               <span>
                  Player 1 
               </span>
               <divonclick="dice(this,0)">
                   0
               </div>
           </div>
           <div>
                <span>
                  Player 2 
               </span>
               <divonclick="dice(this,1)">
                   0
               </div>
              
           </div>
       </div>
        <divhttps://www.jb51.cc/tag/dob/" target="_blank">doboard">
            <div>
                <div>
                <div><span onclick="movered(this,0)">stars</span></div>
                <div><span onclick="movered(this,1)">stars</span></div>
                <div><span onclick="movered(this,2)">stars</span></div>
                <div><span onclick="movered(this,3)">stars</span></div>
                </div>
            </div>
            <div></div>
            <div></div>
            <div></div>
            <div>
                <div>
                <div><span onclick="movegreen(this,0)">stars</span></div>
                <div><span onclick="movegreen(this,1)">stars</span></div>
                <div><span onclick="movegreen(this,2)">stars</span></div>
                <div><span onclick="movegreen(this,3)">stars</span></div>
                </div>
            </div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <divhttps://www.jb51.cc/tag/Box/" target="_blank">Box"></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            
            
            
            
            <div>
                <div>
                <div><span onclick="moveblue(this,0)">stars</span></div>
                <div><span onclick="moveblue(this,1)">stars</span></div>
                <div><span onclick="moveblue(this,2)">stars</span></div>
                <div><span onclick="moveblue(this,3)">stars</span></div>
                </div>
            </div>
            <div></div>
            <div></div>
            <div></div>
            <div>
                <div>
                <div><span onclick="moveyellow(this,0)">stars</span></div>
                <div><span onclick="moveyellow(this,1)">stars</span></div>
                <div><span onclick="moveyellow(this,2)">stars</span></div>
                <div><span onclick="moveyellow(this,3)">stars</span></div>
                </div>
            </div>
            
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
        <div>
           <div>
               <span>
                  Player 2 
               </span>
               <divonclick="dice(this,1)">
                   0
               </div>
           </div>
           <div>
               
               <divonclick="dice(this,2)">
                   0
               </div>
               <span>
                  Player 3
               </span>
           </div>
       </div>
       
       <div>
           <div>
               
               <divonclick="dice(this,3)">
                   0
               </div>
               <span>
                  Player 4 
               </span>
           </div>
           <div>
               
               <divonclick="dice(this,2)">
                   0
               </div>
               <span>
                  Player 3
               </span>
           </div>
       </div>
    </div>
<script src="game.js"></script>
</div>   
</body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction

ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction

1.Action、RenderAction加载办法的视图,履行Controller → Model → View的次序,然后把产生的页面带回到本来的View中再回传。而Partial、RenderPartial直接加载视图文件内容

2.Html.Partial可以直接供给用户控件名作为参数,而Html.Action须要有对应的Action,在Action内部返回PartailResult(即retun PartialView())。

3.对于简单的没有任何逻辑的用户控件,推荐应用Html.Partial;对于须要设置一些Model的用户控件,推荐应用Html.Action。当然,有Model数据也是可以应用Html.Partial办法的,可以看办法的重载。

4.Html.Partial与Html.Action有啥区别呢?区别就是,Html.Partial只有一个视图,而Html.Action除了视图,还真的有个Action跟它对应,所以,Html.Action功能比Html.Partial要强。

 

如何调用这个Html.Partial

 //1、以视图名使用当前文件夹下的视图(如果没有找到,则搜索 Shared 文件夹)
@Html.Partial( "_test" //加载对应文件 /Views/Product/_test.cshtml
 
//2、依据应用根路径定位视图// 以 "/" 或 "~/" 开头的路径代表应用根路径
@Html.Partial( "~/Views/Product/_test.cshtml" )
@Html.Partial( "/Views/Product/_test2.cshtml" )
 
//3、加载其他目录的 视图文件
//注意:需要复制views中的web.config 到template目录,否则会提示  "/template/A.cshtml”处的视图必须派生自 WebViewPage 或 WebViewPage<TModel>"
@Html.Partial( "/template/A.cshtml" )

asp.net – Html.Partial vs Html.RenderPartial&Html.Action vs Html.RenderAction.任何人都可以描述不同之处

asp.net – Html.Partial vs Html.RenderPartial&Html.Action vs Html.RenderAction.任何人都可以描述不同之处

在ASP.NET MVC中,有什么区别:

Html.Partial and Html.RenderPartial
Html.Action and Html.RenderAction

解决方法

Html.Action调用控制器的动作,这意味着它实例化控制器实体,调用动作方法,构建模型并返回视图结果.

Html.Partial使用已创建的模型(或者可以在没有模型的情况下调用)来渲染指定的视图.

何时使用一个而不是另一个?如果您已有模型并且只想拥有可重复使用的视图,请选择Html.Partial.如果你看到某个部分值得拥有自己的模型和动作,那么使用Html.Action可能是有意义的.

这个问题在this article中有更详细的讨论,你在上面看到的基本上是它的摘录.

asp.net 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction

asp.net 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction

1、带有Render的方法返回值是void,在方法内部进行输出;不带的返回值类型为MvcHtmlString,所以只能这样使用:

     @Html.Partial 对应 @{Html.RenderPartial(....);}@Html.Action 对应 @{Html.RenderAction(....);}

2、Html.Partial可以直接提供用户控件名作为参数,

    而Html.Action需要有对应的Action,在Action内部返回PartailResult(即retun PartialView())。

3、对于简单的没有任何逻辑的用户控件,推荐使用Html.Partial;对于需要设置一些Model的用户控件,推荐使用Html.Action。当然,有         Model数据也是可以使用Html.Partial方法的,可以看方法的重载。

4、使用Html.Action有个好处,就是可以根据不同的场景选择不同的用户控件。比如:@Html.Action("UserInfoControl")在对应的    UserInfoControl这个Action中,在用户未登录的时候,可以retun PartialView("LogOnUserControl");登录后,可以retun  PartialView("UserInfoControl");

AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf

AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf

如何解决AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf

在我的 nodejs 应用程序中使用 html-pdf 包创建 pdf 文件时出现此错误

AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf

res.render(''pdf/attend-report'',{ data: attendData,date: `From: ${date(req.body.repFromDate || req.params.from)} To: ${date(req.body.repToDate || req.params.to)} - ${days} days(s)` },function(err,html) {
            pdf.create(html,options).toFile(''../public/pdf-html/attend-report.pdf'',result) {
                if (err) {
                    return console.log(err);
                } else {
                    // console.log(res);
                    var datafile = fs.readFileSync(''../public/pdf-html/attend-report.pdf'');
                    res.header(''content-type'',''application/pdf'');
                    res.send(datafile);
                }
            });
        })

如果我创建 html 链接“const html = fs.readFileSync(''../views/pdf/attend-report.ejs'',''utf8'');”我仍然找不到文件

修复此错误的任何帮助

今天关于用 HTML 创建 Ludo 应用程序 ||无法在用户之间切换机会为什么创建不了html文件的分享就到这里,希望大家有所收获,若想了解更多关于ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction、asp.net – Html.Partial vs Html.RenderPartial&Html.Action vs Html.RenderAction.任何人都可以描述不同之处、asp.net 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction、AssertionError [ERR_ASSERTION]: html-pdf: 无法在 html-pdf 中创建没有 html 字符串的 pdf等相关知识,可以在本站进行查询。

本文标签:

上一篇使用 Node.js 解析和修改本地 HTML(node修改js文件)

下一篇CSS 样式在扩展时如何影响基本 HTML 模板?(css扩展属性)