123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace loyalsoft;
- /**
- * 任务步骤
- */
- class TaskStepVo extends Object_ext {
- /**
- * @var type 查询用的id
- */
- public $typeId = 0;
- /**
- * @var float 任务进度(浮点值好了>=1代表完成)
- */
- public $progress = 0;
- /**
- * 用于将进度更新的数据待会给客户端,比如当前PVP积分之类的,在客户端是无法即时拿到数据的
- * @var object
- */
- public $tag1;
- public $tag2;
- /**
- * @var int 计数器
- */
- public $counter = 0;
- /**
- * @return \sm_task_step mo
- */
- public function mo() {
- $mo = GameConfig::task_step_getItem($this->typeId);
- my_Assert(null != $mo, ErrCode::err_const_no);
- return $mo;
- }
- public function __construct($args) {
- if (isInt($args)) {
- $this->typeId = $args;
- } else {
- parent::__construct($args);
- }
- }
- /**
- * @param TaskParams $taskParam
- * @return bool
- */
- public function check($taskParam) {
- if ($this->progress >= 1) {
- return true;
- }
- if ($taskParam->taskType == $this->mo()->tasktype) {
- if (null == $this->mo()->canshu1) {
- $this->progress = 1;
- return true;
- }
- if ($this->mo()->canshu1 == $taskParam->canshu1) {
- $this->tag1 = $taskParam->canshu1;
- if (null == $this->mo()->canshu2 || 0 == $this->mo()->canshu2) {
- $this->progress = 1;
- $this->tag2 = $taskParam->canshu2;
- return true;
- } else {
- if (is_numeric($this->mo()->canshu2)) {
- $this->tag2 = max($this->tag2, $taskParam->canshu2);
- if ($this->mo()->canshu2 <= $taskParam->canshu2) {
- $this->progress = 1;
- return true;
- }
- } else {
- $this->tag2 = $taskParam->canshu2;
- if ($this->mo()->canshu2 == $taskParam->canshu2) {
- $this->progress = 1;
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- }
|