LoginSignup
0
1

More than 3 years have passed since last update.

Akashic Engine にて作成したニコ生向けゲームをiOSアプリ用に移植する方法

Last updated at Posted at 2020-06-25

はじめに

本記事では、実質ニコ生ゲーム用のゲームエンジンであるAkashic Engineを使用した
ゲームをiOSアプリに移植したときの備忘録です。
HTML5で作られた他のエンジン製のゲームでも応用できるかと思います。
なお、Akashic Engineのマルチプレイ機能を用いたゲームは対象外です。

※当記事のやり方では審査を通らない可能性が高いです。ご了承ください

AkashicEngine 2.7
XCode 11.5

手順

1.Akashic Engineのゲームをスタンドアローン形式で出力。

https://akashic-games.github.io/tutorial/v2/7-export.html
akashic export html --magnify --output ../mygame

2.XCodeで新規プロジェクト作成

File→New→Project
iOSタグ→Single View App
※User Interface を Storyboardとすること

3.1で作成したファイルをプロジェクト直下に配置する

1で作成したmygameフォルダをそのままドラッグで良い

4.WKWebViewを配置し、ローカルのhtmlを表示する

ViewController.swift
import UIKit
import WebKit

class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate {

    var webView: WKWebView!

    override func loadView() {


        let webConfiguration = WKWebViewConfiguration()

        //これを入れないと効果音が出ない
        webConfiguration.mediaTypesRequiringUserActionForPlayback = []

        //WKWebView に Configuration を引き渡し initialize
        webView = WKWebView(frame: .zero, configuration: webConfiguration)
        //WKUIDelegate の移譲先として self を登録
        webView.uiDelegate = self
        //WKNavigationDelegate の移譲先として self を登録
        webView.navigationDelegate = self
        //view に webView を割り当て
        view = webView

    }

    override func viewDidLoad() {
        super.viewDidLoad()

        // 読み込み開始
        if let html = Bundle.main.path(forResource: "mygame/index", ofType: "html") {
            let url = URL(fileURLWithPath: html)
            let request = URLRequest(url: url)
            webView.load(request)
        }
    }


}

5.横画面表示のみとする

TARGETS→General→Deployment Info
のDeviceOrienttatitonのチェックボックスを
Landscape LeftとLandscape Rightのみとする

これで大体完成です。
アイコン等を設定すればストアに申請できます。
ただし、通りません。

Guideline 4.2 - Design - Minimum Functionality
となってしまいます。
何か機能を追加すれば通るかもしれません。

以上。

※追記
全部まとめて1つのアプリにしたら通りました。
https://apps.apple.com/jp/app/id1533177256

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1