Beispiel #1
0
 public void OnPointerEnter( PointerEventData eventData ) {
     U3D_LabSceneLoad.ChangeMaxLengthText(
         string.Format(
             "Name: {0}\n" +
             "Description: {1}\n"
             , RegulatoryGene.Name, RegulatoryGene.Description
         ) );
 }
 public void OnPointerEnter(PointerEventData eventData)
 {
     U3D_LabSceneLoad.ChangeMaxLengthText(
         string.Format(
             "Name: {0}\n" +
             "Description: {1}\n"
             , Strain.Name, ""
             ));
 }
 public void OnPointerDown(PointerEventData eventData)
 {
     if (Input.GetMouseButtonDown(1))      // Right
     {
         U3D_AlertPanel.EmitAlert("Do you want to delete the strain?",
                                  () => {
             Save.Strains.Remove(Strain);
             gameObject.SetActive(false);
             Save.SaveAllStrains();
             U3D_LabSceneLoad.RefreshStrainList();
         },
                                  () => { });
     }
 }
        public void ClearSelectionWithNoAlert()
        {
            LabCurrent.Strain = new CellWar.Model.Substance.Strain {
                BasicRace = Local.AllRaces[0]
            };

            LabCurrent.RegulatoryGene = null;
            // 勾选所有的reg
            UIHelper.SwitchOffAllToggle("UI_RegList");
            UIHelper.SwitchOffAllToggle("UI_LabStrainList");
            // 刷新长度提示
            U3D_LabSceneLoad.FreshLength();
            // 替换input名字
            UIHelper.SetInputText("UI_Strain_Name", "");
        }
Beispiel #5
0
 /// <summary>
 /// 当value on change时调用
 /// </summary>
 public void ChangeText()
 {
     if (Race == null || LabCurrent.Strain == null)
     {
         LabCurrent.MakeStrainNotBeNull();
         return;
     }
     try {
         LabCurrent.Strain.BasicRace = Race.Clone();
         U3D_LabSceneLoad.FreshLength();
     }
     catch (System.Exception ex) {
         Debug.Log(ex);
     }
 }
Beispiel #6
0
        public void OnPointerDown( PointerEventData eventData ) {
            var regs = LabCurrent.Strain.PlayerSelectedGenes;
            var reg = regs.Find( m => m.Name == RegulatoryGene.Name );

            if( Input.GetMouseButtonDown( 0 ) ) { // Left
                if( reg == null ) {
                    regs.Add( reg = ObjectHelper.Clone( RegulatoryGene, RegulatoryGene.GetType() ) );
                } else {
                    regs.Remove( reg );
                }
                SwitchCodingGeneList( reg );
            }
            if( Input.GetMouseButtonDown( 1 ) && GetComponent<Toggle>().isOn ) { // Right
                SwitchCodingGeneList( reg );
            }
            U3D_LabSceneLoad.FreshLength();
        }
Beispiel #7
0
        public void OnPointerClick(PointerEventData eventData)
        {
            var dominatedGenes = LabCurrent.RegulatoryGene.DominatedGenes;
            var cod            = dominatedGenes.Find(m => m.Name == CodingGene.Name);

            if (GetComponent <Toggle>().isOn)
            {
                if (cod == null)
                {
                    dominatedGenes.Add(ObjectHelper.Clone(CodingGene));
                }
            }
            else
            {
                dominatedGenes.Remove(cod);
            }
            U3D_LabSceneLoad.FreshLength();
        }
        public void LoadStrainInfo()
        {
            LabCurrent.Strain = GetComponent <Toggle>().isOn ?  Strain.Clone() as Strain : null;
            if (LabCurrent.Strain == null)
            {
                return;
            }

            LabCurrent.RegulatoryGene = Strain.PlayerSelectedGenes.Count != 0 ? Strain.PlayerSelectedGenes[0] : null;
            // 勾选race
            UIHelper.SwitchToggle(LabCurrent.Strain.BasicRace.Name, true);
            // 勾选所有的reg
            foreach (Transform reg in GameObject.Find("UI_RegList").transform)
            {
                reg.gameObject.GetComponent <Toggle>().isOn = LabCurrent.Strain.PlayerSelectedGenes.Exists(m => m.Name == reg.gameObject.name);
            }
            // 刷新长度提示
            U3D_LabSceneLoad.FreshLength();
            // 替换input名字
            UIHelper.SetInputText("UI_Strain_Name", LabCurrent.Strain.Name);
        }
Beispiel #9
0
 public void OnPointerExit(PointerEventData eventData)
 {
     U3D_LabSceneLoad.FreshLength();
 }