Пример #1
0
 void AddConnectionViaEnterIPWindow(ConnectionTreeViewWindow menuOptions, Rect buttonScreenRect,
                                    Func <bool> disabler = null)
 {
     menuOptions.AddItem(new ConnectionDropDownItem(Content.EnterIPText.text, -2, Content.DirectConnection, ConnectionDropDownItem.ConnectionMajorGroup.Direct, () => false, () =>
     {
         AttachToPlayerPlayerIPWindow.Show(buttonScreenRect);
         GUIUtility.ExitGUI(); // clear the gui state to prevent hot control issues
     }));
 }
Пример #2
0
        void AddLastConnectedIP(ConnectionTreeViewWindow menuOptions, ref bool hasOpenConnection)
        {
            string lastIP = AttachToPlayerPlayerIPWindow.GetLastIPString();

            if (string.IsNullOrEmpty(lastIP))
            {
                return;
            }

            bool isConnected = ProfilerDriver.connectedProfiler == PLAYER_DIRECT_IP_CONNECT_GUID;

            hasOpenConnection |= isConnected;
            menuOptions.AddItem(new ConnectionDropDownItem(lastIP, PLAYER_DIRECT_IP_CONNECT_GUID,
                                                           Content.DirectConnection, ConnectionDropDownItem.ConnectionMajorGroup.Direct, () => ProfilerDriver.connectedProfiler == PLAYER_DIRECT_IP_CONNECT_GUID,
                                                           () => DirectIPConnect(lastIP)));
        }
Пример #3
0
        void AddAvailableDeviceConnections(ConnectionTreeViewWindow menuOptions, ref bool hasOpenConnection)
        {
            foreach (var device in DevDeviceList.GetDevices())
            {
                bool supportsPlayerConnection = (device.features & DevDeviceFeatures.PlayerConnection) != 0;
                if (!device.isConnected || !supportsPlayerConnection)
                {
                    continue;
                }

                var  url         = "device://" + device.id;
                bool isConnected = ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID && ProfilerDriver.directConnectionUrl == url;
                hasOpenConnection |= isConnected;
                //iphone handles the naming differently to android
                menuOptions.AddItem(new ConnectionDropDownItem(
                                        device.type == "Android"
                    ? device.name.Substring(device.name.IndexOf('(') + 1).TrimEnd(')')
                    : device.name, PLAYER_DIRECT_URL_CONNECT_GUID, "Devices",
                                        ConnectionDropDownItem.ConnectionMajorGroup.Local,
                                        () => ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID &&
                                        ProfilerDriver.directConnectionUrl == url, () => DirectURLConnect(url), true, device.type == "iOS" ? "IPhonePlayer" : device.type));
            }
        }
Пример #4
0
        void AddAvailablePlayerConnections(ConnectionTreeViewWindow menuOptions, ref bool hasOpenConnection,
                                           Func <bool> disabler = null)
        {
            int[] connectionGuids = ProfilerDriver.GetAvailableProfilers();
            for (int index = 0; index < connectionGuids.Length; index++)
            {
                int    guid         = connectionGuids[index];
                string name         = GetConnectionName(guid);
                bool   isProhibited = ProfilerDriver.IsIdentifierOnLocalhost(guid) && (name.Contains("MetroPlayerX") || name.Contains("UWPPlayerX"));
                bool   enabled      = !isProhibited && ProfilerDriver.IsIdentifierConnectable(guid);

                bool isConnected = ProfilerDriver.connectedProfiler == guid;
                hasOpenConnection |= isConnected;
                if (!enabled)
                {
                    if (isProhibited)
                    {
                        name += Content.LocalHostProhibited;
                    }
                    else
                    {
                        name += Content.VersionMismatch;
                    }
                }
                if (enabled)
                {
                    if (m_EditorModeTargetState.HasValue && name.Contains(k_EditorConnectionName))
                    {
                        if (!menuOptions.HasItem(Content.Playmode.text) && !name.StartsWith("Profiler-"))
                        {
                            menuOptions.AddItem(new ConnectionDropDownItem(Content.Playmode.text, guid, Content.Editor,
                                                                           ConnectionDropDownItem.ConnectionMajorGroup.Editor,
                                                                           () => ProfilerDriver.connectedProfiler == guid &&
                                                                           !m_EditorModeTargetConnectionStatus(EditorConnectionTarget
                                                                                                               .MainEditorProcessPlaymode),
                                                                           () =>
                            {
                                ProfilerDriver.connectedProfiler = guid;
                                SuccessfullyConnectedToPlayer(connectionName,
                                                              EditorConnectionTarget.MainEditorProcessPlaymode);
                            }));

                            menuOptions.AddItem(new ConnectionDropDownItem(Content.Editmode.text, guid, Content.Editor,
                                                                           ConnectionDropDownItem.ConnectionMajorGroup.Editor,
                                                                           () => ProfilerDriver.connectedProfiler == guid &&
                                                                           m_EditorModeTargetConnectionStatus(EditorConnectionTarget
                                                                                                              .MainEditorProcessEditmode),
                                                                           () =>
                            {
                                ProfilerDriver.connectedProfiler = guid;
                                SuccessfullyConnectedToPlayer(connectionName,
                                                              EditorConnectionTarget.MainEditorProcessEditmode);
                            }));
                        }
                    }
                    else
                    {
                        menuOptions.AddItem(new ConnectionDropDownItem(
                                                name, guid, null, ConnectionDropDownItem.ConnectionMajorGroup.Unknown,
                                                () => ProfilerDriver.connectedProfiler == guid,
                                                () =>
                        {
                            ProfilerDriver.connectedProfiler = guid;
                            if (ProfilerDriver.connectedProfiler == guid)
                            {
                                SuccessfullyConnectedToPlayer(connectionName);
                            }
                        }));
                    }
                }
                else
                {
                    menuOptions.AddDisabledItem(new ConnectionDropDownItem(name, guid, null, ConnectionDropDownItem.ConnectionMajorGroup.Unknown, () => ProfilerDriver.connectedProfiler == guid, null));
                }
            }
        }