Skip to content

YourOwnProject

xxr5566833 edited this page Dec 11, 2017 · 4 revisions

YourOwnProject

独立开发的project

properties:

(平台,功能,技术和种类的数据结构规定分别在对应的文件中,目前它们只有属性,目前还没有方法)

PlatForm platform_

所属开发平台

Function[] functions_

所选的功能,可能会有多种功能

Technology[] techs_

所使用的技术,可能会使用多种技术

double budget_

最后预算

Number publishDay_

在第几天发布

double price_

最终定价

double m_

影响力,仅仅和project自身属性有关,初始为0

Number[] bugnum_

长度为6的数组,分别表示 低级未发现bug数,低级已发现bug数,中级未发现bug数,中级已发现bug数,高级未发现bug数,高级已发现bug数

目前bug有三种严重程度

functions:

重写 boolean isOverdue()

return false

对于独立开发项目,永远都不不会超过截止时间

void setPlatform(Platform platform)

设置自己的平台,并且预算增加,难度增加

  1. this.platForm_ = platform

  2. this.budget_ += platform.budget_

  3. this.difficulty_ += this.platform_.difficulty_

void unsetPlatform()

取消自己所选的平台,撤去这个平台对project的属性的影响

  1. this.budget_ -= this.platform_.budget_
  2. this.difficulty_ -= this.platform_.difficulty_
  3. this.platform_= null
void addFunction(Function func)

设置自己的功能,并且附加这个功能对属性的影响

  1. this.functions_ 包含 func
  2. this.requireFuncion_ += func.function_
  3. this.difficulty_ += func_.difficulty_

目前就是直接加,以后有了具体机制再说

void subFunction(Function func)

撤销这个功能对自己属性的影响,并且把这个功能从功能列表中删去

  1. this.function_中找到和func同名功能tempfunc
  2. this.requireFuncion_ -= tempfunc.function_
  3. this.difficulty_ -= tempfunc.difficulty_
  4. tempfuncthis.function_中除去
void subAllFunction()

撤销自己的所有功能,撤销所有功能对自己属性的影响

  1. 遍历this.function_,每个功能设为function

    1. this.budget_ -= function.budget_
    2. this.difficulty_ -= function.difficulty_
  2. 设置自己的this.function_的长度为0

void addTech(Technology tech)

设置自己的技术,并且需要的预算增加,难度增加

  1. this.techs 包含tech

  2. this.budget_ += tech.budget_

  3. this.difficulty_ += tech.difficulty_

void subTech(Technology tech)

撤销tech对自己属性的影响,并把它从this.techs_中除去

  1. this.budget_ -= tech.budget_
  2. this.difficulty_ -= tech.difficulty_
  3. this.techs_中找到和techname_相同的元素
  4. 把这个元素从this.techs_中除去
void subAllTech()

撤销自己的所有技术,撤销这些技术给自己的属性的影响

具体逻辑同上面的功能

boolean init(Platform platform, ProjectType[] types, Function[] funcs, string name, Technology[] techs)

根据玩家选择,设置相应的platform,type,function,name和technology

首先根据当前平台,技术的选择,计算最终的预算,记为budget_,设置好event属性,注意force=false,并分发"MONEYCUT",获得返回值 如果是false,说明操作失败,返回false结束

如果为true,说明支付成功,执行下面:

  • 返回 true
void setPublishDay(Number day)

this.publishDay_ = day

Number getPublishDay()

return this.publishDay_

double getExpectPrice()

根据Ve = F * F / 1000返回预期定价

void setPrice(double price)

this.price_ = price

void updateM(Number t)

t表示自软件发布以来经历的时间t

如果this.m_ == 0,表示是第一次更新,那么根据 m = sqrt(7E + 3P) *F *(t + sqrt(I))/t Ve = F * F / 1000 , 其中Ve为预期定价 m' = Ve * m / V ,其中 V 为定价,即this.price_,Ve即getExpectPrice(), 计算,this.m_ = m'

如果this.m_ != 0,那么按照this.m_=f(p,t)*this.m_,进行更新

但是目前f(p,t)公式还没有明确。

double getM()

returnthis.m_

Number getTimeFromPublish(Number nowday)

即公式中的t,从发布开始到现在过了多少天

return nowday - this.publishDay_

void setBug(Number highnum, Number midnum, Number lownum)

按照 已发现:未发现 = 6:4 设置已发现bug和未发现bug数量,设置好this.bugnum_ 通过生成随机数的方式确定数量,比例大约等于6:4

void findBug(eBug level, Number num)

规定eBug = cc.Enum({ low : 0, mid : 1, high: 2, }); 按照level,让相应级别的未发现bug数减去num(注意最小数量为0),已发现bug数加上num

void removeBug(eBug level ,Number num)

按照level,让相应级别的已发现bug数减去num(注意最小数量为0)

Clone this wiki locally