Пример #1
0
    private void DrawNodeWindow(int id)
    {
        if (GUIUtility.hotControl == 0) //mouseup event outside parent window?
        {
            _handleActive = false;      //make sure handle is deactivated
        }

        float _cornerX = 0f;
        float _cornerY = 0f;

        switch (id) //case which window this is and nab size info
        {
        case 1:
            _cornerX = window1.width;
            _cornerY = window1.height;
            break;

        case 2:
            _cornerX = window2.width;
            _cornerY = window2.height;
            break;
        }

        //begin layout of contents
        GUILayout.BeginArea(new Rect(1, 16, _cornerX - 3, _cornerY - 1));
        GUILayout.BeginHorizontal(EditorStyles.toolbar);
        _nodeOption = GUILayout.Toggle(_nodeOption, "Node Toggle", EditorStyles.toolbarButton);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        GUILayout.BeginArea(new Rect(1, _cornerY - 16, _cornerX - 3, 14));
        GUILayout.BeginHorizontal(EditorStyles.toolbarTextField, GUILayout.ExpandWidth(true));
        GUILayout.FlexibleSpace();

        //grab corner area based on content reference
        _handleArea = GUILayoutUtility.GetRect(_icon, GUIStyle.none);
        GUI.DrawTexture(new Rect(_handleArea.xMin + 6, _handleArea.yMin - 3, 20, 20), _resizeHandle); //hacky placement
        _action = (Event.current.type == EventType.MouseDown) || (Event.current.type == EventType.MouseDrag);
        if (!_handleActive && _action)
        {
            if (_handleArea.Contains(Event.current.mousePosition, true))
            {
                _handleActive         = true;                                       //active when cursor is in contact area
                GUIUtility.hotControl = GUIUtility.GetControlID(FocusType.Passive); //set handle hot
            }
        }

        EditorGUIUtility.AddCursorRect(_handleArea, MouseCursor.ResizeUpLeft);
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        //resize window
        if (_handleActive && (Event.current.type == EventType.MouseDrag))
        {
            ResizeNode(id, Event.current.delta.x, Event.current.delta.y);
            Repaint();
            Event.current.Use();
        }

        //enable drag for node
        if (!_handleActive)
        {
            GUI.DragWindow();
        }
    }
Пример #2
0
    // Recognized color string sequences:
    // #aabbccdd - Change current color to the one specified by the hex string
    //             red green blue alpha
    // #!        - Revert back to the original color that was used before this function call
    // #n        - normal font
    // #x        - bold font
    // #i        - italic font
    public void FancyLabel(Rect rect, string text, Font normalFont, Font boldFont, Font italicFont, TextAlignment alignment)
    {
        int   i1 = 0, i2 = 0;
        bool  done          = false;
        bool  newLine       = false;
        Color originalColor = UnityEngine.GUI.contentColor;
        Color textColor     = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a);

        bool     leftSpace = false, rightSpace = false, topSpace = false, bottomSpace = false;
        Font     defaultFont = UnityEngine.GUI.skin.font;
        Font     newFont     = null;
        GUIStyle fontStyle   = new GUIStyle();

        // Start with normal font
        if (normalFont != null)
        {
            fontStyle.font = normalFont;
        }
        else
        {
            fontStyle.font = defaultFont;
        }
        // NOTE: Lowering this padding reduces the line spacing
        // May need to adjust per font
        fontStyle.padding.bottom = -3;
        GUILayout.BeginArea(rect);
        GUILayout.BeginVertical(GUILayout.ExpandHeight(true), GUILayout.Width(rect.height), GUILayout.MinWidth(rect.height));
        GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.Width(rect.width), GUILayout.MinWidth(rect.width));

        // Insert flexible space on the left if Center or Right aligned
        if (alignment == TextAlignment.Right || alignment == TextAlignment.Center)
        {
            GUILayout.FlexibleSpace();
        }

        while (!done)
        {
            int skipChars = 0;
            int firstEscape, firstDoubleEscape, firstNewline;
            firstEscape  = text.IndexOf("#", i2);
            firstNewline = text.IndexOf("\n", i2);
            if (firstEscape != -1 && (firstNewline == -1 || firstEscape < firstNewline))
            {
                i1 = firstEscape;
            }
            else
            {
                i1 = firstNewline;
            }
            // We're at the end, set the index to the end of the
            // string and signal an end
            if (i1 == -1)
            {
                i1   = text.Length - 1;
                done = true;
            }

            fontStyle.normal.textColor = textColor;

            if (newFont != null)
            {
                fontStyle.font = newFont;
                newFont        = null;
            }

            // If the next character is # then we have a ## sequence
            // We want to point one of the # so advance the index by
            // one to include the first #
            if (!done)
            {
                if (text.Substring(i1, 1) == "#")
                {
                    if ((text.Length - i1) >= 2 && text.Substring(i1 + 1, 1) == "#")
                    {
                        skipChars = 2;
                    }

                    // Revert to original color sequence
                    else if ((text.Length - i1) >= 2 && text.Substring(i1 + 1, 1) == "!")
                    {
                        textColor = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a);
                        i1--;
                        skipChars = 3;
                    }

                    // Set normal font
                    else if ((text.Length - i1) >= 2 && text.Substring(i1 + 1, 1) == "n")
                    {
                        if (normalFont != null)
                        {
                            newFont = normalFont;
                        }
                        else
                        {
                            newFont = defaultFont;
                        }
                        i1--;
                        skipChars = 3;
                    }

                    // Set bold font
                    else if ((text.Length - i1) >= 2 && text.Substring(i1 + 1, 1) == "x")
                    {
                        if (boldFont != null)
                        {
                            newFont = boldFont;
                        }
                        else
                        {
                            newFont = defaultFont;
                        }

                        i1--;
                        skipChars = 3;
                    }

                    // Set italic font
                    else if ((text.Length - i1) >= 2 && text.Substring(i1 + 1, 1) == "i")
                    {
                        if (italicFont != null)
                        {
                            newFont = italicFont;
                        }
                        else
                        {
                            newFont = defaultFont;
                        }

                        i1--;
                        skipChars = 3;
                    }

                    //  New color sequence
                    else if ((text.Length - i1) >= 10)
                    {
                        string rText = text.Substring(i1 + 1, 2);
                        string gText = text.Substring(i1 + 3, 2);
                        string bText = text.Substring(i1 + 5, 2);
                        string aText = text.Substring(i1 + 7, 2);

                        float r = HexStringToInt(rText) / 255.0f;
                        float g = HexStringToInt(gText) / 255.0f;
                        float b = HexStringToInt(bText) / 255.0f;
                        float a = HexStringToInt(aText) / 255.0f;

                        if (r < 0 || g < 0 || b < 0 || a < 0)
                        {
                            Debug.Log("Invalid color sequence");
                            return;
                        }

                        textColor = new Color(r, g, b, a);
                        skipChars = 10;
                        // Move back one character so that we don't print the #

                        i1--;
                    }
                    else
                    {
                        Debug.Log("Invalid # escape sequence");
                        return;
                    }
                }
                else if ((text.Length - i1) >= 1 && text.Substring(i1, 1) == "\n")
                {
                    newLine = true;
                    i1--;
                    skipChars = 2;
                }
                else
                {
                    Debug.Log("Invalid escape sequence");
                    return;
                }
            }
            string textPiece = text.Substring(i2, i1 - i2 + 1);
            GUILayout.Label(textPiece, fontStyle);

            // Unity seems to cut off the trailing spaces in the label, he have
            // to add them manually here
            // Figure out how many trailing spaces there are

            int spaces = textPiece.Length - textPiece.TrimEnd(' ').Length;

            // NOTE: Add the proper amount of gap for trailing spaces.
            // the length of space is a questimate here,
            // may need to be adjusted for different fonts

            GUILayout.Space(spaces * 5.0f);

            if (newLine)
            {
                // Create a new line by ending the horizontal layout
                if (alignment == TextAlignment.Left || alignment == TextAlignment.Center)
                {
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.Width(rect.width), GUILayout.MinWidth(rect.width));

                if (alignment == TextAlignment.Right || alignment == TextAlignment.Center)
                {
                    GUILayout.FlexibleSpace();
                }
                newLine = false;
            }

            // Store the last index
            i2 = i1 + skipChars;
        }

        if (alignment == TextAlignment.Left || alignment == TextAlignment.Center)
        {
            GUILayout.FlexibleSpace();
        }

        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Пример #3
0
        // Draws one side of the tool.
        private void DrawHandGUI(BKI_Hand hand)
        {
            Rect r  = handGUIContainer;
            Rect r2 = handRect;

            if (hand == BKI_Hand.right)
            {
                r.x = r.x + (WINDOW_MAX_SIZE_X / 2) - 3;
            }

            r.width  += (DEFAULT_AREA_PADDING);
            r2.width += (DEFAULT_AREA_PADDING / 4);

            GUILayout.BeginArea(r);
            {
                GUI.DrawTexture(r2, containerHandTex2D);
                EditorGUILayout.BeginVertical();
                {
                    DrawHandTitle(hand);

                    DrawBooleans(hand);

                    GUILayout.Space(108);

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(12);
                        GUILayout.Label("Requires clench:");
                        ((hand == BKI_Hand.right) ? rightHandValues : leftHandValues).requiresClench = EditorGUILayout.Toggle(((hand == BKI_Hand.right) ? rightHandValues : leftHandValues).requiresClench);
                        GUILayout.Space(84);
                    }
                    EditorGUILayout.EndHorizontal();

                    BKI_GestureMirrorClass values = (hand == BKI_Hand.right) ? rightHandValues : leftHandValues;
                    DrawHandImages(hand, values, baseHandRect);

                    GUILayout.Space(WINDOW_MAX_SIZE_Y * 0.37f);

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(16);
                        EditorGUILayout.BeginVertical();
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                GUILayout.Label("Gesture identifier:");
                                ((hand == BKI_Hand.right) ? rightHandValues : leftHandValues).gestureIdentifier = EditorGUILayout.TextField(((hand == BKI_Hand.right) ? rightHandValues : leftHandValues).gestureIdentifier, GUILayout.Width(128));
                                GUILayout.Space(128);
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        EditorGUILayout.EndVertical();
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    {
                        DrawButtonsSingle(hand);
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
            }
            GUILayout.EndArea();
        }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_Friend: " + m_Friend);
        GUILayout.Label("m_Clan: " + m_Clan);
        GUILayout.Label("m_CoPlayFriend: " + m_CoPlayFriend);
        GUILayout.Label("m_SmallAvatar:");
        GUILayout.Label(m_SmallAvatar);
        GUILayout.Label("m_MediumAvatar:");
        GUILayout.Label(m_MediumAvatar);
        GUILayout.Label("m_LargeAvatar:");
        GUILayout.Label(m_LargeAvatar);
        GUILayout.EndArea();

        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("GetPersonaName() : " + SteamFriends.GetPersonaName());

        if (GUILayout.Button("SetPersonaName(SteamFriends.GetPersonaName())"))
        {
            SteamAPICall_t handle = SteamFriends.SetPersonaName(SteamFriends.GetPersonaName());
            OnSetPersonaNameResponseCallResult.Set(handle);
            print("SteamFriends.SetPersonaName(" + SteamFriends.GetPersonaName() + ") : " + handle);
        }

        GUILayout.Label("GetPersonaState() : " + SteamFriends.GetPersonaState());

        GUILayout.Label("GetFriendCount(EFriendFlags.k_EFriendFlagImmediate) : " + SteamFriends.GetFriendCount(EFriendFlags.k_EFriendFlagImmediate));

        {
            m_Friend = SteamFriends.GetFriendByIndex(0, EFriendFlags.k_EFriendFlagImmediate);
            GUILayout.Label("GetFriendByIndex(0, EFriendFlags.k_EFriendFlagImmediate) : " + m_Friend);
        }

        GUILayout.Label("GetFriendRelationship(m_Friend) : " + SteamFriends.GetFriendRelationship(m_Friend));

        GUILayout.Label("GetFriendPersonaState(m_Friend) : " + SteamFriends.GetFriendPersonaState(m_Friend));

        GUILayout.Label("GetFriendPersonaName(m_Friend) : " + SteamFriends.GetFriendPersonaName(m_Friend));

        {
            var  fgi = new FriendGameInfo_t();
            bool ret = SteamFriends.GetFriendGamePlayed(m_Friend, out fgi);
            GUILayout.Label("GetFriendGamePlayed(m_Friend, out fgi) : " + ret + " -- " + fgi.m_gameID + " -- " + fgi.m_unGameIP + " -- " + fgi.m_usGamePort + " -- " + fgi.m_usQueryPort + " -- " + fgi.m_steamIDLobby);
        }

        GUILayout.Label("GetFriendPersonaNameHistory(m_Friend, 1) : " + SteamFriends.GetFriendPersonaNameHistory(m_Friend, 1));

        GUILayout.Label("GetFriendSteamLevel(m_Friend) : " + SteamFriends.GetFriendSteamLevel(m_Friend));

        GUILayout.Label("GetPlayerNickname(m_Friend) : " + SteamFriends.GetPlayerNickname(m_Friend));

        {
            int FriendsGroupCount = SteamFriends.GetFriendsGroupCount();
            GUILayout.Label("GetFriendsGroupCount() : " + FriendsGroupCount);

            if (FriendsGroupCount > 0)
            {
                FriendsGroupID_t FriendsGroupID = SteamFriends.GetFriendsGroupIDByIndex(0);
                GUILayout.Label("SteamFriends.GetFriendsGroupIDByIndex(0) : " + FriendsGroupID);

                GUILayout.Label("GetFriendsGroupName(FriendsGroupID) : " + SteamFriends.GetFriendsGroupName(FriendsGroupID));

                int FriendsGroupMembersCount = SteamFriends.GetFriendsGroupMembersCount(FriendsGroupID);
                GUILayout.Label("GetFriendsGroupMembersCount(FriendsGroupID) : " + FriendsGroupMembersCount);

                if (FriendsGroupMembersCount > 0)
                {
                    CSteamID[] FriendsGroupMembersList = new CSteamID[FriendsGroupMembersCount];
                    SteamFriends.GetFriendsGroupMembersList(FriendsGroupID, FriendsGroupMembersList, FriendsGroupMembersCount);
                    GUILayout.Label("GetFriendsGroupMembersList(FriendsGroupID, FriendsGroupMembersList, FriendsGroupMembersCount) : " + FriendsGroupMembersList[0]);
                }
            }
        }

        GUILayout.Label("HasFriend(m_Friend, EFriendFlags.k_EFriendFlagImmediate) : " + SteamFriends.HasFriend(m_Friend, EFriendFlags.k_EFriendFlagImmediate));

        GUILayout.Label("GetClanCount() : " + SteamFriends.GetClanCount());

        m_Clan = SteamFriends.GetClanByIndex(0);
        GUILayout.Label("GetClanByIndex(0) : " + m_Clan);

        GUILayout.Label("GetClanName(m_Clan) : " + SteamFriends.GetClanName(m_Clan));

        GUILayout.Label("GetClanTag(m_Clan) : " + SteamFriends.GetClanTag(m_Clan));

        {
            int  Online;
            int  InGame;
            int  Chatting;
            bool ret = SteamFriends.GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting);
            GUILayout.Label("GetClanActivityCounts(m_Clan, out Online, out InGame, out Chatting) : " + ret + " -- " + Online + " -- " + InGame + " -- " + Chatting);
        }

        if (GUILayout.Button("DownloadClanActivityCounts(Clans, Clans.Length)"))
        {
            CSteamID[]     Clans  = { m_Clan, TestConstants.Instance.k_SteamId_Group_SteamUniverse };
            SteamAPICall_t handle = SteamFriends.DownloadClanActivityCounts(Clans, Clans.Length);
            OnDownloadClanActivityCountsResultCallResult.Set(handle);             // This call never seems to produce the CallResult.
            OnDownloadClanActivityCountsResultCallResult.Set(handle);
            print("SteamFriends.DownloadClanActivityCounts(" + Clans + ", " + Clans.Length + ") : " + handle);
        }

        {
            int FriendCount = SteamFriends.GetFriendCountFromSource(m_Clan);
            GUILayout.Label("GetFriendCountFromSource(m_Clan) : " + FriendCount);

            if (FriendCount > 0)
            {
                GUILayout.Label("GetFriendFromSourceByIndex(m_Clan, 0) : " + SteamFriends.GetFriendFromSourceByIndex(m_Clan, 0));
            }
        }

        GUILayout.Label("IsUserInSource(m_Friend, m_Clan) : " + SteamFriends.IsUserInSource(m_Friend, m_Clan));

        if (GUILayout.Button("SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false)"))
        {
            SteamFriends.SetInGameVoiceSpeaking(SteamUser.GetSteamID(), false);
            print("SteamFriends.SetInGameVoiceSpeaking(" + SteamUser.GetSteamID() + ", " + false + ")");
        }

        if (GUILayout.Button("ActivateGameOverlay(\"Friends\")"))
        {
            SteamFriends.ActivateGameOverlay("Friends");
            print("SteamFriends.ActivateGameOverlay(" + "\"Friends\"" + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToUser(\"friendadd\", TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.ActivateGameOverlayToUser("friendadd", TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.ActivateGameOverlayToUser(" + "\"friendadd\"" + ", " + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToWebPage(\"http://steamworks.github.io\")"))
        {
            SteamFriends.ActivateGameOverlayToWebPage("http://steamworks.github.io");
            print("SteamFriends.ActivateGameOverlayToWebPage(" + "\"http://steamworks.github.io\"" + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayToStore(TestConstants.Instance.k_AppId_TeamFortress2, EOverlayToStoreFlag.k_EOverlayToStoreFlag_None)"))
        {
            SteamFriends.ActivateGameOverlayToStore(TestConstants.Instance.k_AppId_TeamFortress2, EOverlayToStoreFlag.k_EOverlayToStoreFlag_None);
            print("SteamFriends.ActivateGameOverlayToStore(" + TestConstants.Instance.k_AppId_TeamFortress2 + ", " + EOverlayToStoreFlag.k_EOverlayToStoreFlag_None + ")");
        }

        if (GUILayout.Button("SetPlayedWith(TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.SetPlayedWith(TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.SetPlayedWith(" + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("ActivateGameOverlayInviteDialog(TestConstants.Instance.k_SteamId_rlabrecque)"))
        {
            SteamFriends.ActivateGameOverlayInviteDialog(TestConstants.Instance.k_SteamId_rlabrecque);
            print("SteamFriends.ActivateGameOverlayInviteDialog(" + TestConstants.Instance.k_SteamId_rlabrecque + ")");
        }

        if (GUILayout.Button("GetSmallFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetSmallFriendAvatar(m_Friend);
            print("SteamFriends.GetSmallFriendAvatar(" + m_Friend + ") : " + ret);
            m_SmallAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("GetMediumFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetMediumFriendAvatar(m_Friend);
            print("SteamFriends.GetMediumFriendAvatar(" + m_Friend + ") : " + ret);
            m_MediumAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("GetLargeFriendAvatar(m_Friend)"))
        {
            int ret = SteamFriends.GetLargeFriendAvatar(m_Friend);
            print("SteamFriends.GetLargeFriendAvatar(" + m_Friend + ") : " + ret);
            m_LargeAvatar = SteamUtilsTest.GetSteamImageAsTexture2D(ret);
        }

        if (GUILayout.Button("RequestUserInformation(m_Friend, false)"))
        {
            bool ret = SteamFriends.RequestUserInformation(m_Friend, false);
            print("SteamFriends.RequestUserInformation(" + m_Friend + ", " + false + ") : " + ret);
        }

        if (GUILayout.Button("RequestClanOfficerList(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.RequestClanOfficerList(m_Clan);
            OnClanOfficerListResponseCallResult.Set(handle);
            print("SteamFriends.RequestClanOfficerList(" + m_Clan + ") : " + handle);
        }

        GUILayout.Label("GetClanOwner(m_Clan) : " + SteamFriends.GetClanOwner(m_Clan));

        GUILayout.Label("GetClanOfficerCount(m_Clan) : " + SteamFriends.GetClanOfficerCount(m_Clan));

        GUILayout.Label("GetClanOfficerByIndex(m_Clan, 0) : " + SteamFriends.GetClanOfficerByIndex(m_Clan, 0));

        GUILayout.Label("GetUserRestrictions() : " + SteamFriends.GetUserRestrictions());

        if (GUILayout.Button("SetRichPresence(\"status\", \"Testing 1.. 2.. 3..\")"))
        {
            bool ret = SteamFriends.SetRichPresence("status", "Testing 1.. 2.. 3..");
            print("SteamFriends.SetRichPresence(" + "\"status\"" + ", " + "\"Testing 1.. 2.. 3..\"" + ") : " + ret);
        }

        if (GUILayout.Button("ClearRichPresence()"))
        {
            SteamFriends.ClearRichPresence();
            print("SteamFriends.ClearRichPresence()");
        }

        GUILayout.Label("GetFriendRichPresence(SteamUser.GetSteamID(), \"status\") : " + SteamFriends.GetFriendRichPresence(SteamUser.GetSteamID(), "status"));

        GUILayout.Label("GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()) : " + SteamFriends.GetFriendRichPresenceKeyCount(SteamUser.GetSteamID()));

        GUILayout.Label("GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0) : " + SteamFriends.GetFriendRichPresenceKeyByIndex(SteamUser.GetSteamID(), 0));

        if (GUILayout.Button("RequestFriendRichPresence(m_Friend)"))
        {
            SteamFriends.RequestFriendRichPresence(m_Friend);
            print("SteamFriends.RequestFriendRichPresence(" + m_Friend + ")");
        }

        if (GUILayout.Button("InviteUserToGame(SteamUser.GetSteamID(), \"testing\")"))
        {
            bool ret = SteamFriends.InviteUserToGame(SteamUser.GetSteamID(), "testing");
            print("SteamFriends.InviteUserToGame(" + SteamUser.GetSteamID() + ", " + "\"testing\"" + ") : " + ret);
        }

        GUILayout.Label("GetCoplayFriendCount() : " + SteamFriends.GetCoplayFriendCount());

        if (GUILayout.Button("GetCoplayFriend(0)"))
        {
            m_CoPlayFriend = SteamFriends.GetCoplayFriend(0);
            print("SteamFriends.GetCoplayFriend(" + 0 + ") : " + m_CoPlayFriend);
        }

        GUILayout.Label("GetFriendCoplayTime(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayTime(m_CoPlayFriend));

        GUILayout.Label("GetFriendCoplayGame(m_CoPlayFriend) : " + SteamFriends.GetFriendCoplayGame(m_CoPlayFriend));

        if (GUILayout.Button("JoinClanChatRoom(m_Clan)"))
        {
            SteamAPICall_t handle = SteamFriends.JoinClanChatRoom(m_Clan);
            OnJoinClanChatRoomCompletionResultCallResult.Set(handle);
            print("SteamFriends.JoinClanChatRoom(" + m_Clan + ") : " + handle);
        }

        if (GUILayout.Button("LeaveClanChatRoom(m_Clan)"))
        {
            bool ret = SteamFriends.LeaveClanChatRoom(m_Clan);
            print("SteamFriends.LeaveClanChatRoom(" + m_Clan + ") : " + ret);
        }

        GUILayout.Label("GetClanChatMemberCount(m_Clan) : " + SteamFriends.GetClanChatMemberCount(m_Clan));

        GUILayout.Label("GetChatMemberByIndex(m_Clan, 0) : " + SteamFriends.GetChatMemberByIndex(m_Clan, 0));

        if (GUILayout.Button("SendClanChatMessage(m_Clan, \"Test\")"))
        {
            bool ret = SteamFriends.SendClanChatMessage(m_Clan, "Test");
            print("SteamFriends.SendClanChatMessage(" + m_Clan + ", " + "\"Test\"" + ") : " + ret);
        }

        //GUILayout.Label("SteamFriends.GetClanChatMessage() : " + SteamFriends.GetClanChatMessage()); // N/A - Must be called from within the callback OnGameConnectedClanChatMsg

        GUILayout.Label("IsClanChatAdmin(m_Clan, m_Friend) : " + SteamFriends.IsClanChatAdmin(m_Clan, m_Friend));

        GUILayout.Label("IsClanChatWindowOpenInSteam(m_Clan) : " + SteamFriends.IsClanChatWindowOpenInSteam(m_Clan));

        if (GUILayout.Button("OpenClanChatWindowInSteam(m_Clan)"))
        {
            bool ret = SteamFriends.OpenClanChatWindowInSteam(m_Clan);
            print("SteamFriends.OpenClanChatWindowInSteam(" + m_Clan + ") : " + ret);
        }

        if (GUILayout.Button("CloseClanChatWindowInSteam(m_Clan)"))
        {
            bool ret = SteamFriends.CloseClanChatWindowInSteam(m_Clan);
            print("SteamFriends.CloseClanChatWindowInSteam(" + m_Clan + ") : " + ret);
        }

        if (GUILayout.Button("SetListenForFriendsMessages(true)"))
        {
            bool ret = SteamFriends.SetListenForFriendsMessages(true);
            print("SteamFriends.SetListenForFriendsMessages(" + true + ") : " + ret);
        }

        if (GUILayout.Button("ReplyToFriendMessage(SteamUser.GetSteamID(), \"Testing!\")"))
        {
            bool ret = SteamFriends.ReplyToFriendMessage(SteamUser.GetSteamID(), "Testing!");
            print("SteamFriends.ReplyToFriendMessage(" + SteamUser.GetSteamID() + ", " + "\"Testing!\"" + ") : " + ret);
        }

        //GUILayout.Label("SteamFriends.GetFriendMessage() : " + SteamFriends.GetFriendMessage()); // N/A - Must be called from within the callback OnGameConnectedFriendChatMsg

        if (GUILayout.Button("GetFollowerCount(SteamUser.GetSteamID())"))
        {
            SteamAPICall_t handle = SteamFriends.GetFollowerCount(SteamUser.GetSteamID());
            OnFriendsGetFollowerCountCallResult.Set(handle);
            print("SteamFriends.GetFollowerCount(" + SteamUser.GetSteamID() + ") : " + handle);
        }

        if (GUILayout.Button("IsFollowing(m_Friend)"))
        {
            SteamAPICall_t handle = SteamFriends.IsFollowing(m_Friend);
            OnFriendsIsFollowingCallResult.Set(handle);
            print("SteamFriends.IsFollowing(" + m_Friend + ") : " + handle);
        }

        if (GUILayout.Button("EnumerateFollowingList(0)"))
        {
            SteamAPICall_t handle = SteamFriends.EnumerateFollowingList(0);
            OnFriendsEnumerateFollowingListCallResult.Set(handle);
            print("SteamFriends.EnumerateFollowingList(" + 0 + ") : " + handle);
        }

        GUILayout.Label("IsClanPublic(m_Clan) : " + SteamFriends.IsClanPublic(m_Clan));

        GUILayout.Label("IsClanOfficialGameGroup(m_Clan) : " + SteamFriends.IsClanOfficialGameGroup(m_Clan));

        GUILayout.Label("GetNumChatsWithUnreadPriorityMessages() : " + SteamFriends.GetNumChatsWithUnreadPriorityMessages());

        if (GUILayout.Button("ActivateGameOverlayRemotePlayTogetherInviteDialog(m_Friend)"))
        {
            SteamFriends.ActivateGameOverlayRemotePlayTogetherInviteDialog(m_Friend);
            print("SteamFriends.ActivateGameOverlayRemotePlayTogetherInviteDialog(" + m_Friend + ")");
        }

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Пример #5
0
    void OnGUI()
    {
        GUILayoutOption[] width200 = new GUILayoutOption[] { GUILayout.Width(200) };

        GUILayout.BeginArea(new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 100, 400, 200));

        GUILayout.BeginVertical();
        GUILayout.Label("Time Left:" + this.timeLeft.ToString("0.000"));
        if (this.gs == gameState.waiting || this.gs == gameState.running)
        {
            if (GUILayout.Button("Click me as much as you can in " + this.startTime.ToString("0") + " seconds!"))
            {
                this.totalScore++;
                this.gs = gameState.running;
            }

            GUILayout.Label("Total Score: " + this.totalScore.ToString());
        }



        if (this.gs == gameState.enterscore)
        {
            GUILayout.Label("Total Score: " + this.totalScore.ToString());
            GUILayout.BeginHorizontal();
            GUILayout.Label("Your Name: ");
            this.playerName = GUILayout.TextField(this.playerName, width200);

            if (GUILayout.Button("Save Score"))
            {
                // add the score...
                dl.AddScore(this.playerName, totalScore);

                this.gs = gameState.leaderboard;
            }
            GUILayout.EndHorizontal();
        }

        if (this.gs == gameState.leaderboard)
        {
            GUILayout.Label("High Scores:");
            dreamloLeaderBoard.Score[] scoreList = dl.ToScoreArray();

            if (scoreList == null)
            {
                GUILayout.Label("(loading...)");
            }
            else
            {
                foreach (dreamloLeaderBoard.Score currentScore in scoreList)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(currentScore.playerName, width200);
                    GUILayout.Label(currentScore.score.ToString(), width200);
                    GUILayout.EndHorizontal();
                }
            }
        }

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Пример #6
0
    void OnGUI()
    {
        //#region ObjectField
        //Object dataObj = null;
        //dataObj = EditorGUILayout.ObjectField(dataObj, typeof(DataManager), false);
        //data = dataObj as DataManager;
        //#endregion

        #region Buttons
        EditorGUILayout.BeginHorizontal();
        Dictionary <string, string> outLang;
        List <string> popDialog = null;
        if (selectedLanguage != null && data.languages.TryGetValue(selectedLanguage, out outLang))
        {
            //selectedDialog = outLang.Keys.FirstOrDefault();
            popDialog = outLang.Keys.ToList();
        }
        //List<string> popLang = data.languages.Keys.ToList();
        if (GUILayout.Button("Previous"))
        {
            Debug.Log("Previous Text");
            selectedDialog = popDialog[(selectPopDialog - 1 + totalDialog - 2) % (totalDialog - 2)];
            Debug.Log(selectedDialog);
        }
        if (GUILayout.Button("Next"))
        {
            Debug.Log("Next Text");
            selectedDialog = popDialog[(selectPopDialog + 1) % (totalDialog - 2)];
        }
        if (GUILayout.Button("Add Lang"))
        {
            Debug.Log("Added Language");
            wizard = AddLanguageWizard.CreateInstance <AddLanguageWizard>();
            wizard.Show();
        }

        EditorGUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Load Text"))
        {
            Debug.Log("Loading All Text...");
        }
        if (GUILayout.Button("Save Changes"))
        {
            Debug.Log("Saving Changes");
            //SaveTextDebug(translatedText);
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region Popup
        Rect popup = new Rect(new Vector2(0, 2 * EditorGUIUtility.singleLineHeight), new Vector2(this.position.width, EditorGUIUtility.singleLineHeight));

        if (localizedLanguages.Count > 0)
        {
            List <string> popLang = data.languages.Keys.ToList();
            selectedLanguage = popLang[EditorGUI.Popup(popup, selectPopLanguage, options.ToArray())];
        }
        #endregion

        #region OriginalText
        GUILayout.BeginArea(new Rect(0, 3 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        GUILayout.TextArea(GetTextDebug(data.languages.Keys.FirstOrDefault(), selectedDialog), GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion

        #region LocalizedText
        GUILayout.BeginArea(new Rect(0, 10 * EditorGUIUtility.singleLineHeight, this.position.width, EditorGUIUtility.singleLineHeight * 6));
        EditorGUILayout.BeginHorizontal();
        translatedText = GUILayout.TextArea(translatedText, GUILayout.Height(position.height - 30));
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
        #endregion
    }
Пример #7
0
 /// <summary>
 /// Use this at the end of an OnGUI call in order to shake OnGUI with
 /// Camera Shake (uses GUILayout).
 /// </summary>
 public void EndShakeGUILayout()
 {
     GUILayout.EndArea();
 }
Пример #8
0
    private void OnGUI()
    {
        if (overlay == null)
        {
            return;
        }

        var texture = overlay.texture as RenderTexture;

        var prevActive = RenderTexture.active;

        RenderTexture.active = texture;

        if (Event.current.type == EventType.Repaint)
        {
            GL.Clear(false, true, Color.clear);
        }

        var area = new Rect(0, 0, texture.width, texture.height);

        // Account for screen smaller than texture (since mouse position gets clamped)
        if (Screen.width < texture.width)
        {
            area.width         = Screen.width;
            overlay.uvOffset.x = -(float)(texture.width - Screen.width) / (2 * texture.width);
        }
        if (Screen.height < texture.height)
        {
            area.height        = Screen.height;
            overlay.uvOffset.y = (float)(texture.height - Screen.height) / (2 * texture.height);
        }

        GUILayout.BeginArea(area);

        if (background != null)
        {
            GUI.DrawTexture(new Rect(
                                (area.width - background.width) / 2,
                                (area.height - background.height) / 2,
                                background.width, background.height), background);
        }

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();

        if (logo != null)
        {
            GUILayout.Space(area.height / 2 - logoHeight);
            GUILayout.Box(logo);
        }

        GUILayout.Space(menuOffset);

        var bHideMenu = GUILayout.Button("[Esc] - Close menu");

        GUILayout.BeginHorizontal();
        GUILayout.Label(string.Format("Scale: {0:N4}", scale));
        {
            var result = GUILayout.HorizontalSlider(scale, scaleLimits.x, scaleLimits.y);
            if (result != scale)
            {
                SetScale(result);
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label(string.Format("Scale limits:"));
        {
            var result = GUILayout.TextField(scaleLimitX);
            if (result != scaleLimitX)
            {
                if (float.TryParse(result, out scaleLimits.x))
                {
                    scaleLimitX = result;
                }
            }
        }
        {
            var result = GUILayout.TextField(scaleLimitY);
            if (result != scaleLimitY)
            {
                if (float.TryParse(result, out scaleLimits.y))
                {
                    scaleLimitY = result;
                }
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label(string.Format("Scale rate:"));
        {
            var result = GUILayout.TextField(scaleRateText);
            if (result != scaleRateText)
            {
                if (float.TryParse(result, out scaleRate))
                {
                    scaleRateText = result;
                }
            }
        }
        GUILayout.EndHorizontal();

        if (SteamVR.active)
        {
            var vr = SteamVR.instance;

            GUILayout.BeginHorizontal();
            {
                var t   = SteamVR_Camera.sceneResolutionScale;
                var w   = (int)(vr.sceneWidth * t);
                var h   = (int)(vr.sceneHeight * t);
                var pct = (int)(100.0f * t);
                GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", w, h, pct));
                var result = Mathf.RoundToInt(GUILayout.HorizontalSlider(pct, 50, 200));
                if (result != pct)
                {
                    SteamVR_Camera.sceneResolutionScale = (float)result / 100.0f;
                }
            }
            GUILayout.EndHorizontal();
        }

        overlay.highquality = GUILayout.Toggle(overlay.highquality, "High quality");

        if (overlay.highquality)
        {
            overlay.curved    = GUILayout.Toggle(overlay.curved, "Curved overlay");
            overlay.antialias = GUILayout.Toggle(overlay.antialias, "Overlay RGSS(2x2)");
        }
        else
        {
            overlay.curved    = false;
            overlay.antialias = false;
        }

        var tracker = SteamVR_Render.Top();

        if (tracker != null)
        {
            tracker.wireframe = GUILayout.Toggle(tracker.wireframe, "Wireframe");

            var render = SteamVR_Render.instance;
            if (render.trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
            {
                if (GUILayout.Button("Switch to Standing"))
                {
                    render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseStanding;
                }
                if (GUILayout.Button("Center View"))
                {
                    var system = OpenVR.System;
                    if (system != null)
                    {
                        system.ResetSeatedZeroPose();
                    }
                }
            }
            else
            {
                if (GUILayout.Button("Switch to Seated"))
                {
                    render.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseSeated;
                }
            }
        }

#if !UNITY_EDITOR
        if (GUILayout.Button("Exit"))
        {
            Application.Quit();
        }
#endif
        GUILayout.Space(menuOffset);

        var env = System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
        if (env != null)
        {
            GUILayout.Label("VR_OVERRIDE=" + env);
        }

        GUILayout.Label("Graphics device: " + SystemInfo.graphicsDeviceVersion);

        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        if (cursor != null)
        {
            float x = Input.mousePosition.x, y = Screen.height - Input.mousePosition.y;
            float w = cursor.width, h = cursor.height;
            GUI.DrawTexture(new Rect(x, y, w, h), cursor);
        }

        RenderTexture.active = prevActive;

        if (bHideMenu)
        {
            HideMenu();
        }
    }
Пример #9
0
    public void OnGUI()
    {
        float scale = Screen.height / ORIGINAL_HEIGHT;

        // Center scaled gui
        float offset = (Screen.width / 2.0f) / scale;

        Matrix4x4 oldMatrix = GUI.matrix;

        GUI.matrix  = Matrix4x4.identity;
        GUI.matrix *= Matrix4x4.Scale(new Vector3(scale, scale, 1));
        GUI.matrix *= Matrix4x4.TRS(new Vector3(offset, 0, 0), Quaternion.identity, Vector3.one);

        if (!enableGUI || LevelSelectGUI.menuState != LevelSelectGUI.MenuState.OPTIONS)
        {
            return;
        }

        float labelWidth = ORIGINAL_WIDTH * 0.3f;

        // Save and switch skin
        GUISkin old = GUI.skin;

        GUI.skin = skin;

#if UNITY_IPHONE || UNITY_ANDROID
        // Phones
        GUILayout.BeginArea(new Rect(ORIGINAL_WIDTH * -0.45f, ORIGINAL_HEIGHT * 0.35f, ORIGINAL_WIDTH * 0.8f, ORIGINAL_HEIGHT * 0.6f));

        // Networking

        /*
         *      GUILayout.BeginHorizontal();
         *
         *              GUILayout.Label("Networking", GUILayout.Width(labelWidth));
         *
         *              if (GUILayout.SelectionGrid((networking ? 1 : 0), new string[] { "Off", "On" }, 2) == 0)
         *                      networking = false;
         *              else
         *                      networking = true;
         *
         *      GUILayout.EndHorizontal();
         */

        // Sensitivity slider
        GUILayout.BeginHorizontal();

        //GUI.skin.label.alignment = TextAnchor.UpperLeft;
        GUILayout.Label("Turning sensitivity", GUILayout.Width(labelWidth));
        //GUI.skin.label.alignment = TextAnchor.MiddleCenter;

        sensitivity = GUILayout.HorizontalSlider(sensitivity, 0.3f, 1.7f);

        GUILayout.EndHorizontal();

        // Audio
        //GUILayout.Label("Audio");

        // Master volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("Master Volume", GUILayout.Width(labelWidth));
        mastervolume = GUILayout.HorizontalSlider(mastervolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        // Music volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("BGM Volume", GUILayout.Width(labelWidth));
        bgmvolume = GUILayout.HorizontalSlider(bgmvolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        // Sound effect volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("SFX Volume", GUILayout.Width(labelWidth));
        sfxvolume = GUILayout.HorizontalSlider(sfxvolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        /*if (GUILayout.Button("WHATEVER YOU DO DONT DO IT"))
         * {
         *      current = Screen.resolutions[currentResolution];
         *      Screen.SetResolution(current.width, current.height, false);
         *      UpdateSettings();
         *      Save();
         * }*/

        GUILayout.EndArea();
#else
        #if UNITY_IPHONE || UNITY_ANDROID
        // Phones
        GUILayout.BeginArea(new Rect(ORIGINAL_WIDTH * -0.3f, ORIGINAL_HEIGHT * 0.4f, ORIGINAL_WIDTH * 0.6f, ORIGINAL_HEIGHT * 0.6f));
        #else
        current = Screen.resolutions[currentResolution];

        // PC
        GUILayout.BeginArea(new Rect(ORIGINAL_WIDTH * -0.475f, ORIGINAL_HEIGHT * 0.35f, ORIGINAL_WIDTH * 0.425f, ORIGINAL_HEIGHT * 0.65f));

        // Resolution
        GUILayout.BeginHorizontal();

        GUILayout.Label("Resolution", GUILayout.Width(180));

        // Previous button
        if (GUILayout.Button("<"))
        {
            currentResolution = Mathf.Clamp(currentResolution - 1, 0, Screen.resolutions.Length - 1);
        }

        // Current selection
        Font       oldfont  = GUI.skin.label.font;
        TextAnchor oldalign = GUI.skin.label.alignment;
        GUI.skin.label.alignment = TextAnchor.MiddleCenter;
        GUI.skin.label.font      = GUI.skin.button.font;
        GUILayout.Label(current.width + ", " + current.height);
        GUI.skin.label.alignment = oldalign;
        GUI.skin.label.font      = oldfont;

        // Next button
        if (GUILayout.Button(">"))
        {
            currentResolution = Mathf.Clamp(currentResolution + 1, 0, Screen.resolutions.Length - 1);
        }

        GUILayout.EndHorizontal();

        // Whether or not to be fullscreen
        GUILayout.BeginHorizontal();

        GUILayout.Label("Display", GUILayout.Width(180));
        fullscreen = GUILayout.SelectionGrid(fullscreen, new string[] { "Windowed", "Fullscreen" }, 2);

        GUILayout.EndHorizontal();

        // Quality
        GUILayout.BeginHorizontal();

        GUILayout.Label("Quality", GUILayout.Width(180));

        if (GUILayout.Button("Low"))
        {
            SetQuality(0);
        }
        else if (GUILayout.Button("Medium"))
        {
            SetQuality(1);
        }
        else if (GUILayout.Button("High"))
        {
            SetQuality(2);
        }
        else if (GUILayout.Button("Ultra"))
        {
            SetQuality(3);
        }

        GUILayout.EndHorizontal();

        // Seperator
        GUILayout.Label("");
        #endif

        // Networking

        /*
         *      GUILayout.BeginHorizontal();
         *
         *              GUILayout.Label("Networking", GUILayout.Width(260));
         *
         *              if (GUILayout.SelectionGrid((networking ? 1 : 0), new string[] { "Off", "On" }, 2) == 0)
         *                      networking = false;
         *              else
         *                      networking = true;
         *
         *      GUILayout.EndHorizontal();
         */

        #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_MAC || UNITY_STANDALONE_LINUX || UNITY_WEBPLAYER
        // Seperator
        GUILayout.Label("");
        #endif

        // Controls
        //GUILayout.Label("Controls");

        // Sensitivity slider
        GUILayout.BeginHorizontal();

        //GUI.skin.label.alignment = TextAnchor.UpperLeft;
        GUILayout.Label("Turning sensitivity", GUILayout.Width(260));
        //GUI.skin.label.alignment = TextAnchor.MiddleCenter;

        sensitivity = GUILayout.HorizontalSlider(sensitivity, 0.3f, 1.7f);

        GUILayout.EndHorizontal();

        #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_MAC || UNITY_STANDALONE_LINUX || UNITY_WEBPLAYER
        // Seperator
        GUILayout.Label("");
        #endif

        // Audio
        //GUILayout.Label("Audio");

        // Master volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("Master Volume", GUILayout.Width(260));
        mastervolume = GUILayout.HorizontalSlider(mastervolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        // Music volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("BGM Volume", GUILayout.Width(260));
        bgmvolume = GUILayout.HorizontalSlider(bgmvolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        // Sound effect volume
        GUILayout.BeginHorizontal();

        GUILayout.Label("SFX Volume", GUILayout.Width(260));
        sfxvolume = GUILayout.HorizontalSlider(sfxvolume, 0.0f, 1.0f);

        GUILayout.EndHorizontal();

        /*if (GUILayout.Button("WHATEVER YOU DO DONT DO IT"))
         * {
         *      current = Screen.resolutions[currentResolution];
         *      Screen.SetResolution(current.width, current.height, false);
         *      UpdateSettings();
         *      Save();
         * }*/

        GUILayout.EndArea();

        // Only show advanced on PC
        #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_MAC || UNITY_STANDALONE_LINUX || UNITY_WEBPLAYER
        // Advanced area
        GUILayout.BeginArea(new Rect(0.025f * ORIGINAL_WIDTH, 0.35f * ORIGINAL_HEIGHT, 0.425f * ORIGINAL_WIDTH, 0.65f * ORIGINAL_HEIGHT));

        GUILayout.BeginHorizontal();

        GUILayout.Label("Advanced", GUILayout.Width(160));

        if (GUILayout.SelectionGrid((advanced ? 1 : 0), new string[] { "Hide", "Show" }, 2) == 0)
        {
            advanced = false;
        }
        else
        {
            advanced = true;
        }

        GUILayout.EndHorizontal();

        if (advanced)
        {
            // Seperator
            GUILayout.Label("");

            // Anti-aliasing level
            GUILayout.BeginHorizontal();

            GUILayout.Label("Anti-aliasing", GUILayout.Width(160));

            // Previous button
            if (GUILayout.Button("<"))
            {
                aalevel = Mathf.Clamp(aalevel - 1, 0, AA_LEVELS.Length - 1);
            }

            // Current selection
            oldfont  = GUI.skin.label.font;
            oldalign = GUI.skin.label.alignment;
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUI.skin.label.font      = GUI.skin.button.font;
            GUILayout.Label(AA_LEVELS[aalevel] + "x");
            GUI.skin.label.alignment = oldalign;
            GUI.skin.label.font      = oldfont;

            // Next button
            if (GUILayout.Button(">"))
            {
                aalevel = Mathf.Clamp(aalevel + 1, 0, AA_LEVELS.Length - 1);
            }

            GUILayout.EndHorizontal();

            // Anisotropic filtering
            GUILayout.BeginHorizontal();

            GUILayout.Label("Filtering", GUILayout.Width(160));

            aniso = GUILayout.SelectionGrid(aniso, new string[] { "Off", "On" }, 2);

            GUILayout.EndHorizontal();

            // Vsync
            GUILayout.BeginHorizontal();

            GUILayout.Label("Vertical Sync", GUILayout.Width(160));

            vsync = GUILayout.SelectionGrid(vsync, new string[] { "Off", "On" }, 2);

            GUILayout.EndHorizontal();

            // Texture resolution
            GUILayout.BeginHorizontal();

            GUILayout.Label("Texture Res", GUILayout.Width(160));

            textureres = GUILayout.SelectionGrid(textureres, new string[] { "Low", "Medium", "High" }, 3);

            GUILayout.EndHorizontal();
        }

        // Advanced area
        GUILayout.EndArea();
        #endif
#endif

        // Restore skin
        GUI.skin = old;

        // Restore matrix
        GUI.matrix = oldMatrix;
    }
Пример #10
0
    // Main Window function of browser, used to draw GUI
    void windowFunction(int windowID)
    {
        GUI.skin = Skin;

        UWKWebView view = null;

        if (numTabs != 0)
        {
            view = tabs [activeTab].View;
        }

        GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);

        buttonStyle.padding = new RectOffset(2, 2, 2, 2);

        GUI.color   = new Color(1.0f, 1.0f, 1.0f, transparency);
        browserRect = new Rect(4, 118 + 8, Width, Height);

        Rect headerRect = new Rect(4, 4, Width, 118 + 4);

        GUI.DrawTexture(headerRect, texHeader);

        int  titleHeight = 24;
        Rect titleRect   = new Rect(0, 0, Width, titleHeight);

        GUI.DragWindow(titleRect);

        GUILayout.BeginVertical();
        // Main Vertical
        GUILayout.BeginArea(new Rect(8, 4, Width, 118));

        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical();

        // title
        Texture2D bxTex = GUI.skin.box.normal.background;

        GUI.skin.box.normal.background = null;
        GUI.skin.box.normal.textColor  = new Color(.25f, .25f, .25f, 1.0f);

        //TODO: uWebKit3
        GUILayout.Box(view == null ? "" : view.Title);
        GUI.skin.box.normal.background = bxTex;

        GUILayout.BeginHorizontal();

        GUI.enabled = view != null && view.CanGoBack;

        if (GUILayout.Button(texBack, buttonStyle, GUILayout.Width(texBack.width), GUILayout.Height(texBack.height)))
        {
            if (view != null)
            {
                view.Back();
            }
        }

        GUI.enabled = view != null && view.CanGoForward;

        if (GUILayout.Button(texForward, buttonStyle, GUILayout.Width(texForward.width), GUILayout.Height(texForward.height)))
        {
            if (view != null)
            {
                view.Forward();
            }
        }

        GUI.enabled = view != null && !view.Loading;

        if (GUILayout.Button(texReload, buttonStyle, GUILayout.Width(texReload.width), GUILayout.Height(texReload.height)))
        {
            if (view != null)
            {
                view.LoadURL(currentURL);
            }
        }

        GUI.enabled = true;


        bool nav = false;

        if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter))
        {
            nav = true;
        }

        GUI.SetNextControlName("BrowserURL");

        currentURL = GUILayout.TextField(currentURL, GUILayout.MaxWidth(Width - 196));

        // this is grey for some reason
        if (pageLoadProgress != 100)
        {
            Rect urlRect = GUILayoutUtility.GetLastRect();
            urlRect.width *= (float)pageLoadProgress / 100.0f;
            GUI.DrawTexture(urlRect, texProgress);
        }

        if (nav && GUI.GetNameOfFocusedControl() == "BrowserURL")
        {
            GUIUtility.keyboardControl = 0;
            if (view != null)
            {
                string URL = currentURL.Replace(" ", "%20");

                if (!URL.Contains(".") && !URL.StartsWith("file://"))
                {
                    URL = "http://www.google.com/search?q=" + URL;
                }

                if (!URL.Contains("://"))
                {
                    URL = "http://" + URL;
                }

                currentURL = URL;
                view.LoadURL(URL);
            }
        }

        GUILayout.EndHorizontal();

        guiTabs(ref buttonStyle);

        GUILayout.EndVertical();
        buttonStyle.normal.background = null;

        buttonStyle.normal.background = null;
        buttonStyle.hover.background  = null;
        buttonStyle.active.background = null;
        buttonStyle.padding           = new RectOffset(0, 0, 0, 0);

        if (GUILayout.Button(texLogo, buttonStyle, GUILayout.Width(84), GUILayout.Height(100)))
        {
        }

        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        GUILayout.EndVertical();

        // End Main Vertical

        if (view != null)
        {
            view.DrawTexture(browserRect);
            //TODO: uWebKit3
            //view.DrawTextIME ((int)browserRect.x, (int)browserRect.y);
        }


        Rect footerRect = new Rect(4, browserRect.yMax, Width, 8);

        GUI.DrawTexture(footerRect, texFooter);
    }
Пример #11
0
        protected override void OldOnGUI()
        {
            const float space               = 10;
            const float largeSpace          = 20;
            const float standardButtonWidth = 32;
            const float dropdownWidth       = 80;
            const float playPauseStopWidth  = 140;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.color = isOrWillEnterPlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(largeSpace, ref pos);

            int playModeControlsStart = Mathf.RoundToInt((position.width - playPauseStopWidth) / 2);

            pos.x    += pos.width;
            pos.width = (playModeControlsStart - pos.x) - largeSpace;
            DoToolSettings(EditorToolGUI.GetThickArea(pos));

            // Position centered controls.
            pos = new Rect(playModeControlsStart, 0, 240, 0);

            if (ModeService.HasCapability(ModeCapability.Playbar, true))
            {
                GUILayout.BeginArea(EditorToolGUI.GetThickArea(pos));
                GUILayout.BeginHorizontal();
                {
                    if (!ModeService.Execute("gui_playbar", isOrWillEnterPlaymode))
                    {
                        DoPlayButtons(isOrWillEnterPlaymode);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(dropdownWidth, ref pos);
            DoLayoutDropDown(EditorToolGUI.GetThinArea(pos));

            if (ModeService.HasCapability(ModeCapability.Layers, true))
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                DoLayersDropDown(EditorToolGUI.GetThinArea(pos));
            }

            if (Unity.MPE.ProcessService.level == Unity.MPE.ProcessLevel.UMP_MASTER)
            {
                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(dropdownWidth, ref pos);
                if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
                {
                    ShowUserMenu(EditorToolGUI.GetThinArea(pos));
                }

                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(standardButtonWidth, ref pos);
                if (GUI.Button(EditorToolGUI.GetThinArea(pos), s_CloudIcon, Styles.command))
                {
                    UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "cloud_icon"); // Should show hub when it's done
                }
            }

            foreach (SubToolbar subToolbar in s_SubToolbars)
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(subToolbar.Width, ref pos);
                subToolbar.OnGUI(EditorToolGUI.GetThinArea(pos));
            }


            if (ModeService.modeCount > 1 && Unsupported.IsDeveloperBuild())
            {
                EditorGUI.BeginChangeCheck();
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                var selectedModeIndex = EditorGUI.Popup(EditorToolGUI.GetThinArea(pos), ModeService.currentIndex, ModeService.modeNames, Styles.dropdown);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selectedModeIndex);
                    GUIUtility.ExitGUI();
                }
            }

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
Пример #12
0
    void OnGUI()
    {
        var stats = HTTPManager.GetGeneralStatistics(StatisticsQueryFlags.All);

        // Connection statistics
        GUIHelper.DrawArea(new Rect(0, 0, Screen.width / 3, statisticsHeight), false, () =>
        {
            // Header
            GUIHelper.DrawCenteredText("Connections");

            GUILayout.Space(5);

            GUIHelper.DrawRow("Sum:", stats.Connections.ToString());
            GUIHelper.DrawRow("Active:", stats.ActiveConnections.ToString());
            GUIHelper.DrawRow("Free:", stats.FreeConnections.ToString());
            GUIHelper.DrawRow("Recycled:", stats.RecycledConnections.ToString());
            GUIHelper.DrawRow("Requests in queue:", stats.RequestsInQueue.ToString());
        });

        // Cache statistics
        GUIHelper.DrawArea(new Rect(Screen.width / 3, 0, Screen.width / 3, statisticsHeight), false, () =>
        {
            GUIHelper.DrawCenteredText("Cache");

#if !BESTHTTP_DISABLE_CACHING && (!UNITY_WEBGL || UNITY_EDITOR)
            if (!BestHTTP.Caching.HTTPCacheService.IsSupported)
            {
#endif
            GUI.color = Color.yellow;
            GUIHelper.DrawCenteredText("Disabled in WebPlayer, WebGL & Samsung Smart TV Builds!");
            GUI.color = Color.white;
#if !BESTHTTP_DISABLE_CACHING && (!UNITY_WEBGL || UNITY_EDITOR)
        }
                           else
        {
            GUILayout.Space(5);

            GUIHelper.DrawRow("Cached entities:", stats.CacheEntityCount.ToString());
            GUIHelper.DrawRow("Sum Size (bytes): ", stats.CacheSize.ToString("N0"));

            GUILayout.BeginVertical();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Clear Cache"))
            {
                BestHTTP.Caching.HTTPCacheService.BeginClear();
            }

            GUILayout.EndVertical();
        }
#endif
        });

        // Cookie statistics
        GUIHelper.DrawArea(new Rect((Screen.width / 3) * 2, 0, Screen.width / 3, statisticsHeight), false, () =>
        {
            GUIHelper.DrawCenteredText("Cookies");

#if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR)
            if (!BestHTTP.Cookies.CookieJar.IsSavingSupported)
            {
#endif
            GUI.color = Color.yellow;
            GUIHelper.DrawCenteredText("Saving and loading from disk is disabled in WebPlayer, WebGL & Samsung Smart TV Builds!");
            GUI.color = Color.white;
#if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR)
        }
                           else
        {
            GUILayout.Space(5);

            GUIHelper.DrawRow("Cookies:", stats.CookieCount.ToString());
            GUIHelper.DrawRow("Estimated size (bytes):", stats.CookieJarSize.ToString("N0"));

            GUILayout.BeginVertical();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Clear Cookies"))
            {
                //BestHTTP.Cookies.CookieJar.Clear();
                BestHTTP.HTTPManager.OnQuit();
            }

            GUILayout.EndVertical();
        }
#endif
        });

        if (SelectedSample == null || (SelectedSample != null && !SelectedSample.IsRunning))
        {
            // Draw the list of samples
            GUIHelper.DrawArea(new Rect(0, statisticsHeight + 5, SelectedSample == null ? Screen.width : Screen.width / 3, Screen.height - statisticsHeight - 5), false, () =>
            {
                scrollPos = GUILayout.BeginScrollView(scrollPos);
                for (int i = 0; i < Samples.Count; ++i)
                {
                    DrawSample(Samples[i]);
                }
                GUILayout.EndScrollView();
            });

            if (SelectedSample != null)
            {
                DrawSampleDetails(SelectedSample);
            }
        }
        else if (SelectedSample != null && SelectedSample.IsRunning)
        {
            GUILayout.BeginArea(new Rect(0, Screen.height - 50, Screen.width, 50), string.Empty);
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Back", GUILayout.MinWidth(100)))
            {
                SelectedSample.DestroyUnityObject();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
    }
Пример #13
0
    public override void OnGUI()
    {
        base.OnGUI();

        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            if (GUI.Button(new Rect(10, 10, 90, 25), "Start Server"))
            {
                Network.InitializeServer(m_MaxConnections, m_ListenPort, m_UseNat);
            }

#if false
            // code for connecting to the server

            string m_ConnectionIP   = "127.0.0.1";
            int    m_ConnectionPort = 25000;

            Rect m_ConnectButtonRect  = new Rect(10, 55, 90, 25);
            Rect m_ConnectionIPRect   = new Rect(105, 56.5f, 90, 22);
            Rect m_ConnectionPortRect = new Rect(105, 80.5f, 90, 22);
            if (GUI.Button(m_ConnectButtonRect, "Connect"))
            {
                Network.Connect(m_ConnectionIP, m_ConnectionPort);
            }

            m_ConnectionIP   = GUI.TextField(m_ConnectionIPRect, m_ConnectionIP);
            m_ConnectionPort = int.Parse(GUI.TextField(m_ConnectionPortRect, m_ConnectionPort.ToString()));
#endif
        }
        else
        {
            if (GUI.Button(new Rect(10, 10, 90, 25), "Disconnect"))
            {
                Network.Disconnect(200);
            }
        }


        float      fps        = 0;
        float      averageFps = 0;
        FpsCounter fpsCounter = GetComponent <FpsCounter>();
        if (fpsCounter)
        {
            fps        = fpsCounter.Fps;
            averageFps = fpsCounter.AverageFps;
        }


        GUILayout.BeginArea(new Rect(0, 80, Screen.width, Screen.height));
        GUILayout.BeginVertical();

        VHGUILayout.Label(string.Format("T: {0:f2} F: {1} AVG: {2:f0} FPS: {3:f2}", Time.time, Time.frameCount, averageFps, fps), new Color(1, Math.Min(1.0f, averageFps / 30), Math.Min(1.0f, averageFps / 30)));
        GUILayout.Label(string.Format("{0}x{1}x{2} ({3})", Screen.width, Screen.height, Screen.currentResolution.refreshRate, VHUtils.GetCommonAspectText((float)Screen.width / Screen.height)));

        GUILayout.Label(SystemInfo.operatingSystem);                                                                                                                                                     // Operating system name with version (Read Only).
        GUILayout.Label(string.Format("{0} x {1}", SystemInfo.processorCount, SystemInfo.processorType));                                                                                                // Processor name (Read Only).
        GUILayout.Label(string.Format("Mem: {0:f1}gb", SystemInfo.systemMemorySize / 1000.0f));                                                                                                          // Amount of system memory present (Read Only).
        GUILayout.Label(SystemInfo.graphicsDeviceName);                                                                                                                                                  // The name of the graphics device (Read Only).
        GUILayout.Label(SystemInfo.graphicsDeviceVersion);                                                                                                                                               // The graphics API version supported by the graphics device (Read Only).
        GUILayout.Label(string.Format("VMem: {0}mb", SystemInfo.graphicsMemorySize));                                                                                                                    // Amount of video memory present (Read Only).
        GUILayout.Label(string.Format("Shader Level: {0:f1}", SystemInfo.graphicsShaderLevel / 10.0f));                                                                                                  // Graphics device shader capability level (Read Only).
        GUILayout.Label(string.Format("Shadows:{0} RT:{1} FX:{2}", SystemInfo.supportsShadows ? "y" : "n", SystemInfo.supportsRenderTextures ? "y" : "n", SystemInfo.supportsImageEffects ? "y" : "n")); // Are built-in shadows supported? (Read Only)
        GUILayout.Label(string.Format("deviceUniqueIdentifier: {0}", SystemInfo.deviceUniqueIdentifier));                                                                                                // A unique device identifier. It is guaranteed to be unique for every
        GUILayout.Label(string.Format("deviceName: {0}", SystemInfo.deviceName));                                                                                                                        // The user defined name of the device (Read Only).
        GUILayout.Label(string.Format("deviceModel: {0}", SystemInfo.deviceModel));                                                                                                                      // The model of the device (Read Only).

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Пример #14
0
    void OnGUI()
    {
        GUI.DrawTexture(m_KeyImageRect, m_KeyImage);

        GUILayout.BeginArea(m_MainAreaRect, GUI.skin.box);

        if (m_ViewingReadme)
        {
            m_ReadmeScrollPosition = GUILayout.BeginScrollView(m_ReadmeScrollPosition, false, false,
                                                               GUILayout.Width(502), GUILayout.Height(292));

            GUILayout.Label(m_Readme.text, EditorStyles.wordWrappedLabel);

            GUILayout.EndScrollView();

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Done", GUILayout.Height(22)))
            {
                m_ViewingReadme = false;
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
        else
        {
            GUILayout.FlexibleSpace();

            // Description
            GUILayout.Label(ASInstaller._description, EditorStyles.wordWrappedLabel);

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            // Custom GUI
            var canInstall = ASInstaller.OnInstallGUI_Invoke();

            // Install
            EditorGUI.BeginDisabledGroup(!canInstall);
            if (GUILayout.Button(string.Format("Install {0}", ASInstaller._displayName), GUILayout.Height(30)))
            {
                ASInstaller.StartInstall();
                Close();
            }
            EditorGUI.EndDisabledGroup();

            // View readme
            if (m_Readme)
            {
                if (GUILayout.Button("View README", GUILayout.Height(30)))
                {
                    m_ViewingReadme = true;
                }
            }
            GUILayout.FlexibleSpace();

            // Installer version information
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label(ASInstaller._installerVersionString, EditorStyles.miniLabel);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }

        GUILayout.EndArea();
    }
Пример #15
0
        void GUIDrawNodeWindow(int nodeId)
        {
            Node node = Graph.GetNode(nodeId);

            node.ContentRect.Set(0, Config.SocketOffsetTop,
                                 node.Width, node.Height - Config.SocketOffsetTop);

            if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && _draggingPathPointIndex == -1)
            {
                if (_selectedNodes.Count == 0 || (_selectedNodes.Count == 1 && _selectedNodes.Contains(node)))
                {
                    ShowNodeMenu(node);
                }
                else
                {
                    if (_selectedNodes.Count > 0)
                    {
                        if (_selectedNodes.Contains(node))
                        {
                            ShowSelectionMenu();
                        }
                        else
                        {
                            ShowNodeMenu(node);
                        }
                    }
                }
            }

            if (!node.Collapsed)
            {
                GUILayout.BeginArea(node.ContentRect);
                GUI.color = Color.white;
                node.Draw();
                GUILayout.EndArea();
            }

            if (Event.current.type == EventType.MouseUp)
            {
                _selectionBoxDraging = false;
                if (node.IsDragging)
                {
                    node.IsDragging = false;
                    OnDragEnd(node);
                    if (_selectedNodes.Count == 0)
                    {
                        AddToSelection(node);
                    }
                }
                else
                {
                    if (!Event.current.shift)
                    {
                        ClearSelection();
                    }
                    AddToSelection(node);
                }
            }

            GUI.DragWindow();


            if (Event.current.GetTypeForControl(node.Id) == EventType.Used)
            {
                if (Node.LastFocusedNodeId != node.Id)
                {
                    OnFocusNode(node);
                }
                Node.LastFocusedNodeId = node.Id;
            }

            DrawWindowBorder(node);
        }
Пример #16
0
 public void DrawHelpBox(string message)
 {
     GUILayout.BeginArea(new Rect(20, 90, Screen.width - 40, 100));
     EditorGUILayout.HelpBox(message, MessageType.Info);
     GUILayout.EndArea();
 }
Пример #17
0
        public void HandleZoomAndPanEvents(Rect area)
        {
            GUILayout.BeginArea(area);
            area.x = 0f;
            area.y = 0f;
            int controlID = GUIUtility.GetControlID(ZoomableArea.zoomableAreaHash, FocusType.Passive, area);

            switch (Event.current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (area.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = controlID;
                    if (this.IsZoomEvent() || this.IsPanEvent())
                    {
                        GUIUtility.hotControl            = controlID;
                        ZoomableArea.m_MouseDownPosition = this.mousePositionInDrawing;
                        Event.current.Use();
                    }
                }

                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID)
                {
                    GUIUtility.hotControl            = 0;
                    ZoomableArea.m_MouseDownPosition = new Vector2(-1000000f, -1000000f);
                }

                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    if (this.IsZoomEvent())
                    {
                        this.Zoom(ZoomableArea.m_MouseDownPosition, false);
                        Event.current.Use();
                    }
                    else
                    {
                        if (this.IsPanEvent())
                        {
                            this.Pan();
                            Event.current.Use();
                        }
                    }
                }

                break;

            case EventType.ScrollWheel:
                if (area.Contains(Event.current.mousePosition))
                {
                    if (!this.m_IgnoreScrollWheelUntilClicked || GUIUtility.keyboardControl == controlID)
                    {
                        this.Zoom(this.mousePositionInDrawing, true);
                        Event.current.Use();
                    }
                }

                break;
            }

            GUILayout.EndArea();
        }
Пример #18
0
        public void OnGUI()
        {
            if (position.width != _oldPosition.width && Event.current.type == EventType.Layout)
            {
                Drawings     = null;
                _oldPosition = position;
            }

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Styles", EditorStyles.toolbarButton))
            {
                _showingIcons      = true;
                _showingStyles     = false;
                _showingOtherIcons = false;
                Drawings           = null;
            }

            if (GUILayout.Button("Icons", EditorStyles.toolbarButton))
            {
                _showingIcons      = false;
                _showingStyles     = true;
                _showingOtherIcons = false;
                Drawings           = null;
            }

            if (GUILayout.Button("Other Icons", EditorStyles.toolbarButton))
            {
                _showingIcons      = false;
                _showingStyles     = false;
                _showingOtherIcons = true;
                Drawings           = null;
            }

            GUILayout.EndHorizontal();

            string newSearch = GUILayout.TextField(_search);

            if (newSearch != _search)
            {
                _search  = newSearch;
                Drawings = null;
            }

            if (_showingOtherIcons)
            {
                DrawAllIcons();
                return;
            }

            float top = 36;

            if (Drawings == null)
            {
                string lowerSearch = _search.ToLower();

                Drawings = new List <Drawing> ();

                GUIContent inactiveText = new GUIContent("inactive");
                GUIContent activeText   = new GUIContent("active");

                float x = 5.0f;
                float y = 5.0f;

                if (_showingStyles)
                {
                    foreach (GUIStyle ss in GUI.skin.customStyles)
                    {
                        if (lowerSearch != "" && !ss.name.ToLower().Contains(lowerSearch))
                        {
                            continue;
                        }

                        GUIStyle thisStyle = ss;

                        Drawing draw = new Drawing();

                        float width = Mathf.Max(
                            100.0f,
                            GUI.skin.button.CalcSize(new GUIContent(ss.name)).x,
                            ss.CalcSize(inactiveText).x + ss.CalcSize(activeText).x
                            ) + 16.0f;

                        float height = 60.0f;

                        if (x + width > position.width - 32 && x > 5.0f)
                        {
                            x  = 5.0f;
                            y += height + 10.0f;
                        }

                        draw.Rect = new Rect(x, y, width, height);

                        width -= 8.0f;

                        draw.Draw = () => {
                            if (GUILayout.Button(thisStyle.name, GUILayout.Width(width)))
                            {
                                CopyText("(GUIStyle)\"" + thisStyle.name + "\"");
                            }

                            GUILayout.BeginHorizontal();
                            GUILayout.Toggle(false, inactiveText, thisStyle, GUILayout.Width(width / 2));
                            GUILayout.Toggle(false, activeText, thisStyle, GUILayout.Width(width / 2));
                            GUILayout.EndHorizontal();
                        };

                        x += width + 18.0f;

                        Drawings.Add(draw);
                    }
                }
                else if (_showingIcons)
                {
                    if (_objects == null)
                    {
                        _objects = new List <UnityEngine.Object> (Resources.FindObjectsOfTypeAll(typeof(Texture)));
                        _objects.Sort((pA, pB) => System.String.Compare(pA.name, pB.name, System.StringComparison.OrdinalIgnoreCase));
                    }

                    float rowHeight = 0.0f;

                    foreach (UnityEngine.Object oo in _objects)
                    {
                        Texture texture = (Texture)oo;
                        if (texture != null)
                        {
                            if (texture.name == "")
                            {
                                continue;
                            }

                            if (lowerSearch != "" && !texture.name.ToLower().Contains(lowerSearch))
                            {
                                continue;
                            }
                            if (texture is Cubemap || texture is RenderTexture || texture is Texture2DArray || texture is Texture3D || texture is CubemapArray)
                            {
                                continue;
                            }
                            Drawing draw = new Drawing();


                            float width = Mathf.Max(
                                GUI.skin.button.CalcSize(new GUIContent(texture.name)).x,
                                texture.width
                                ) + 8.0f;

                            float height = texture.height + GUI.skin.button.CalcSize(new GUIContent(texture.name)).y + 8.0f;

                            if (x + width > position.width - 32.0f)
                            {
                                x         = 5.0f;
                                y        += rowHeight + 8.0f;
                                rowHeight = 0.0f;
                            }

                            draw.Rect = new Rect(x, y, width, height);

                            rowHeight = Mathf.Max(rowHeight, height);

                            width -= 8.0f;

                            draw.Draw = () => {
                                if (GUILayout.Button(texture.name, GUILayout.Width(width)))
                                {
                                    CopyText("EditorGUIUtility.FindTexture( \"" + texture.name + "\" )");
                                }

                                Rect textureRect = GUILayoutUtility.GetRect(texture.width, texture.width, texture.height, texture.height, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false));
                                EditorGUI.DrawTextureTransparent(textureRect, texture);
                            };

                            x += width + 8.0f;

                            Drawings.Add(draw);
                        }
                    }
                }

                _maxY = y;
            }

            Rect r = position;

            r.y       = top;
            r.height -= r.y;
            r.x       = r.width - 16;
            r.width   = 16;

            float areaHeight = position.height - top;

            _scrollPos = GUI.VerticalScrollbar(r, _scrollPos, areaHeight, 0.0f, _maxY);

            Rect area = new Rect(0, top, position.width - 16.0f, areaHeight);

            GUILayout.BeginArea(area);

            int count = 0;

            foreach (Drawing draw in Drawings)
            {
                Rect newRect = draw.Rect;
                newRect.y -= _scrollPos;

                if (newRect.y + newRect.height > 0 && newRect.y < areaHeight)
                {
                    GUILayout.BeginArea(newRect, GUI.skin.textField);
                    draw.Draw();
                    GUILayout.EndArea();

                    count++;
                }
            }

            GUILayout.EndArea();
        }
    public void RenderOnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, Screen.height));
        GUILayout.Label("Variables:");
        GUILayout.Label("m_SteamInventoryResult: " + m_SteamInventoryResult);
        GUILayout.EndArea();

        // INVENTORY ASYNC RESULT MANAGEMENT

        GUILayout.Label("SteamInventory.GetResultStatus(" + m_SteamInventoryResult + ") - " + SteamInventory.GetResultStatus(m_SteamInventoryResult));

        if (GUILayout.Button("GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize)"))
        {
            uint OutItemsArraySize = 0;
            bool ret = SteamInventory.GetResultItems(m_SteamInventoryResult, null, ref OutItemsArraySize);
            if (ret && OutItemsArraySize > 0)
            {
                m_SteamItemDetails = new SteamItemDetails_t[OutItemsArraySize];
                ret = SteamInventory.GetResultItems(m_SteamInventoryResult, m_SteamItemDetails, ref OutItemsArraySize);
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", m_SteamItemDetails, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);

                System.Text.StringBuilder test = new System.Text.StringBuilder();
                for (int i = 0; i < OutItemsArraySize; ++i)
                {
                    test.AppendFormat("{0} - {1} - {2} - {3} - {4}\n", i, m_SteamItemDetails[i].m_itemId, m_SteamItemDetails[i].m_iDefinition, m_SteamItemDetails[i].m_unQuantity, m_SteamItemDetails[i].m_unFlags);
                }
                print(test);
            }
            else
            {
                print("SteamInventory.GetResultItems(" + m_SteamInventoryResult + ", null, out OutItemsArraySize) - " + ret + " -- " + OutItemsArraySize);
            }
        }

        if (GUILayout.Button("GetResultTimestamp(m_SteamInventoryResult)"))
        {
            print("SteamInventory.GetResultTimestamp(" + m_SteamInventoryResult + ") - " + SteamInventory.GetResultTimestamp(m_SteamInventoryResult));
        }

        if (GUILayout.Button("CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID())"))
        {
            print("SteamInventory.CheckResultSteamID(" + m_SteamInventoryResult + ", " + SteamUser.GetSteamID() + ") - " + SteamInventory.CheckResultSteamID(m_SteamInventoryResult, SteamUser.GetSteamID()));
        }

        if (GUILayout.Button("DestroyResult(m_SteamInventoryResult)"))
        {
            DestroyResult();
        }

        // INVENTORY ASYNC QUERY

        if (GUILayout.Button("GetAllItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GetAllItems(out m_SteamInventoryResult);
            print("SteamInventory.GetAllItems(out m_SteamInventoryResult) - " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GetItemsByID(out m_SteamInventoryResult, InstanceIDs, InstanceIDs.Length)"))
        {
            SteamItemInstanceID_t[] InstanceIDs = { (SteamItemInstanceID_t)0, (SteamItemInstanceID_t)1, };
            bool ret = SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, (uint)InstanceIDs.Length);
            print("SteamInventory.GetItemsByID(out m_SteamInventoryResult, InstanceIDs, " + InstanceIDs.Length + ") - " + ret + " -- " + m_SteamInventoryResult);
        }

        // RESULT SERIALIZATION AND AUTHENTICATION
        if (GUILayout.Button("SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize)"))
        {
            uint OutBufferSize;
            bool ret = SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize);
            if (ret)
            {
                m_SerializedBuffer = new byte[OutBufferSize];
                ret = SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize);
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, m_SerializedBuffer, out OutBufferSize) - " + ret + " -- " + OutBufferSize + " -- " + System.Text.Encoding.UTF8.GetString(m_SerializedBuffer, 0, m_SerializedBuffer.Length));
            }
            else
            {
                print("SteamInventory.SerializeResult(m_SteamInventoryResult, null, out OutBufferSize) - " + ret + " -- " + OutBufferSize);
            }
        }

        if (GUILayout.Button("DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length)"))
        {
            bool ret = SteamInventory.DeserializeResult(out m_SteamInventoryResult, m_SerializedBuffer, (uint)m_SerializedBuffer.Length);
            print("SteamInventory.DeserializeResult(out m_SteamInventoryResult, " + m_SerializedBuffer + ", " + (uint)m_SerializedBuffer.Length + ") - " + ret + " -- " + m_SteamInventoryResult);
        }

        // INVENTORY ASYNC MODIFICATION

        if (GUILayout.Button("GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration2 };

            bool ret = SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, (uint)ArrayItemDefs.Length);
            print("SteamInventory.GenerateItems(out m_SteamInventoryResult, ArrayItemDefs, null, " + (uint)ArrayItemDefs.Length + ") - " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("GrantPromoItems(out m_SteamInventoryResult)"))
        {
            bool ret = SteamInventory.GrantPromoItems(out m_SteamInventoryResult);
            print("SteamInventory.GrantPromoItems(out m_SteamInventoryResult) - " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1)"))
        {
            bool ret = SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1);
            print("SteamInventory.AddPromoItem(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1) - " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length)"))
        {
            SteamItemDef_t[] ArrayItemDefs = { ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon1, ESpaceWarItemDefIDs.k_SpaceWarItem_ShipWeapon2 };
            bool             ret           = SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, (uint)ArrayItemDefs.Length);
            print("SteamInventory.AddPromoItems(out m_SteamInventoryResult, ArrayItemDefs, " + (uint)ArrayItemDefs.Length + ") - " + ret + " -- " + m_SteamInventoryResult);
        }

        if (GUILayout.Button("ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ConsumeItem(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1);
                print("SteamInventory.ConsumeItem(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("ExchangeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.ExchangeItems(out m_SteamInventoryResult, null, null, 0, null, null, 0);                 // TODO
                print("SteamInventory.ExchangeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        if (GUILayout.Button("TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, m_SteamItemDetails[0].m_itemId, 1, SteamItemInstanceID_t.Invalid);
                print("SteamInventory.TransferItemQuantity(out m_SteamInventoryResult, " + m_SteamItemDetails[0].m_itemId + ", 1, SteamItemInstanceID_t.Invalid) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // TIMED DROPS AND PLAYTIME CREDIT

        if (GUILayout.Button("SendItemDropHeartbeat()"))
        {
            SteamInventory.SendItemDropHeartbeat();
            print("SteamInventory.SendItemDropHeartbeat()");
        }

        if (GUILayout.Button("TriggerItemDrop(out m_SteamInventoryResult, k_SpaceWarItem_TimedDropList)"))
        {
            SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, ESpaceWarItemDefIDs.k_SpaceWarItem_TimedDropList);
            print("SteamInventory.TriggerItemDrop(out m_SteamInventoryResult, k_SpaceWarItem_TimedDropList)");
        }

        // IN-GAME TRADING
        if (GUILayout.Button("TradeItems(TODO)"))
        {
            if (m_SteamItemDetails != null)
            {
                bool ret = SteamInventory.TradeItems(out m_SteamInventoryResult, SteamUser.GetSteamID(), null, null, 0, null, null, 0);                 // TODO... Difficult
                print("SteamInventory.TradeItems(TODO) - " + ret + " -- " + m_SteamInventoryResult);
            }
        }

        // ITEM DEFINITIONS
        if (GUILayout.Button("LoadItemDefinitions()"))
        {
            print("SteamInventory.LoadItemDefinitions() - " + SteamInventory.LoadItemDefinitions());
        }

        if (GUILayout.Button("GetItemDefinitionIDs(ItemDefIDs, ref length)"))
        {
            uint length;
            bool ret = SteamInventory.GetItemDefinitionIDs(null, out length);
            if (ret)
            {
                m_SteamItemDef = new SteamItemDef_t[length];
                ret            = SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length);
                print("SteamInventory.GetItemDefinitionIDs(m_SteamItemDef, out length) - " + ret + " -- " + length);
            }
            else
            {
                print("SteamInventory.GetItemDefinitionIDs(null, out length) - " + ret + " -- " + length);
            }
        }

        if (GUILayout.Button("GetItemDefinitionProperty()"))
        {
            string ValueBuffer;
            uint   length = 2048;
            bool   ret    = SteamInventory.GetItemDefinitionProperty(ESpaceWarItemDefIDs.k_SpaceWarItem_ShipDecoration1, null, out ValueBuffer, ref length);
            print("SteamInventory.GetItemDefinitionProperty() - " + ret + " -- " + ValueBuffer + " -- " + length);
        }
    }
Пример #20
0
        void OnLightMeterGUI(PostProcessRenderContext context)
        {
            if (m_TickLabelStyle == null)
            {
                m_TickLabelStyle = new GUIStyle("Label")
                {
                    fontStyle = FontStyle.Bold,
                    fontSize  = 10,
                    alignment = TextAnchor.MiddleCenter
                };
            }

            var histogram = context.logHistogram;
            int kMargin   = 8;
            int x         = kMargin;
            int w         = (int)(context.width * (3 / 5f) - kMargin * 2);
            int h         = context.height / 4;
            int y         = context.height - h - kMargin - 30;
            var rect      = new Rect(x, y, w, h);

            if (Event.current.type == EventType.Repaint)
            {
                CheckTexture(ref m_LightMeterRT, (int)rect.width, (int)rect.height);

                var material = context.propertySheets.Get(context.resources.shaders.lightMeter).material;
                material.shaderKeywords = null;
                material.SetBuffer(Uniforms._HistogramBuffer, histogram.data);

                var scaleOffsetRes = histogram.GetHistogramScaleOffsetRes(context);
                scaleOffsetRes.z = 1f / rect.width;
                scaleOffsetRes.w = 1f / rect.height;

                material.SetVector(Uniforms._ScaleOffsetRes, scaleOffsetRes);

                if (context.logLut != null)
                {
                    material.EnableKeyword("COLOR_GRADING_HDR");
                    material.SetTexture(Uniforms._Lut3D, context.logLut);
                }

                if (context.autoExposure != null)
                {
                    var settings = context.autoExposure;

                    // Make sure filtering values are correct to avoid apocalyptic consequences
                    float       lowPercent  = settings.filtering.value.x;
                    float       highPercent = settings.filtering.value.y;
                    const float kMinDelta   = 1e-2f;
                    highPercent = Mathf.Clamp(highPercent, 1f + kMinDelta, 99f);
                    lowPercent  = Mathf.Clamp(lowPercent, 1f, highPercent - kMinDelta);

                    material.EnableKeyword("AUTO_EXPOSURE");
                    material.SetVector(Uniforms._Params, new Vector4(lowPercent * 0.01f, highPercent * 0.01f, RuntimeUtilities.Exp2(settings.minLuminance.value), RuntimeUtilities.Exp2(settings.maxLuminance.value)));
                }

                RuntimeUtilities.BlitFullscreenTriangle(null, m_LightMeterRT, material, 0);
                GUI.DrawTexture(rect, m_LightMeterRT);
            }

            // Labels
            rect.y     += rect.height;
            rect.height = 30;
            int maxSize = Mathf.FloorToInt(rect.width / (LogHistogram.rangeMax - LogHistogram.rangeMin + 2));

            GUI.DrawTexture(rect, RuntimeUtilities.blackTexture);

            GUILayout.BeginArea(rect);
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(4);

                    for (int i = LogHistogram.rangeMin; i < LogHistogram.rangeMax; i++)
                    {
                        GUILayout.Label(i + "\n" + RuntimeUtilities.Exp2(i).ToString("0.###"), m_TickLabelStyle, GUILayout.Width(maxSize));
                        GUILayout.FlexibleSpace();
                    }

                    GUILayout.Label(LogHistogram.rangeMax + "\n" + RuntimeUtilities.Exp2(LogHistogram.rangeMax).ToString("0.###"), m_TickLabelStyle, GUILayout.Width(maxSize));
                    GUILayout.Space(4);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();
        }
Пример #21
0
        public void Draw(Player player)
        {
            GUILayout.BeginArea(new Rect(Screen.width - 200, 200, 200, 400));
            if (ShowUI)
            {
                if (GUILayout.Button("Neues Angebot erstellen"))
                {
                    ShowUI             = false;
                    ShowNewOfferScreen = true;
                }
                if (GUILayout.Button("Offene Angebote zeigen"))
                {
                    ShowOffers = true;
                    ShowUI     = false;
                }
                if (GUILayout.Button("Handelsübersicht schließen"))
                {
                    ShowUI = false;
                }
            }
            else if (ShowNewOfferScreen)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Baustoffe"))
                {
                    OfferedResource = ResourceType.ConstructionMaterial;
                }
                if (GUILayout.Button("Einfluss"))
                {
                    OfferedResource = ResourceType.Power;
                }
                if (GUILayout.Button("Technologie"))
                {
                    OfferedResource = ResourceType.Technology;
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Amount: ");
                AmountOffered = GUILayout.TextField(AmountOffered);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Baustoffe"))
                {
                    RequestedResource = ResourceType.ConstructionMaterial;
                }
                if (GUILayout.Button("Einfluss"))
                {
                    RequestedResource = ResourceType.Power;
                }
                if (GUILayout.Button("Technologie"))
                {
                    RequestedResource = ResourceType.Technology;
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Amount: ");
                AmountRequested = GUILayout.TextField(AmountRequested);
                GUILayout.EndHorizontal();
                if (GUILayout.Button("Angebot erstellen"))
                {
                    player.CmdPostTradingOffer(OfferedResource, AmountOffered,
                                               RequestedResource, AmountRequested);
                }
                if (GUILayout.Button("Abbrechen"))
                {
                    ShowNewOfferScreen = false;
                    ShowUI             = true;
                }
            }
            else if (ShowOffers)
            {
                foreach (var offer in Offers)
                {
                    if (GUILayout.Button($"{offer.Owner} möchte {offer.OfferedAmount} {offer.OfferedResource}" +
                                         $" gegen {offer.RequestedAmount} {offer.RequestedResource} tauschen"))
                    {
                        SelectedOffer = offer;
                    }
                }
                if (GUILayout.Button("Zurück"))
                {
                    ShowOffers = false;
                    ShowUI     = true;
                }
            }
            else
            {
                if (GUILayout.Button("Handelsübersicht öffnen"))
                {
                    ShowUI = true;
                }
            }
            GUILayout.EndArea();

            if (SelectedOffer != null)
            {
                GUILayout.BeginArea(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 100, 200, 200));
                if (SelectedOffer.Value.Owner == player.netId)
                {
                    if (GUILayout.Button("Angebot zurückziehen"))
                    {
                        player.CmdRemoveTradingOffer(SelectedOffer.Value);
                        SelectedOffer = null;
                    }
                    if (GUILayout.Button("Zurück"))
                    {
                        SelectedOffer = null;
                    }
                }
                else
                {
                    if (GUILayout.Button("Angebot annehmen"))
                    {
                        player.CmdAcceptTradingOffer(SelectedOffer.Value);
                        SelectedOffer = null;
                    }
                    if (GUILayout.Button("Zurück"))
                    {
                        SelectedOffer = null;
                    }
                }
                GUILayout.EndArea();
            }
        }
        public static void Main(Rect fullArea, Rect leftArea, Rect mainArea, Rme_Main window)
        {
            GUI.Box(fullArea, "", "backgroundBox");

            GUILayout.BeginArea(fullArea);
            GUILayout.BeginVertical();
            if(GUILayout.Button("Add Skill"))
            {
             Windows.Add(new VisualiserWindow()
                             {
                                 ID = Windows.Count > 0 ? (Windows.Max(i => i.ID) + 1) : 0,
                                 SkillID = "",
                                 Type = VisualiserType.Skill,
                                 rect = new Rect(Random.Range(50,100+1),Random.Range(50,100+1),50,50),
                                 Area = 1
                             });   
            }
            if(GUILayout.Button("Add Horizontal"))
            {
             Windows.Add(new VisualiserWindow()
                             {
                                 ID = Windows.Count > 0 ? (Windows.Max(i => i.ID) + 1) : 0,
                                 SkillID = "",
                                 Type = VisualiserType.Hori,
                                 rect = new Rect(Random.Range(50,100+1),Random.Range(50,100+1),25,10),
                                 Area = 1
                             });  
            }
            if(GUILayout.Button("Add Vertical"))
            {
             Windows.Add(new VisualiserWindow()
                             {
                                 ID = Windows.Count > 0 ? (Windows.Max(i => i.ID) + 1) : 0,
                                 SkillID = "",
                                 Type = VisualiserType.Vert,
                                 rect = new Rect(Random.Range(50,100+1),Random.Range(50,100+1),10,25),
                                 Area = 1
                             });  
            }
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Box("",GUILayout.Width(300),GUILayout.Height(500));
            var toRectA = GUILayoutUtility.GetLastRect();

            GUILayout.FlexibleSpace();


            GUILayout.Box("", GUILayout.Width(300), GUILayout.Height(500));
            var toRectB = GUILayoutUtility.GetLastRect();

            GUILayout.FlexibleSpace();

            GUILayout.Box("", GUILayout.Width(300), GUILayout.Height(500));
            var toRectC = GUILayoutUtility.GetLastRect();

            GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            window.BeginWindows();
            
            for (int i = 0; i < Windows.Count; i++)
            {
                var windowData = Windows[i];
                Rect rect;
                switch(windowData.Area)
                {
                    case 0:
                        rect = toRectA;
                        break;
                    case 1:
                        rect = toRectB;
                        break;
                    case 2:
                        rect = toRectC;
                        break;
                    default:
                        rect = toRectA;
                        break;
                }
                windowData.rect = RoundWindow(ClampWindow(GUILayout.Window(windowData.ID, windowData.rect, myWindow, "", "visualiserWindow_" + windowData.Type.ToString()), rect));
			}

            window.EndWindows();
            GUILayout.EndArea();
        }
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            actionTableRect = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.5f * windowHeight);
            rightPanelRect  = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.5f * windowHeight);
            descriptionRect = new Rect(0f, 0.6f * windowHeight, 0.95f * windowWidth, 0.2f * windowHeight);
            effectsRect     = new Rect(0f, 0.8f * windowHeight, windowWidth, windowHeight * 0.15f);


            GUILayout.BeginArea(actionTableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Element.Action"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("ActionsList.NeedsGoTo"), GUILayout.Width(windowWidth * 0.39f));
            GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.1f));
            GUILayout.EndHorizontal();
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(false));
            // Action table
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                     GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions().Count;
                 i++)
            {
                if (i == selectedAction)
                {
                    GUI.skin = selectedAreaSkin;
                }
                else
                {
                    GUI.skin = noBackgroundSkin;
                }

                tmpTex = (Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                              GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions()
                          .getBlocksCount() > 0
                    ? conditionsTex
                    : noConditionsTex);

                GUILayout.BeginHorizontal();
                if (i == selectedAction)
                {
                    int t = Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                        GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getType();

                    if (t == Controller.ACTION_USE_WITH || t == Controller.ACTION_GIVE_TO || t == Controller.ACTION_DRAG_TO)
                    {
                        selectedTarget =
                            EditorGUILayout.Popup(
                                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                    GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i]
                                .getTypeName(),
                                selectedTarget, joinedNamesList,
                                GUILayout.Width(windowWidth * 0.39f));
                        if (selectedTarget != selectedTargetLast)
                        {
                            ChangeActionTarget(selectedTarget);
                        }
                    }
                    else
                    {
                        GUILayout.Label(
                            Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i]
                            .getTypeName(), GUILayout.Width(windowWidth * 0.39f));
                    }

                    if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                    {
                        if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    else
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(windowWidth * 0.39f));

                        Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                            GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].setNeedsGoTo(
                            GUILayout.Toggle(
                                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                    GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i]
                                .getNeedsGoTo(), ""));
                        Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                            GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i]
                        .setKeepDistance(
                            EditorGUILayout.IntField(
                                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                    GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i]
                                .getKeepDistance()));

                        GUILayout.EndHorizontal();
                    }

                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f)))
                    {
                        ConditionEditorWindow window =
                            (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                        GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getConditions
                                        ());
                    }
                }
                else
                {
                    if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                             GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getTypeName(),
                                         GUILayout.Width(windowWidth * 0.39f)))
                    {
                        OnActionSelectionChange(i);
                    }

                    if (Controller.getInstance().playerMode() == Controller.FILE_ADVENTURE_1STPERSON_PLAYER)
                    {
                        if (GUILayout.Button(TC.get("ActionsList.NotRelevant"), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    else
                    {
                        if (
                            GUILayout.Button(
                                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                    GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[i].getNeedsGoTo().ToString(), GUILayout.Width(windowWidth * 0.39f)))
                        {
                            OnActionSelectionChange(i);
                        }
                    }
                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.1f)))
                    {
                        OnActionSelectionChange(i);
                    }
                }
                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                addMenu.menu.ShowAsContext();
            }
            if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                    GameRources.GetInstance().selectedCharacterIndex].getActionsList()
                .duplicateElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                      GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]);
            }
            //if (GUILayout.Button(moveUp, GUILayout.MaxWidth(0.08f * windowWidth)))
            //{
            //    Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
            //      GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementUp(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
            //          GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]);
            //}
            //if (GUILayout.Button(moveDown, GUILayout.MaxWidth(0.08f * windowWidth)))
            //{
            //    Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
            //      GameRources.GetInstance().selectedCharacterIndex].getActionsList().moveElementDown(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
            //          GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]);
            //}
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                    GameRources.GetInstance().selectedCharacterIndex].getActionsList()
                .deleteElement(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                   GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction],
                               false);
                if (selectedAction >= 0)
                {
                    selectedAction--;
                }
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            GUILayout.BeginArea(descriptionRect);
            GUILayout.Label(TC.get("Action.Documentation"));
            GUILayout.Space(20);
            documentation = GUILayout.TextArea(documentation);
            if (!documentation.Equals(documentationLast))
            {
                OnDocumentationChanged(documentation);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(effectsRect);
            if (selectedAction < 0)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button(TC.get("Element.Effects")))
            {
                EffectEditorWindow window =
                    (EffectEditorWindow)ScriptableObject.CreateInstance(typeof(EffectEditorWindow));
                window.Init(Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
                                GameRources.GetInstance().selectedCharacterIndex].getActionsList().getActions()[selectedAction]
                            .getEffects());
            }
            GUI.enabled = true;
            GUILayout.EndArea();
        }
Пример #24
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(5, 20, Screen.width - 10, 30));
        GUILayout.BeginHorizontal();

        GUILayout.Label("Effect", GUILayout.Width(50));
        if (GUILayout.Button("<", GUILayout.Width(20)))
        {
            prevParticle();
        }
        GUILayout.Label(ParticleExamples[exampleIndex].name, GUILayout.Width(190));
        if (GUILayout.Button(">", GUILayout.Width(20)))
        {
            nextParticle();
        }

        GUILayout.Label("Click on the ground to spawn selected particles");

        if (GUILayout.Button(CFX_Demo_RotateCamera.rotating ? "Pause Camera" : "Rotate Camera", GUILayout.Width(140)))
        {
            CFX_Demo_RotateCamera.rotating = !CFX_Demo_RotateCamera.rotating;
        }


        if (GUILayout.Button(randomSpawns ? "Stop Random Spawns" : "Start Random Spawns", GUILayout.Width(140)))
        {
            randomSpawns = !randomSpawns;
            if (randomSpawns)
            {
                StartCoroutine("RandomSpawnsCoroutine");
            }
            else
            {
                StopCoroutine("RandomSpawnsCoroutine");
            }
        }

        randomSpawnsDelay = GUILayout.TextField(randomSpawnsDelay, 10, GUILayout.Width(42));
        randomSpawnsDelay = Regex.Replace(randomSpawnsDelay, @"[^0-9.]", "");

        if (GUILayout.Button(this.renderer.enabled ? "Hide Ground" : "Show Ground", GUILayout.Width(90)))
        {
            this.renderer.enabled = !this.renderer.enabled;
        }

        if (GUILayout.Button(slowMo ? "Normal Speed" : "Slow Motion", GUILayout.Width(100)))
        {
            slowMo = !slowMo;
            if (slowMo)
            {
                Time.timeScale = 0.33f;
            }
            else
            {
                Time.timeScale = 1.0f;
            }
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Пример #25
0
        public void Draw_ToChangerPlate(int changerIndex, float width)
        {
            GUILayout.BeginArea(new Rect(0, (changerIndex * (AutomatineGUISettings.CHANGER_TO_PLATE_HEIGHT + 2)), width + AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, AutomatineGUISettings.CHANGER_PLATE_HEIGHT));
            {
                // bg
                var changerRect = new Rect(AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, 0, width - AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, AutomatineGUISettings.CHANGER_TO_PLATE_HEIGHT);

                var timelineConditionTypeLabelSmall = new GUIStyle();
                timelineConditionTypeLabelSmall.normal.textColor = Color.white;
                timelineConditionTypeLabelSmall.fontSize         = 12;
                timelineConditionTypeLabelSmall.alignment        = TextAnchor.MiddleCenter;

                var timelineConditionTypeLabelSmall2 = new GUIStyle();
                timelineConditionTypeLabelSmall2.normal.textColor = Color.white;
                timelineConditionTypeLabelSmall2.fontSize         = 12;
                timelineConditionTypeLabelSmall2.alignment        = TextAnchor.MiddleLeft;

                var timelineConditionTypeLabelSmall3 = new GUIStyle();
                timelineConditionTypeLabelSmall3.normal.textColor = Color.white;
                timelineConditionTypeLabelSmall3.fontSize         = 12;
                timelineConditionTypeLabelSmall3.alignment        = TextAnchor.MiddleCenter;

                var changerNameRect = new Rect(
                    AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE + 1f,
                    1f,
                    AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 2f,
                    AutomatineGUISettings.CHANGER_TO_PLATE_HEIGHT - 2f
                    );

                if (active)
                {
                    // set active.
                    GUI.DrawTexture(changerRect, AutomatineGUISettings.activeObjectBaseTex);
                    var activeChangerBaseRect = new Rect(
                        AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE + 1f,
                        1f,
                        changerRect.width - 2f,
                        changerRect.height - 2f
                        );

                    // changer base tex.
                    GUI.DrawTexture(activeChangerBaseRect, AutomatineGUISettings.changerBaseTex);

                    // Order up
                    if (GUI.Button(new Rect(3, 0, AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE), string.Empty, "Grad Up Swatch"))
                    {
                        Emit(new OnChangerEvent(OnChangerEvent.EventType.EVENT_ORDERUP, changerId));
                        return;
                    }

                    // Order down
                    if (GUI.Button(new Rect(3, AutomatineGUISettings.CHANGER_TO_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE, AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE), string.Empty, "Grad Down Swatch"))
                    {
                        Emit(new OnChangerEvent(OnChangerEvent.EventType.EVENT_ORDERDOWN, changerId));
                        return;
                    }
                }
                else
                {
                    // changer base tex.
                    GUI.DrawTexture(changerRect, AutomatineGUISettings.changerBaseTex);
                }

                // name
                GUI.DrawTexture(changerNameRect, AutomatineGUISettings.changerNameTex);
                GUI.Label(
                    changerNameRect,
                    changerName,
                    timelineConditionTypeLabelSmall
                    );

                var itemOffsetX = AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH + AutomatineGUISettings.CHANGER_TO_PLATE_ORDERBUTTON_SIZE;
                if (branchBinds.Any())
                {
                    if (useContinue)
                    {
                        // continue header.
                        var changerContinueRect = new Rect(
                            itemOffsetX,
                            1f,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 2f
                            );
                        GUI.DrawTexture(changerContinueRect, AutomatineGUISettings.changerContinueTex);
                        GUI.Label(
                            changerContinueRect,
                            " continue",
                            timelineConditionTypeLabelSmall2
                            );

                        if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 30f, 1f, 30f, 15f), "c"))
                        {
                            Debug.LogError("コンディションに該当する範囲を光らせる");
                        }

                        // continue item bg.
                        var changerContinueItemRect = new Rect(
                            itemOffsetX,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 1f
                            );
                        GUI.DrawTexture(changerContinueItemRect, AutomatineGUISettings.changerItemBaseTex);
                        GUI.Label(
                            changerContinueItemRect,
                            "-",
                            timelineConditionTypeLabelSmall3
                            );

                        if (useFinally)
                        {
                            itemOffsetX = itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH + AutomatineGUISettings.CHANGER_TO_PLATE_LINEWIDTH;

                            // finally header.
                            var changerFinallyRect = new Rect(
                                itemOffsetX,
                                1f,
                                AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                                AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 2f
                                );
                            GUI.DrawTexture(changerFinallyRect, AutomatineGUISettings.changerFinallyTex);
                            GUI.Label(
                                changerFinallyRect,
                                " finally",
                                timelineConditionTypeLabelSmall2
                                );

                            if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 60f, 1f, 30f, 15f), "c"))
                            {
                                Debug.LogError("finallyのcond");
                            }

                            if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 30f, 1f, 30f, 15f), "i"))
                            {
                                Debug.LogError("finallyのinherit");
                            }

                            // finally item bg.
                            var changerFinallyItemRect = new Rect(
                                itemOffsetX,
                                AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT,
                                AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                                AutomatineGUISettings.CHANGER_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 1f
                                );
                            GUI.DrawTexture(changerFinallyItemRect, AutomatineGUISettings.changerItemBaseTex);
                            if (
                                GUI.Button(
                                    changerFinallyItemRect,
                                    GetAutoNameById(finallyAutoId),
                                    timelineConditionTypeLabelSmall2
                                    )
                                )
                            {
                                ShowContextMenuToOtherAuto(finallyAutoId);
                            }
                        }
                    }
                    else
                    {
                        var changerBranchRect = new Rect(
                            itemOffsetX,
                            1f,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 2f
                            );
                        GUI.DrawTexture(changerBranchRect, AutomatineGUISettings.changerBranchTex);
                        GUI.Label(
                            changerBranchRect,
                            " branch",
                            timelineConditionTypeLabelSmall2
                            );

                        if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 60f, 1f, 30f, 15f), "c"))
                        {
                            Debug.LogError("コンディションに該当する範囲を光らせる");
                        }

                        if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 30f, 1f, 30f, 15f), "i"))
                        {
                            Debug.LogError("コンディションに該当する範囲を光らせる");
                        }

                        // branch item bg.
                        var changerBranchItemRect = new Rect(
                            itemOffsetX,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 1f
                            );
                        GUI.DrawTexture(changerBranchItemRect, AutomatineGUISettings.changerItemBaseTex);
                        if (
                            GUI.Button(
                                changerBranchItemRect,
                                GetAutoNameById(branchAutoId),
                                timelineConditionTypeLabelSmall2
                                )
                            )
                        {
                            ShowContextMenuToOtherAuto(branchAutoId);
                        }


                        if (useFinally)
                        {
                            itemOffsetX = itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH + AutomatineGUISettings.CHANGER_TO_PLATE_LINEWIDTH;

                            var changerFinallyRect = new Rect(
                                itemOffsetX,
                                1f,
                                AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                                AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 2f
                                );
                            GUI.DrawTexture(changerFinallyRect, AutomatineGUISettings.changerFinallyTex);
                            GUI.Label(
                                changerFinallyRect,
                                " finally",
                                timelineConditionTypeLabelSmall2
                                );


                            if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 60f, 1f, 30f, 15f), "c"))
                            {
                                Debug.LogError("finallyのcond");
                            }

                            if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 30f, 1f, 30f, 15f), "i"))
                            {
                                Debug.LogError("finallyのinherit");
                            }

                            // finally item bg.
                            var changerFinallyItemRect = new Rect(
                                itemOffsetX,
                                AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT,
                                AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                                AutomatineGUISettings.CHANGER_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 1f
                                );
                            GUI.DrawTexture(changerFinallyItemRect, AutomatineGUISettings.changerItemBaseTex);
                            if (
                                GUI.Button(
                                    changerFinallyItemRect,
                                    GetAutoNameById(finallyAutoId),
                                    timelineConditionTypeLabelSmall2
                                    )
                                )
                            {
                                ShowContextMenuToOtherAuto(finallyAutoId);
                            }
                        }
                    }
                }
                else
                {
                    if (useFinally)
                    {
                        var changerFinallyRect = new Rect(
                            itemOffsetX,
                            1f,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 2f
                            );
                        GUI.DrawTexture(changerFinallyRect, AutomatineGUISettings.changerFinallyTex);
                        GUI.Label(
                            changerFinallyRect,
                            " finally",
                            timelineConditionTypeLabelSmall2
                            );

                        if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 60f, 1f, 30f, 15f), "c"))
                        {
                            Debug.LogError("コンディションに該当する範囲を光らせる");
                        }

                        if (GUI.Button(new Rect(itemOffsetX + AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH - 30f, 1f, 30f, 15f), "i"))
                        {
                            Debug.LogError("inheritに該当する範囲を光らせる");
                        }

                        // finally item bg.
                        var changerFinallyItemRect = new Rect(
                            itemOffsetX,
                            AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT,
                            AutomatineGUISettings.CHANGER_TO_PLATE_NAME_WIDTH,
                            AutomatineGUISettings.CHANGER_PLATE_HEIGHT - AutomatineGUISettings.CHANGER_TO_PLATE_PARTS_HEIGHT - 1f
                            );
                        GUI.DrawTexture(changerFinallyItemRect, AutomatineGUISettings.changerItemBaseTex);
                        if (
                            GUI.Button(
                                changerFinallyItemRect,
                                GetAutoNameById(finallyAutoId),
                                timelineConditionTypeLabelSmall2
                                )
                            )
                        {
                            ShowContextMenuToOtherAuto(finallyAutoId);
                        }
                    }
                }

                switch (Event.current.type)
                {
                case EventType.MouseUp:
                {
                    // is right clicked
                    if (Event.current.button == 1)
                    {
                        ShowContextMenuOnChanger();
                        Event.current.Use();
                        break;
                    }

                    if (changerRect.Contains(Event.current.mousePosition))
                    {
                        Emit(new OnChangerEvent(OnChangerEvent.EventType.EVENT_SELECTED, changerId));
                    }
                    break;
                }
                }
            }
            GUILayout.EndArea();
        }
Пример #26
0
        /// <inheritdoc />
        public override void Draw(Rect window)
        {
            GUILayout.BeginArea(window);

            GUILayout.Label("Setup Training", CreatorEditorStyles.Title);

            GUI.enabled = loadSampleScene == false;
            GUILayout.Label("Name of your VR Training", CreatorEditorStyles.Header);
            courseName  = CreatorGUILayout.DrawTextField(courseName, MaxCourseNameLength, GUILayout.Width(window.width * 0.7f));
            GUI.enabled = true;

            if (CourseAssetUtils.CanCreate(courseName, out string errorMessage) == false && lastCreatedCourse != courseName)
            {
                GUIContent courseWarningContent = warningContent;
                courseWarningContent.text = errorMessage;
                GUILayout.Label(courseWarningContent, CreatorEditorStyles.Label, GUILayout.MinHeight(MinHeightOfInfoText));
                CanProceed = false;
            }
            else
            {
                GUILayout.Space(MinHeightOfInfoText + CreatorEditorStyles.BaseIndent);
                CanProceed = true;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Space(CreatorEditorStyles.Indent);
            GUILayout.BeginVertical();
            bool isUseCurrentScene = GUILayout.Toggle(useCurrentScene, "Take my current scene", CreatorEditorStyles.RadioButton);

            if (useCurrentScene == false && isUseCurrentScene)
            {
                useCurrentScene = true;
                createNewScene  = false;
                loadSampleScene = false;
            }

            bool isCreateNewScene = GUILayout.Toggle(createNewScene, "Create a new scene", CreatorEditorStyles.RadioButton);

            if (createNewScene == false && isCreateNewScene)
            {
                createNewScene  = true;
                useCurrentScene = false;
                loadSampleScene = false;
            }

            EditorGUILayout.Space();

            loadSampleScene = GUILayout.Toggle(loadSampleScene, "Load Step by Step Guide Scene", CreatorEditorStyles.RadioButton);
            if (loadSampleScene)
            {
                createNewScene  = false;
                useCurrentScene = false;
                CanProceed      = true;

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(CreatorEditorStyles.Indent);
                    CreatorGUILayout.DrawLink("Hello Creator – a 5-step guide to a basic training application", "https://developers.innoactive.de/documentation/creator/latest/articles/step-by-step-guides/hello-creator.html");
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            if (createNewScene)
            {
                GUIContent helpContent;
                string     sceneInfoText = "Scene will have the same name as the training course.";
                if (SceneSetupUtils.SceneExists(courseName))
                {
                    sceneInfoText += " Scene already exists";
                    CanProceed     = false;
                    helpContent    = warningContent;
                }
                else
                {
                    helpContent = infoContent;
                }

                helpContent.text = sceneInfoText;
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(CreatorEditorStyles.Indent);
                    EditorGUILayout.LabelField(helpContent, CreatorEditorStyles.Label, GUILayout.MinHeight(MinHeightOfInfoText));
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.EndArea();
        }
Пример #27
0
    void OnGUI()
    {
        this.titleContent = new GUIContent("Ease: " + (oData.time_numbering ? AMTimeline.frameToTime(key.frame, (float)aData.getCurrentTake().frameRate) + " s" : key.frame.ToString()));
        AMTimeline.loadSkin(oData, ref skin, ref cachedSkinName, position);
        bool updateEasingCurve = false;

        GUIStyle styleBox = new GUIStyle(GUI.skin.button);

        styleBox.normal = GUI.skin.button.active;
        styleBox.hover  = styleBox.normal;
        styleBox.border = GUI.skin.button.border;
        GUILayout.BeginArea(new Rect(5f, 5f, position.width - 10f, position.height - 10f));
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("", styleBox, GUILayout.Width(500f), GUILayout.Height(100f)))
        {
            selectedSpeedIndex = (selectedSpeedIndex + 1) % speedValues.Length;
            percent            = waitPercent * -1f;
        }

        GUILayout.EndHorizontal();

        GUILayout.Space(5f);
        GUILayout.BeginHorizontal();
        int  prevCategory         = category;
        bool updatedSelectedIndex = false;

        if (setCategory(GUILayout.SelectionGrid(category, categories, (position.width >= 715f ? 12 : 6), GUILayout.Width(position.width - 16f))))
        {
            selectedIndex = getSelectedEaseIndex(prevCategory, selectedIndex);
            selectedIndex = getCategoryIndexForEase(selectedIndex);
            if (selectedIndex < 0)
            {
                selectedIndex        = 0;
                percent              = waitPercent * -1f;
                updatedSelectedIndex = true;
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(5f);

        GUILayout.BeginVertical(GUILayout.Height(233f));
        if (updatedSelectedIndex || setSelectedIndex(GUILayout.SelectionGrid(selectedIndex, easeTypesFiltered[category].ToArray(), 3)))
        {
            percent           = waitPercent * -1f;
            updateEasingCurve = true;
            if (getSelectedEaseName(category, selectedIndex) == "Custom")
            {
                isCustomEase = true;
                if (key.customEase.Count > 0)
                {
                    curve = key.getCustomEaseCurve();
                }
                else
                {
                    setEasingCurve();
                }
            }
            else
            {
                isCustomEase = false;
            }
        }
        GUILayout.EndVertical();
        GUILayout.Space(5f);
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Apply"))
        {
            bool shouldUpdateCache = false;
            if (isCustomEase)
            {
                key.setCustomEase(curve);
                shouldUpdateCache = true;
            }
            if (key.setEaseType(getSelectedEaseIndex(category, selectedIndex)))
            {
                shouldUpdateCache = true;
            }
            if (shouldUpdateCache)
            {
                // update cache when modifying varaibles
                track.updateCache();
                AMCodeView.refresh();
                // preview new position
                aData.getCurrentTake().previewFrame(aData.getCurrentTake().selectedFrame);
                // save data
                EditorUtility.SetDirty(aData);
            }
            this.Close();
        }
        if (GUILayout.Button("Cancel"))
        {
            this.Close();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        // orb texture
        GUI.DrawTexture(new Rect(x_pos, 15f, 80f, 80f), tex_orb);
        // speed label
        GUIStyle styleLabelRight = new GUIStyle(GUI.skin.label);

        styleLabelRight.alignment        = TextAnchor.MiddleRight;
        styleLabelRight.normal.textColor = Color.white;
        EditorGUI.DropShadowLabel(new Rect(475f, 5f, 25f, 25f), speedNames[selectedSpeedIndex], styleLabelRight);
        // draw border
        GUI.color = GUI.skin.window.normal.textColor;
        GUI.DrawTexture(new Rect(0f, 0f, 7f, 110f), EditorGUIUtility.whiteTexture);
        GUI.DrawTexture(new Rect(position.width - 209f, 0f, 208f, 110f), EditorGUIUtility.whiteTexture);
        GUI.color = Color.white;

        // curve field
        if (updateEasingCurve)
        {
            setEasingCurve();
        }
        else if (!isCustomEase && didChangeCurve())
        {
            isCustomEase  = true;
            selectedIndex = getCategoryIndexForEaseName("Custom");
            if (selectedIndex < 0)
            {
                category      = 0;
                selectedIndex = getCategoryIndexForEaseName("Custom");
            }
        }

        curve = EditorGUI.CurveField(new Rect(500f, 5f, 208f, 100f), curve, Color.blue, new Rect(0f, -0.5f, 1f, 2.0f));
    }
Пример #28
0
        public void Draw(EditorWindow window, Rect region, AbstractSocket currentDragingSocket)
        {
            Event e = Event.current;

            InitWindowStyles();

            if (e.type == EventType.MouseUp)
            {
                if (_draggingPathPointIndex != -1)
                {
                    _draggingPathPointIndex = -1;
                    Event.current.Use();
                    OnEdgePointDragEnd();
                }
            }

            if (e.type == EventType.MouseDown)
            {
                _currentHelpText = null;
                _renamingNodeId  = -1;
            }

            if (_centeredLabelStyle == null)
            {
                _centeredLabelStyle = GUI.skin.GetStyle("Label");
            }
            _centeredLabelStyle.alignment = TextAnchor.MiddleCenter;

            EditorZoomArea.Begin(Zoom, region);

            if (Style.normal.background == null)
            {
                Style.normal.background = CreateBackgroundTexture();
            }
            GUI.DrawTextureWithTexCoords(DrawArea, Style.normal.background, new Rect(0, 0, 1000, 1000));
            DrawArea.Set(Position.x, Position.y, GDICanvasSize, GDICanvasSize);
            GUILayout.BeginArea(DrawArea);
            DrawEdges(region);
            window.BeginWindows();
            DrawNodes(region);
            window.EndWindows();
            DrawDragEdge(currentDragingSocket);

            GUILayout.EndArea();
            EditorZoomArea.End();


            if (e.type == EventType.MouseDrag)
            {
                if (e.button == 0)
                {
                    if (_draggingPathPointIndex > -1 && _hoveringEdge != null)
                    {
                        Vector2 pos = ProjectToGDICanvas(e.mousePosition);
                        pos.y += Config.PathPointSize;
                        _hoveringEdge.SetPathPointAtIndex(_draggingPathPointIndex, pos);
                        Event.current.Use();
                    }
                }
            }

            if (_hoveringEdge != null && Config.ShowEdgeHover)
            {
                string tooltipText = _hoveringEdge.Output.Parent.Name + "-> " + _hoveringEdge.Input.Parent.Name;
                float  width       = GUI.skin.textField.CalcSize(new GUIContent(tooltipText)).x;
                _tmpRect.Set(Event.current.mousePosition.x - width / 2f, e.mousePosition.y - 30, width, 20);
                DrawTooltip(_tmpRect, tooltipText);
            }


            HandleSelectionBox();
            DrawHelpText();


            if (!_initialEdgeCalcDone)
            {
                _initialEdgeCalcDone = true;
                Graph.UpdateEdgeBounds();
            }

            GUI.SetNextControlName(Config.NullControlName);
            GUI.TextField(new Rect(0, 0, 0, 0), "");
            if (GUI.GetNameOfFocusedControl().Equals(Config.NullControlName))
            {
                if (e.keyCode == KeyCode.Delete)
                {
                    DeleteSelectedNodes(null);
                }
                if ((e.control || e.command) && e.keyCode == KeyCode.C && _lastKeyCode != KeyCode.C)
                {
                    CopySelection();
                }
                if ((e.control || e.command) && e.keyCode == KeyCode.V && _lastKeyCode != KeyCode.V)
                {
                    PasteFromClipboard();
                }
            }

            _lastKeyCode = e.keyCode;
        }
Пример #29
0
        // Draws the check boxes and their labels as seen in the tool UI.
        private void DrawBooleans(BKI_Hand hand)
        {
            BKI_GestureMirrorClass values = (hand == BKI_Hand.right) ? rightHandValues : leftHandValues;

            Rect containerRect = (hand == BKI_Hand.right) ? handGUIContainer : handGUIContainer;

            Rect r = new Rect(DEFAULT_AREA_PADDING + 5, TITLE_FIELD_SIZE + 2, containerRect.width - DEFAULT_AREA_PADDING * 1.5f, containerRect.height - DEFAULT_AREA_PADDING * 1.5f - TITLE_FIELD_SIZE);

            GUILayout.BeginArea(r);
            {
                // Parenthesis to clarify GUI layout at code side.
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUILayout.BeginVertical();
                    {
                        GUILayout.Label("Thumb: ");
                        GUILayout.Space(3);
                        GUILayout.Label("Index: ");
                        GUILayout.Space(3);
                        GUILayout.Label("Middle: ");
                        GUILayout.Space(3);
                        GUILayout.Label("Ring: ");
                        GUILayout.Space(3);
                        GUILayout.Label("Pinky: ");
                    }
                    EditorGUILayout.EndVertical();
                    GUILayout.Space(-60);
                    EditorGUILayout.BeginVertical();
                    {
                        values.fingerStates[0] = (BKI_FingerState)GUILayout.Toolbar((int)values.fingerStates[0], toolbarText, GUILayout.Width(160));
                        values.fingerStates[1] = (BKI_FingerState)GUILayout.Toolbar((int)values.fingerStates[1], toolbarText, GUILayout.Width(160));
                        values.fingerStates[2] = (BKI_FingerState)GUILayout.Toolbar((int)values.fingerStates[2], toolbarText, GUILayout.Width(160));
                        values.fingerStates[3] = (BKI_FingerState)GUILayout.Toolbar((int)values.fingerStates[3], toolbarText, GUILayout.Width(160));
                        values.fingerStates[4] = (BKI_FingerState)GUILayout.Toolbar((int)values.fingerStates[4], toolbarText, GUILayout.Width(160));
                    }
                    EditorGUILayout.EndVertical();

                    //EditorGUILayout.BeginVertical();
                    //{
                    //	bool thumb = values.GetFingerPressed(BKI_Finger.thumb);
                    //	thumb = EditorGUILayout.Toggle(values.GetFingerPressed(BKI_Finger.thumb));
                    //	values.SetFingerPressed(BKI_Finger.thumb, thumb);

                    //	bool index = values.GetFingerPressed(BKI_Finger.index);
                    //	index = EditorGUILayout.Toggle(values.GetFingerPressed(BKI_Finger.index));
                    //	values.SetFingerPressed(BKI_Finger.index, index);

                    //	bool middle = values.GetFingerPressed(BKI_Finger.middle);
                    //	middle = EditorGUILayout.Toggle(values.GetFingerPressed(BKI_Finger.middle));
                    //	values.SetFingerPressed(BKI_Finger.middle, middle);

                    //	bool ring = values.GetFingerPressed(BKI_Finger.ring);
                    //	ring = EditorGUILayout.Toggle(values.GetFingerPressed(BKI_Finger.ring));
                    //	values.SetFingerPressed(BKI_Finger.ring, ring);

                    //	bool pinky = values.GetFingerPressed(BKI_Finger.pinky);
                    //	pinky = EditorGUILayout.Toggle(values.GetFingerPressed(BKI_Finger.pinky));
                    //	values.SetFingerPressed(BKI_Finger.pinky, pinky);
                    //}
                    //EditorGUILayout.EndVertical();

                    //EditorGUILayout.BeginVertical();
                    //{
                    //	GUILayout.Label("Ignore thumb: ");
                    //	GUILayout.Label("Ignore index: ");
                    //	GUILayout.Label("Ignore middle: ");
                    //	GUILayout.Label("Ignore ring: ");
                    //	GUILayout.Label("Ignore pinky: ");
                    //}
                    //EditorGUILayout.EndVertical();

                    //EditorGUILayout.BeginVertical();
                    //{
                    //	bool thumb = values.GetFingerIgnored(BKI_Finger.thumb);
                    //	thumb = EditorGUILayout.Toggle(values.GetFingerIgnored(BKI_Finger.thumb));
                    //	values.SetFingerIgnored(BKI_Finger.thumb, thumb);

                    //	bool index = values.GetFingerIgnored(BKI_Finger.index);
                    //	index = EditorGUILayout.Toggle(values.GetFingerIgnored(BKI_Finger.index));
                    //	values.SetFingerIgnored(BKI_Finger.index, index);

                    //	bool middle = values.GetFingerIgnored(BKI_Finger.middle);
                    //	middle = EditorGUILayout.Toggle(values.GetFingerIgnored(BKI_Finger.middle));
                    //	values.SetFingerIgnored(BKI_Finger.middle, middle);

                    //	bool ring = values.GetFingerIgnored(BKI_Finger.ring);
                    //	ring = EditorGUILayout.Toggle(values.GetFingerIgnored(BKI_Finger.ring));
                    //	values.SetFingerIgnored(BKI_Finger.ring, ring);

                    //	bool pinky = values.GetFingerIgnored(BKI_Finger.pinky);
                    //	pinky = EditorGUILayout.Toggle(values.GetFingerIgnored(BKI_Finger.pinky));
                    //	values.SetFingerIgnored(BKI_Finger.pinky, pinky);
                    //}
                    //EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();
            }
            GUILayout.EndArea();

            if (hand == BKI_Hand.right)
            {
                if (rightHandValues != values && values.gestureIdentifier != pickerWindowGNameRh)
                {
                    ResetPickerWindow(false, true, false);
                    rightHandValues = values;
                }
            }
            else if (leftHandValues != values && values.gestureIdentifier != pickerWindowGNameLh)
            {
                ResetPickerWindow(true, false, false);
                leftHandValues = values;
            }
        }
Пример #30
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.BeginArea(rect);
            {
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
                {
                    EGUI.BeginLabelWidth(60);
                    {
                        EditorGUILayout.LabelField(Contents.NewDataContent, EGUIStyles.MiddleCenterLabel);

                        EditorGUILayout.Space();

                        string dataKey = newData.Key;
                        dataKey = EditorGUILayout.TextField(Contents.DataNameContent, dataKey);
                        if (newData.Key != dataKey)
                        {
                            newData.Key = dataKey;
                            if (string.IsNullOrEmpty(dataKey))
                            {
                                errorMessage = Contents.DataNameEmptyStr;
                            }
                            else
                            {
                                if ((group.AsDynamic()).dataDic.ContainsKey(newData.Key))
                                {
                                    errorMessage = Contents.DataNameRepeatStr;
                                }
                                else
                                {
                                    errorMessage = null;
                                }
                            }
                        }

                        if (newData.OptionValues != null && newData.OptionValues.Length > 0)
                        {
                            newData.Value = EGUILayout.StringPopup(Contents.DataValueContent, newData.Value, newData.OptionValues);
                        }
                        else
                        {
                            newData.Value = EditorGUILayout.TextField(Contents.DataValueContent, newData.Value);
                        }

                        newData.Comment = EditorGUILayout.TextField(Contents.DataCommentContent, newData.Comment);
                        optionValuesRList.DoLayoutList();

                        if (!string.IsNullOrEmpty(errorMessage))
                        {
                            EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
                        }
                        else
                        {
                            GUILayout.FlexibleSpace();

                            if (GUILayout.Button(Contents.SaveStr))
                            {
                                newData.OptionValues = optionValues.ToArray();

                                group.AddData(newData.Key, newData.Value, newData.Comment, newData.OptionValues);

                                onCreatedCallback?.Invoke(group.Name, newData.Key);
                                editorWindow.Close();
                            }
                        }
                    }
                    EGUI.EndLableWidth();
                }
                EditorGUILayout.EndScrollView();
            }
            GUILayout.EndArea();
        }