<?php
/**
* This file is part of workerman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Server\Messages;
class Population
{
public $world = 0;
public $total = 0;
public function __construct($world, $total)
{
$this->world = $world;
$this->total = $total;
}
public function serialize()
{
return array(TYPES_MESSAGES_POPULATION,
$this->world,
$this->total,
);
}
}
WorldServer.php 文件 1306行, updatePopulation函数:
额,没看出来哪里错了。
应该怎么拼呢?
下面是 Population 类:
然后,new 一个 Messages\Population对象的时候,第一个参数不应该是一个worldServer的实例吗?好像不应该是$this->playerCount?
没错
嗯。