public static void TestRegGeneCondition_PA() { var condition = new List <Chemical> { new Chemical { Name = "1", Count = 10 }, new Chemical { Name = "2", Count = 200 }, new Chemical { Name = "3", Count = -200 } }; RegulatoryGene reg = new RegulatoryGene { Conditions = ObjectHelper.CloneList2(condition), Type = "PA" }; Debug.Assert(true == ctor.IsTriggered(condition, reg)); Debug.Assert(!triggered("1", 190, reg)); Debug.Assert(!triggered("2", 190, reg)); Debug.Assert(!triggered("3", 190, reg)); }
public Race Clone() { return(new Race { Name = Name, Description = Description, MaxLength = MaxLength, RegulatoryGenes = ObjectHelper.CloneList2 <RegulatoryGene>(this.RegulatoryGenes) }); }
private void RaceHelperForm_Load(Object sender, EventArgs e) { regGene = ObjectHelper.CloneList2(Local.AllRegulartoryGenes); clb_regs.DataSource = regGene; clb_regs.DisplayMember = "Name"; lb_cods.DataSource = Local.AllCodingGenes; lb_cods.DisplayMember = "Name"; }
public System.Object Clone() { return(new Strain() { Population = 0, Name = this.Name, PlayerSelectedGenes = ObjectHelper.CloneList2(PlayerSelectedGenes), Owner = this.Owner, BasicRace = this.BasicRace }); }
/// <summary> /// 同时刷新lab和maingame的strainlist /// </summary> public static void RefreshStrainList() { MainGameCurrent.StrainList = ObjectHelper.CloneList2 <Strain>(Save.Strains); UIHelper.RefreshUIList("UI_LabStrainList", UIStrainElement, Save.Strains, (GameObject g, Strain obj) => { g.GetComponent <U3D_StrainElement>().Strain = obj; g.name = obj.Name; }); UIHelper.RefreshUIList("UI_StrainList", MainGameCurrent.UI_StrainElement, Save.Strains, (GameObject g, Model.Substance.Strain obj) => { g.GetComponent <U3D_StrainPackageLogic>().Strain = obj; g.name = obj.Name; }); }
void SetStartPlayerResources() { MainGameCurrent.StrainList = ObjectHelper.CloneList2(Save.Strains); /// 将所有玩家制作的strain的privatechemicals设置成地图给出的默认值 /// 每个strain一份 MainGameCurrent.StrainList.ForEach(strain => strain.PrivateChemicals = ObjectHelper.CloneList2(MainGameCurrent.StageMap.PlayerOwnedChemicals)); UIHelper.InitUIList("UI_StrainList", "UI_Strain", MainGameCurrent.StrainList, (GameObject g, Model.Substance.Strain obj) => { g.GetComponent <U3D_StrainPackageLogic>().Strain = obj; g.name = obj.Name; }, ref MainGameCurrent.UI_StrainElement); }
public System.Object Clone() { return(new Strain() { Population = this.Population, Name = this.Name, /// 直接引用,使所有同类strain公用一个PrivateChemicals /// 若有两个strain且他们的相邻格子中没有对方的话,情况另议 PrivateChemicals = this.PrivateChemicals, PlayerSelectedGenes = ObjectHelper.CloneList2(PlayerSelectedGenes), Owner = this.Owner, BasicRace = this.BasicRace }); }