本文整理汇总了PHP中pocketmine\command\CommandSender::setLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP CommandSender::setLevel方法的具体用法?PHP CommandSender::setLevel怎么用?PHP CommandSender::setLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\command\CommandSender
的用法示例。
在下文中一共展示了CommandSender::setLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
if ($command->getName() == "lobby") {
if ($this->gameStatus >= 2) {
$sender->sendMessage("[SurvivalGames] The game was started,you can't back to lobby.");
return;
}
if (isset($this->players[$sender->getName()])) {
unset($this->players[$sender->getName()]);
$sender->setLevel($this->signlevel);
$sender->teleport($this->signlevel->getSpawnLocation());
$sender->sendMessage("[SurvivalGames] Back to lobby...");
$this->sendToAll("[SurvivalGames] Player " . $sender->getName() . " exit from game");
$this->changeStatusSign();
if ($this->gameStatus == 1 && count($this->players) < 2) {
$this->gameStatus = 0;
$this->lastTime = 0;
$this->sendToAll("[SurvivalGames] Less than 2 players,stopped countdown");
/*foreach($this->players as $pl)
{
$p=$this->getServer()->getPlayer($pl["id"]);
$p->setLevel($this->signlevel);
$p->teleport($this->signlevel->getSpawnLocation());
unset($p,$pl);
}*/
}
} else {
$sender->sendMessage("[SurvivalGames] You are not in the game.");
}
return true;
}
if (!isset($args[0])) {
unset($sender, $cmd, $label, $args);
return false;
}
switch ($args[0]) {
case "set":
if ($this->config->exists("lastpos")) {
$sender->sendMessage("[SurvivalGames] The game was set before,please use /fsg remove and try again.");
} else {
$name = $sender->getName();
$this->SetStatus[$name] = 0;
$sender->sendMessage("[SurvivalGames] Please tap the status sign.");
}
break;
case "remove":
$this->config->remove("sign");
$this->config->remove("pos1");
$this->config->remove("pos2");
$this->config->remove("pos3");
$this->config->remove("pos4");
$this->config->remove("pos5");
$this->config->remove("pos6");
$this->config->remove("pos7");
$this->config->remove("pos8");
$this->config->remove("lastpos");
$this->config->save();
unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->lastpos);
$sender->sendMessage("[SurvivalGames] succeeded in deleting game settings");
break;
case "start":
$this->sendToAll("[SurvivalGames] Force start game...");
$this->gameStatus = 1;
$this->lastTime = 5;
break;
case "reload":
unset($this->config);
@mkdir($this->getDataFolder(), 0777, true);
$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array());
if ($this->config->exists("lastpos")) {
$this->sign = $this->config->get("sign");
$this->pos1 = $this->config->get("pos1");
$this->pos2 = $this->config->get("pos2");
$this->pos3 = $this->config->get("pos3");
$this->pos4 = $this->config->get("pos4");
$this->pos5 = $this->config->get("pos5");
$this->pos6 = $this->config->get("pos6");
$this->pos7 = $this->config->get("pos7");
$this->pos8 = $this->config->get("pos8");
$this->lastpos = $this->config->get("lastpos");
$this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]);
$this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]);
$this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]);
$this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5);
$this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5);
$this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5);
$this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5);
$this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5);
$this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5);
$this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5);
$this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5);
$this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5);
}
if (!$this->config->exists("endTime")) {
$this->config->set("endTime", 600);
}
if (!$this->config->exists("gameTime")) {
$this->config->set("gameTime", 300);
}
if (!$this->config->exists("waitTime")) {
//.........这里部分代码省略.........
示例2: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
if ($command->getName() == "lobby") {
if ($this->gameStatus >= 2) {
$In - Match == $this->getConfig()->get("In-Match");
$sender->sendMessage("[{$this->getConfig()->get("prefix")}] {$In}-Match");
return;
}
if (isset($this->players[$sender->getName()])) {
unset($this->players[$sender->getName()]);
$sender->setLevel($this->signlevel);
$sender->teleport($this->signlevel->getSpawnLocation());
$sender->sendMessage(TextFormat::GREEN . "[{$this->getConfig()->get("prefix")}] Teleporting to lobby...");
$event->getPlayer()->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]Player " . $sender->getName() . " left the match.");
$this->changeStatusSign();
if ($this->gameStatus == 1 && count($this->players) < 2) {
$this->gameStatus = 0;
$this->lastTime = 0;
$Arena - Join == $this->getConfig()->get("Arena-Join");
$event->getPlayer()->sendMessage("[{$this->getConfig()->get("prefix")}] {$Arena}-Join");
/*foreach($this->players as $pl)
{
$p=$this->getServer()->getPlayer($pl["id"]);
$p->setLevel($this->signlevel);
$p->teleport($this->signlevel->getSpawnLocation());
unset($p,$pl);
}*/
}
} else {
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You are not in a match.");
}
return true;
}
if (!isset($args[0])) {
unset($sender, $cmd, $label, $args);
return false;
}
switch ($args[0]) {
case "stats":
if ($sender->hasPermission("sg.command.stats") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) {
if (!isset($args[1])) {
$player = $sender->getName();
$deaths = $this->points->get($player)[0];
$kills = $this->points->get($player)[1];
$points = $this->points->get($player)[2];
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You have " . $deaths . " deaths and " . $kills . " kills. ");
return true;
} else {
$player = $args[1];
$deaths = $this->points->get($player)[0];
$kills = $this->points->get($player)[1];
$points = $this->points->get($player)[2];
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]" . $player . " has " . $deaths . " deaths and " . $kills . " kills. ");
return true;
}
} else {
$sender->sendMessage("You dont have permissions to run this command.");
return true;
}
break;
case "set":
if ($this->config->exists("lastpos")) {
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] You already setup the arena. use /sg remove to remove the current arena.");
} else {
$name = $sender->getName();
$this->SetStatus[$name] = 0;
$sender->sendMessage(TextFormat::DARK_BLUE . "[{$this->getConfig()->get("prefix")}] Tap a sign to set join sign.");
}
break;
case "remove":
$this->config->remove("sign");
$this->config->remove("pos1");
$this->config->remove("pos2");
$this->config->remove("pos3");
$this->config->remove("pos4");
$this->config->remove("pos5");
$this->config->remove("pos6");
$this->config->remove("pos7");
$this->config->remove("pos8");
$this->config->remove("pos9");
$this->config->remove("pos10");
$this->config->remove("pos11");
$this->config->remove("pos12");
$this->config->remove("pos13");
$this->config->remove("pos14");
$this->config->remove("pos15");
$this->config->remove("pos16");
$this->config->remove("lastpos");
$this->config->save();
unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->pos9, $this->pos10, $this->pos11, $this->pos12, $this->pos13, $this->pos14, $this->pos15, $this->pos16, $this->pos17, $this->pos18, $this->pos19, $this->pos20, $this->pos21, $this->pos22, $this->pos23, $this->pos24, $this->lastpos);
$sender->sendMessage(TextFormat::GREEN . "[SG]Game settings successfully removed.");
break;
case "start":
Server::getInstance()->broadcastMessage(TextFormat::BLUE . "[Game] The Tournament has been forced to start.");
$this->gameStatus = 1;
$this->lastTime = 5;
break;
case "reload":
@mkdir($this->getDataFolder(), 0777, true);
$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array());
//.........这里部分代码省略.........
示例3: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
if ($command->getName() == "lobby") {
if ($this->gameStatus >= 2) {
$sender->sendMessage("[游戏系统] [饥饿游戏] 游戏已开始 ,不能退出");
return;
}
if (isset($this->players[$sender->getName()])) {
unset($this->players[$sender->getName()]);
$sender->setLevel($this->signlevel);
$sender->teleport($this->signlevel->getSpawnLocation());
$sender->sendMessage("[游戏系统] [饥饿游戏] 成功退出");
$this->sendToAll("[游戏系统] [饥饿游戏] 玩家" . $sender->getName() . "退出了游戏");
$this->changeStatusSign();
if ($this->gameStatus == 1 && count($this->players) < 2) {
$this->gameStatus = 0;
$this->lastTime = 0;
$this->sendToAll("[游戏系统] [饥饿游戏] 人数不足 ,已停止倒计时");
/*foreach($this->players as $pl)
{
$p=$this->getServer()->getPlayer($pl["id"]);
$p->setLevel($this->signlevel);
$p->teleport($this->signlevel->getSpawnLocation());
unset($p,$pl);
}*/
}
} else {
$sender->sendMessage("[游戏系统] [饥饿游戏] 你不在游戏中");
}
return true;
}
if (!isset($args[0])) {
unset($sender, $cmd, $label, $args);
return false;
}
switch ($args[0]) {
case "set":
if ($this->config->exists("lastpos")) {
$sender->sendMessage("[游戏系统] [饥饿游戏] 游戏已经设置,请先删除设置");
} else {
$name = $sender->getName();
$this->SetStatus[$name] = 0;
$sender->sendMessage("[游戏系统] [饥饿游戏] 已进入设置模式 ,请先设置状态牌子");
}
break;
case "remove":
$this->config->remove("sign");
$this->config->remove("pos1");
$this->config->remove("pos2");
$this->config->remove("pos3");
$this->config->remove("pos4");
$this->config->remove("pos5");
$this->config->remove("pos6");
$this->config->remove("pos7");
$this->config->remove("pos8");
$this->config->remove("lastpos");
$this->config->save();
unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->lastpos);
$sender->sendMessage("[游戏系统] [饥饿游戏] 已删除游戏设置");
break;
case "start":
$this->sendToAll("[游戏系统] [饥饿游戏] 已强制开始游戏");
$this->gameStatus = 1;
$this->lastTime = 5;
break;
case "reload":
unset($this->config);
@mkdir($this->getDataFolder(), 0777, true);
$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array());
if ($this->config->exists("lastpos")) {
$this->sign = $this->config->get("sign");
$this->pos1 = $this->config->get("pos1");
$this->pos2 = $this->config->get("pos2");
$this->pos3 = $this->config->get("pos3");
$this->pos4 = $this->config->get("pos4");
$this->pos5 = $this->config->get("pos5");
$this->pos6 = $this->config->get("pos6");
$this->pos7 = $this->config->get("pos7");
$this->pos8 = $this->config->get("pos8");
$this->lastpos = $this->config->get("lastpos");
$this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]);
$this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]);
$this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]);
$this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"], $this->pos1["z"] + 0.5);
$this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"], $this->pos2["z"] + 0.5);
$this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"], $this->pos3["z"] + 0.5);
$this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"], $this->pos4["z"] + 0.5);
$this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"], $this->pos5["z"] + 0.5);
$this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"], $this->pos6["z"] + 0.5);
$this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"], $this->pos7["z"] + 0.5);
$this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"], $this->pos8["z"] + 0.5);
$this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"], $this->lastpos["z"] + 0.5);
}
if (!$this->config->exists("endTime")) {
$this->config->set("endTime", 600);
}
if (!$this->config->exists("gameTime")) {
$this->config->set("gameTime", 300);
}
if (!$this->config->exists("waitTime")) {
//.........这里部分代码省略.........
示例4: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
if ($command->getName() == "lobby") {
if (isset($this->players[$sender->getName()])) {
unset($this->players[$sender->getName()]);
$sender->setLevel($this->signlevel);
$sender->teleport($this->signlevel->getSpawnLocation());
$sender->sendMessage("§3> §eBack to lobby...");
$this->sendToAll("§3> §7Player " . $sender->getName() . " left the game");
$this->changeStatusSign();
if ($this->gameStatus == 1 && count($this->players) < 2) {
$this->gameStatus = 0;
$this->lastTime = 0;
$this->sendPopup("§3> §eGame taking to long to start invite your friends");
/*foreach($this->players as $pl)
{
$p=$this->getServer()->getPlayer($pl["id"]);
$p->setLevel($this->signlevel);
$p->teleport($this->signlevel->getSpawnLocation());
unset($p,$pl);
}*/
}
}
}
if (!isset($args[0])) {
unset($sender, $cmd, $label, $args);
return false;
}
switch ($args[0]) {
case "set":
if ($this->config->exists("lastpos")) {
$sender->sendMessage("GAME HAS ALREADY BEEN SET");
} else {
$name = $sender->getName();
$this->SetStatus[$name] = 0;
$sender->sendMessage("PLEASE TAP A SIGN.");
}
break;
case "remove":
$this->config->remove("sign");
$this->config->remove("pos1");
$this->config->remove("pos2");
$this->config->remove("pos3");
$this->config->remove("pos4");
$this->config->remove("pos5");
$this->config->remove("pos6");
$this->config->remove("pos7");
$this->config->remove("pos8");
$this->config->remove("lastpos");
$this->config->save();
unset($this->sign, $this->pos1, $this->pos2, $this->pos3, $this->pos4, $this->pos5, $this->pos6, $this->pos7, $this->pos8, $this->pos9, $this->pos10, $this->pos11, $this->pos12, $this->pos13, $this->pos14, $this->pos15, $this->pos16, $this->pos17, $this->pos18, $this->pos19, $this->pos20, $this->pos21, $this->pos22, $this->pos23, $this->pos24, $this->lastpos);
$sender->sendMessage("YOU HAVE DELETED THE SETTINGS");
break;
case "start":
$this->sendPopup("§6§lBeing Force to Start");
$this->gameStatus = 1;
$this->lastTime = 5;
break;
case "reload":
unset($this->config);
@mkdir($this->getDataFolder(), 0777, true);
$this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array());
if ($this->config->exists("lastpos")) {
$this->sign = $this->config->get("sign");
$this->pos1 = $this->config->get("pos1");
$this->pos2 = $this->config->get("pos2");
$this->pos3 = $this->config->get("pos3");
$this->pos4 = $this->config->get("pos4");
$this->pos5 = $this->config->get("pos5");
$this->pos6 = $this->config->get("pos6");
$this->pos7 = $this->config->get("pos7");
$this->pos8 = $this->config->get("pos8");
$this->lastpos = $this->config->get("lastpos");
$this->level = $this->getServer()->getLevelByName($this->config->get("pos1")["level"]);
$this->signlevel = $this->getServer()->getLevelByName($this->config->get("sign")["level"]);
$this->sign = new Vector3($this->sign["x"], $this->sign["y"], $this->sign["z"]);
$this->pos1 = new Vector3($this->pos1["x"] + 0.5, $this->pos1["y"] + 1, $this->pos1["z"] + 0.5);
$this->pos2 = new Vector3($this->pos2["x"] + 0.5, $this->pos2["y"] + 1, $this->pos2["z"] + 0.5);
$this->pos3 = new Vector3($this->pos3["x"] + 0.5, $this->pos3["y"] + 1, $this->pos3["z"] + 0.5);
$this->pos4 = new Vector3($this->pos4["x"] + 0.5, $this->pos4["y"] + 1, $this->pos4["z"] + 0.5);
$this->pos5 = new Vector3($this->pos5["x"] + 0.5, $this->pos5["y"] + 1, $this->pos5["z"] + 0.5);
$this->pos6 = new Vector3($this->pos6["x"] + 0.5, $this->pos6["y"] + 1, $this->pos6["z"] + 0.5);
$this->pos7 = new Vector3($this->pos7["x"] + 0.5, $this->pos7["y"] + 1, $this->pos7["z"] + 0.5);
$this->pos8 = new Vector3($this->pos8["x"] + 0.5, $this->pos8["y"] + 1, $this->pos8["z"] + 0.5);
$this->lastpos = new Vector3($this->lastpos["x"] + 0.5, $this->lastpos["y"] + 1, $this->lastpos["z"] + 0.5);
}
if (!$this->config->exists("endTime")) {
$this->config->set("endTime", 600);
}
if (!$this->config->exists("gameTime")) {
$this->config->set("gameTime", 300);
}
if (!$this->config->exists("waitTime")) {
$this->config->set("waitTime", 180);
}
if (!$this->config->exists("godTime")) {
$this->config->set("godTime", 15);
}
$this->endTime = (int) $this->config->get("endTime");
$this->gameTime = (int) $this->config->get("gameTime");
//.........这里部分代码省略.........
示例5: onCommand
public function onCommand(CommandSender $sender, Command $command, $label, array $args)
{
if ($command->getName() == "lobby") {
if ($this->gameStatus >= 2) {
$sender->sendMessage("[{$this->getConfig()->get("prefix")}] {$Already_Playing}");
return;
}
if (isset($this->players[$sender->getName()])) {
unset($this->players[$sender->getName()]);
$sender->setLevel($this->signlevel);
$sender->teleport($this->signlevel->getSpawnLocation());
$sender->sendMessage(TextFormat::GREEN . "[{$this->getConfig()->get("prefix")}] Teleporting to lobby...");
$this->getServer()->broadcastMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}]Player " . $sender->getName() . " left the match.");
$this->changeStatusSign();
if ($this->gameStatus == 1 && count($this->players) < 2) {
$this->gameStatus = 0;
$this->lastTime = 0;
$event->getPlayer()->sendMessage("[{$this->getConfig()->get("prefix")}] {$Arena}");
/*foreach($this->players as $pl)
{
$p=$this->getServer()->getPlayer($pl["id"]);
$p->setLevel($this->signlevel);
$p->teleport($this->signlevel->getSpawnLocation());
unset($p,$pl);
}*/
}
} else {
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] {$Not_In_Match}");
}
return true;
}
if (!isset($args[0])) {
unset($sender, $cmd, $label, $args);
return false;
}
switch ($args[0]) {
case "help":
if ($sender->hasPermission("sg.command.help") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) {
$sender->sendMessage("§d§o-------SurvivalGames Help-------");
$sender->sendMessage("§d§oUse §e/sg stats - View your stats");
$sender->sendMessage("§d§oUse §e/sg set - Set up an arena");
$sender->sendMessage("§d§oUse §e/sg remove - Remove a arena");
$sender->sendMessage("§d§oUse §e/sg start - Force start a match");
$sender->sendMessage("§d§oUse §e/sg reload - Reload the spawn positions");
$sender->sendMessage("§d§o--------------------------------");
return true;
}
break;
case "stats":
if ($sender instanceof Player) {
if ($sender->hasPermission("sg.command.stats") or $sender->hasPermission("sg.command") or $sender->hasPermission("sg")) {
if (!isset($args[1])) {
$player = $sender->getName();
$deaths = $this->points->get($player)[0];
$kills = $this->points->get($player)[1];
$points = $this->points->get($player)[2];
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §bYou're stats");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lDeaths: §9{$deaths}");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lKills: §9{$kills}");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------");
return true;
} else {
$player = $args[1];
$deaths = $this->points->get($player)[0];
$kills = $this->points->get($player)[1];
$points = $this->points->get($player)[2];
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §bPlayer: §9{$player} Stats");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lDeaths: §9{$deaths}");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] §lKills: §9{$kills}");
$sender->sendMessage(TextFormat::RED . "[{$this->getConfig()->get("prefix")}] ---------------");
return true;
}
} else {
$sender->sendMessage("{$No_Permission}");
return true;
}
} else {
$sender->sendMessage(TextFormat::RED . "That command can only be used in-game!");
return true;
}
break;
case "set":
if ($sender instanceof Player) {
if ($this->config->exists("lastpos")) {
$sender->sendMessage("Seems like you have already setup an arena");
} else {
$name = $sender->getName();
$this->SetStatus[$name] = 0;
$sender->sendMessage("Tap a sign to set it as join sign!");
}
} else {
$sender->sendMessage(TextFormat::RED . "You may only use ths command in-game!");
return true;
}
break;
case "remove":
$this->config->remove("sign");
$this->config->remove("pos1");
//.........这里部分代码省略.........