zoukankan      html  css  js  c++  java
  • VUE+WebPack实现精美前端游戏:CardBattle的游戏场景设置

    C:UsersHONGZHENHUAcardBattlesrcApp.vue

    src/App.vue

    <template>
      <div id="app">
        <!--
        <img src="./assets/logo.png">
        -->
        <game-container></game-container>
        <!--
        <router-view/>
        -->
      </div>
    </template>
    
    <script>
      import GameContainer from './components/gamecontainer'
    export default {
      components: {
        GameContainer
      },
      name: 'App'
    }
    </script>
    
    <style>
      /**
    #app {
      font-family: 'Avenir', Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-align: center;
      color: #2c3e50;
      margin-top: 60px;
    }
      **/
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsgamecontainer.vue

    src/components/gamecontainer.vue

    <template>
      <div>
        <header>
          <div class="row">
             <h1>Card Battle!</h1>
             <section id="game" class="row">
              <start-scene></start-scene>
            </section>
          </div>
        </header>
        <section class="how-to-play">
          <h2>玩法介绍</h2>
          <p>选择任意一张牌,然后观看点数的pk结果</p>
        </section>
        <footer>
          <p>给我打个赏把!</p>
          <img id="payme" src="../../static/payme.jpg">
        </footer>
      </div>
    </template>
    
    <script>
      import StartScene from './startscenecomponent'
      export default {
        components: {
          StartScene
        }
      }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
      #game {
        wdith: 480px;
        height:600px;
        border-radius: 8px;
        overflow: hidden;
      }
    
      .scene {
        width: 100%;
        height: 100%;
        position: absolute;
        overflow: hidden;
        border-radius: 8px;
        transition: all.3s ease-out;
    
      }
    
      #payme {
        width:240px;
        height: 256px;
      }
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsHelloWorld.vue

    src/components/HelloWorld.vue

    <template>
      <div class="hello">
        <h1>{{ msg }}</h1>
        <h2>Essential Links</h2>
        <ul>
          <li>
            <a
              href="https://vuejs.org"
              target="_blank"
            >
              Core Docs
            </a>
          </li>
          <li>
            <a
              href="https://forum.vuejs.org"
              target="_blank"
            >
              Forum
            </a>
          </li>
          <li>
            <a
              href="https://chat.vuejs.org"
              target="_blank"
            >
              Community Chat
            </a>
          </li>
          <li>
            <a
              href="https://twitter.com/vuejs"
              target="_blank"
            >
              Twitter
            </a>
          </li>
          <br>
          <li>
            <a
              href="http://vuejs-templates.github.io/webpack/"
              target="_blank"
            >
              Docs for This Template
            </a>
          </li>
        </ul>
        <h2>Ecosystem</h2>
        <ul>
          <li>
            <a
              href="http://router.vuejs.org/"
              target="_blank"
            >
              vue-router
            </a>
          </li>
          <li>
            <a
              href="http://vuex.vuejs.org/"
              target="_blank"
            >
              vuex
            </a>
          </li>
          <li>
            <a
              href="http://vue-loader.vuejs.org/"
              target="_blank"
            >
              vue-loader
            </a>
          </li>
          <li>
            <a
              href="https://github.com/vuejs/awesome-vue"
              target="_blank"
            >
              awesome-vue
            </a>
          </li>
        </ul>
      </div>
    </template>
    
    <script>
    export default {
      name: 'HelloWorld',
      data () {
        return {
          msg: 'Welcome to Your Vue.js App'
        }
      }
    }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    h1, h2 {
      font-weight: normal;
    }
    ul {
      list-style-type: none;
      padding: 0;
    }
    li {
      display: inline-block;
      margin: 0 10px;
    }
    a {
      color: #42b983;
    }
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsstartscenecomponent.vue

    src/components/startscenecomponent.vue

    <template>
      <div id="start-scene" class="scene">
        <a href="#" id="start-btn" class="button"></a>
      </div>
    
    </template>
    
    <script>
      export default {
      }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
      #start-scene {
        background: url(../../static/images/start-scene-bg.png) no-repeat;}
    
      .button{
        position:absolute;
         100%;
        height: 100%;
        top:0;
        left:0;
      }
    </style>

    C:UsersHONGZHENHUAcardBattleindex.html

    index.html

    <!DOCTYPE html>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>CardBattle</title>
      </head>
      <body>
        <div id="app"></div>
        <!-- built files will be auto injected -->
      </body>
    </html>

  • 相关阅读:
    poj1273
    JavaSE入门学习23:Java面向对象之构造方法
    NOI 2015 滞后赛解题报告
    LuaInterface简单介绍
    解决在onCreate()过程中获取View的width和Height为0的4种方法
    函数指针和指针函数
    Quartz-中断正在执行的任务
    servlet3.0获取参数与文件上传代码示例
    Servlet学习:(三)Servlet3.0 上传文件
    layui 批量上传文件 + 后台 用servlet3.0接收【我】
  • 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/10133238.html
Copyright © 2011-2022 走看看