예제 #1
0
 public void OnSelected()
 {
     if (this == null)
     {
         return;
     }
     foreach (Transform child in this.transform)
     {
         IDisplayerSelected displayer = child.GetComponent <IDisplayerSelected>();
         if (displayer != null)
         {
             displayer.OnSelected();
         }
     }
 }
예제 #2
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();
        }
    }