Exemple #1
0
 public void OnChildCancelSelected()
 {
     if (this == null)
     {
         return;
     }
     //启用残基Renderer 禁用所有子物体Renderer
     GetComponent <Renderer>().enabled = true;
     foreach (Transform child in this.transform)
     {
         IDisplayerSelected displayer = child.GetComponent <IDisplayerSelected>();
         if (displayer != null)
         {
             if (displayer is AtomDisplayer)
             {
                 child.GetComponent <Renderer>().enabled = false;
             }
             else if (displayer is BondDisplayer)
             {
                 foreach (Transform bond in child)
                 {
                     bond.GetComponent <Renderer>().enabled = false;
                 }
             }
             else
             {
                 throw new System.Exception();
             }
         }
     }
 }
Exemple #2
0
 public void OnUnSelected()
 {
     if (this == null)
     {
         return;
     }
     foreach (Transform child in this.transform)
     {
         IDisplayerSelected displayer = child.GetComponent <IDisplayerSelected>();
         if (displayer != null)
         {
             displayer.OnUnSelected();
         }
     }
 }
Exemple #3
0
    public void SetSelectedDisplayer(IDisplayerSelected displayer)
    {
        ProteinDisplayModel model = GetModel <ProteinDisplayModel>();
        ProteinDisplayView  view  = GetView <ProteinDisplayView>();

        //若是同一个displayer则跳过
        if (model.SelectedDisplayer != null && model.SelectedDisplayer == displayer)
        {
            return;
        }
        //取消上一个Displayer的选中状态
        if (model.SelectedDisplayer != null)
        {
            model.SelectedDisplayer.OnUnSelected();
        }
        model.SelectedDisplayer = displayer;
        //设置当前选中的Displayer的选中状态
        displayer.OnSelected();
        //更新BoardInfo
        if (displayer is AtomDisplayer)
        {
            view.SetBoardInfo(displayer as AtomDisplayer);
        }
        else if (displayer is AminoacidDisplayer)
        {
            view.SetBoardInfo(displayer as AminoacidDisplayer);
        }
        else if (displayer is ChainDisplayer)
        {
            view.SetBoardInfo(displayer as ChainDisplayer);
        }
        else
        {
            throw new System.Exception();
        }
    }
 public SetSelectedDisplayerCommand(IDisplayerSelected displayer)
 {
     this.Displayer = displayer;
 }