VerticalPaneState.ResolveStateToCurrentContext C# (CSharp) Méthode

ResolveStateToCurrentContext() public méthode

public ResolveStateToCurrentContext ( int currentId, VerticalPaneState, prototype ) : void
currentId int
prototype VerticalPaneState,
Résultat void
    public void ResolveStateToCurrentContext(int currentId, VerticalPaneState prototype)
    {
        if(id != currentId)
          Reset(currentId);
        else if(prototype != null)
          InitFromPrototype(currentId, prototype);
    }

Usage Example

    public static void Begin(VerticalPaneState prototype)
    {
        int id = GUIUtility.GetControlID(FocusType.Passive);
        vState = (VerticalPaneState)GUIUtility.GetStateObject(typeof(VerticalPaneState), id);
        vState.ResolveStateToCurrentContext(id, prototype);

        Rect totalArea = EditorGUILayout.BeginVertical();
          vState.availableHeight = totalArea.height - vState.splitterHeight;
          vState.isPaneHeightChanged = false;
          if(totalArea.height > 0) {
        if(vState.topPaneHeight < 0) {
          if(vState.initialTopPaneHeight < 0)
            vState.topPaneHeight = vState.availableHeight * 0.5f;
          else
            vState.topPaneHeight = vState.initialTopPaneHeight;
          vState.isPaneHeightChanged = true;
        }
        if(vState.lastAvailableHeight < 0)
          vState.lastAvailableHeight = vState.availableHeight;
        if(vState.lastAvailableHeight != vState.availableHeight) {
          vState.topPaneHeight = vState.availableHeight * (vState.topPaneHeight / vState.lastAvailableHeight);
          vState.isPaneHeightChanged = true;
        }
        vState.lastAvailableHeight = vState.availableHeight;
          }

          GUILayout.BeginVertical(GUILayout.Height(vState.topPaneHeight));
    }
All Usage Examples Of VerticalPaneState::ResolveStateToCurrentContext