GetServiceEnv() public static method

public static GetServiceEnv ( string serviceName ) : int
serviceName string
return int
Exemplo n.º 1
0
 public CloudPanelPref(string serviceName)
 {
     this.m_ServiceName          = serviceName;
     this.m_CloudPanelServer     = UnityConnectPrefs.GetServiceEnv(this.m_ServiceName);
     this.m_CloudPanelCustomUrl  = EditorPrefs.GetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", this.m_ServiceName));
     this.m_CloudPanelCustomPort = EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", this.m_ServiceName));
 }
        private void EnsureDrawerIsVisible(bool forceFocus)
        {
            if (UnityConnectServiceCollection.s_UnityConnectEditorWindow == null || !UnityConnectServiceCollection.s_UnityConnectEditorWindow.UrlsMatch(this.GetAllServiceUrls()))
            {
                string text       = "Services";
                int    serviceEnv = UnityConnectPrefs.GetServiceEnv(this.m_CurrentServiceName);
                if (serviceEnv != 0)
                {
                    text = text + " [" + UnityConnectPrefs.kEnvironmentFamilies[serviceEnv] + "]";
                }
                UnityConnectServiceCollection.s_UnityConnectEditorWindow          = UnityConnectEditorWindow.Create(text, this.GetAllServiceUrls());
                UnityConnectServiceCollection.s_UnityConnectEditorWindow.ErrorUrl = this.m_Services["ErrorHub"].serviceUrl;
                UnityConnectServiceCollection.s_UnityConnectEditorWindow.minSize  = new Vector2(275f, 50f);
            }
            string text2 = this.m_Services[this.m_CurrentServiceName].serviceUrl;

            if (this.m_CurrentPageName.Length > 0)
            {
                text2 = text2 + "/#/" + this.m_CurrentPageName;
            }
            UnityConnectServiceCollection.s_UnityConnectEditorWindow.currentUrl = text2;
            UnityConnectServiceCollection.s_UnityConnectEditorWindow.ShowTab();
            if (InternalEditorUtility.isApplicationActive && forceFocus)
            {
                UnityConnectServiceCollection.s_UnityConnectEditorWindow.Focus();
            }
        }
Exemplo n.º 3
0
        public static string FixUrl(string url, string serviceName)
        {
            string str1       = url;
            int    serviceEnv = UnityConnectPrefs.GetServiceEnv(serviceName);

            if (serviceEnv != 0)
            {
                if (str1.StartsWith("http://") || str1.StartsWith("https://"))
                {
                    return(serviceEnv != 3 ? str1.ToLower().Replace("/" + UnityConnectPrefs.kEnvironmentFamilies[0].ToLower() + "/", "/" + UnityConnectPrefs.kEnvironmentFamilies[serviceEnv].ToLower() + "/") : EditorPrefs.GetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", serviceName)) + ":" + (object)EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", serviceName)));
                }
                if (str1.StartsWith("file://"))
                {
                    string str2 = str1.Substring(7);
                    if (serviceEnv == 3)
                    {
                        str2 = EditorPrefs.GetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", serviceName)) + ":" + (object)EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", serviceName));
                    }
                    return(str2);
                }
                if (!str1.StartsWith("file://") && !str1.StartsWith("http://") && !str1.StartsWith("https://"))
                {
                    return("http://" + str1);
                }
            }
            return(str1);
        }
Exemplo n.º 4
0
        private void EnsureDrawerIsVisible(bool forceFocus)
        {
            //Create the container in case it doesnt exist
            if (s_UnityConnectEditorWindow == null || !s_UnityConnectEditorWindow.UrlsMatch(GetAllServiceUrls()))
            {
                var fixTitle = kDrawerContainerTitle;

                var panelEnv = UnityConnectPrefs.GetServiceEnv(m_CurrentServiceName);
                if (panelEnv != UnityConnectPrefs.kProductionEnv)
                {
                    fixTitle += " [" + UnityConnectPrefs.kEnvironmentFamilies[panelEnv] + "]";
                }

                s_UnityConnectEditorWindow          = UnityConnectEditorWindow.Create(fixTitle, GetAllServiceUrls());
                s_UnityConnectEditorWindow.ErrorUrl = m_Services[ErrorHubAccess.kServiceName].serviceUrl;
                s_UnityConnectEditorWindow.minSize  = new Vector2(275, 50);
            }
            //Since s_UnityConnectEditorWindow.currentUrl is a property that load a page we must build the url before changing it
            var newUrl = m_Services[m_CurrentServiceName].serviceUrl;

            if (m_CurrentPageName.Length > 0)
            {
                newUrl += ("/#/" + m_CurrentPageName);
            }
            s_UnityConnectEditorWindow.currentUrl = newUrl;
            s_UnityConnectEditorWindow.ShowTab();

            if (InternalEditorUtility.isApplicationActive && forceFocus)
            {
                s_UnityConnectEditorWindow.Focus();
            }
        }
Exemplo n.º 5
0
        private void EnsureDrawerIsVisible(bool forceFocus)
        {
            if ((UnityEngine.Object)UnityConnectServiceCollection.s_UnityConnectEditorWindow == (UnityEngine.Object)null || !UnityConnectServiceCollection.s_UnityConnectEditorWindow.UrlsMatch(this.GetAllServiceUrls()))
            {
                string title      = "Services";
                int    serviceEnv = UnityConnectPrefs.GetServiceEnv(this.m_CurrentServiceName);
                if (serviceEnv != 0)
                {
                    title = title + " [" + UnityConnectPrefs.kEnvironmentFamilies[serviceEnv] + "]";
                }
                UnityConnectServiceCollection.s_UnityConnectEditorWindow          = UnityConnectEditorWindow.Create(title, this.GetAllServiceUrls());
                UnityConnectServiceCollection.s_UnityConnectEditorWindow.ErrorUrl = this.m_Services["ErrorHub"].serviceUrl;
                UnityConnectServiceCollection.s_UnityConnectEditorWindow.minSize  = new Vector2(275f, 50f);
            }
            string str = this.m_Services[this.m_CurrentServiceName].serviceUrl;

            if (this.m_CurrentPageName.Length > 0)
            {
                str = str + "/#/" + this.m_CurrentPageName;
            }
            UnityConnectServiceCollection.s_UnityConnectEditorWindow.currentUrl = str;
            UnityConnectServiceCollection.s_UnityConnectEditorWindow.Show();
            if (!InternalEditorUtility.isApplicationActive || !forceFocus)
            {
                return;
            }
            UnityConnectServiceCollection.s_UnityConnectEditorWindow.Focus();
        }
        public static string FixUrl(string url, string serviceName)
        {
            int    serviceEnv = UnityConnectPrefs.GetServiceEnv(serviceName);
            string result;

            if (serviceEnv != 0)
            {
                if (url.StartsWith("http://") || url.StartsWith("https://"))
                {
                    string text;
                    if (serviceEnv == 3)
                    {
                        string @string = EditorPrefs.GetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", serviceName));
                        int    @int    = EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", serviceName));
                        text = ((@int != 0) ? (@string + ":" + @int) : @string);
                    }
                    else
                    {
                        text = url.ToLower();
                        text = text.Replace("/" + UnityConnectPrefs.kEnvironmentFamilies[0].ToLower() + "/", "/" + UnityConnectPrefs.kEnvironmentFamilies[serviceEnv].ToLower() + "/");
                    }
                    result = text;
                    return(result);
                }
                if (url.StartsWith("file://"))
                {
                    string text = url.Substring(7);
                    if (serviceEnv == 3)
                    {
                        string string2 = EditorPrefs.GetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", serviceName));
                        int    int2    = EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", serviceName));
                        text = string2 + ":" + int2;
                    }
                    result = text;
                    return(result);
                }
                if (!url.StartsWith("file://") && !url.StartsWith("http://") && !url.StartsWith("https://"))
                {
                    string text = "http://" + url;
                    result = text;
                    return(result);
                }
            }
            result = url;
            return(result);
        }