Ejemplo n.º 1
0
 private void DoListView()
 {
     this.listArea.Set(0f, this.toolbarHeight, this.listWidth, base.get_position().get_height() - this.toolbarHeight - this.scrollbarHeight);
     this.listItemArea.Set(0f, 0f, this.listWidth, 20f);
     if (this.autoScroll)
     {
         float num = (float)this.selectedIndex * 20f;
         if (num < this.scrollPosition.y)
         {
             this.scrollPosition.y = num;
         }
         else
         {
             if (num > this.scrollPosition.y + this.listArea.get_height() - 20f)
             {
                 this.scrollPosition.y = (float)(this.selectedIndex + 1) * 20f - this.listArea.get_height();
             }
         }
         this.autoScroll = false;
     }
     GUI.BeginGroup(this.listArea);
     if (this.FsmList.get_Count() == 0)
     {
         GUILayout.Label(Strings.get_Label_None(), new GUILayoutOption[0]);
     }
     this.firstVisibleItem = Mathf.FloorToInt(this.scrollPosition.y / 20f);
     this.firstVisibleItem = Mathf.Clamp(this.firstVisibleItem, 0, this.FsmList.get_Count());
     this.lastVisibleItem  = this.firstVisibleItem + Mathf.CeilToInt(this.listArea.get_height() / 20f) + 1;
     this.lastVisibleItem  = Mathf.Clamp(this.lastVisibleItem, 0, this.FsmList.get_Count());
     this.listItemArea.set_y((float)this.firstVisibleItem * 20f - this.scrollPosition.y);
     for (int i = this.firstVisibleItem; i < this.lastVisibleItem; i++)
     {
         Skill fsm  = this.FsmList.get_Item(i);
         bool  flag = SkillEditor.SelectedFsm == fsm;
         if (flag)
         {
             if (this.eventType == 7)
             {
                 GUI.DrawTexture(this.listItemArea, SkillEditorStyles.SelectedBG);
             }
             if (this.selectedIndex != i)
             {
                 this.autoScroll = true;
             }
             this.selectedIndex = i;
         }
         if (GUI.Button(this.listItemArea, Labels.GetRuntimeFsmLabelToFit(fsm, this.listWidth, SkillEditorStyles.TableRowText), flag ? SkillEditorStyles.TableRowTextSelected : SkillEditorStyles.TableRowText))
         {
             this.SelectFsm(fsm);
         }
         this.listItemArea.set_y(this.listItemArea.get_y() + 20f);
         this.line.SetColor(SkillEditorStyles.LabelTextColor);
         this.line.DrawLine(0.05f, 0f, this.listItemArea.get_y() - 1f, this.listWidth, this.listItemArea.get_y() - 1f);
     }
     GUI.EndGroup();
     if (this.listArea.Contains(this.currentEvent.get_mousePosition()) && this.eventType == 6)
     {
         this.scrollPosition.y = this.scrollPosition.y + this.currentEvent.get_delta().y;
         base.Repaint();
     }
     this.listArea.Set(0f, base.get_position().get_height() - this.scrollbarHeight, this.listWidth, this.scrollbarHeight);
     GUI.Box(this.listArea, GUIContent.none, EditorStyles.get_toolbar());
     if (GUI.Button(this.listArea, Strings.get_Label_Refresh(), EditorStyles.get_toolbarButton()))
     {
         this.RefreshList();
     }
 }
Ejemplo n.º 2
0
 public static GUIContent GetRuntimeFsmLabelToFit(Skill fsm, float width, GUIStyle style)
 {
     return(Labels.GetRuntimeFsmLabelToFit(fsm, width, style));
 }