示例#1
0
        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));
        }
示例#2
0
 public Race Clone()
 {
     return(new Race {
         Name = Name,
         Description = Description,
         MaxLength = MaxLength,
         RegulatoryGenes = ObjectHelper.CloneList2 <RegulatoryGene>(this.RegulatoryGenes)
     });
 }
示例#3
0
        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";
        }
示例#4
0
 public System.Object Clone()
 {
     return(new Strain()
     {
         Population = 0,
         Name = this.Name,
         PlayerSelectedGenes = ObjectHelper.CloneList2(PlayerSelectedGenes),
         Owner = this.Owner,
         BasicRace = this.BasicRace
     });
 }
示例#5
0
 /// <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;
     });
 }
示例#6
0
        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);
        }
示例#7
0
 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
     });
 }