37 lines
803 B
PHP
Executable File
37 lines
803 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
/**
|
|
* 凡人修仙传 - 文字版
|
|
* CLI 游戏入口
|
|
*/
|
|
|
|
// 自动加载
|
|
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
} elseif (file_exists('phar://hanli-idle.phar/vendor/autoload.php')) {
|
|
require 'phar://hanli-idle.phar/vendor/autoload.php';
|
|
}
|
|
|
|
use Game\Console\ConsoleOutput;
|
|
use Game\Core\Input;
|
|
use Game\Core\Game;
|
|
|
|
// 设置终端为 UTF-8
|
|
if (function_exists('mb_internal_encoding')) {
|
|
mb_internal_encoding('UTF-8');
|
|
}
|
|
|
|
// 检查是否在终端中运行
|
|
if (php_sapi_name() !== 'cli') {
|
|
echo "此游戏需要在命令行终端中运行\n";
|
|
exit(1);
|
|
}
|
|
|
|
// 创建输入输出
|
|
$input = new Input();
|
|
$output = new ConsoleOutput();
|
|
|
|
// 启动游戏
|
|
$game = new Game($input, $output);
|
|
$game->run();
|