コード例 #1
0
                private void RenderExternalLink(StateMachineEditorLink link, StateEditorGUI fromState, int linkIndex)
                {
                    StateMachineExternalStateEditorGUI externalState = null;

                    StateRef stateRef = link.GetStateRef();

                    //Find external link for this state
                    foreach (StateEditorGUI state in _editableObjects)
                    {
                        StateMachineExternalStateEditorGUI extState = state as StateMachineExternalStateEditorGUI;

                        if (extState != null)
                        {
                            StateRef extStateRef = extState.ExternalStateRef.GetStateRef();

                            if (extStateRef.GetStateID() == stateRef.GetStateID() && extStateRef.GetExternalFile().GetFileGUID() == stateRef.GetExternalFile().GetFileGUID())
                            {
                                externalState = extState;
                                break;
                            }
                        }
                    }

                    //If none exists, create a new one
                    if (externalState == null)
                    {
                        externalState = (StateMachineExternalStateEditorGUI)AddNewObject(new StateMachineExternalState());
                        externalState.ExternalStateRef = link;
                        _editableObjects.Add(externalState);
                    }

                    if (!externalState.ExternalHasRendered)
                    {
                        externalState.CalcBounds(_style);
                        bool  selected     = _selectedObjects.Contains(externalState);
                        Color borderColor  = selected ? _style._stateBackgroundSelected : _style._stateBackground;
                        Rect  renderedRect = GetScreenRect(externalState.GetBounds());
                        externalState.Render(renderedRect, borderColor, _style._externalStateColor, _style, selected ? 2.0f : 1.0f);
                        externalState.ExternalHasRendered = true;
                    }

                    RenderLink(link.GetDescription(), fromState, externalState, linkIndex);
                }
コード例 #2
0
            public override string GetAutoDescription()
            {
                StateRef stateRef = _externalStateRef.GetStateRef();

                return(stateRef.GetExternalFile()._editorAsset != null ? stateRef.GetExternalFile()._editorAsset.name : null);
            }