<?php


require_once __DIR__ . '/Library/AutoLoad.php';

use Game\Config\GameConfig;
use Game\GameLive;

$type = "";
$Zone = "";

if (count($argv) != 3) {
    echo "参数数量错误， 第一个是区 第二个是服务名称";
    return;
}

$zone = $argv[1];
$type = $argv[2];

if ($zone == "") {
    echo "game zone 不存在";
    return;
}
if ($type == "") {
    echo "服务不存在";
    return;
}

GameLive::getInstance()->InitZone($zone);
GameLive::getInstance()->InitLog(GameConfig::getInstance()->CLI_LOG_PATH());
GameLive::getInstance()->InitException();
GameLive::getInstance()->InitDefineConfig();

ini_set('default_socket_timeout', -1);

$file = __DIR__ . "/Server/".$type.".php";
if(!file_exists($file))
{
    echo "服务".$type."不存在";
    return;
}
require_once $file;
GameLive::getInstance()->GameOver();