当前位置: 首页>>代码示例>>C#>>正文


C# GUISkin.GetStyle方法代码示例

本文整理汇总了C#中UnityEngine.GUISkin.GetStyle方法的典型用法代码示例。如果您正苦于以下问题:C# GUISkin.GetStyle方法的具体用法?C# GUISkin.GetStyle怎么用?C# GUISkin.GetStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.GUISkin的用法示例。


在下文中一共展示了GUISkin.GetStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: drawShelfGroup

    public void drawShelfGroup(Event e, float yCoord, int shelfGroupIndex, Rect viewRect, NodeGraph currentNodeGraph, GUISkin viewSkin)
    {
        if (isExpanded)
        {
            groupRect = new Rect(5f, yCoord, viewRect.width - 10f, getHeight());
            GUI.Box(groupRect, groupName, viewSkin.GetStyle(("shelf_group_bg")));

            int hiddenNodes = 0;

            for (int i = 0; i < shelfNodes.Count; i++)
            {
                if (!shelfNodes[i].isHidden)
                {
                    shelfNodes[i].shelfNodeRect = new Rect(10f, yCoord + 40f + (50f * (i - hiddenNodes)), viewRect.width - 20f, 40f);
                    shelfNodes[i].drawNodeShelfGroupNode(e, yCoord, viewSkin);
                }
                else
                {
                    hiddenNodes++;
                }
            }
        }
        else
        {
            groupRect = new Rect(5f, yCoord, viewRect.width - 10f, 40f);
            GUI.Box(groupRect, groupName, viewSkin.GetStyle(("shelf_group_bg")));
        }

        ProcessEvent(e, currentNodeGraph);
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:30,代码来源:NodeShelfGroup.cs

示例2: DrawDragButton

    public void DrawDragButton(Event e, Rect nodeRect, GUISkin guiSkin)
    {
        leftButtonRect = new Rect(nodeRect.x, nodeRect.y + nodeRect.height, 30f, 30f);
        middleButtonRect = new Rect(nodeRect.x + nodeRect.width * 0.5f - 15f, nodeRect.y + nodeRect.height, 30f, 30f);
        rightButtonRect = new Rect(nodeRect.x + nodeRect.width - 30f, nodeRect.y + nodeRect.height, 30f, 30f);

        GUI.Box(leftButtonRect, "", guiSkin.GetStyle("node_default"));
        GUI.Box(rightButtonRect, "", guiSkin.GetStyle("node_default"));
        GUI.Box(middleButtonRect, "", guiSkin.GetStyle("node_default"));
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:10,代码来源:DragButton.cs

示例3: InitFromRemoteData

 void InitFromRemoteData()
 {
     if (!RemoteData.DataValid) { // Подождать загрузки данных
         RemoteData.AllComplete += InitFromRemoteData;
         return;
     }
     //Иначе данные уже загрузить, можно отписаться и проинициализароваться
     RemoteData.AllComplete -= InitFromRemoteData;
     // Инициализация объектов данными из удаленного источника и отписка:
     _skin = RemoteData.RequiredAssets["MenuSkin"].obj as GUISkin;
     _welcomLabel = _skin.GetStyle("Header");
 }
开发者ID:glazkovalex,项目名称:demo-unity3d,代码行数:12,代码来源:MenuAndSettings.cs

示例4: UpdateNodeGUI

    public override void UpdateNodeGUI(Event e, Rect viewRect, Rect workViewRect, GUISkin guiSkin)
    {
        base.UpdateNodeGUI(e, viewRect, workViewRect, guiSkin);

        stringToEdit = GUI.TextField(new Rect(nodeRect.x + nodeRect.width * 0.5f + 8f, nodeRect.y + nodeRect.height * 0.5f - 10f, nodeRect.width * 0.4f, 20f), nodeValue.ToString(), 25);
        try
        {
            nodeValue = float.Parse(stringToEdit); // TODO handle Exception from Bad Input
        }catch(FormatException ex){ }

        if (GUI.Button(new Rect(nodeRect.x + nodeRect.width - 10f, nodeRect.y + nodeRect.height * 0.5f - 10f, 20f, 20f), "", guiSkin.GetStyle("node_output")))
        {
            if (parentGraph != null)
            {
                parentGraph.wantsConnection = true;
                parentGraph.connectionNode = this;
            }
        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:19,代码来源:FloatNode.cs

示例5: InstructionScreen

 public InstructionScreen(GUISkin Skin, SpriteRenderer BackgroundRenderer, PauseMenu PauseMenu)
     : base(Skin, BackgroundRenderer, PauseMenu)
 {
     Background = Resources.Load<Sprite>( "Sprites/GUI/Menu/Instructions_page" );
     backStyle = Skin.GetStyle( "Pause-InsBack" );
     backRect = new Rect( 656, 562, 150, 44 );
 }
开发者ID:JamesZinger,项目名称:Axon-TOJam9,代码行数:7,代码来源:PauseMenu.cs

示例6: DrawFloatNodeProperties

 private void DrawFloatNodeProperties(GUISkin guiSkin)
 {
     if(parameters != null)
     {
         parameters["value"].floatParam = EditorGUILayout.FloatField("Float value", parameters["value"].floatParam, guiSkin.GetStyle("property_view"));
     }
 }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:7,代码来源:NodeBase.cs

示例7: drawInputHandles

    //Draws the Inputhandles of the Node (Leftside Red Handles)
    public void drawInputHandles(GUISkin guiSkin)
    {
        if (multiInput)
        {
            //Multi Input Box
            if (GUI.Button(new Rect(nodeRect.x - 24f, nodeRect.y + ((nodeRect.height + 25f) * 0.5f) - 25f, 24f, 50f), "", guiSkin.GetStyle("node_multiInput")))
            {
                if (parentGraph != null)
                {
                    if (parentGraph.wantsConnection)
                    {
                        if (parentGraph.connectionOutputList != null)
                        {
                            for (int i = 0; i < parentGraph.connectionOutputList.Count; i++)
                            {
                                bool needsExpanding = true;
                                for (int k = 0; k < nodeInputs.Count; k++)
                                {
                                    if (parentGraph.connectionOutputList[i].outputNode == this)
                                    {
                                        Debug.Log("Connection impossible");
                                        return;
                                    }

                                    if (nodeInputs[k].inputNode == null && nodeInputs[k].isOccupied == false)
                                    {
                                        nodeInputs[k].inputNode = parentGraph.connectionOutputList[i].outputNode;
                                        nodeInputs[k].isOccupied = nodeInputs[k].inputNode != null;
                                        //experimental
                                        nodeInputs[k].outputPos = parentGraph.connectionOutputList[i].position;

                                        nodeInputs[k].inputNode.nodeOutputs[nodeInputs[k].outputPos].connectedToNode = this;
                                        parentGraph.connectionOutputList[i].connectedToNode = this;
                                        //experimental

                                        Debug.Log("Connected at: " + k);
                                        needsExpanding = false;

                                        break;
                                    }
                                    else
                                    {
                                        needsExpanding = true;
                                    }
                                }

                                if (numberOfInputs < nodeInputsMax && needsExpanding)
                                {
                                    int t = nodeInputs.Count;
                                    numberOfInputs = t + 1;
                                    nodeInputs.Add(new NodeInput());
                                    nodeInputs[t].inputNode = parentGraph.connectionOutputList[i].outputNode;
                                    nodeInputs[t].isOccupied = nodeInputs[t].inputNode != null;

                                    nodeInputs[t].outputPos = parentGraph.connectionOutputList[i].position;

                                    nodeInputs[t].inputNode.nodeOutputs[nodeInputs[t].outputPos].connectedToNode = this;
                                    parentGraph.connectionOutputList[i].connectedToNode = this;

                                    Debug.Log("Increased Input and Connected");
                                }
                            }

                            parentGraph.wantsConnection = false;
                            parentGraph.connectionNode = null;
                            parentGraph.connectionOutputList = null;
                        }
                        else
                        {
                            for (int k = 0; k < nodeInputs.Count; k++)
                            {
                                if (parentGraph.connectionOutput.outputNode == this)
                                {
                                    Debug.Log("Connection impossible");
                                    return;
                                }

                                if (nodeInputs[k].inputNode == null && nodeInputs[k].isOccupied == false)
                                {
                                    nodeInputs[k].inputNode = parentGraph.connectionOutput.outputNode;
                                    nodeInputs[k].isOccupied = nodeInputs[k].inputNode != null;
                                    nodeInputs[k].outputPos = parentGraph.connectionOutput.position;

                                    nodeInputs[k].inputNode.nodeOutputs[nodeInputs[k].outputPos].connectedToNode = this;
                                    parentGraph.connectionOutput.connectedToNode = this;

                                    parentGraph.wantsConnection = false;
                                    parentGraph.connectionNode = null;
                                    Debug.Log("Connected at: " + k);

                                    return;
                                }
                            }

                            if (numberOfInputs < nodeInputsMax)
                            {
                                int i = nodeInputs.Count;
                                numberOfInputs = i + 1;
                                nodeInputs.Add(new NodeInput());
//.........这里部分代码省略.........
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:101,代码来源:NodeBase.cs

示例8: UpdateNodeGUI

    public virtual void UpdateNodeGUI(Event e, Rect viewRect, Rect workViewRect, GUISkin guiSkin)
    {
        ProcessEvents(e, viewRect, workViewRect);
        if(WorkPreferences.liveEvaluate)
            evaluateNode();

        nodeSkin = guiSkin;
        viewPortRect = viewRect;

        string currentStyle = isSelected ? "node_selected" : "node_default";
        if (timePointer.isSelected)
            currentStyle = "node_selected";
        GUI.Box(nodeRect, nodeName, guiSkin.GetStyle(currentStyle));
        GUI.Box(new Rect(nodeRect.x, nodeRect.y, nodeRect.width, 27f), nodeName, guiSkin.GetStyle((currentStyle + "_titlebar_" + titleBarColor)));
        GUI.Box(new Rect(nodeRect.x, nodeRect.y + nodeRect.height - 27f, nodeRect.width, 27f), "", guiSkin.GetStyle(currentStyle));

        DrawCurrentTimePosition();      

        if (timePointer != null)
            timePointer.drawArrow(e, viewRect, workViewRect, guiSkin);

        resizeNodeBox();

        DrawNodeBoxInsideByType(viewRect);

        drawOutputHandles(guiSkin);
        drawInputHandles(guiSkin);

        DrawInputLines();

        if(timePointer.hasTiming)
            dragButton.DrawDragButton(e, nodeRect, guiSkin);

        EditorUtility.SetDirty(this);
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:35,代码来源:NodeBase.cs

示例9: DrawDefaultProperties

 private void DrawDefaultProperties(GUISkin guiSkin)
 {
     if (parameters != null)
     {
         foreach (var key in parameters.Keys)
         {
             if (parameters[key].getParameterType() == typeof(float))
             {
                 parameters[key].floatParam = EditorGUILayout.FloatField(key, parameters[key].floatParam, guiSkin.GetStyle("property_view"));
             }
             else if (parameters[key].getParameterType() == typeof(bool))
             {
                 parameters[key].boolParam = EditorGUILayout.Toggle(key, parameters[key].boolParam);
             }
             else
                 Debug.LogWarning("parameter type not supported: " + parameters[key].GetType());
         }
     }
 }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:19,代码来源:NodeBase.cs

示例10: DrawText

    public static void DrawText ( GUISkin guiSkin, string text, Vector3 position, Color? color = null, int fontSize = 0, float yOffset = 0 ) {
#if UNITY_EDITOR
        var prevSkin = GUI.skin;
        if ( guiSkin == null )
            Debug.LogWarning ( "editor warning: guiSkin parameter is null" );
        else
            GUI.skin = guiSkin;

        GUIContent textContent = new GUIContent ( text );

        GUIStyle style = (guiSkin != null) ? new GUIStyle ( guiSkin.GetStyle ( "Label" ) ) : new GUIStyle ();
        if ( color != null )
            style.normal.textColor = (Color)color;
        if ( fontSize > 0 )
            style.fontSize = fontSize;

        Vector2 textSize = style.CalcSize ( textContent );
        Vector3 screenPoint = Camera.current.WorldToScreenPoint ( position );

        if ( screenPoint.z > 0 ) // checks necessary to the text is not visible when the camera is pointed in the opposite direction relative to the object
        {
            var worldPosition = Camera.current.ScreenToWorldPoint ( new Vector3 ( screenPoint.x - textSize.x * 0.5f, screenPoint.y + textSize.y * 0.5f + yOffset, screenPoint.z ) );
            UnityEditor.Handles.Label ( worldPosition, textContent, style );
        }
        GUI.skin = prevSkin;
#endif
    }
开发者ID:MarvTekko,项目名称:AISG,代码行数:27,代码来源:WorldOld.cs

示例11: drawOutputHandles

    //Draws Outputhandles of the Node (Rightside Green Handles)
    public void drawOutputHandles(GUISkin guiSkin)
    {
        if (multiOutput)
        {
            if (GUI.Button(new Rect(nodeRect.x + nodeRect.width, nodeRect.y + ((nodeRect.height + 25f) * 0.5f) - 25f, 24f, 50f), "", guiSkin.GetStyle("node_multiOutput")))
            {
                if (parentGraph != null)
                {
                    parentGraph.wantsConnection = true;
                    parentGraph.connectionOutputList = new List<NodeOutput>();
                    foreach(NodeOutput n in nodeOutputs)
                    {
                        parentGraph.connectionOutputList.Add(n);
                    }
                }
            }

            GUI.Label(new Rect(nodeRect.x + nodeRect.width , nodeRect.y + ((nodeRect.height + 25f) * 0.5f) - 10f, nodeRect.width * 0.2f - 10f, 20f), nodeOutputs.Count + "", guiSkin.GetStyle("std_whiteText"));
        }
        else
        {
            //Single Output Circles (green)
            for (int i = 0; i < nodeOutputs.Count; i++)
            {
                nodeOutputs[i].rect.x = nodeRect.x + nodeRect.width - 10f;
                nodeOutputs[i].rect.y = nodeRect.y + (nodeRect.height * (1f / (nodeOutputs.Count + 1))) * (i + 1) - 10f;
                nodeOutputs[i].position = i;

                if (GUI.Button(nodeOutputs[i].rect, "", guiSkin.GetStyle("node_output")))
                {
                    if (parentGraph != null)
                    {
                        if (nodeOutputs[i].connectedToNode == null)
                        {
                            if(nodeType == NodeType.Graph)
                            {
                                if (nodeOutputs[i].outputNode != null)
                                {
                                    parentGraph.wantsConnection = true;
                                    parentGraph.connectionNode = nodeOutputs[i].outputNode;                                
                                    parentGraph.connectionOutput = nodeOutputs[i];
                                }
                            }
                            else
                            {
                                parentGraph.wantsConnection = true;
                                parentGraph.connectionNode = this;
                                parentGraph.connectionOutput = nodeOutputs[i];
                            }
                        }
                        else
                        {
                            nodeOutputs[i].connectedToNode = null;
                            nodeOutputs[i].isOccupied = false;

                            parentGraph.wantsConnection = true;
                            parentGraph.connectionNode = this;
                            parentGraph.connectionOutput = nodeOutputs[i];
                            //TODO disconnect the output from the input
                            Debug.Log("disconnect it!");
                        }
                    }
                }
            }
        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:67,代码来源:NodeBase.cs

示例12: OnTextEditorGUI

        public override void OnTextEditorGUI(int windowID)
        {
            this.windowID = windowID;
            if (!show) return;

            GUI.color = new Color(1,1,1,1);

            if (!editor.TestClickBlockers(editor.windowMousePos,this)) {
                GUI.BringWindowToFront(windowID);
                if (Event.current.type == EventType.MouseDown) {
                    FocusWindow();
                }
            }

            skin = editor.editorWindow.theme.skin;

            textEditorRect = editor.GetTextEditorRect();
            textEditorRect.y += editor.tabRect.height;
            textEditorRect.height -= editor.tabRect.height;
            textEditorRectZeroPos = textEditorRect;
            textEditorRectZeroPos.x = 0;
            textEditorRectZeroPos.y = 0;

            UpdateRect();

            GUI.skin = skin;

            Rect winRect = rect;
            winRect.x += textEditorRect.x;
            winRect.y += textEditorRect.y;

            Rect shadowClipRect = textEditorRect;
            shadowClipRect.x = 0;
            GUI.BeginGroup(shadowClipRect);
            GUIStyle shadowStyle = skin.GetStyle("DropShadow");
            if (shadowStyle != null) {
                Rect shadowRect = rect;
                shadowRect.x += editor.lineNumberWidth;
                GUI.Box(shadowRect,"",shadowStyle);
            }
            GUI.EndGroup();

            GUI.BeginGroup(textEditorRect);
            GUI.Window(windowID, winRect, DrawGUIWindow, "Find And Replace", new GUIStyle());
            GUI.EndGroup();

            GUI.skin = null;
        }
开发者ID:micha224,项目名称:Jan_1GAM,代码行数:48,代码来源:FindAndReplace.cs

示例13: DrawNodeGraphOutputs

    //Rightside Red
    public void DrawNodeGraphOutputs(Rect viewRect, GUISkin guiSkin)
    {
        if (graphNode != null)
        {
            NodeBase mostOuterNode = getMostOuterNode();
            if (ViewOptions.showShelf)
            {
                graphNodeRect = new Rect(viewRect.width - nodeShelfWidth - 32f, viewRect.y + (viewRect.height * 0.5f) - panY, 32f, 120f);
            }
            else
            {
                graphNodeRect = new Rect(viewRect.x + viewRect.width - 32f, viewRect.y + (viewRect.height * 0.5f) - panY, 32f, 120f);
            }

            graphNodeRect.x = graphNodeRect.x / zoom;
            graphNodeRect.x = graphNodeRect.x - panX;
            graphNodeRect.width = graphNodeRect.width / zoom;

            if(mostOuterNode != null)
            {
                if (graphNodeRect.x < (mostOuterNode.nodeRect.x + mostOuterNode.nodeRect.width + 100))
                    graphNodeRect.x = mostOuterNode.nodeRect.x + mostOuterNode.nodeRect.width + 100;
            }

            if (GUI.Button(graphNodeRect, "", guiSkin.GetStyle("node_multiInput")))
            {
                if (wantsConnection)
                {
                    for (int k = 0; k < graphNode.nodeOutputs.Count; k++)
                    {
                        if (graphNode.nodeOutputs[k].outputNode == null && graphNode.nodeOutputs[k].isOccupied == false)
                        {
                            graphNode.nodeOutputs[k].outputNode = connectionNode;
                            graphNode.nodeOutputs[k].isOccupied = graphNode.nodeOutputs[k].outputNode != null;
                            //graphNode.nodeOutputs[k].position = k;

                            wantsConnection = false;
                            connectionNode = null;
                            Debug.Log("Connected to GroupNode Output at: " + k);

                            return;
                        }
                    }

                    if (graphNode.numberOfOutputs < graphNode.nodeOutputsMax)
                    {
                        int i = graphNode.nodeOutputs.Count;
                        graphNode.numberOfOutputs = i + 1;
                        graphNode.nodeOutputs.Add(new NodeOutput());
                        graphNode.nodeOutputs[i].outputNode = connectionNode;
                        graphNode.nodeOutputs[i].isOccupied = graphNode.nodeOutputs[i].outputNode != null;
                        Debug.Log("Increased Output of GroupNode and Connected");
                    }
                    
                    wantsConnection = false;
                    connectionNode = null;
                }
                else
                {
                    Debug.Log("Removing Group Node Outputs");
                    graphNode.nodeOutputs = new List<NodeOutput>();
                    graphNode.numberOfOutputs = graphNode.nodeOutputs.Count;
                }
            }
            GUI.Label(graphNodeRect, graphNode.nodeOutputs.Count + "", guiSkin.GetStyle("std_whiteText"));

        }
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:69,代码来源:NodeGraph.cs

示例14: PlayModeScreen

        public PlayModeScreen( GUISkin Skin, SpriteRenderer BackgroundRenderer, MainMenu MainMenu )
            : base(Skin, BackgroundRenderer, MainMenu)
        {
            Background = Resources.Load<Sprite>( "Sprites/GUI/Menu/mainMenu-playmode" );

            backRct    = new Rect( 353, 562, 150, 44 );
            coworkRct  = new Rect(  70, 200, 355, 175 );
            studentRct = new Rect( 430, 200, 355, 175 );

            styleMap 		  = new Dictionary<Option, string>	 ();
            unselectedOptions = new Dictionary<Option, Texture2D>();
            selectedOptions   = new Dictionary<Option, Texture2D>();

            styleMap.Add( Option.Coworker, "Coworker Opt" );
            styleMap.Add( Option.Student , "Student Opt"  );

            unselectedOptions.Add( Option.Coworker, Resources.Load<Texture2D>( "Sprites/GUI/Menu/coworkerUnselected" ) );
            unselectedOptions.Add( Option.Student , Resources.Load<Texture2D>( "Sprites/GUI/Menu/studentUnselected"  ) );

            selectedOptions.Add( Option.Coworker, Resources.Load<Texture2D>( "Sprites/GUI/Menu/coworkerSelected" ) );
            selectedOptions.Add( Option.Student	, Resources.Load<Texture2D>( "Sprites/GUI/Menu/studentSelected"   ) );

            currentSelection = Option.Coworker;
            Skin.GetStyle( styleMap[ currentSelection ] ).normal.background = selectedOptions[ currentSelection ];
        }
开发者ID:JamesZinger,项目名称:Axon-TOJam9,代码行数:25,代码来源:MainMenu.cs

示例15: drawNodeShelfGroupNode

 public void drawNodeShelfGroupNode(Event e, float yCoord, GUISkin viewSkin)
 {
     GUI.Box(shelfNodeRect, shelfNodeName, viewSkin.GetStyle(("node_default_titlebar_blue")));
 }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:4,代码来源:NodeShelfGroupNode.cs


注:本文中的UnityEngine.GUISkin.GetStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。